PowerPoint-presentatie - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

PowerPoint-presentatie

Description:

A Core Course on Modeling Week 3- Time for Change Contents * Change needs Time Introduction to Processes States and State Charts – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 38
Provided by: Systeem
Category:

less

Transcript and Presenter's Notes

Title: PowerPoint-presentatie


1
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Contents ? ? ? ? ?
  • Change needs Time
  • Introduction to Processes
  • States and State Charts
  • Applying State Charts
  • Time and State Transitions
  • Partially Ordered Time
  • Totally Ordered Time
  • Totally Ordered Time Equal Intervals
  • Totally Ordered Time Infinitesimal Intervals
  • Summary
  • References to lecture notes book
  • References to quiz-questions and homework
    assignments (lecture notes)

2
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Contents ? ? ? ? ?
2
  • Question
  • how to model systems
  • that vary over time
  • such that their behavior
  • can be predicted,
  • can be specified,
  • can be verified,
  • can be ?

3
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
3
  • Running example 4-color ballpoint pen
  • Purpose the model should
  • simulate a virtual 4-color ballpoint, say, as a
    plug-in in Photoshop, or
  • warn when one of the pens is about to run out, or
  • train users to handle a 4-color ballpoint, or
  • specification of a Photoshop plugin

4
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
4
Running example 4-color ballpoint pen Step 1
conceptual model with properties myPen
fourCPen fourCPen red pen, green pen, blue
pen, black pen, use TRUE,FALSE penlevel
099,inOut in,out myPen.use is true if
there is a pen p with p.levelgt0 and p.inOutout
Is my 4CP ready for writing ?
Is this pen in or out?
What is the ink level in this pen (in
percentile, so level0 means ink between 0.00
and 0.01 of maximum)?
5
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
5
Describe processes statecharts intuition
describe a process by relating states (freezes
or snapshots) of the system
All four pens are in and contain some ink
Red pen is out other three pens are in red
pen contains some ink
Red pen is out other three pens are in red
pen contains less ink
write with red pen
red pen goes out
6
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
6
  • State all properties in the conceptual model
    with their values
  • State space the collection of all states
  • A behavior a route through statespace
  • A process the collection of behaviors of a
    system

7
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
7
  • State all properties in the conceptual model
    with their values
  • State space the collection of all states
  • A behavior a route through statespace
  • A process the collection of behaviors of a
    system

Green pen is out other three pens are in red
pen contains some ink
Red pen is out other three pens are in red
pen contains some ink
Green pen is out other three pens are in
green pen contains some ink
All four pens are in and contains some ink
Blue pen is out other three pens are in blue
pen contains some ink
Red pen is out other three pens are in red
pen contains less ink
All four pens are in and contain some ink
Red pen is out other three pens are in red
pen contains some ink
All four pens are in and contain some ink
Red pen is out other three pens are in red
pen contains no ink
8
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
8
  • State all properties in the conceptual model
    with their values
  • State space the collection of all states
  • A behavior a route through statespace
  • A process collection of behaviors of a system
  • Examples from real life
  • parking garage 1080 states
  • after some approximations 3.3 x 106 states

9
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
9
  • State all properties in the conceptual model
    with their values
  • State space the collection of all states
  • A behavior a route through statespace
  • A process collection of behaviors of a system
  • With n quantities, each assuming mi values, nr
    states ?i1 n mi
  • Number of behaviors with p steps ?j1 p
    ?i1 n mi
  • State and process explosion

10
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
10
For the 4-color ballpoint, myPenfourCPen four
CPen red pen,green pen, blue pen,black
pen, use TRUE,FALSE pen level099,
inOut in,out the state space contains 100 x
100 x 100 x 100 x 2 x 2 x 2 x 2 1600000000
states Is this really necessary ??
red.level
green.level
blue.level
black.level
red.inOut
green.inOut
blue.inOut
black.inOut
11
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
11
Let us look at individual properties use is
relevant level is not relevant (not
visible) inOut is relevant depends on purpose
12
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
12
Let us look at individual properties use is
relevant level is not relevant (not
visible) inOut is relevant depends on
purpose make use an exposed quantity make level a
hidden quantity make inOut exposed if color of a
pen matters otherwise hidden use is true if a
pen p with p.levelgt0 has p.inOutout
13
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
13
  • Partial remedy to decrease amount of states
    distinguish exposed and hidden quantities or
    values, and focus on the exposed ones
  • Exposed quantities or values externally visible
    or accessible
  • Hidden quantities or values internal behaviour,
    may help explaining seemingly uncausal exposed
    behavior

