3 - Discrete Event Simulation
3 - Discrete Event Simulation
• Other Topics:
• Mixed-Signal Simulation
• Finite Element Modeling and Multi-physics
What is a system?
• System: set of objects, joined to accomplish some purpose.
2. Process-interaction
• The simulation is considered as a collection of interactions among processes.
• It is similar to the object-oriented programming paradigm.
• Processes interact with each other by messages.
• Intuitive appeal: analyst can describe the process flow in terms of high-level blocks, while the
interaction between processes is handled automatically.
• Usually, many processes are simultaneously active
• Quite complex interaction
World Views (cont.)
3. Activity scanning
• With activity-scanning approach, a modeler concentrates on the activities of a model and those
conditions that allow an activity to begin.
• Simulation runs in fixed time increments
• At each clock advance, conditions are checked, and if met, the activity can begin
• Repeated scanning for activity conditions
• slows down the computer simulation
• Replications (trials):
• Same model’s logic or data for a certain experiment.
• Differentiated by the use of a certain set of values for random variables.
• Statistical results can be analyzed for a set of such replications.
• Run:
• A replication consists of: initialization, run, results reporting.
• Clock:
• Internally managed and stored data value
• Tracks the passage of “simulated” time as opposed to real time.
• Advances automatically in discrete, typically unequal steps.
Model Execution (cont.)
• Execution of a run:
• User-Managed Lists
• Holds entities in the dormant state.
• The modeler must establish such lists and supply the logic to transfer entities to and from the lists.
Model Execution (cont.)
• Execution of a run revisited:
• Replace the analog waveforms of DAE-solver simulators with the three or more values: 0, 1, and X
(undefined).
• E.g., In simulating digital designs, circuit elements are modeled as simple switches or gates
connected by wires (typically zero delay).
• Provides the ability to simulate larger designs than circuit-level simulators can, at the
expense of detail.
Discrete-Time Simulation (cont.)
• Often use simple table-driven models
• The behavior of a gate can be stored in a simple truth table.
• Its output can be looked up once the inputs are known.
• Device delay can be assumed to be a single time unit, or can be calculated
from a delay model that takes the actual device geometry into account.
• Transistors are modeled as simple switches with each node having a state 0, 1, or X.
• Circuit elements are modeled at the gate rather than the transistor level.
• They cannot easily model some common VLSI structures (for example, pass
transistors).
Discrete-Time Case Study (2):
Gate-Level Simulators (cont.)
• Take a schematic or a netlist of the circuit in terms of wires and logic gates as an
input (for example, NAND, OR, D-flip flop).
• Truth tables, extended to include the undefined logic value, are used to model
each gate.
• Allows the inclusion of more of the design for a given amount of computation time.
• Gives the designer confidence in the correctness of the design as a whole.
• Subtle errors (e.g., race conditions) can be missed because of the lack of detail.
• Mixed-mode simulators allow different parts of the design to be simulated at different levels of
abstraction.
Behavioral-Level Simulators: ATM machine
The following table shows both the arrival and service times for
customers at an ATM machine.
Show the sequence of state changes that occur during the simulation.
Cust. Arrival Service Departure
1 0 5
2 3 7
3 4 1
4 7 3
5 9 2
Course Outline
• Introducing the Concepts
• Time Handling Mechanisms
• Discrete Event Simulation (DES)
• General Principles
• DES Case Study in SIMAN/Arena
• Continuous-Time Simulation
• DAE Solvers
• Random Numbers
• Usage, Generation, Validation, Pitfalls
• Queuing Systems
• Other Topics:
• Mixed-Signal Simulation
• Finite Element Modeling and Multi-physics
SIMAN/Arena’s Terminology
• Entity: unit of traffic or a transaction
• Instigates and responds to events
• External entities: creation and movement are explicitly arranged by the
modeler.
• Internal entities: creation and manipulation are implicitly arranged by the
simulation engine itself.
• Simulation languages
• GPSS, SIMSCRIPT, SLAM, SIMAN,… etc.
• Better simulation framework but still a steep learning curve.
• High-level simulators
• Operate via an intuitive GUI and dynamic animation.
• Domain specific and generally less flexible than simulation languages.
Case Study in Arena
• The Smarts directory installed with the tool provides excellent tutorials: e.g.,
Smarts07 and Smarts059.
• Wait time is the time an entity spends in any activity where the allocation is specified as Wait.
• Similarly, other types are depending on the allocation.
• By default, all time spent in a queue (such as waiting for a resource in a Process module or
waiting for other group members in a Batch module) is specified as Wait.
• All time spent using material handling from the Advanced Transfer panel (such as a conveyor or
transporter) is specified as Transfer.
Time/Cost in Arena (cont.)
• Cost for a specific type is the cost accrued by the entity while it is in that type of time.
• E.g., wait cost is accrued by an entity while it is in a wait activity or waiting in a queue. This includes the
overhead cost of keeping the entity in the system as well as the cost of continuing to hold any resources
it owns.
• E.g., Wait cost is calculated at the end of the waiting activity/period using the formula:
Wait cost =
(Entity.HoldCostRate + ResCostRateEnt) * Wait Time
where ResCostRateEnt returns the sum of the busy cost rates for all resources held.
and Entity.HoldCostRate is specified in the Entity module and is user-assignable.
Time/Cost in Arena (cont.)
• Total cost is simply the sum of the costs incurred in the five allocation categories
(Value Added, Non-Value Added, Wait, Transfer, and Other) for an entity or
process.
• Total time for an entity is calculated based on the time the entity enters the
system until when statistics are generated (TNOW – Entity.CreateTime).
• Although often the total time will correspond to the sum of the times in the five
allocation categories, in some modeling situations such as using groups, this may
not be true.
Entity Animation
• There are two ways to show entities moving through the system:
• Facility-based Animation
• uses stations to represent physical locations where specific processes or
events occur, and involves animating the physical relationships as they exist in
the real system.