Escolar Documentos
Profissional Documentos
Cultura Documentos
B. Tech. (IT)
SEMESTER - VII SEMESTER - VII
Part I
July - 2013
System Simulation
Introduction
Simulation is a very powerful and widely used
computational science technique for the analysis and study
of complex systems.
Simulation may be defined as a technique that imitates the
operation of a real-world system as it evolves over time.
This is normally done by developing a simulation model. A This is normally done by developing a simulation model. A
simulation model usually takes the form of a set of
assumptions about the operation of the system, expressed
as mathematical or logical relations between the objects of
interest in the system.
Simulation has its advantages and disadvantages. We will
focus our attention on simulation models and the
simulation technique.
Simulation
What is simulation
The !rocess o" desi#nin# a mathematical or
lo#ical model o" a real-system and then lo#ical model o" a real-system and then
conductin# com!uter-$ased e%!eriments &ith
the model to descri$e' e%!lain' and !redict
the $eha(ior o" the real system)
Simulation
Where simulation "its in
Programming
Simulation
Analysis
Modeling
Probability
&
Statistics
*asic Terminolo#y
In most simulation studies' &e are concerned &ith
the simulation o" some system)
Thus' in order to model a system' &e must
understand the conce!t o" a system)
Definition: + systemis a collection o" entities that
act and interact to&ards the accom!lishment o"
some lo#ical end)
Systems #enerally tend to $e dynamic , their status
chan#es o(er time) To descri$e this status' &e use
the conce!t o" the state o" a system)
E%am!les o" - Simulation Model
-ano cars - num$ers o" cars !roduced !er day
.throu#h!ut/
Emer#ency Room , .$eds' doctors' nurses/' .minor'
moderate' ma0or' critical/ moderate' ma0or' critical/
Missile , *allistic Missile Sur(i(a$ility a#ainst Some
Threat
Institutes .IIIT +/ Par1in# !lace
Po&er Inte#ration , Semiconductor 2a!acity' and
random machine do&n times
Value o" Simulation
Em!irical Method (erses Mathematical model
+llo& you to calculate the e%treme (alues not +llo& you to calculate the e%treme (alues not
0ust the e%!ected (alue
Simulation
What is simulation
Simulation is the actual running of the model
system to gain insight into its performance. system to gain insight into its performance.
Simulation
Why use simulation
Simulation is used to better understand the
expected performance of the real system and to expected performance of the real system and to
test the effectiveness of the system design.
Simulation
Why use simulation
Without $uildin# them
e%!erimental system
ne& conce!ts ne& conce!ts
Without distur$in# them
costly e%!erimentation
unsa"e e%!erimentation)
Without destroyin# them
3etermine limits o" stress
Alternative to simulation
Simulation
+nalytic models
Physical e%!erimentation Physical e%!erimentation
Visit other sites
Simulation (s) +nalytic modelin#
+d(anta#e
(arious !er"ormance measures
#reater realism
easier to understand easier to understand
model the steady-state as &ell as the transit
$eha(ior)
3isad(anta#e
May not !ro(ide you &ith the o!timal
solution
time to construct model &ill $e lon#er)
Simulation (s) Physical
+d(anta#e
4i#h S!eed
-ot disru!ti(e
Re!lication easy Re!lication easy
2ontrol (ariations
5enerally less costly
3isad(anta#e
Realism
Validity
Simulation (s) +lternati(es
V A S P
Realism
V A
V A S P
Cost
Re!resentin# system
System
a collection o" mutually interactin# o$0ects
desi#ned to accom!lish a #oal .machines
re!air system/ re!air system/
Entities
denotes an element6o$0ect &ithin $oundary
o" system .machines' o!erators' re!airman/
Entity , &or1 $ein# !er"ormed on o$0ect
Resource , !er"ormin# the &or1
Re!resentin# system
+ttri$ute
2haracteristic or !ro!erty or an entity
.machine I3' Ty!e o" $rea1do&n' time that
machine &ent do&n/ machine &ent do&n/
+cti(ity
trans"orms the state o" an o$0ect usually o(er
some time .re!airman ser(ice time' machine
run time/
Re!resentin# system
State o" the system
-umeric (alues that contain all the
in"ormation necessary to descri$e the system
at any time) at any time)
3elays
Processes that ta1e a conditional len#th o"
time in the system
Re!resentin# system
E(ents
2han#e the state o" the system.end o" ser(ice
o" machine'machine $rea1s do&n/
7ueue
it is set' used to model &aitin#
E%) Ele(ator systems
Entities
Ele(ators' !eo!le
Sets
Peo!le &aitin# at each "loor
+ttri$utes
Ele(ators , ca!acity' s!eed' destination'
current location o" each ele(ator
Peo!le , inter-arri(al time at each "loor'
destination o" each !eo!le
E%) Ele(ator systems
State o" system
8 o" !eo!le on each ele(ator
8 o" !eo!le in each "loor
+cti(ities +cti(ities
9oad6:nloadin# !assen#er
Tra(el to ne%t "loor .s!eed and distance/
Persons tra(el to ele(ator
E%) Ele(ator systems
3elays
Persons &aitin# "or ele(ator
E(ents
Ele(ator arri(al
End unloadin#
End 9oadin#
Person +rri(al
Simulation ty!es
Static (s) dynamic
3eterministic (s) stochastic
2ontinuous (s) discrete
Simulation model system model Simulation model system model
Static Simulation (s) 3ynamic
Simulation
There are t&o ty!es o" simulation models'
static and dynamic)
Definition: + static simulation model is a
re!resentation o" a system at a !articular re!resentation o" a system at a !articular
!oint in time)
We usually re"er to a static simulation as a
Monte 2arlo simulation)
Static Simulation (s) 3ynamic
Simulation
Definition: + dynamic simulation is a
re!resentation o" a system as it e(ol(es
o(er time)
Within these t&o classi"ications' a Within these t&o classi"ications' a
simulation may $e deterministic or
stochastic)
+ deteministic simulation model is one
that contains no random (aria$les; a
stochastic simulation model contains one
or more random (aria$les)
3iscrete E(ent (s) 2ontinuous
E(ent Simulation
3iscrete e(ent
state o" system chan#es only at discrete !oints
in time.e(ents/
e%) Machine re!air !ro$lem e%) Machine re!air !ro$lem
Pro#rammin#
9oo1 at system only &hen e(ents occur; time is
ad(anced "rom e(ent to e(ent)
3iscrete E(ent (s) 2ontinuous
E(ent Simulation
2ontinuous e(ent
state o" system chan#es continuously o(er
time
E%) 9e(el o" "luid in tan1 E%) 9e(el o" "luid in tan1
Pro#rammin#
+d(ances time in small inter(als) :se di""erential
e<uations to re!resent "lo&s)
+n E%am!le o" a 3iscrete-E(ent
Simulation
To simulate a <ueuin# system' &e "irst ha(e to
descri$e it)
We assume arri(als are dra&n "rom an in"inite callin#
!o!ulation)
There is unlimited &aitin# room ca!acity' and There is unlimited &aitin# room ca!acity' and
customers &ill $e ser(e in the order o" their arri(al
.=2=S/)
+rri(als occur one at a time in a random "ashion)
+ll arri(als are e(entually ser(ed &ith the distri$ution
o" ser(ice teams as sho&n in the $oo1)
Ser(ice times are also assumed to $e random) +"ter
ser(ice' all customers return to the callin#
!o!ulation)
=or this e%am!le' &e use the "ollo&in# (aria$les to
de"ine the state o" the system .1/ the num$er o" de"ine the state o" the system .1/ the num$er o"
customers in the system; .2/ the status o" the ser(er
, that is' &hether the ser(er is $usy or idle; and
.3/the time o" the ne%t arri(al)
+n e!ent is de"ined as a situation that causes the
state o" the system to chan#e instantaneously)
3iscrete E(ent Simulation
E(ent schedulin#
Write modules that descri$e chan#es in the
state o" the system at each e(ent
Main !ro#ram ad(ances time Main !ro#ram ad(ances time
>ne su$!ro#ram "or each e(ent
5eneral !ur!ose !ro#rammin# lan#ua#e
3iscrete E(ent Simulation
Process interaction
Write modules that descri$e the !ro#ress o"
entities throu#h the system
+s entities mo(e the systems chan#es state +s entities mo(e the systems chan#es state
Entities are held to re!resent acti(ities and
delays
Promodel !ro#rammin# lan#ua#e
E(ent schedulin#
Time is ad(anced "rom e(ent to e(ent
=uture e(ents list , ordered list o"
u!comin# e(ents
+s e(ents are scheduled' they are added to
the list
+s e(ents occur they are remo(ed "rom list
+cti(ities in e(ent . one 6 e(ent ty!e/
E(ent schedulin#
9ist is re<uired to 1ee! trac1 o" entities in a
set
Statistics , T&o ty!es
Sam!le statistics , a(era#e o" some (alues
.W/
W ? .W1 @W2 @ A@Wn/6n ? Total Wait 6 8 o" &ait
Time a(era#e statistics , time &ei#hted .9/
9 ? .0.t1/ @ 1.t2-t1/ @ 2.t3-t2/ @ 1.tB-t3// 6 tB
+cti(ity scannin#
+cti(ity scannin#
Time is modeled in "i%ed time increments to
chec1 i" acti(ity occurred
Small time increments is ine""icient Small time increments is ine""icient
9ar#e time increments may miss acti(ity
descri$es the acti(ities in &hich the entities in
the system en#a#e)
Process >riented
Process oriented
Many simulation models include elements
&hich occur in de"ined !atterns
The lo#ic associated &ith such a system or The lo#ic associated &ith such a system or
e(ents can $e #eneraliCed and de"ined $y a
sin#le statement
+ simulation lan#ua#e could then translate
such statement into the a!!ro!riate se<uence
o" e(ents
descri$es the !rocesses throu#h &hich the
entities in the system "lo&)
Process >riented
Process oriented
These statements' de"ine a se<uence o"
e(ents &hich are automatically e%ecuted $y
the simulation lan#ua#e as the entities mo(e the simulation lan#ua#e as the entities mo(e
throu#h the !rocess
2reate arri(al entities e(ery t time units
4o&e(er' since &e are normally restricted to a
set o" standardiCed statement' !ro(ided $y
the simulation lan#ua#e' our model "le%i$ility
is not as #reat as &ith the e(ent condition
=eature !ro(ided $y a lan#ua#e
2once!tual "rame&or1.entities' attri$utes'
resource' <ueues/
Maintenance o" e(ent list
Random (aria$le #eneration Random (aria$le #eneration
+nimation
3e$u##in# "unction
>ut!ut analysis
In!ut analysis
Re!ort #eneration
The Simulation Modelin# Ste!s
We no& discuss the !rocess "or a com!lete
simulation study and !resent a systematic a!!roach
o" carryin# out a simulation)
+ simulation study normally consists o" se(eral
distinct sta#es) distinct sta#es)
4o&e(er' not all simulation studies consist o" all
these sta#es or "ollo& the order stated here)
>n the other hand' there may e(en $e considera$le
o(erla! $et&een some o" these sta#es)
+ircra"t Per"ormance Model
an e%am!le o" 3eterministic Systems Modelin#
Lift force (L) = Weight of aircraft (W)
Engine Thrust (T) = Drag force (D)
+ircra"t Per"ormance Model))
Expressions for lift and drag forces
+ircra"t Per"ormance Model))
Rate of decrease of aircraft weight due to fuel
consumption
An empirical relation for drag polar relating C
L
and C
D
Now the collection model equations
+ircra"t Per"ormance Model))
OR
The air density ratio at an altitude
T =
Where = 9296 $elo& 11 Dm
The "ngineeing
#o$lem Sol!ing
B3
#ocess
Newtons 2
nd
law of Motion
The time rate change of momentum of a body is equal
to the resulting force acting on it.
Formulated as F = m.a
F = net force acting on the body
m = mass of the object (kg)
a
2
BB
a = its acceleration (m/s
2
)
Some complex models may require more sophisticated
mathematical techniques than simple algebra
Example, modeling of a falling parachutist:
F
U
= Force due to air resistance = -cv (c = drag coefficient)
F
D
= Force due to gravity = mg
U D
F F F + =
cv mg dv
cv F
mg F
F F F
m
F
dt
dv
U
D
U D
=
=
=
+ =
=
This is a first order ordinary differential equation.
We would like to solve for v (velocity).
It can not be solved using algebraic manipulation
Analytical olution!
If the parachutist is initially at rest (v"# at t"#)$
using calculus dv%dt can be solved to give the result!
m dt
=
v
m
c
g
dt
dv
=
using calculus dv%dt can be solved to give the result!
( )
t m c
e
c
gm
t v
) / (
1 ) (
=
Independent
variable
Dependent
variable
Parameter
s
Forcing function
**here Analytical Solution
( )
t m c
e
c
gm
t v
) / (
1 ) (
=
t (sec.) V (m/s)
0 0
If v(t) could not be solved analytically, then
we need to use a numerical method to solve
g = 9.8 m/s
2
c =12.5 kg/s
m = 68.1 kg
BE
0 0
2 16.40
4 27.77
8 41.10
10 44.87
12 47.49
53.39
) (
) ( ) (
lim ........
) ( ) (
1
1
0
1
1
i
i i
i i
t
i i
i i
t v
m
c
g
t t
t v t v
t
v
dt
dv
t t
t v t v
t
v
dt
dv
=
+
+
+
+
c
This equation can be rearranged to
yield
Numerical Solution
BF
) )]( ( [ ) ( ) (
1 1 i i i
t t t v
m
c
g t v t v
i i
+ =
+ +
yield
t = 2 sec
To minimize the error, use a smaller step size, t
No problem, if you use a computer!
t (sec.) V (m/s)
0 0
2 19.60
4 32.00
8 44.82
10 47.97
12 49.96
53.39
t (sec.) V (m/s)
0 0
2 19.60
4 32.00
8 44.82
t (sec.) V (m/s)
0 0
2 16.40
4 27.77
8 41.10
m=68.1 kg c=12.5
kg/s g=9.8 m/s
t = 2 sec
Analytical
t (sec.) V (m/s)
0 0
2 17.06
4 28.67
8 41.95
t = 0.5 sec
t (sec.) V (m/s)
0 0
2 16.41
4 27.83
8 41.13
t = 0.01 sec
Numerical solution
vs.
8 44.82
10 47.97
12 49.96
53.39
8 41.10
10 44.87
12 47.49
53.39
( )
t m c
e
c
gm
t v
) / (
1 ) (
=
t t v
m
c
g t v t v
i i i
+ = + )] ( [ ) ( ) ( 1
8 41.95
10 45.60
12 48.09
53.39
8 41.13
10 44.90
12 47.51
53.39
CONCLUSION: If you want to minimize
the error, use a smaller step size, t
Manual Simulation E%am!le
5i(en the "ollo&in# arri(al times "or a sin#le ser(er
system &hat &ill $e the a!eage num$e in the
%ueue' a!eage num$e in the system& a!eage time
in system& a!eage time in %ueue' the num$e of
com'leted (o$s& num$e in the %ueue& num$e in com'leted (o$s& num$e in the %ueue& num$e in
the system& and se!e utili)ation at time 1G i" the
ser(ice time is 3 time units "or each entity)