14
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
14
  • Partial remedy to decrease amount of states
    distinguish exposed and hidden quantities or
    values, and focus on the exposed ones
  • Which quantities need exposure depends on
    purpose of the model
  • Which quantities may be hidden as much as
    possible to simplify model

15
A Core Course on Modeling
Week 3- Time for Change
Assume that initially there is one pen out
? ? ? ? ? Introduction to Processes ? ? ? ? ?
15
  • Example 4-color pen
  • The simplest process description contains merely
    two states, only involving the most crucial
    exposed quantity use

myPen.useTRUE
myPen.useFALSE
16
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
16
  • Example 4-color pen
  • The 2-state model is presumably too naive
  • does not take into account that a pen must be out
    to write
  • does not take into account that only one pen can
    be out at a time
  • does not take into account that ink only
    decreases if a pen is out
  • need to denote a process without having to resort
    to full state space

17
A Core Course on Modeling
state red pen is out no ink left in red pen
state red pen is out levelgt0 in red pen
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
17
Denote state and state transitions statechart
red.inOutout red.levelgt0
red.inOutout red.level0
black.inOutout black.level0
green.inOutout green.levelgt0
red pen, running out of ink only possible when
out
red.inOutin green.inOutin blue.inOutin black.in
Outin
clicking red pen, levelgt0, in and out
clicking red pen, with no ink, in and out
green.inOutout green.level0
black.inOutout black.levelgt0
state all pens are in (say nothing about ink
levels)
blue.inOutout blue.levelgt0
blue.inOutout blue.level0
18
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
18
Denote state and state transitions statechart
  • This model behaves like a true 4-color ballpoint
  • shows how eventually, every pen.level will become
    0
  • shows how in the useFALSE state, we can only
    click empty pens in and out
  • never more than 1 pen is out.
  • of the 16000000 states, we projected out only 9
    relevant ones

Using projection, we reduced multiple states
with irrelevant differences to only one state
red.inOutout red.levelgt0
red.inOutout red.level0
black.inOutout black.level0
green.inOutout green.levelgt0
red.inOutin green.inOutin blue.inOutin black.in
Outin
green.inOutout green.level0
black.inOutout black.levelgt0
blue.inOutout blue.levelgt0
blue.inOutout blue.level0
19
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
19
Projection one conceptual model ? different
statecharts, depending on the choice for exposed
quantities
red.inOutout
black.inOut out
red.inOutin green.inOutin blue.inOutin black.in
Outin
Purpose just clicking behavior is
interesting Only exposed quantities are the
inOut properties
green.inOutout
blue.inOutout
20
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
20
Projection one conceptual model ? different
statecharts, depending on the choice for exposed
quantities
None of the simplified statecharts shows
relations between level and inOut Carefully
select exposed quantities. Balance simplicity ??
expressive power (given the purpose) Advanced
hierarchical states, conditional transitions,
orthogonal regions (see lecture series process
modeling)
red.level0
red.levelgt0
green.level0
green.levelgt0
Purpose warn user when pen runs out Only exposed
quantities are the level properties
blue.levelgt0
blue.level0
black.levelgt0
black.level0
21
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
21
  • Now we have a state chart model. So what?
  • predict see when/if a particular state occurs
    (or a state with a certain property), or examine
    the properties of a given (future) state
  • specify give desired properties of some final
    state
  • verify check that a certain state cannot occur
  • analyse if there no are deadlocks (dead end
    routes)
  • analyse if states that should be reached can be
    reached
  • analyse if states that should be reached in some
    order are reached in that order
  • analyse if occurring transitions are permitted
    (while monitoring a system)

22
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
22
  • Flavours of time
  • Transitions happen instantaneous (take no time)
  • States may last
  • States and Transitions alternate

23
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
23
  • Flavours of time
  • partial order
  • for zero or more pairs of transitions T1, T2,
    you can specify or verify earlier(T1,T2) or
    later(T1,T2)
  • application specification or verification
    e.g., manufacturing, control, parallel
    calculations,
  • total order
  • for all pairs of transitions T1, T2, you can
    determine earlier (T1,T2) or later(T1,T2)
  • application prediction or documentation
    (logging) e.g., physics, material engineering,

