CSC328 · TU past paper
Simulation and Modeling 2082 question paper
The complete TU 2082 exam paper for Simulation and Modeling (CSC328), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksSimulation LanguagesHideAnswer
Describe the MARK and TABULATE block in GPSS. A coffee shop has a single barista serving customers. Customers arrive at an average rate of one every 3 minutes and the barista takes an average of 2.5 minutes to serve a customer. Create a simulation model and block diagram representing the coffee shop using GPSS blocks and simulate the system for 8 hours.[10]
MARK and TABULATE Block in GPSS & Coffee Shop Simulation
Part A: MARK Block
The MARK block is used to record the current simulation clock time into a specified parameter of a transaction. This timestamp is later used to calculate the transit time (total time spent in the system).
Syntax:
MARK A- If operand A is specified: the current clock time is stored in parameter A of the transaction
- If A is blank: the clock time is stored in the Mark Time word of the transaction
- Used in conjunction with the TABULATE block to measure time intervals
- Helps collect time-in-system statistics for performance analysis
Symbol:
+--------+ | MARK | | A | +--------+
Part B: TABULATE Block
The TABULATE block is used to collect statistical data and record frequency distributions into a TABLE entity. Each time a transaction passes through this block, one entry is made in the specified table.
Syntax:
TABULATE A- Operand A specifies the TABLE name/number where data is recorded
- Works with a previously defined TABLE definition statement
TABLE Definition Syntax:
name TABLE A, B, C, DParameter Meaning A Variable to be tabulated (e.g., MP1 for transit time from parameter 1) B Upper limit of the first frequency class C Width of each frequency class D Number of frequency classes Symbol:
+-----------+ | TABULATE | | A | +-----------+How MARK and TABULATE work together:
- MARK records the arrival time in a transaction parameter (e.g., parameter 1)
- TABULATE later computes the elapsed time as: Current Clock Time - Marked Time
- This elapsed time is entered into the specified TABLE for statistical analysis
Part C: Coffee Shop Simulation Model
Given Data
Parameter Value Inter-arrival time Average 3 minutes (exponential) Service time Average 2.5 minutes (exponential) Number of servers 1 (single barista) Simulation duration 8 hours = 480 minutes System Type
This is an M/M/1 queuing system:
- Poisson arrivals (exponential inter-arrival times)
- Exponential service times
- Single server (one barista)
- FIFO discipline
Theoretical Performance (Pre-Simulation)
Server Utilization (rho):
rho = lambda / mu = (1/3) / (1/2.5) = 2.5 / 3 = 0.833 (83.3%)Expected customers served in 480 minutes:
Customers = 480 / 3 = 160 customers (approximately)Since rho < 1, the system is stable.
Block Diagram
+------------------+ | GENERATE 3 | <-- Customers arrive every 3 min (exponential) +------------------+ | +------------------+ | MARK 1 | <-- Record arrival time in parameter 1 +------------------+ | +------------------+ | QUEUE LINE | <-- Customer joins the waiting line +------------------+ | +------------------+ | SEIZE BARISTA | <-- Customer occupies the barista +------------------+ | +------------------+ | DEPART LINE | <-- Customer leaves the queue count +------------------+ | +------------------+ | ADVANCE 2.5,FN$ | <-- Service time avg 2.5 min (exponential) +------------------+ | +------------------+ | RELEASE BARISTA | <-- Barista is freed for next customer +------------------+ | +------------------+ | TABULATE THRUPUT | <-- Record transit time in table +------------------+ | +------------------+ | TERMINATE | <-- Customer leaves the system +------------------+
GPSS Program Code
* ================================================ * Coffee Shop Simulation Model * Single Barista, 8-hour simulation (480 minutes) * ================================================ SIMULATE * Define Table for Transit Time (time in system) * MP1 = transit time from parameter 1 * Upper limit of first class = 0 * Class width = 1 minute * Number of classes = 20 THRUPUT TABLE MP1,0,1,20 * ------------------------------------------------ * Customer Arrival and Service Segment * ------------------------------------------------ GENERATE 3,FN$XPDIS ;Customers arrive, avg every 3 min (exponential) MARK 1 ;Store arrival time in parameter 1 QUEUE LINE ;Customer joins the waiting line SEIZE BARISTA ;Customer seizes the single barista DEPART LINE ;Customer departs from queue ADVANCE 2.5,FN$XPDIS ;Service takes avg 2.5 min (exponential) RELEASE BARISTA ;Barista is released TABULATE THRUPUT ;Record time-in-system in table TERMINATE ;Customer exits the system * ------------------------------------------------ * Timer Segment (controls simulation end time) * ------------------------------------------------ GENERATE 480 ;Generate one transaction at 480 minutes TERMINATE 1 ;Decrement termination counter to 0 * ------------------------------------------------ * Control Statement * ------------------------------------------------ START 1 ;Run simulation until counter reaches 0 END
Explanation of Each Block
Block Purpose GENERATE 3,FN$XPDISCreates a customer transaction on average every 3 minutes, the function XPDIS spreading the inter-arrival times exponentially MARK 1Writes the current clock time into parameter 1 of the customer, fixing the instant of arrival QUEUE LINEEnters the customer in the queue entity LINE and starts collecting waiting line statistics SEIZE BARISTAThe customer takes the single server facility BARISTA, and waits here if the barista is already busy DEPART LINERemoves the customer from the queue count once service begins ADVANCE 2.5,FN$XPDISHolds the customer for the service time, exponentially distributed about a mean of 2.5 minutes RELEASE BARISTAFrees the barista so that the next waiting customer can be served TABULATE THRUPUTEnters the elapsed time since the MARK block into the table THRUPUT TERMINATERemoves the served customer from the model, leaving the termination counter unchanged GENERATE 480Timer segment: produces a single transaction at clock time 480, the end of the 8 hour day TERMINATE 1Reduces the termination counter by 1, bringing it to zero and stopping the run START 1Sets the termination counter to 1 and starts the simulation
What the 8 Hour Run Produces
The line
THRUPUT TABLE MP1,0,1,20is a definition statement rather than a block: MP1 is the transit time measured from parameter 1, the first frequency class closes at 0, each class is 1 minute wide, and 20 classes are kept. Since MARK writes the arrival time and TABULATE reads it back through MP1, every entry in THRUPUT is one customer's total time in the shop.When the timer transaction drives the termination counter to zero at 480 minutes, GPSS prints its standard report: the utilisation and number of entries of the facility BARISTA, the average and maximum contents of the queue LINE together with the average waiting time, and the THRUPUT table with its mean and standard deviation. With $\lambda = 1/3$ per minute and $\mu = 1/2.5 = 0.4$ per minute, the M/M/1 results give the values those simulated figures should settle near:
$$\rho = \frac{\lambda}{\mu} = 0.833, \qquad L_s = \frac{\rho}{1 - \rho} = 5 \text{ customers}, \qquad L_q = \frac{\rho^2}{1 - \rho} = 4.17 \text{ customers}$$
$$W_s = \frac{1}{\mu - \lambda} = 15 \text{ minutes}, \qquad W_q = \frac{\rho}{\mu - \lambda} = 12.5 \text{ minutes}$$
So over the 8 hour day about 160 customers arrive, the barista is busy for roughly 83 percent of the time, and a customer spends about 15 minutes in the shop of which about 12.5 minutes is spent waiting for service. A single 480 minute run is short, so the figures the simulation reports scatter around these analytical values rather than reproduce them exactly.
- 210 marksAnalog MethodsHideAnswer
What is simulation? Describe the analogy between a mechanical system and corresponding electrical system with reference to dynamic physical model.[10]
Simulation and Dynamic Physical Model: Mechanical-Electrical Analogy
1. What is Simulation?
Simulation is the imitation of the operation of a real-world process or system over time. It involves the generation of an artificial history of the system, and the observation of that artificial history to draw inferences concerning the operating characteristics of the real system that is represented.
In other words, simulation allows us to study the behavior of a system without actually building or experimenting on the real system, by creating a model that mimics its behavior.
2. Physical Model
A physical model is one in which system attributes are represented by physical measures such as voltage, and the system activities are represented by physical laws.
Physical models are of two types:
Type Description Static Physical Model A scaled-down model that does not change with time (e.g., an architect's building design) Dynamic Physical Model A model that changes with time or is a function of time (e.g., wind tunnel testing)
3. Dynamic Physical Model
A dynamic physical model is one which changes with time or which is a function of time. Dynamic models follow the changes over time that result from system activities.
Example: In a wind tunnel, small aircraft models are kept and air is blown over them. The wind velocity changes with time, and forces are measured with the help of transducers. Since the system changes with time, it is an example of a dynamic physical model.
4. Analogy Between Mechanical System and Electrical System
The mechanical and electrical systems are classic examples of dynamic systems. The analogy is established by identifying corresponding (analogous) quantities between the two systems.
4.1 Mechanical System
Consider a spring-mass-damper system where:
- A mass M is attached to a spring (spring constant K) and a damper (damping coefficient B)
- An external force F(t) is applied
The governing equation (Newton's second law) is:
$$M\frac{d^2x}{dt^2} + B\frac{dx}{dt} + Kx = F(t)$$
Where:
- x = displacement
- dx/dt = velocity
- d²x/dt² = acceleration
4.2 Electrical System
Consider a series RLC circuit where:
- A resistor R, inductor L, and capacitor C are connected in series
- A voltage source V(t) drives the circuit
The governing equation (Kirchhoff's Voltage Law) is:
$$L\frac{d^2q}{dt^2} + R\frac{dq}{dt} + \frac{1}{C}q = V(t)$$
Where:
- q = charge
- dq/dt = current (i)
4.3 Analogy Table
By comparing the two governing equations:
$$M\frac{d^2x}{dt^2} + B\frac{dx}{dt} + Kx = F(t) \quad \longleftrightarrow \quad L\frac{d^2q}{dt^2} + R\frac{dq}{dt} + \frac{1}{C}q = V(t)$$
Mechanical Quantity Symbol Electrical Quantity Symbol Mass M Inductance L Damping Coefficient B Resistance R Spring Constant K Reciprocal of Capacitance 1/C Force F(t) Voltage V(t) Displacement x Charge q Velocity dx/dt Current dq/dt = i
4.4 Diagram
Mechanical System Electrical System F(t) V(t) | | [M] Mass [L] Inductor | | [B] Damper [R] Resistor | | [K] Spring [C] Capacitor | | GND GND
5. Significance of the Analogy
- The two systems have mathematically identical governing equations, which means the behavior of one system can be studied by analyzing the other.
- This is the core idea of simulation: instead of building a costly or dangerous mechanical system, an equivalent electrical circuit can be constructed and analyzed.
- This analogy is widely used in control systems, vibration analysis, and system modeling.
Summary
Simulation imitates a real-world system over time. Dynamic physical models change with time. The mechanical system (mass-spring-damper) and the electrical system (RLC circuit) are analogous dynamic systems governed by identical differential equations, where mass corresponds to inductance, damping to resistance, spring constant to 1/capacitance, force to voltage, and displacement to charge.
- 310 marksNumericalTests for Randomness - Uniformity and indeHideAnswer
What are the properties of random numbers?
The sequence of numbers 0.23, 0.45, 0.67, 0.12, 0.89, 0.34, 0.56, 0.78, 0.19, 0.41, 0.63, 0.08, 0.85, 0.29, 0.51, 0.73, 0.16, 0.94, 0.37, 0.59 has been generated. Test for the independence among numbers in the sequence starting with index $i = 2$ and lag $m = 3$ using auto-correlation test. ($\alpha = 0.05$, $Z_{\alpha/2} = 1.96$)[10]
Properties of Random Numbers and Auto-Correlation Test
Part 1: Properties of Random Numbers
Random numbers $R_i$ must satisfy two key properties:
1. Uniformity The numbers are uniformly distributed on $(0,1)$; every value is equally likely. The pdf is:
$$f(x) = \begin{cases} 1 & 0 \le x \le 1 \ 0 & \text{otherwise} \end{cases}$$
with $E(R) = \tfrac{1}{2}$ and $Var(R) = \tfrac{1}{12}$.
2. Independence The current value has no correlation with previous values; the probability of observing a value in a subinterval is independent of prior draws.
Part 2: Auto-Correlation Test
Given Data
Index 1 2 3 4 5 6 7 8 9 10 Value 0.23 0.45 0.67 0.12 0.89 0.34 0.56 0.78 0.19 0.41 Index 11 12 13 14 15 16 17 18 19 20 Value 0.63 0.08 0.85 0.29 0.51 0.73 0.16 0.94 0.37 0.59 - $i = 2$, $m = 3$, $N = 20$, $\alpha = 0.05$, $Z_{\alpha/2} = 1.96$
Step 1: Find M
$M$ is the largest integer such that $i + (M+1)m \le N$:
$$2 + (M+1)\cdot 3 \le 20 \Rightarrow (M+1)\cdot 3 \le 18 \Rightarrow M+1 \le 6 \Rightarrow M \le 5$$
$$\boxed{M = 5}$$
Step 2: Subsequence Values
Indices $2 + 3k$ for $k = 0,1,\dots,5$:
k Index Value 0 2 0.45 1 5 0.89 2 8 0.78 3 11 0.63 4 14 0.29 5 17 0.16 Step 3: Auto-Correlation Estimate
$$\hat{\rho}m = \frac{1}{M+1}\left[\sum{k=0}^{M} R_{i+km},R_{i+(k+1)m}\right] - 0.25$$
The summation runs $k = 0$ to $M$, giving $M+1 = 6$ products of consecutive pairs:
k $R_{i+km}$ $R_{i+(k+1)m}$ Product 0 0.45 0.89 0.4005 1 0.89 0.78 0.6942 2 0.78 0.63 0.4914 3 0.63 0.29 0.1827 4 0.29 0.16 0.0464 5 0.16 ? - Note on convention: The standard Banks/Carson formula sums $k=0$ to $M$ using pairs $R_{i+km}\cdot R_{i+(k+1)m}$, where the last term needs $R_{i+(M+1)m} = R_{2+18} = R_{20} = 0.59$.
Including the $k=5$ term: $0.16 \times 0.59 = 0.0944$.
$$\sum_{k=0}^{5} = 0.4005 + 0.6942 + 0.4914 + 0.1827 + 0.0464 + 0.0944 = 1.9096$$
$$\hat{\rho}_m = \frac{1.9096}{5+1} - 0.25 = \frac{1.9096}{6} - 0.25 = 0.31827 - 0.25 = 0.06827$$
Step 4: Standard Deviation of the Estimate
$$\sigma_{\hat{\rho}_m} = \frac{\sqrt{13M + 7}}{12(M+1)} = \frac{\sqrt{13(5)+7}}{12(6)} = \frac{\sqrt{72}}{72} = \frac{8.4853}{72} = 0.11785$$
Step 5: Test Statistic
$$Z_0 = \frac{\hat{\rho}m}{\sigma{\hat{\rho}_m}} = \frac{0.06827}{0.11785} = 0.5793$$
Step 6: Decision
Since $|Z_0| = 0.5793 < Z_{\alpha/2} = 1.96$, we fail to reject the null hypothesis of independence.
$$\boxed{\text{The numbers are independent (no significant autocorrelation).}}$$
- 45 marksTypes of ModelHideAnswer
Explain static mathematical model with suitable example. [5]
A static mathematical model is a type of mathematical model that represents a system at a particular point in time, where the system attribute values do not change over time. It uses symbolic notation and mathematical equations to repres...
- 55 marksFeaturesHideAnswer
Define Markov Chain. Explain with suitable example. [5]
Markov Chain: Definition and Explanation
Definition
A Markov Chain is a sequence of random variables X₁, X₂, X₃, ... with the Markov property, namely that, given the present state, the future and past states are independent.
Formally, this can be written as:
P(Xₙ₊₁ = xₙ₊₁ | X₁ = x₁, X₂ = x₂, ..., Xₙ = xₙ) = P(Xₙ₊₁ = xₙ₊₁ | Xₙ = xₙ)
This property is called the "memoryless" property - the next state depends only on the current state, not on the sequence of states that preceded it.
Key Concepts
Term Meaning State A possible condition the system can be in Transition Movement from one state to another Transition Probability Probability of moving from state i to state j Transition Matrix Matrix containing all transition probabilities
Example: Weather Prediction
Consider a simple weather model with two states:
- State 1: Sunny (S)
- State 2: Rainy (R)
Transition Probabilities
Suppose:
- If today is Sunny, probability of Sunny tomorrow = 0.8, Rainy = 0.2
- If today is Rainy, probability of Sunny tomorrow = 0.4, Rainy = 0.6
Transition Matrix
$$P = \begin{pmatrix} 0.8 & 0.2 \ 0.4 & 0.6 \end{pmatrix}$$
Where rows represent the current state and columns represent the next state.
State Diagram
0.8 0.6 [Sunny] ←→ 0.2 →→ [Rainy] ↑ ↑ ←←←← 0.4 ←←←←←←←←←←Applying the Markov Property
If today is Sunny, the probability that it will be Rainy after 2 days is:
- Sunny → Sunny → Rainy = 0.8 × 0.2 = 0.16
- Sunny → Rainy → Rainy = 0.2 × 0.6 = 0.12
- Total = 0.16 + 0.12 = 0.28
This calculation depends only on today's state (Sunny), not on what the weather was yesterday. This demonstrates the Markov property.
Application in Queuing Systems
Markov Chains are widely used in queuing models. For example, a single-server queue can be modeled as a continuous time Markov chain with transition matrix:
$$Q = \begin{pmatrix} -\lambda & \lambda \ \mu & -\mu \end{pmatrix}$$
The system is stable only if the utilization factor P = λ/μ < 1, meaning the arrival rate must be less than the service rate.
Summary
- Markov Chain models systems that transition between states over time.
- The key assumption is that the future depends only on the present, not the past.
- It is widely used in simulation, queuing theory, weather forecasting, and network modeling.
- 65 marksModels of Arrival Processes - Poisson ProcHideAnswer
Explain non-stationary Poisson process in brief. [5]
A non-stationary Poisson process is a Poisson process in which the arrival rate varies with time. Unlike the stationary Poisson process where the arrival rate λ is constant, here the arrival rate λ(t) is a function of time. --- The defin...
- 75 marksRandom Variate GenerationHideAnswer
Discuss the inverse transform technique and acceptance-rejection technique for random variate generation. [5]
--- The inverse transform method generates random variates by inverting the Cumulative Distribution Function (CDF) of the desired probability distribution. The technique can be utilized for any distribution when the CDF, F(x), is of a fo...
- 85 marksCalibration and Validation of the modelsHideAnswer
Explain the iterative process of calibrating a model. [5]
Iterative Process of Calibrating a Model
Definition
Calibration is the iterative process of comparing the model to the real system, making adjustments to the model, comparing again, and so on, until the model adequately represents the real system. The comparison of the model to reality is carried out by a variety of tests.
Steps in the Iterative Calibration Process
The calibration process follows a cycle of repeated steps as described below:
Step 1: Build the Initial Model
Construct an initial version of the simulation or mathematical model based on available data, assumptions, and understanding of the real system.
Step 2: Run the Model
Execute the model to generate outputs under defined conditions or inputs.
Step 3: Compare Model Output to Real System
Compare the model's output against observed real-world data or behavior. This comparison is carried out using a variety of tests, such as:
- Statistical tests (mean, variance comparison)
- Graphical comparisons (trend matching)
- Sensitivity analysis
Step 4: Identify Discrepancies
Identify where and how the model output deviates from the real system behavior. These discrepancies indicate areas where the model needs adjustment.
Step 5: Adjust the Model
Modify model parameters, assumptions, or structure to reduce the identified discrepancies. Adjustments may include:
- Changing input distributions
- Modifying rate parameters
- Revising model logic or equations
Step 6: Repeat (Iterate)
Return to Step 2 and repeat the process. The cycle continues until the model output closely matches the real system behavior within an acceptable tolerance.
Diagram of the Iterative Calibration Process
+------------------+ | Build/Adjust | | Model | +--------+---------+ | v +--------+---------+ | Run the Model | +--------+---------+ | v +--------+---------+ | Compare Model to | | Real System | +--------+---------+ | +---------+ | Match? | +---------+ / \ YES NO | | v v Accept Adjust Model Model (Go back to top)
Key Points
Aspect Description Nature Iterative (repeated cycles) Goal Model output matches real system behavior Tool Variety of comparison tests Outcome A validated, calibrated model ready for use
Conclusion
Calibration ensures that the simulation model is a reliable representation of the real system. Since no model is perfect on the first attempt, the iterative nature of calibration is essential to progressively improve model accuracy before it is used for decision-making or analysis.
- 95 marksQueuing notationHideAnswer
Explain Kendall notation with appropriate example. [5]
Kendall Notation is the standard system used to describe and classify a queuing system. It provides a compact and systematic way to represent the characteristics of any queuing model. --- Kendall Notation is represented as: $$A / B / C /...
- 105 marksHybrid SimulationHideAnswer
Explain Hybrid Simulation with examples. [5]
In most cases, a system under study is clearly either continuous or discrete in nature, and this determines whether an analog or digital computer is used for simulation. However, some systems are neither purely continuous nor purely disc...
- 115 marksFeedback SystemsHideAnswer
What is a feedback system? Explain with suitable examples. [5]
Feedback System
Definition
A feedback system is a system in which the output of the system is measured and fed back (returned) to the input side to be compared with the desired input, so that the system can automatically adjust and control its behavior to achieve the desired output.
In other words, a feedback system uses information about its own output to regulate or modify its future behavior. It is also known as a closed-loop system.
Key Components of a Feedback System
Component Description Input (Reference) The desired value or goal Process/System The actual system being controlled Output The result produced by the system Feedback Path The path that carries output information back to input Comparator Compares actual output with desired input Controller Takes corrective action based on the error
Block Diagram
Error Input --> [Comparator] --> [Controller] --> [Process] --> Output ^ | |_____________[Feedback Path]__________________|- Error = Input - Feedback (Output)
- If error is positive, the system increases its action.
- If error is negative, the system decreases its action.
Types of Feedback
- Positive Feedback: The feedback signal adds to the input, amplifying the output (less common in control systems).
- Negative Feedback: The feedback signal opposes the input, stabilizing the output (most commonly used).
Examples
Example 1: Thermostat (Temperature Control System)
- A room thermostat is set to a desired temperature (e.g., 25°C).
- A temperature sensor continuously measures the actual room temperature.
- If the actual temperature falls below 25°C, the heater is turned ON.
- If the actual temperature rises above 25°C, the heater is turned OFF.
- The measured temperature is continuously fed back to the comparator to maintain the desired level.
Example 2: Automatic Water Tank (Float Valve)
- The desired water level is the reference input.
- As water level drops, the float goes down, opening the valve to allow water in.
- As water reaches the desired level, the float rises and closes the valve.
- The water level (output) is continuously fed back to control the valve (input).
Example 3: Human Body Temperature Regulation
- The human body maintains a temperature of approximately 37°C.
- If body temperature rises, sweating occurs to cool it down.
- If body temperature falls, shivering occurs to generate heat.
- This is a natural biological feedback system.
Advantages of Feedback Systems
- Reduces error and improves accuracy
- Provides stability to the system
- Makes the system self-correcting
- Reduces the effect of disturbances and noise
Summary
A feedback system continuously monitors its output and uses that information to adjust its input, ensuring the system behaves as desired. It is widely used in engineering, biology, economics, and simulation modeling to maintain control and stability.
- 125 marksMethods of generation of Random NumberHideAnswer
Write a short note on: a. Mid Square Method b. Digital Analog Simulation [2.5+2.5]
--- The Mid Square Method is one of the earliest and simplest techniques for generating pseudo-random numbers. It was proposed by John von Neumann. 1. Start with an n-digit seed number (initial value) $X0$. 2. Square the seed to obtain a...