PowerPoint-presentatie - PowerPoint PPT Presentation

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:171
Avg rating:3.0/5.0
Slides: 47
Provided by: Syste376
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, or
  • warn when one of the pens is about to run out, or
  • train users to handle a 4-color ballpoint, or
  • specificatin 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
5
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
5
Describe processes statecharts Process series
of states
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
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
  • A real-life example controlling a parking garage

9
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
9
  • With n quantities, each 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 Parking garage 1080 states (including
folded cars!)
11
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
11
  • Idea hiding and exposing
  • quantities or
  • values

12
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
12
Individual properties use is visible level is
not visible inOut depends on purpose
make use an exposed quantity make level a hidden
quantity make inOut exposed if color of a pen
matters otherwise hidden
13
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
13
  • Decrease amount of states
  • distinguish exposed and hidden quantities or
    values
  • focus on the exposed ones

14
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
14
  • Example 4-color pen
  • Simples process description just two states

myPen.useTRUE
myPen.useFALSE
15
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
15
  • Example 4-color pen
  • The 2-state model is too naive
  • pen must be out to write
  • only one pen out at a time
  • ink only decreases if a pen is out

16
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
16
Denote state and state transitions statechart
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
17
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
17
Denote state and state transitions statechart
red.inOutout
black.inOut out
red.inOutin green.inOutin blue.inOutin black.in
Outin
green.inOutout
blue.inOutout
18
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
18
Denote state and state transitions statechart
red.level0
red.levelgt0
green.level0
green.levelgt0
blue.levelgt0
blue.level0
black.levelgt0
black.level0
19
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
19
Now we have a state chart model. So what?
garage model was reduced to 3.3 x 106 states
and could be analysed by computer
20
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Introduction to Processes ? ? ? ? ?
20
Now we have a state chart model. So what?
  • predict how will process run?
  • specify desired state, process
  • verify undesired state wont occur
  • analyse no deadlocks?
  • analyse reachability
  • analyse correct order?
  • analyse only permitted transitions?

21
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
21
Lets start talking about time.
22
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
22
state S0
transition T1
state S1
transition T2
state S2
transition T3
state S3
23
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
23
Flavours of time partial order for ?0 pairs of
T1, T2, earlier(T1,T2) or later(T1,T2) total
order for all pairs of T1, T2, earlier (T1,T2) or
later(T1,T2)
24
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
24
  • Flavours of time
  • specify coin operated vending machine
  • ealier(insertCoin,giveProduct)
  • earlier(makeChoice,giveProduct)
  • earlier(insertCoin,giveChange)
  • earlier(makeChoice,giveChange)
  • earlier(giveProduct,giveChange) ?
  • earlier(giveChange,giveProduct) ?

25
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
25
Flavours of time (applications) partial order
26
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
26
Flavours of time (applications) total order for
all pairs of T1, T2, earlier (T1,T2) or
later(T1,T2)
27
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
27
Flavours of time (applications) total order
equal intervals
28
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
28
Flavours of time (applications) total order
infinitesimal intervals
29
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
29
Causality QcurrF(Qprev,Pprev) Forbidden
QcurrF(Qcurr,)
30
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
30
Causality QcurrF(Qprev,Pprev) Forbidden
QcurrF(Qcurr,) F is a recursive function
31
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
31
Arbitrary intervals a 20 km march route 15
control posts every post a box of bananas a
list of efforts (kCal) between posts, Ei. At
which posts should you pick banana(s)?
32
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
32
  • Arbitrary intervals
  • Qiamount of kCal in stomach at post i, i gt 0
  • Q0amount of kCal in stomach at start.
  • Qi1 Qi - Ei (dont eat)
  • Qi1 Qi Ei niB (eat n bananas at post i)
  • ni such that ?i, Qi1 gt 0, and as small as
    possible.
  • Qi1 Qi Ei niB Qi Ei niB gt 0,
  • so niB gt Ei - Qi ni max(0,?(Ei - Qi) / B?), so
  • Qi1 Qi Ei B max(0,?(Ei - Qi) / B?) or
    Qi1 F(Qi,Pi)

