Edward Smith BT
Contents� Models and how they are used
� Discrete Event Simulation and its uses
� The basic format of a model� Events and interrupts and how they drive models � Events and interrupts and how they drive models
� How statistics are gathered and interpreted.
� Examples showing: � TCP performance
� OSPF behaviour
� Queuing
� Radio LANs.
� Modelling a contact centre
Modelling Principles
� Understand what you are trying to model
� Keep the model simple
� Know what to include and what to exclude.� Know what to include and what to exclude.
� Focus on key features
� Document your model
What is it used for� IP V6 networks
� MPLS Traffic Engineering
� Modelling wireless networks (802.11, LTE, Sensor networks.)networks.)
� MANETS and VANETS.
� Security, including DDOS attacks
� General Protocol performance
� Teaching network mechanisms.
Enter Executive
Function Block
C-Code called by any FSM component
Header Block
Macro definitions, often define state
change
Temporary VariablesDo not persist across process
invocations
State Variables
Persistent across multiple process
invocations.
Process Model – Finite State Machine
Finite State Machine
Enter ExecutiveContains code that is executed on
entering the state
Exit ExecutiveContains code that executed on
leaving the state.
Transition ExecutiveContains actions that are associated
with a specific transition
Termination Block
Destroying a dynamic process
invokes this code.
DiagnosticBlock
C or C++ code used to output diagnostic s.
� Events held in Event List
� Tracked and co-ordinated by the Simulation Kernel.
� Simulation time advances as events processed.
Simulation kernel processes event at the head of event
Events
� Simulation kernel processes event at the head of event list and passes control to target queue or processor.
� Begin simulation interrupt starts simulation time
� Simulations end through: end of simulation, process command or a fatal error occurs.
Adding Statistical Variation� Seed specified for each model� Plugged into a random number
generator� Generate the desired distribution.� One way of doing this is a
technique known as Inverse Transform Sampling
� Trivial example generated using
Random Exponential Function0.013156 0.98693
0.247602 0.7806710.229863 0.7946420.54244 0.581328
0.645261 0.5245260.59365 0.552308
0.337984 0.7132070.900944 0.406186
0.44942 0.637998� Trivial example generated using Excel
0.44942 0.6379980.381069 0.6831310.212416 0.808628
0
0,2
0,4
0,6
0,8
1
1,2P
r
o
b
a
b
i
l
i
t
y
Exponential Function
Exponential Function
0
0,2
0,4
0,6
0,8
1
1,2
0 0,5 1 1,5
Pro
ba
bil
ity
Random Number
Exponential Distribution
Exponential Function
Traffic and Statistics� Packet by Packet traffic � explicitly through either a
process module or network level applications
� Back ground traffic can also be generated on links or across nodes.
Import back ground from live networks using Netflow or � Import back ground from live networks using Netflow or Sniffer traffic.
� Statistics gathered at the end of a simulation run are the main output of the modelling exercise.
� The standard models offer a set of predefined statistics.
� At process level can define, register and collect bespoke statistics.
Dangers� Errors in simulations or improper data analysis.
� Different packages may produce different results.
� Validate simulation models against the real world.
Document model and assumptions. � Document model and assumptions.
� Statistical significance of the results collected.
� Collect results when steady state reached.
� Select only appropriate of traffic flows
� Sensitivity Analysis for parameters varied.
Andel, T.R. and Yasinsac, A. On the Credibility of Manet Simulations, IEEE Computer, July 2006,48-54
M/M/1 and M/D/1 – Simulation v Analytical
solution
0,02
0,025
0,03D
ela
y (
mS
)
M/M/1
0
0,005
0,01
0,015
0% 5% 10,0% 15,0% 20,0% 25,0% 30,0% 35,0% 40,0% 45,0% 50,0% 55,0% 60,0% 65,0% 70,0% 75,0% 80,0% 85,0% 90,0% 95,0%
De
lay
(m
S)
Utilisation %
M/M/1
M/D/1
M/M/1 Sumulation
M/D/1 Simulation
Self Similar Traffic – Analytical Result
200
250
300
Av
era
ge
Qu
eu
ing
De
lay
mS M/M/1
H=0.8
H=0.75
H=0.7
H=0.65
Utilisation %
0
50
100
150
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100
Av
era
ge
Qu
eu
ing
De
lay
mS
H=0.65
From: On the Prediction of Average Queuing Delay with Self Similar Traffic. Y.G. Kim and P.S. Min Globecom’03,IEEE Global Telecommunications Conference, 1-5 Dec 2003, IEEE pp 2987-91.
0,1
0,12
0,14
0,16
H=0.5
H=0.65
Simulation of Pareto Arrivals Process
0
0,02
0,04
0,06
0,08
0% 5% 10,0% 15,0% 20,0% 25,0% 30,0% 35,0% 40,0% 45,0% 50,0% 55,0% 60,0% 65,0% 70,0% 75,0% 80,0% 85,0% 90,0% 95,0%
De
lay
(m
S)
Utilisation %
H=0.65
H=0.7
H=0.75
H=0.8
M/M/1 data points
orig-id
orig_port
ack
svc time
svc_time_remain
svc_start
instructions
svc_start
current_subq
current_priority
last_update_time
server_busy 01
Set from sub-queue
Get packet priority
current time
Current time
0init
Current time
0
svc_complete 0
init routineIdleservice startpacket arrival – arrived packetpacket arrival - pre-empt packetservice complete
Work_left last – last_update_time
work_left_last
total_busy_time
processing _rate
time_in_processor
original_svc_time
processing_delay
pk_svc_time
svc_complete
pk_instructions
old_svc_time
time_processedCurrent_time – stamp of pre-empted packet
op_interrupt_schedule(current_time+pk_svc_time)
old_svc_time –time_processed
current time
Server_busy*current time – last_update_time
pk_instructions/processing_rate
current_time –svc_start
time_in_processor – original_svc_time
Work_left last –(Server_busy*current time – last_update_time)
Total_busy_time –(Server_busy*current time – last_update_time)
Add to
time_in_processor=svc_time–original_svc_time
/** state (arrival) enter executives **/FSM_STATE_ENTER_FORCED (2, "arrival", state2_enter_exec, "jsd_prio [arrival enter execs]")FSM_PROFILE_SECTION_IN ("jsd_prio [arrival enter execs]", state2_enter_exec){/** These executives are encountered when a packet arrives on an input **//** stream. The incoming packet is enqueued in priority order in a subqueue. **//** If packet already in service, it will not be preempted. Acquire the arriving packet.*/
pkptr = op_pk_get (op_intrpt_strm());if (pkptr == OPC_NIL)
jsd_prio_error ("Unable to get packet from input stream.");/** Determine the remaining service time of the incoming packet. **//** Determine the remaining service time of the incoming packet. **//* If the svc_time field of the packet is set, we can *//* read the remaining service time directly from it. */if (op_pk_nfd_get (pkptr, "svc_time",&pk_svc_time) ==
OPC_COMPCODE_FAILURE)jsd_prio_error ("Unable to get remaining service time from packet.");if (pk_svc_time > 0){
/* Set a success flag to be used later. */svc_time_determined = 1;
}/* Otherwise we need to determine the number of instructions *//* in the packet. */
20
25
30
35
40
Q
u
e
u
i
Analytical
Full_Model _Exponential
Comparison of Analytical model
and Simulation
0
5
10
15
20
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
i
n
g
%
Number of Agents
8
10
12
A
v
e
r
a
g
e
t
i
m
(
s
e
Calculated
Full Model -240 calls exponentialModel - Contention experienced at media gateway
Impact on Time in queue
0
2
4
6
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
m
e
i
n
q
u
e
u
e
e
c
s)
Number of Agents
Full Model -500 calls - exponentialModel – No Contention at media gateway
Route Callto ACD
Call ArrivalReturn to wait For next event
Media Gateway Node
Media Gateway
Initialisation
Clean up call count
WaitOn Event
Return to wait For next event
For next event
CallCompletion
Queuing hereIncreases call duration
Which increases occupation at media gateway
Impact of Media Gateway
CallSource
MediaGateway
Agent Queue
One call every 1.5seconds
One call every 1.5Seconds – Minus Calls dropped
Increasing blockingAt media gateway Equilibrium
Will be established aseffects of queuing andBlocking balance
Bibliography� Andel, T.R. and Yasinsac, A., On the Credibility of Manet Simulations, IEEE Computer,
July 2006, pp 48-54.� Svensson, T. and Popescu, A., Development of laboratory exercises based on Opnet
Modeller, Blenkinge Institute of Technology, June 2003, available from http://staff.ustc.edu.cn/~bhua/experiments/Lab_Exercices_Modeler.pdf
� Smith, E.A., The Goals and Benefits of Network Modelling in a Commercial Environment, Proceedings of 51st FITCE Congress, Poznan, September 6th and 7th 2012, paper #1569593947.Environment, Proceedings of 51 FITCE Congress, Poznan, September 6 and 7 2012, paper #1569593947.
Also published in: Journal of Telecommunications and Information Technology, 2013, No 1, pp 25 – 31� Smith, E.A., A Brief Examination of Network Modelling, Journal of the Institute Of
Telecommunications Professionals, 2013, 7(1), pp 37-42. � Smith, E.A., Statistical Modelling of a Contact Centre, Journal of The Institute Of
Telecommunications Professionals, 2015, 9(2), pp 23-30. � Smith, E.A., Principles of using formal modelling techniques, unpublished, copy
available from author on request. � Smith, E.A., Modelling queuing behaviour using Opnet modeller, unpublished, copy
available from author on request.