24
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
24
  • Flavours of time
  • example of partial order
  • specify coin operated vending machine
  • ealier(insertCoin,giveProduct)
  • earlier(makeChoice,giveProduct)
  • earlier(insertCoin,giveChange)
  • earlier(makeChoice,giveChange)
  • earlier(giveProduct,giveChange) ?
  • earlier(giveChange,giveProduct) ?

these transitions are not ordered ? no total order
25
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
25
  • Flavours of time (applications)
  • partial order
  • specification or verification see earlier
    sheets
  • total order
  • time table problems, scheduling, games,
    protocols,
  • total order equal intervals
  • compound interest, clocks with counting mechanism
    (pendulum, tuning fork and electronic clocks)
  • total order infinitesimal intervals
  • lumped physical quantities (not fundamental
    physics!)

26
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
26
Causality forbids that something depends on its
future. Any quantitys value in the current state
can only depend on the previous
state(s) QcurrF(Qprev,Pprev) Since dependency
works from previous to current, Qprev and
Pprev have no dependence on Qcurr. So we wont
have QcurrF(Qcurr,) If we stick to these rules,
we can straightforwardly evaluate F for each of
the quantities Q, and the order of evaluation
doesnt matter.
Various forms of perpetuum mobiles assume some
circular causality.
27
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
27
Causality forbids that something depends on its
future. Any quantitys value in the current state
can only depend on the previous
state(s) QcurrF(Qprev,Pprev) Since dependency
works from previous to current, Qprev and
Pprev have no dependence on Qcurr. So we wont
have QcurrF(Qcurr,) F is called a recursive
function it calculates Q taking an earlier value
of Q as argument.
HELP!!! I dont see an F
Various forms of perpetuum mobiles assume some
circular causality.
so lets look at some examples
28
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
28
  • Arbitrary intervals consider a leisure sports
    event
  • a 20 km march route
  • 15 control posts, to be visited in right order
    (no shortcuts! ? total order, no partial
    order!!!)
  • every post features a box full of bananas
  • a list of efforts (kCal) between subsequent
    posts (uphill, downhill, rough road, ), Ei
  • question at which posts should you pick
    banana(s) (each containing B kCal)?

