Professional Documents
Culture Documents
LECTURE 2
SIMULATION PRINCIPLE
Introduction
Introduction
Stochastic (random process) or deterministic (a computation that given an initial state of the system will always produce the same final state when given the same input) Steady-state or dynamic Continuous (small changes in the input result in small changes in the output) or discrete (ex: events over time) Local or distributed (using two or more computers communicating over a network to accomplish a common objective or task)
Introduction
Stochastic models use random number generators to model the chance or random events; they are also called Monte Carlo simulations. Ex: rainfall/runoff models A discrete event simulation (DE) manages events in time. Most computer simulations are of this type. In this type of simulation, the simulator maintains a queue of events sorted by the simulated time they should occur. The simulator reads the queue and triggers new events as each event is processed. It is not important to execute the simulation in real time. It's often more important to be able to access the data produced by the simulation, to discover logic defects in the design, or the sequence of events.
Introduction
A continuous simulation uses differential equations, implemented numerically. Periodically, the simulation program solves all the equations, and uses the numbers to change the state and output of the simulation. Most flight and racing-car simulations are of this type. This may also be used to simulate electrical circuits. Distributed models run on a network of interconnected computers, possibly through the Internet. Simulations dispersed across multiple host computers like this are often referred to as "distributed simulations". There are several military standards for distributed simulation.
Introduction
Computer simulations are used in a wide variety of practical contexts, such as:
analysis of air pollutant dispersion using atmospheric dispersion modeling design of complex systems such as aircraft and also logistics systems. design of Noise barriers to effect roadway noise mitigation flight simulators to train pilots weather forecasting
10
11
Deterministic v. Stochastic
Deterministic Fixed Data 7% Fixed Outcomes $1,200,00
Variable Outcomes
350.00
425.00
500.00
575.00
650.00
13
Time-Driven Simulation
In a time-driven simulation we have a variable recording the current time, which is incremented in fixed steps. After each increment we check to see which events may happen at the current time point, and handle those that do. For example, suppose we want to simulate the trajectory of a projectile.
At time zero we assign it an initial position and velocity. At each time step we calculate a new position and velocity using the forces acting on the projectile.
Time-Driven Simulation
Time-driven simulation is suitable here because there is an event (movement) that happens at each time step. How do know when to stop the simulation?
We can use either the criterion of time reaching a certain point, or the model reaching a certain state, or some combination of the two.
Time-Driven Simulation
General algorithm for time-driven simulation: 1. Initialize the system state and simulation time 2. while (simulation is not finished)
a) Collect statistics about the current state b) handle events that occurred between last step and now c) Increment simulation time
Example
A line-up at a bank, where customers don't arrive at regular time intervals, and may be deterred by a long line-up.
The list of events can be managed in ordered by increasing time (a priority heap might be efficient) and not to generate all the events in the list at the beginning.
References
Dr. Anis Kouba, CS433: Modeling and Simulation (http://coins.csrlab.org/imamu/akoubaa/cs433/) ref