Title: Discrete Event Simulation
1Discrete Event Simulation
- Dr. Frank H. Li
- USC Upstate
- 8/24/05
2Ways To Study A System
3Characterizing a Model
- Deterministic or Stochastic
- Does the model contain stochastic components?
- Randomness is easy to add to a DES
- Static or Dynamic
- Is time a significant variable?
- Continuous or Discrete
- Does the system state evolve continuously or only
at discrete points in time? - Continuous classical mechanics
- Discrete queuing, inventory, machine shop models
4Model Taxonomy
5DES Model Development
- Algorithm How to develop a model
- Determine the goals and objectives
- Build a conceptual model
- Convert into a specification model
- Convert into a computational model
- Verify (Did we build the model right?)
- Validate (Did we build the right model?)
- (Typically an iterative process)
6Discrete Event Simulation (1)
- A discrete event is something that occurs at an
instant of time. - Pushing an elevator button
- Starting/stopping of a motor
- Turning on a light
- Activities such as moving a train from point A to
point B are NOT discrete events. Why?
7Discrete Event Simulation (2)
- However, we can model moving a train from point
A to point B as - The event of the train leaving point A at 7am
- The event of the train arriving at point B at
11am - A discrete event simulation is to study a complex
system by computing the times that would be
associated with real event in a real-life
situation.
8Discrete Event Simulation (3)
- How to model moving a train from point
- A to point B?
- Initially, generate an event (E1) with an
attribute occure_time 7am - Do we need to generate another event with an
attribute occure_time 11am ? NO! - When E1 is handle, E1 will trigger (generate) an
event E2 scheduled at 4 hours later.
9Discrete Event Simulation (4)
- A simulation could use the real-time clock.
However this would take unnecessarily long time. - Waiting 4 hours to see train arrival at point B
- A discrete event simulation is to compute, as
quickly as possible, the physical time that
would occur in real time in a physical system,
but without actually waiting for the delays
between events to occur in real time.
10Discrete Event Simulation (5)
- Four components
- Simulation time
- Events
- An Event list
- Event handler (can be the main program)
- Simulation time
- Begins at 0
- e.g., the train leaves from A at 0 simulation
time - it arrives B at 4 hour simulation time
11Discrete Event Simulation (6)
- Events
- Object C/Java
- Structure C
- Number Matlab
- Having an attribute occur_time
- Events can be scheduled and handled
- When scheduled, an event will be put into the
event list, which is sorted by occur_time
(ascending) - When handled, do something and may trigger other
events (schedule events)
12Discrete Event Simulation (7)
- Event handler (main program)
- While( Event list is not empty)
-
- get the first event
- handle the event
- Advance the simulation time by the occur_time
of the current event - Run the event (do something about it)
- May schedule new events
- generate new events (occur_time)
- put into ordered event list
- Remove the current event from the event list
13Discrete Event Simulation (8)
- main()
-
- schedule E1,0
- schedule E2,0
- while( Event list is not empty)
-
- E getEvent()
- Handler( E )
- RemoveEvent( E )
-
14Discrete Event Simulation (9)
- Handler( Event E )
-
- Switch( E )
-
- case e1
- xxx
- schedule Ea,t
- break
- case e2
- yyy
- schedule Eb,t
- break
-
15Discrete Event Simulation (10)
- Random number generator
- Why random numbers?
- e.g.,
- Inter-arrival time exponential distribution
- Arrival time Poisson distribution
- Service time exponential distribution
- Function/method generates random number in
C/Java
16Discrete Event Simulation (11)
- Distribution -1 mean log(1.0 -
randomNumber) - mean is the mean of this exponential
distribution - log() is a base e log function
- randomNumber is a random number between 0 to 1
- Feed a series of randomNumbers to this formula,
get a series of values for this distribution.
17Quality of Service (QoS) in Cellular Networks
- Calls
- New calls
- Handoff calls
- QoS
- (New) call blocking probability (CBP)
- Handoff dropping probability (HDP)
- HDP is more important than CBP (Why?)
- There are N channels in a base station. We
simulate several channel allocation algorithms
and compare the performance.
18Traffic Model (1)
- The average new calls arrival rate ?_new
(requests/sec) - The average handoff calls arrival rate ?_handoff
(requests/sec) - Total average call arrival rate (?_new
?_handoff) -
- Note When arrival rate is ?, the inter-arrival
time is 1/ ?
19Traffic Model (2)
- The average call time 1/µ (second/call)
- Since there are N channels, if all channels are
occupied all the time, on average, N calls will
finish in 1/µ second. - Therefore, Nµ calls will finish in each second.
(Nµ calls/sec service rate) - In summary
- Arrival rate (?_new ?_handoff) calls/sec
- Service rate Nµ calls/sec
- Mean Traffic load
- ?_mean (?_new ?_handoff) / (Nµ)
- Traffic load in a measurement interval
- ? (total channel busy time) / (total channel
time) - How to choose ?_new and ?_handoff ?
20Performance Metrics
- During a time period
- Utilization (U) the average percentage of
channels occupied - CBP
- HDP
- Comparing several schemes
- Complete sharing (CS) scheme
- Complete partition (CP) scheme
- Some other schemes you propose to improve system
performance
21About the Programming Project
- Work in groups of 3 or 4 for this project. Hand
in a single set of report for the entire group.
Each group will make an up to 10 minute
demonstration. - Your programming project report must contain the
following sections - Introduction an brief overview of your project
- Specification what this program suppose to do
- Implementation program structure, core algorithm
pseudo code, etc. - Test cases and results
- Discussion issues and challenges
- Appendix the hardcopy of your source code. A
softcopy of the program should be emailed to me
in the zipped folder on the same day.