33
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
33
Equal intervals a mass-spring system.
34
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
34
Equal intervals a mass-spring system. K ma K
C(urest-u) a v v u t i?
35
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
35
Equal intervals a mass-spring system. K
ma K(t) ? Ki K C(urest-u) a(t) ?
(v(t?)-v(t))/? (vi1 - vi) / ? a v v(t)
? (u(t ?)-u(t))/? (ui1 - ui) / ? v
u t i?
36
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
36
Equal intervals a mass-spring system. K
ma K(t) ? Ki K C(urest-u) a(t) ?
(v(t?)-v(t))/? (vi1 - vi) / ? a v v(t) ?
(u(t ?)-u(t))/? (ui1 - ui) / ? v u ui1
ui ?vi t i? vi1 vi ?ai
vi ?K/m vi ? C(urest-ui)
/m
37
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
37
Equal intervals a mass-spring system. K
ma K(t) ? Ki K C(urest-u) a(t) ?
(v(t?)-v(t))/? (vi1 - vi) / ? a v v(t) ?
(u(t ?)-u(t))/? (ui1 - ui) / ? v u ui1
ui ?vi t i? vi1 vi ?ai
vi ?K/m vi ? C(urest-ui)
/m So Qcurr F(Qprev, Pprev)
ucurr F1(uprev,vprev) uprev?vprev
vcurr F2(vprev,uprev) vprev? C(urest-uprev)
/m, with given u0 and v0
38
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
38
Equal intervals a mass-spring system with
damping. K ma K(t) ? Ki K C(urest-u) -
?v a(t) ? (v(t?)-v(t))/? (vi1 - vi) / ? a
v v(t) ? (u(t ?)-u(t))/? (ui1 - ui) / ? v
u ui1 ui ?vi t i? vi1 vi
?ai vi ?K/m vi
?(C(urest-ui) - ?vi ) /m So Qcurr
F(Qprev, Pprev) ucurr F1(uprev,vprev)
uprev?vprev vcurr F2(vprev,uprev)
vprev?(C(urest-uprev)-?vprev )/m, with given u0
and v0
39
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
39
Equal intervals a mass-spring system with
damping.
39
40
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
40
Infinitesimal intervals a mass-spring system with
damping.
41
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
41
Infinitesimal intervals a mass-spring system with
damping. K K(t), u u(t), K C(urest-u) -
?v. First try for ? 0 u urestA
sin(t/T) u -T-2Asin(t/T) Substitute
back -mT-2Asin(t/T) C(urest-urest-Asin(t/T), mT
-2 C, or T ?m/C ( T0)
42
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
42
Infinitesimal intervals a mass-spring system with
damping. K K(t), u u(t), K C(urest-u) -
?v. Next try for ? ?0 u urest A
e?t C(urest-u) - ?u mu and use u A?e?t
u A?2e?t. C(urest-urest-Ae?t) - ?A?e?t
mA?2e?t . Must hold for any t, so C ?? m?2
0, hence ?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
43
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Summary ? ? ? ? ?
43
Purpose ? exposed and hidden variables Purpose ?
partial order or total order ? If total order
unknown or known intervals? What determines
(sampling) intervals? If verification or
specification consider statecharts and process
models If simulation or prediction use
QcurrF(Qprev,Pprev) interested in outcomes? ?
use simplest possible numerical techniques,
small ? accuracy ? ? large ?
performance interested in insight? ? try
symbolic methods
44
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
44
Equal intervals Playing a CD a series of 44100
samples/sec. Playing the sound take a sample
Pi Process the sound (e.g., Qi1?Qi(1-?)Pi) Outp
ut Qi1 to the speaker Qi1 F(Qi,Pi)
45
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Time and State Transitions? ? ? ? ?
45
Equal intervals Playing a CD a series of 44100
samples/sec.
46
A Core Course on Modeling
Week 3- Time for Change
? ? ? ? ? Summary ? ? ? ? ?
46
  • 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