CT753 - 2020 08 29T04 26 21.878Z - Simulation - Modeling
CT753 - 2020 08 29T04 26 21.878Z - Simulation - Modeling
Chapter-1
Introduction to Simulation
System, Model and Simulation
System:
- System is a simplified representation of a selected components with
specified boundaries and predefined time characteristics.
- System generally indicates a real-world entity over space and time in
generalized and simplified form.
- Each system has a time constant that define the time over which the
system may change its state.
Model:
- Model is a computerized program that defines the mechanics of the
considered system.
- During system modeling, the focus is on the system components,
system structure, relationships among the components of the system
and the behavior of the modeled system.
- Model must have state which may change on each time step.
- Model represents the system for the purpose of studying the system.
Simulation:
- Simulation is defined as the process of execution of the model of a
considered system.
- The conditions required for the simulation are initial conditions of the
system under consideration and the specified sets of parameters.
- Simulation involves the generation of the artificial history of a
considered system and their observations to draw inferences
concerning the operating characteristics of the real system.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
implementations.
- Simulation should not be used if the cost exceeds the savings.
- Simulation should not be done if the resources and time are not
available.
- Simulation cannot be done if no data is available.
- Simulation is not preferred if the system behavior is too complex to
be defined.
Disadvantages
- Building model requires specialization which is the art learned
through experience.
- In some cases, the results of the simulation may be so complex to
interpret.
- It may be time consuming and expensive.
Areas of Application
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
1. Manufacturing
- Dynamic modeling of continuous manufacturing systems.
- Modeling for quality and productivity.
- Shared resource capacity analysis.
2. Semiconductor Manufacturing
- Constant time interval production planning.
- Design framework for automated material handling systems.
- Making optimal design decisions.
3. Military
- Frequency based design for terminating simulations.
- Support for military based interactive simulations in 3D
environments.
- Impact of an automatic logistic system.
4. Transportation Modes
- Simulating aircraft-delay absorption.
- Runway schedule determination.
- Modeling ambulance services.
- Modeling ship arrivals in ports.
5. Business Process
- Agent based modeling of store performance.
- Visualization of probabilistic business models.
- Baggage screening at airports.
- Human fatigue risk simulation in continuous operations.
- Optimization of telecommunications billing system.
6. Health Care
- Evaluation of hospital operations.
- Estimating maximum capacity in an emergency room.
- Reducing the length of stay in an emergency department.
- Scheduling emergency room staff.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
develop complexity.
- Excessive complexity should be forbidden to minimize model and
computer expenses.
4. Data Collection
- Data plays important role in simulation.
- Data collection is very difficult phase as it requires more time, so it
should be started as early as possible.
- The data to be collected depends on the study objectives.
5. Model Translation
- The model of real world generally requires storage, so model must
be entered into a computer recognizable format.
- The model programming must be selected by the modeler, whether a
simulation language or to use a special purpose simulation software.
- Simulation languages are more powerful and flexible than software’s.
But the choice depends on model complexity.
6. Verified?
- This stage involves verification of the computer program of modeling.
- Verification is successful if the input parameters and the logical
structure of the models are correctly represented in the computer.
7. Validated?
- Validation is performed by calibrating the model against the actual
system behavior so as to improve the system model.
- This is iterative process which is successful once the model
accuracy is acceptable.
8. Experimental Design
- The alternatives to be simulated are determined.
- For each system design, length of initialization period, length of
simulation run and number of replications to be made of each run are
decided.
9. Production Runs and Analysis
- It is used to estimate measures of performance for the system
design being simulated.
10. More Runs?
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
- After the analysis of the runs, it is decided whether or not more runs
are needed.
11. Documentation and Reporting
- Program documentation is the document stating the operation of the
program. It is necessary to understand how the program works. It
facilitates easy modification and maintenance of the program.
- Progress documentation provides the chronology of work done and
decisions made. It helps in tracking the course of project towards
success.
- The result of the analysis should be clearly stated in a final report.
12. Implementation
- It involves actual implementation of the model.
- Model implementation depends on how well all the other stages are
succeeded.
- Proper success of other stages results in good implementation while
improper model on implementation may result in hazards.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-2
Physical and Mathematical models
Physical Model
- Physical model is the smaller or larger physical copy of an object
being modeled.
- The geometry of model is just the rescaled view of the object it
represents.
- The horizontal and vertical scaling may not be balanced as per the
requirements of the model.
- The physical model helps in visualization of the object taken into
consideration in an effective way.
- It is also used to solve equations with the particular boundary
conditions.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Mathematical Model
- Mathematical model is the model which is composed of a symbols
and logic.
- Such model is also called an abstract model.
- It describes the system using mathematical concepts.
- The mathematical model is used to explain the system and to study
the effects of different components, and to make predictions about the
behavior of the system.
- It generally consists of following major elements:
a) Governing equations
b) Defining equations
c) Constitutive equations
d) Constraints
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Examples: Model
Scale Model of a Ship (Static Physical Model):
- A scale model of a ship is a simplified approach to determine the
exact measurements of the components of the ship during its
construction.
- It removes the necessity of drawing complex 3D shapes to just
analyze the ship model and their measurements.
- The measurements on scale model are later converted into the
values that would occur in the real system.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Physical Model
- Physical model is the smaller or larger physical copy of an object
being modeled.
- The geometry of model is just the rescaled view of the object it
represents.
- The horizontal and vertical scaling may not be balanced as per the
requirements of the model.
- The physical model helps in visualization of the object taken into
consideration in an effective way.
- It is also used to solve equations with the particular boundary
conditions.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Mathematical Model
- Mathematical model is the model which is composed of a symbols
and logic.
- Such model is also called an abstract model.
- It describes the system using mathematical concepts.
- The mathematical model is used to explain the system and to study
the effects of different components, and to make predictions about the
behavior of the system.
- It generally consists of following major elements:
a) Governing equations
b) Defining equations
c) Constitutive equations
d) Constraints
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Examples: Model
Scale Model of a Ship (Static Physical Model):
- A scale model of a ship is a simplified approach to determine the
exact measurements of the components of the ship during its
construction.
- It removes the necessity of drawing complex 3D shapes to just
analyze the ship model and their measurements.
- The measurements on scale model are later converted into the
values that would occur in the real system.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
a) Displacement x = Charge q
b) Velocity x’ = Current I, q’
c) Force F = Voltage E
d) Mass M = Inductance L
e) Damping Factor D = Resistance R
f) Spring stiffness K = Inverse of Capacitance 1/C
g) Acceleration x’’ = Rate of change of current q’’
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-3
Continuous system simulation
Differential and Partial Differential
Equations
- The equation that consists of the higher order derivatives of the
dependent variable is known as differential equations.
- The differential equation is said to be linear if any of the dependent
variables and its derivatives have power of one and are multiplied by
the constant.
Egg: M x’’ + D x’ + K x = K F(t)
where, M, D and K are constants; F(t) is the input to the system
depending upon the independent variable t; x’’ and x’ are second and
first order derivatives of dependent variable x.
- The differential equation is said to be non-linear if the dependent
variable or any of its derivatives are raised to a power or are combined
in other way like multiplication.
- The differential equation is said to be partial if more than one
independent variable occurs in a differential equation.
- Egg: Equation of flow of heat in three-dimensional body. It consists
of four independent variables (three dimensions and time) and one
dependent variable (temperature).
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Analog Computers
- Analog computers are those computers that are unified with devices
like adder and integral so as to simulate the continuous mathematical
model of the system, which generates continuous outputs.
- The electronic analog computer based on the use of high gain dc
amplifiers are widely used analog computer.
- In such analog computer, voltages are equated to mathematical
variables and the op amps can add and integrate the voltages.
- The proper configurations can handle addition of several input
voltages each representing the input variables.
- The coefficient of the model equations are obtained by using the
scale factors.
- The circuit can be arranged to produce integrator that provides
integral w.r.t time of a single input voltage or sum of input voltages.
- Sign inverter is used to reverse the sign of the input as per the
requirement of the model equation.
- The analog computer provides limited accuracy because op amps
have many assumptions which can never be true in reality.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Analog Methods
- The general method to apply analog computers for the simulation of
continuous system models involves following components:
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Hybrid Simulation
- In reality, the system is of neither a pure continuous nor a pure
discrete nature.
- For simulating such system, the combination of analog and digital
computers is used. Such setup is known as hybrid computers.
- The simulation provided by the hybrid computers is known as hybrid
simulation.
- The major difficulty in use of hybrid simulation is that it requires high
speed converters to transform signals from analog to digital form and
vice versa.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-4
Queuing system
Elements of Queuing System
Queuing System
- In many real-world scenarios, queue is prevalent. The problem with
the queue is that if it is not managed properly, the customers should
wait a long time that causes chaos within the customers. To prevent
customer from being unsatisfied with the provided service, queuing
system is managed. For egg: During cash withdraw in bank, you have
to stay in queue and if it is not managed properly then you will surely
be disappointed from the bank service even if that bank is one of the
finest one in the city.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
3. Queue:
- Queue represents the number of customers that have entered into
the system and are waiting for the service.
- The customer being serviced is not considered to be in queue.
- The two main properties of queue are as follows:
a) Maximum Size:
- Queue, in practice, is always limited.
- Maximum size represents the maximum number of customers that
can accommodate in the queue.
b) Queue Discipline:
- Queue discipline represents the rules in which the customers are
inserted or removed to or from the queue.
- It can be organized in various ways like FIFO, LIFO, Serve In
Random Order(SIRO), Priority Queue, etc.
4. Service time:
- Service represents the activity that takes some time and the
customers are waiting for.
- Service time represents the time needed to provide service to a
customer by a server.
- Service time may be of constant duration or of random duration.
5. Number of Servers:
- Servers represent the entity that provides service to the customer.
- A system may consist of single server or multiple servers.
- A system with multiple servers is able to provide parallel services to
the customers.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Network of queues
- Some system may consists of multiple queues.
- The customers from one queue may be routed to another queue as
per necessity.
- Such queue system is known as network of queues.
- For Egg: In a bank with two queues, the customer are routed from
queue with large no of customers to queue with less no of customers.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
3 0.3 15 74
4 0.25 948 53
5 0.1 309 17
6 0.05 922 79
Answer →
Customer Arrival Time = 4.5 (+ or -) 3.5 = 1 to 8 minutes
Service Time = 1 to 6 minutes
So, we can get the probability distribution of arrival at different inter-
arrival time is: (table 1)
Time Probability Cumulative Probability Random Digit assignment
1 0.125 0.125 1 – 125
2 0.125 0.250 126 - 250
3 0.125 0.375 251 - 375
4 0.125 0.500 376 – 500
5 0.125 0.625 501 – 625
6 0.125 0.750 626 – 750
7 0.125 0.875 751 – 875
8 0.125 1 875 – 1000
The random probability distribution as given in the question can be
stated as: (table 2)
ST P CP RDA
1 0.1 0.1 1-10
2 0.2 0.3 11-30
3 0.3 0.6 31-60
4 0.25 0.85 61-85
5 0.1 0.95 86-95
6 0.05 1 95-100
From the given arrival time and table 1, we get: (table 3)
Customer RD IAT
1-0
2 913 8
3 727 6
4 15 1
5 948 8
6 309 3
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-5
Markov chains
Key features of Markov chains
The key features of Markov chains are as follows:
1. The outcome of each experiment is one of the discrete states of the
chain.
2. The outcome of an experiment depends on only the present state
and not on any past states.
3. The transition probabilities remain constant from one transition to
the next.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Q. Given that chance of a Honda bike user to buy Honda bike at next
purchase is 70% and that his next purchase will be Yamaha is 30%.
The chance of Yamaha bike user to buy Yamaha bike at next
purchase is 80% and that his next purchase will be Honda is 20%.
What is the probability to buy Yamaha bike after three purchase of a
current Honda Bike user?
Answer
-------->>>>
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Question
---------
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-6
Random Number
Properties of Random Numbers
What is random number?
A number chosen from some specified distribution randomly such that
selection of large set of these numbers reproduces the underlying
distribution is called random number.
General Properties
1. Uniformity:
- The random numbers generated should be uniform. That means a
sequence of random numbers should be equally probable
everywhere.
- If we divide all the set of random numbers into several numbers of
class interval then number of samples in each class should be same.
- If ‘N’ number of random numbers are divided into ‘K’ class interval,
then expected number of samples in each class should be equal to ei
= N / K.
2. Independent:
- Each random number should be independent samples drawn from a
continuous uniform distribution between 0 and 1.
- The probability density function is given by:
f(x) = 1, 0 <= x <= 1
= 0, otherwise
3. Maximum Density:
- The large samples of random number should be generated in a
given range.
4. Maximum Cycle:
- It states that the repetition of numbers should be allowed only after a
large interval of time.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Problems Associated
- The problems associated with pseudo random numbers are as
follows:
1. The generated numbers might not be uniformly distributed.
2. The generated numbers might be discrete valued instead of
continuous valued.
3. The mean of the generated numbers might be too high or too low.
4. The variance of the generated numbers might be too high or too
low.
5. There might be presence of correlation between the generated
numbers.
Considerations
- The important considerations that should be made while generating
pseudo random numbers are as follows:
1. The method used to generate random number should be fast
because the simulation problem requires a large set of random
numbers which can increase time complexity of the system.
2. The method used should be portable to different platform and
programming languages so as to generate same results wherever it is
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
executed.
3. The method should have long cycle.
4. The random numbers should be replicable. It means that the same
set of random numbers should be generated with same starting point.
5. The generated random numbers should approximate the uniformity
and independence properties.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Algorithm:
1. Rank the data from smallest to largest such that R (1) <= R (2)
<= ………. <= R(N)
2. Compute:
D+ = max [ i / N – R(i) ] for i = 1 to N
D- = max [ R(i) – (i - 1) / N ] for i = 1 to N
3. Compute D = max (D+, D-)
4. Locate in table of sampling distribution of D, the critical value
D(alpha), for specified significance level alpha and given sample
size N.
5. If the sample statistic D is greater than D(alpha), the null
hypothesis that the data are a sample from a uniform distribution
is rejected. Else, no difference has been detected and the
distribution is uniform.
Chi-Square Test:
- The chi-square test uses sample statistic : chi-square =
Summation i = 1 to n [ (O(i) – E(i))^2 / E(i) ]
- O(i) = Observed number in the ith class
- E(i) = Expected number in the ith class
- n = Number of class
- Degree of freedom = n – 1
- If chi-square for sample random numbers is less than standard
chi-square at alpha and degree of freedom(n-1), then the null
hypothesis is not rejected.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-7
Verification and validation of simulation
models
Verification and validation
Model Building:
- The real system and their interactions among various components
should be analyzed.
- The domain knowledge can also be acquired from the interaction
with concerned people.
- As the model development proceeds, new questions arises and the
process of learning system behaviour and structure takes place again.
- Then a conceptual model is constructed with a collection of
assumptions and hypotheses.
- Finally, the conceptual model is implemented using various
simulation software incorporating assumptions into the worldview.
- Hence, model building is an iterative process of domain knowledge
acquisition and model development.
Verification:
- Verification is concerned with building the model correctly.
- It is performed by comparing the conceptual model to the
computerized simulation implementation.
- It tests whether the given model is implemented correctly in the
simulation software.
Validation:
- Validation is concerned with building the correct model.
- It is performed by calibration of the model.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Face Validity:
- A model should appear reasonable on its face to model users and to
those who knows about the real system that is being simulated.
- A model should be designed with high degree of realism regarding
system structure and behavior through reliable data.
- The potential users should also be involved in the validation process
to aid in identification of model deficiencies and optimizing those
deficiencies to produce better model. This process is termed as
structural walkthrough.
- Sensitivity analysis is also used for face validity of the model. It
analyses the effect on output when there is change in input
parameters.
- Sensitivity analysis is done through appropriate statistical
techniques.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
which is served by multiple tellers - Customers form one line for each
teller - The number of teller should be fixed or variable.
- These structural assumptions should be validated by actual
observation during appropriate time periods and also by discussions
with the managers and tellers.
- The data assumptions may be - interarrival times of customers
during peak hour - interarrival times of customers during slack period -
service time for personal accounts and so on.
- These data assumptions should be validated by consultation with
bank managers. The validation is done by using goodness-of-fits tests
such as chi-square test or Kolmogorov-Smirnov tests.
Input-Output Transformations:
- It involves validating whether the model can predict the future
behavior of the real system when the model input data match the real
inputs and when a policy implemented in the model is implemented at
some point in the system.
- In this validation phase, the model accepts values of the input
parameters and transforms them into output measures of
performance.
- The modeler uses the historical data reserved for validation
purposes only.
- The main responses of interest should be used as the primary
criteria for model validation.
- If in future, the model is used for different purpose, it should be
revalidated in terms of new response of interest.
- For the complete input-output validation, at least one set of input
conditions should be collected from the system data so as to compare
to model prediction.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-8
Analysis of simulation output
Estimation methods
Simulation Output: Introduction
- Whenever a random variable is introduced to the simulation model,
all the system variables that describe its behavior become random or
stochastic.
- The values of the variables involved in the system will fluctuate as
the simulation proceeds.
- So, arbitrary measurement of the values of these variables cannot
represent the true value.
- For this, some conditions about the probability of the true value
falling within a given interval about the estimated value must be made.
Such interval is known as confidence interval.
- In simulation study, it is assumed that the observations being made
are mutually independent. But, in most of the real-world problems,
simulation results are mutually dependent.
- The various methods used to analyze simulation results are as
follows:
1. Estimation Methods
2. Simulation Run Statistics
3. Replication of Runs
4. Elimination of Initial Bias
Estimation Method
- It is assumed that the random variables are stationary and
independent drawn from an infinite population with a finite mean and
finite variance.
- Such random variables are independently and identically distributed
(IID) random variable.
- The central limit theorem can be applied to IID data. It states that
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Example:
Let us consider x(i) where i = 1, 2, 3, …………, n be the n number of
random variables drawn from a sample of population with mean μ and
variance σ^2.
Using central limit theorem, and transforming to standard normal
distribution, we get:
Z = (∑ x(i) - nμ) / {n^(½) * σ}
Dividing top and bottom by n, we get:
Z = ( x - μ) / (σ / n^(½))
Where x = ∑ x(i) / n = sample mean
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Example:
- Consider a system with Kendall’s notation M/M/1/FIFO and the
objective is to measure the mean waiting time.
- In simulation run approach, the mean waiting time is estimated by
accumulating the waiting time of n successive entities and then it is
divided by n. This measures the sample mean such that:
x = ∑ x(i) / n for i = 1 to n
- Such series of data in which one value affect other values is said to
be autocorrelated.
- The sample mean of autocorrelated data can be shown to
approximate a normal distribution as the sample size increases.
Problem:
- The distribution may not be stationary.
- A simulation run is started with the system in some initial idle state.
- In this case, the early arrivals will obtain service quickly deviating
from normal distribution.
- Hence, the sample means of the early arrivals is known as initial
bias.
- As the sample size increases and the length of run is long, the effect
of bias dies and the normal distribution is again established.
Replication of runs
- This approach is used to obtain independent results by repeating the
simulation.
- Repeating the experiment with different random numbers for the
same sample size n gives a set of independent determinations of the
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-9
Simulation software
Simulation in Java
- JAVA is a widely used programming language. But it does not
provide any modules directly aimed for simulation system.
- The components that all the simulation models written in JAVA are
as follows:
1. Clock: It is a variable that defines the simulated time.
2. Initialization Method: It is a method to define the system state at
initial time.
3. Min-time event method: It is a method that identifies the imminent
(about to happen) event.
4. Event method: It is a method for each event that update the system
state when it occurs.
5. Random variate generator: It is a method to generate random
samples from the desired probability distributions.
6. Main program: It is the core of the simulation system that controls
the overall event scheduling algorithms.
7. Report generator: It is a method that summarizes the collected
statistics to give the report at the end of the simulation.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Explanation
- Simulation begins by setting clock to zero, initializing cumulative
statistic to zero, generating any initial events and placing them in the
Future Event List (FEL).
- The simulation program then cycles repeatedly passing the current
least time event to approximate event methods until the simulation is
over.
- At each step, clock is advanced to the time of the imminent event
after finding the imminent event but before calling the event method.
- The appropriate event method is called to execute imminent event,
update cumulative statistics and generate future events.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Variables Used:
Queue Length
Number Inservice
Customers
FutureEventList
MeanInterArrivalTime (4.5 mins)
MeanServiceTime (3.2 mins)
Sigma (0.6 mins)
TotalCustomers (1000)
Clock
LastEventTime
Total Busy
MaxQueueLength
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
SumResponseTime
NumberOfDepartures
LongService
RHO = BusyTime / Clock
AVGR
PC4
Functions Used:
exponential(mu)
normal(xmu, Sigma)
Methods Used:
Initialization()
ProcessArrival()
ProcessDeparture()
ReportGeneration()
Simulation in GPSS
- GPSS (General Purpose Simulation System) is a highly structured
and special purpose simulation language based on process interaction
approach and oriented toward queuing systems.
- The system being simulated is described by the block diagram using
various GPSS blocks.
- Each block represents events, delays or other actions that affect the
transaction flow.
- GPSS model is developed by converting the block diagram into block
statements and adding the control statements.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
GENERATE 5 0
QUEUE
SEIZE
DEPART
MARK
ADVANCE 4 3
RELEASE
TABULATE
TRANSFER 0.1 ACC REJ
TERMINATE
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
GENERATE 15, 10
QUEUE
SEIZE
DEPART
MARK
TRANSFER 0.15 FALSE NON-FALSE
FALSE ADVANCE 12, 2
NON-FALSE TRANSFER 0.15 SERIOUS OTHER
SERIOUS ADVANCE 25, 5
OTHER ADVANCE 20, 10
RELEASE
TERMINATE
Simulation in SSF
- SSF stands for Scalable Simulation Framework.
- SSF provides a single, unified interface for discrete-event simulation.
- It is an API that describes a set of capabilities for object oriented and
process view simulation available for C++ and JAVA.
- It is designed to achieve high performance.
- It defines five base classes; Event, Entity, in Channel, out Channel
and process.
- Process implements thread of control in which action method
contains the execution body.
- Entity describes simulation objects.
- in Channel and out Channel describes the communication endpoints.
- Event defines messages sent between entities.
SSF Model
1. Starting the Simulation: A simulation starts when any entity’s start
All () method is called, commonly from the main () routine. The caller
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Chapter-9
Simulation of computer systems
Simulation tools
Level of Abstraction in Computer System
- Computer system have complex time scale behavior from time to
flipping transistor’s state to time for human interaction.
- It is designed hierarchically.
- The high level of abstraction is system level. In this level, one can
view computational activity in terms of tasks circulating among
servers, queuing for service when a server is busy.
- Below it is Processor level in which one can view components of the
processor used.
- Below it is CPU level in which one can view the activity of functional
units that together make up a central processing unit.
- The lowest level is Gate level in which one can view the logical
circuitry that is responsible for all the computations carried out by the
computer system.
- Simulation is used in each level and the results of one level is used
by another level.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Simulation Tools
- Simulation tools are the tools that are used to perform and evaluate
simulations at different abstraction levels of computer system.
- An important characteristic of a tool is how it supports model
building.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Simulation Model:
- All entries into the system are through dedicated router. It examines
the request and forwards it to some web server. It takes some time to
decide whether the request is a new request or part of ongoing
session. One switching time is assumed for a pre-existing request and
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
different time for a new request. It outputs the web server selection
and enqueues request for service to the web server.
- Web server consists of one queue for new requests, one for
suspended requests that are waiting for response from application
server and one for requests that are ready to process response from
application server. It is assumed that web server has enough memory
to handle all the requests. It also has queuing policy. Associated
application server is identified for each new request. A request for
service is formatted and forwarded to the application server and the
request joins the suspended queue.
- Application server organizes the request for services. The new
request for service joins the new-request queue. An application
request is modeled as a sequence of sets of requests (organized in a
burst) from data servers. It is assumed that all data requests from a
burst must be satisfied before next burst computation begins. For
each application, a list of ready to execute and a list of suspended
threads are maintained.
- Data servers create a new thread to respond to data request and
places it in a queue of ready threads. When service is received, the
thread requests data from a disk and then places in a suspended
queue.
- Disk completes its operation for data request and the thread in data
server on receiving response from disk moves to ready list and reports
back to application server associated with the request.
- The thread suspended at application server responds and finishes;
then reports its completion to the web server.
- The thread in web server that initiates that request then
communicates the results back to the Internet.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
CPU simulation
- In CPU simulation, we focus on discovering execution time.
- For CPU simulation, the input is the stream of instructions and the
simulation must model the logical design on what happens in
response to the instruction stream.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Example----
Consider a hypothetical computer with following instructions:
Load $2, $6;
Molt $5, 2;
Add $4, $2;
Add $5, $2;
Assume 4 cycles needed to load register, addition takes 1 cycle to
complete and multiplication takes 2 cycles to complete.
https://engineeringnotenepal.blogspot.com/
Simulation and Modeling
Instruction/Cycle 1 2 3 4 5 6 7
Memory Simulation
Memory is arranged hierarchically with L1 cache, L2 cache, main
memory and disks.
Simulation Model
- Maintain cache directory and LRU status of the lines within the set.
- When an access is made, update LRU status.
- If a hit, record it as such.
- If a miss, update the contents of the directory.
- Cache directory is implemented as an array, with array entries
corresponding to directory entries.
https://engineeringnotenepal.blogspot.com/