Discrete Event Simulation

UniS
University of Surrey
Department of Computing
CS366 - Discrete Event Simulation
Introduction to the basic principles of Discrete-Event Simulation
to model real-world systems (part of system – you decide on
model boundary)
Introduction to Micro Saint Sharp provides a graphical
development environment with specific features for DiscreteEvent Simulation.
A system can be built as a network of activities with entities
flowing through the system. Micro Saint handles the flow of
entities through the model and the sequencing of events over
time – handles time
The analysis of the results of simulation are as important as
building and running a model. Need to be able to comment on
the significance of the results and the behaviour of the model.
Is the model valid?
Two hour Computer Laboratory session each week starting
week 3. One lecture only from week 4
Graded problems using Micro Saint – an assignment every two
weeks. Details will be posted on the web - see site below. A
final group assignment about week 10.
Exam preparation: "take-home" written model specification with
a working solution in the form of a program. Familiarise
yourself with the program.
Examination will be in week 15 with a 3 hours laboratory
session. You will be asked to run the simulation with specific
data, to report on the significance of the output, to modify the
81906594
1
Dr Terry Hinton
9/9/05
model and program and report on the significance of the
changes.
Module Notes including a set of useful PowerPoint slides
provided by Micro Saint and a Manual are available on the web
site: www.computing.ac.uk/courses/cs366
Types of Simulation
Static – Independent of time
stress
distance
Continuous Dynamic System – No events or discontinuities
81906594
2
Dr Terry Hinton
9/9/05
customer
leaves
payment
starts
serving finishes
serving starts
customer arrives
Discrete Events
paying
waiting
serving
waiting
time
Discrete Events
Objects in one of 2 states:
Each event occurs at a particular time and causes a change of state. We look ahead and
schedule the next event. Clock advances in
Waiting in Queue
Being Processed
Time
Queue
(Idle time)
Events occur at certain times - you must predict the time
81906594
3
Dr Terry Hinton
9/9/05
Each event occurs at a particular time and causes a change of
state. We look ahead and schedule the next event. Clock
advances in irregular large steps not small steps dt as in
dynamic systems
Basic Concepts - Activity Based Approach to Modelling
Entities – resources, people, machines, materials, money
Entity - active or idle – (activity based approach)
Why build Activity Based Models?
• A profit-oriented organisation – maximum production,
minimum costs i.e. value added to resources
• A service-oriented organisation – maximum throughput of
customers in minimum time - best service minimum resources
Optimise production vs. costs; throughput vs. time
Entities have attributes - fixed or variable describe its state
e.g. bus attributes and bus activities (give list)
Resources – required to support activity. Resources are either
busy or idle.
When an entity is active it is involved in an activity, task or
process
When an entity is idle waits in a queue
Why have an idle state?
81906594
4
Dr Terry Hinton
9/9/05
Production
Production
Consumption
Stock
Production
Consumption
(Inventory)
Static Object
activity
idle
activity
queue
activity
Mobile Object
activity
Purpose of inventory or idle resource is to decouple the production from the consumption or
the next process. Establishing an inventory policy to determine optimum size. A large
inventory
represents a large capitalis
investment
not earning
revenue e.g. BA capital invested in
pre-condition
customer
waiting?
spare parts significant % of total capital. Too small an inventory will cause very large costs if
appropriate
spare
part not availableiswhen
needed.
(Release
Condition)
there
a bank teller free?
time
Task, activity or process
event
start condition
(Beginning Effect)
end condition
(Ending Effect)
81906594
event
remove customer from queue
engage teller – one less to serve others
predict time of process
release teller - one more to serve others
move customer on to next process
5
Dr Terry Hinton
9/9/05
Micro Saint provides facilities to write code at each event to
specify or check conditions and actions. The code is executed
when the event occurs.
Queue: A queue is the state in which an entity waits to start an
activity. Types of queue:
First in first out
FIFO
Last in first out
LIFO
Sorted
based on value of an attribute
Entering and leaving a queue are events so we need to be
able to specify or check conditions and take action by writing
appropriate code:
Entering Effects
Departing Effects
Activity: An activity is the state in which an entity remains, on
its own, or with other entities, while a specified operation takes
place over a period of time. The time may be constant or
variable. It is calculated beforehand and once the activity has
started it will continue for this duration unless the logic of the
model allows it to be interrupted.
Time of process or activity:
Fixed time
Stochastic – generated from random number sequence to
provide a sample from a given distribution
Use of term Micro-Simulation because consider every
individual entity not just the average behaviour. Hence obtain
maximum and minimum values of important parameters.
81906594
6
Dr Terry Hinton
9/9/05
Design Model:
what is the purpose of the simulation – who are the stake
holders? e.g. client
what entities (objects) to include?
define the boundary to the model – what to leave out
start simple add complexity as necessary
what can be simplified?
what are the attributes of the objects?
what is the behaviour of each object?
how do objects interact?
how does the model start and end?
what data is available to set up the model?
what output data is needed to make useful predictions?
check the level of detail of the model - add more complexity
81906594
7
Dr Terry Hinton
9/9/05
Insert PowerPoint slides Micro-Simulation Example
Slides on Handling Time
Glossary of Modelling Terms
This glossary was provided by David Fone, University of Wales College of Medicine in a
report: Systematic Review of the use and value of stochastic modelling in Population Health
and Health Care Delivery; published in March 2001
81906594
8
Dr Terry Hinton
9/9/05