29
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
29
Arbitrary intervals consider a leisure sports
event Qiamount of kCal in stomach at post i, i
gt 0 Q0amount of kCal in stomach at
start Qi1Qi-Ei if you dont eat Qi1Qi-EiniB
if you eat n bananas at post i What is ni?
Answer ni should be such that Qi1gt0, and as
small as possible (weight!) Qi1Qi-EiniB
Qi-EiniBgt0, so niBgtEi-Qi nimax(0,?(Ei-Qi)/B?),
so Qi1Qi-EiBmax(0,?(Ei-Qi)/B?) or
Qi1F(Qi,Pi)
max(0,) you cant eat a negative amount of
bananas
?? rounding up you dont want to eat a
fraction of a banana
30
A Core Course on Modeling
Week 3- Time for Change
and now with damping
? ? ? ? ? Time and State Transitions? ? ? ? ?
30
t ? i? K(t) ? Ki u(t) ? ui u(t) ?
(u(t?)-u(t))/? (ui1-ui)/? v(t)
?(v(t?)-v(t))/? (vi1-vi)/? So ui1 ui?vi
vi1 vi?ai vi?Ki/m
vi? C(urest-ui) /m
Equal intervals a mass-spring system. From
physics, we know Kma where KC(urest-u)
and au. Write vu, then av. Here, KK(t),
uu(t). Let us approximate by sampling. For ? ?0
Remember order of evaluation F1, F2 is irrelevant
-?v
So again QcurrF(Qprev,Pprev) ucurrF1(uprev,vpre
v)uprev?vprev vcurrF2(vprev,uprev)
vprev? C(urest-uprev) /m, with
suitable u0 and v0
u(t?) u(i??) u((i1)?)
ui1, and similar for v
( -?vprev)
( -?vi)
31
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
31
WARNING ? ? 0 is not the same as ?small. The
substitutions for u(t) and v(t) are
approximations only. As we saw in the previous
sampling example, aliasing errors are worse when
the sampled signal changes rapidly, compared to
the sampling rate. Concrete unless ? is much
smaller than the period of the oscillation
(?m/C), the approximations are bad with the
risk of instability.
t ? i? K(t) ? Ki u(t) ? ui u(t) ?
(u(t?)-u(t))/? (ui1-ui)/? v(t)
?(v(t?)-v(t))/? (vi1-vi)/? So ui1 ui?vi
vi1 vi?ai vi?Fi/m
vi? C(urest-ui) /m
Equal intervals a mass-spring system. From
physics, we know Kma where KC(urest-u)
and au. Write vu, then av. Here, KK(t),
uu(t). Let us approximate by sampling. For ? ?0
-?v
So again QcurrF(Qprev,Pprev) ucurrF1(uprev,vpre
v)uprev?vprev vcurrF2(vprev,uprev)
vprev? C(urest-uprev) /m, with
suitable u0 and v0.
( -?vprev)
( -?vi)
32
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
32
Infinitesimal intervals the mass-spring system
revisited. From physics, we know Kma where
KC(urest-u) and au. Sometimes, the numerical
solution (sampling) is not acceptable given the
purpose Interested in outcome? ? use better
numerical methods Interested in insight? ? try to
use symbolic methods, i.e. analysing
differential equations Only possible in very few
special cases In particular linear (sets of)
DEs.
33
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
33
With damping try uurestAe?t, then C??m?20,
or ?1,2(- ???(?2-4mC))/2m Let ?0?(4mC). For ?
?0? critical damping for ? lt ?0? oscillations
TT0/?(1- (? /?0)2) for ? gt ?0? super critical
damping (further details lectures dynamical
systems)
Infinitesimal intervals the mass-spring system
revisited. From physics, we know Kma where
KC(urest-u) and au. Here, KK(t), uu(t).
Let us try a solution of the form uurestA
sin(t/T) u -AT-2sin(t/T) Substitute
back -mAT-2sin(t/T)C(urest-urest-Asin(t/T), mT-2
C, or T ?m/C ( T0)
34
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Summary ? ? ? ? ?
34
From purpose, propose clever exposed and hidden
variables From purpose, determine what
time-concept you need partial order or total
order If total order unknown or known intervals?
What determines (sampling) intervals? If emphasis
on verification or specification consider
statecharts and process models If emphasis on
simulation or prediction use QcurrF(Qprev,Pprev)
interested in outcomes? ? use simplest
possible numerical techniques, be aware for
accuracy (perhaps decrease ? ? performance
!!) interested in insight? ? try symbolic
methods
35
If ? is (close to) 0, we get the original
samples if ? is closer to 1, Qi1 is more
similar to Qi, so no fast changes in Q higher
frequencies are reduced low-pass filtering
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
35
Equal intervals playing a CD. Sound on a CD is
represented as a series of 44100 samples/sec of
the amplitude. Playing the sound take a sample
Pi Do a calculation to process the sound (e.g.,
Qi1?Qi(1-?)Pi) Next, output Qi1 to the
speaker. So again Qi1F(Qi,Pi)
36
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
36
Equal intervals playing a CD. Sound on a CD is
represented as a series of 44100 samples/sec of
the amplitude. Playing the sound take a sample
Pi Do a calculation to process the sound (e.g.,
Qi1?Qi(1-?)Pi) Next, output Qi1 to the
speaker. So again Qi1F(Qi,Pi)
A remedy to aliasing, is to apply a low-pass
filter on the input signal. This is also a
dynamic system of the form QcurrF(Qprev,Pprev)
(details fall beyond the scope of this lecture)
The reconstructed sound will contain a pitch that
was not present initially!! (sampling ? aliasing)
37
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Summary ? ? ? ? ?
37
  • State snapshot of a conceptual model at some
    time point
  • State space collection of all states
  • Change transitions between states state chart
    graph nodes (states) and arrows (transitions)
  • Behavior path through state space
  • State space explosion number of states is huge
    for non trivial cases
  • Projection given a purpose, distinguish exposed
    and hidden properties or value sets
  • Multiple flavors of time
  • partially ordered time, e.g. specification and
    verification
  • totally ordered time, e.g. prediction,
    steering and control
  • A recursive function Qi1 F(Qi , Qi-1 ,
    Qi-2, . , Pi , Pi-1 , Pi-2 , ) to evaluate or
    unroll a behavior
  • equal intervals closed form evaluation
    (e.g., periodic financial transactions
    sampling)
  • equal, small intervals approximation,
    sampling error (examples moving point mass, )
  • infinitesimal intervals continuous time,
    differential equations (examples mass-spring
    system)
Write a Comment
User Comments (0)
About PowerShow.com