Chapter Two-Simulation Examples
Chapter Two-Simulation Examples
1
Steps Required for a Successful Simulation
Inputs Response
Repetitions Xi1 Xi2 … Xij … Xip yi
1
2
··
·
n
n Why Queues?
¨ Queues are the best known model for discrete systems
¨ We do not have a queue-less system
n A queuing system is described by:
¨ Its calling population
¨ The nature of the arrival
n Indicated with rate of arrival
¨ The service mechanism
n Includes rate of service, number of servers, servers configuration
¨ The system capacity
n Number of customers can wait + Number of customers can get service
¨ The queuing discipline
n How the customers are selected for getting service
¨ Example: First come, First serve (FIFO)
¨ Single-channel/Multi-phase system
¨ Multi-channel/Multi-phase system
Arrival
Event
queue and
server status,
the following
system states
are expected at
the instance a
unit enters or Server outcomes after service completion
leaves the
system
n Event table:
¨ Unlike simulation table, entries are chronically ordered based on
the occurrence of events (not the customers)
¨ Occurrence of two types of events (arrival and departure) in their
chronological order is shown in the following table
¨ Based on this table, the number of customers in every instance of
time could be represented as in the figure
n Calculations (cont’d):
¨ The average (mean) service time (minute):
𝑇𝑜𝑡𝑎𝑙 𝑠𝑒𝑟𝑣𝑖𝑐𝑒 𝑡𝑖𝑚𝑒 68
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑠𝑒𝑟𝑣𝑖𝑐𝑒 𝑡𝑖𝑚𝑒 = = = 3.4 minute
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 20
¨ Note: we could have calculated the average service time without
using the simulation table
n It could be obtained by using the probability distribution table for
service time, and the expected value equation
$
Expected Value = E(S) = b S×P(S) [Eq. 1]
!"#
= 1 0.10 + 2 0.20 + 3 0.30 + 4 0.25 + 5 1.10 + 6 0.05 = 3.2 minute
n The expected service time is slightly lower than the average service
time in the simulation
¨ The longer the simulation, the closer the average will be to
n Calculations (cont’d):
¨ The average of interarrival times (minute):
Sum of interrrivals 82
Average of interarrival times = = = 4.3 minute
Number of customers − 1 19
¨ This result can be compared to the expected time for the
uniformly distributed interarrivals
n This could be calculated by finding the mean of the discrete
uniform distribution whose endpoints are a=1 and b=8
a+b 1+8
E A = = = 4.5 minute
2 2
n Again, the longer the simulation, the closer the average will be
¨ The average waiting time of those who wait:
Total time customers wait in queue 56
Average waiting time of those who wait = = = 4.3 minute
Total numbers of customers who wait 13
n Calculations (cont’d):
¨ The average time a customer spends in the system:
Total time customers spend in the system
Average time customers spends in the system =
Total number of customers
124
= = 6.2 minute
20
¨ As it could be seen:
Average time Average time Average time
customer spends = customer spends + customer spends
in the system waiting in the for getting service
queue
n Assumptions:
¨ Customers (cars) arrive in the manner shown in next slide
¨ Our carhops have different attributes:
n Able does the job a little bit faster than Baker
n The distribution of their service times is shown in the next slide
¨ There would be two different tables
Able
2 Servers (channels)
Baker
A drive-in restaurant where carhops take orders and bring food to the car
Reliable and Durable IoT Applications & Networks
RADIAN Research Laboratory 31
Dr. Bardia Safaei
Simulation of Able Baker Carhop Problem (2)
F10 = IF 'D10 > MAX H$1: H9 , D10, IF 3D10 > MAX K$1: K9 , ""
BOOK