170 likes | 269 Views
Review. CFMS for the ping-pong example. Ball_A. Ball_A. Ball_B. Ball_A. A_D. A_A. B_D. B_A. player_A. player_B. Ball_B. Ball_B. Ball_A. Ball_B. Ball_A. A_A, B_D. A_D, B_A. CFSM. Ball_B. Player_A ï€ ï¤ : X ï‚´ S ï€ ï‚® S X A = {Ball_A}{ï´} ï´: internal event. feedback. Ball_A.
E N D
CFMS for the ping-pong example Ball_A Ball_A Ball_B Ball_A A_D A_A B_D B_A player_A player_B Ball_B Ball_B Ball_A Ball_B Ball_A A_A, B_D A_D, B_A CFSM Ball_B Player_A : X S S XA = {Ball_A}{} : internal event feedback Ball_A /Ball_A A_A A_D A_A A_D Ball_B Ball_A A_A A_D Ball_B
Limitation of expressive power in FSM • Ex) ping-pong game • (i) what if “attack” takes 2 steps: one state generating output, other state with no output. State independent of any inputs. • (ii) what if we want to specify time to be spent for state A or D • A takes 0.1sec. (A’s control : output) • D takes ? sec (B’s control : output) • input event ->state transition • time modeling Infinity • No semantics for such sojourn time specification: • logical time models. Receiving state Ball_A R_B A_A Ball_B Ball_B ? Ball_A A_A A_D replace A_A Ball_A R_B A_D Ball_B A_A Ball_B
Solution : DEVS (Discrete Event System Specification) Formalism • internal transition & time advance function(defined) • introducing internal transition functionint : S S • introducing time advance functionta : S R+0,
DEVS Modeling & Simulation Framework • DEVS = Discrete Event System Specification • Provides sound formal M&S framework • Supports full range of dynamic system representation capability • Supports hierarchical, modular model development (Zeigler, 1976/84/90/00)
The DEVS Framework for M&S • Separates Modeling from Simulation • Derived from Generic Dynamic Systems Formalism • Includes Continuous and Discrete Time Systems • Provides Well Defined Coupling of Components • Supports • Hierarchical Construction • Stand Alone Testing • Repository Reuse • Enables Provably Correct, Efficient, Event-Based, Distributed Simulation
DEVS Formalism • Discrete-Event formalism: time advances using a continuous time base. • Basic models that can be coupled to build complex simulations. • Abstract simulation mechanism
Atomic model definition Behavioral models
DEVS Atomic models • Atomic DEVS = < S, X, Y, int ,ext , , ta > • X : external input event set • Y : external output event set • S : sequential state set • int: internal transition function • ext :external transition function • : output function • ta : time advance function
DEVS Atomic models (cont.) • ta : S R+0, • Q = {(s,e) | s S, 0 e ta(s)} : total state set, e: elapsed time • int : S S • ext : X * Q S • : S Y S int Y X R ext
Atomic model Discrete Event Dynamics • External Event Transition Function (ext): transforms state and an input event into another state • (e.g., receiving a faulty device, put it into a queue to await its turn for repair.) • Internal Event Transition Function (int): transforms state into another state after time has elapsed • (e.g., there are 10 parts available and broken part requires 7 of them, after fixing broken part, 3 parts will remain.) Time Advance Function (ta): maps a state into a duration (e.g., how long to fix a device once processing has started.) • Output Function (): maps a state into an output • (e.g., number of parts available falls below a minimum number, issue an order to restock.)
DEVS atomic models semantics y (3) x (5) s’ = d ext (s,e,x) (6) l (s) (2) s s’ = d int (s) (4) ta(s) (1) DEVS = < X, S, Y, dint , dext , ta, l >
DEVS atomic models semantics y (3) x (5) s’ = d ext (s,e,x) (6) l (s) (2) s s’ = d int (s) (4) ta(s) (1) DEVS = < X, S, Y, dint , dext , ta, l >
Atomic model example: ping-pong • AMplayer_A =< S, X, Y, int ,ext , , ta > • X = {Ball_B} • Y = {Ball_A} • S = {A, D} • int (A) = D • ext (Ball_B, D) = A • ta(A) = thinking_time • ta(D) = INFINITY • (A) = Ball_A Ball_A A D Ball_B Ball_B
Dynamic behavior of DEVS models in M out event x1 y1 x2 t S s2=ext((s0,e),x1) s2 s1=int(s2) s1 s0 t e ta(s1) ta(s2) ta(s0) t