260 likes | 496 Views
Discrete Event Simulation. general principles. System Model System state Entities Attributes. Set Event Activity Delay. Concepts. Example - carhop system for fast food. System state: L q (t), the # of cars waiting to be served at time t
E N D
Discrete Event Simulation general principles
System Model System state Entities Attributes Set Event Activity Delay Concepts
Example- carhop system for fast food • System state: • Lq(t), the # of cars waiting to be served at time t • LA(t), 0 or 1 to indicate Able being ____ or ______ at time t • LB(t), o or 1 to indicate Baker being _____ or _______ at time t • Entities • Cars, Able, and Baker – related to system state • Events • Arrival event • Service completion time by Able • Service completion time by Baker • Activities • ___________ time, service time by Able, service time by Baker • Delay • The wait in _________ until Able or Baker becomes free
Simulation System • Definition of the model ___________s • Provide _______ description of the model • Description of the ______ relationships and interactions between components. • Activities • Events • System states
Questions must be answered • How does each _____ affect system state, entity attributes, and set contents? • How are ______ defined (deterministic or probabilistic)? • What ____ marks the beginning or end of each activity? • Can the activity begin regardless of ________________?
Questions must be answered (cont.) • Which events trigger the beginning (and end) of each type of ________? • What is the system state at time 0? • What events should be generated at time 0 to “_______” the model – i.e., to get the simulation started?
What is simulation • The modeling over ______ of a system all of whose state changes occur at __________ points in time • Those points when an ______ occurs. • Proceed by producing a sequence of system _________s.
System Snapshot Future event list guarantees that all events occur in correct ___________ order when simulation time is advanced.
Scheduling an event • At the instant an activity ________s, • Its _________ is computed • The end-activity event, together with its event time, is placed on the __________________. • Events are chronologically arranged • T < t1 t2 t3 … tn • T is the value of CLOCK, the _____ value of simulation time. • The event associated with time t1 is called the _______ event; the next event to occur. • At CLOCK = t1, the imminent event is ______ from FEL and executed.
Simulation run snapshot snapshot t1 t t2? New event may be __________ and insert to FEL. New snapshot is created based on snapshot at ___. CLOCK
Event-scheduling/time-advance (ES/TA) algorithm • Remove __________ event from FEL • Advance ________ to imminent event time • Execute _______ event; update system _____, change entity _________s, and set membership as needed. • Generate _______ events (if necessary) and place on FEL in correct position. • Update cumulative _________ and counters.
Example ES/TA
Efficiency of Simulation Program • Efficient management of ___ have a major impact on simulation efficiency. • A ___ processing • Removal of _____ event • Insertion of ______ • Cancellation of events • Efficient operation of ______ removal and addition. • List processing too.
List operation • _______ list • Top-down search from the list head • Bottom-up search • ___________ list
Initial condition • System snapshot at time __ • Defined by the _____ conditions and exogenous events. • E.g., • Initial condition (5, 1, 6) at time 0; • Generate arrival event at 0, and • By producing interarrival time a*, the next arrival is at a*, etc. • Generating external arrivals is called _________.
N n+1 arrival ……… Time 0 3.7 4.1 7.4 Clock = t t* a* Bootstrapping by external arrival stream A simulated time t, assumed to be the Instant of the nth arrival, generate ________l time a*, compute _____ and Schedule future arrival on ___ to occur At future time t* Between successive arrival events, other Types of events may occur, causing System state to change
Stopping event • At time 0, schedule a ______ simulation event at a future time TE. • Run length TE is determined by the ___________ itself. • _________ of some specified event E.
Event-scheduling simulation- single channel queue • System state • (Lq(t), Ls(t)) • Entities: • server and customers • Events: • arrival (A), departure (D), stopping event (E). • Activities: • interarrival time and service time. • Delay: • customer time spent in waiting time.
Arrival event Occurs at CLOCK=t No Is Ls(t)=1 ? Yes Increase ____ By 1 Set ______ Generate service time s*; Schedule new _________ Event at time t+s* Generate interarrival time a*; Schedule next ______ event at time t+a* Collect statistics Return control to Time-advance routine To continue simulation
departure event Occurs at CLOCK=t Yes No reduce Lq(t) By 1 Is Lq(t)>1 ? Set Ls(t)=0 Generate service time s*; Schedule new departure Event at time t+s* Collect statistics Return control to Time-advance routine To continue simulation