Tom Kelliher, CS23
Apr. 2, 1996
A technique for modeling the behavior of natural and man-made systems. Useful for summarizing the performance of existing systems or predicting the performance of proposed systems.
Customers at the First National Bank of Avarice are complaining of having to wait too long in line. What should the bank president, Mon E. Baggs, do:
What is our data?
What do we measure?
Data file is ordered pairs:
Assumptions:
Attributes of an event:
What kinds of events:
From arrival event to departure event: where are the waiting customers?
What we need to keep track of:
What ADTs can we use/do we need?
Is there a hierarchy to these ADTs?
How does it fit together?
Customer arrives and enters empty line. Can customer immediately go to teller?
Simulation situation: Moving event from a queue to the event list.
Event flow:
Associated with event:
Needed data structures:
Pseudocode:
open arrival file; set time to 0; initialize statistics; put first arrival on event list; while there's an event get next event; advance time; cause event; print message; accumulate statistics; print final statistics; close arrival file
Example event: sign-in
remove event from sign-in queue; if event's transaction type is license renewal putInLicenseList(); else putInRenewalQueue(); if sign-in queue isn't empty create new sign-in event (event time is current time + 10s.); insert event in event queue;
putInLicenseList():
if license list is empty create new license event (event time is current time + 90s); insert event in event queue; else insert entry in license list;
Walk through some data (sanity testing):