Simulation and Modeling · Unit 2 · 7 hrs
Simulation of Continuous and Discrete System
Exam-focused notes for Simulation of Continuous and Discrete System (Simulation and Modeling, CSC328): what the TU syllabus asks and how it has actually been tested, with 14 solved past questions from this unit.
Simulation of Continuous and Discrete System in short
Unit 1 classified systems as discrete or continuous. This chapter builds the machinery each kind actually needs to be simulated: analog and hybrid methods for continuous systems, the clock-advance mechanisms and arrival-process models that drive discrete-event simulation, and Monte Carlo simulation as a bridge between the two.
What this unit covers
- Continuous System Models
- Analog Computer
- Analog Methods
- Hybrid Simulation
- Digital-Analog Simulators
- Feedback Systems
- Discrete Event Simulation
- Representation of time
- Simulation Clock and Time Management
- Models of Arrival Processes - Poisson Processes, Non-stationary Poisson Processes, Batch Arrivals
- Gathering statistics
- Probability and Monte Carlo Simulation
Analog Methods
2082 · 10 marks
What is simulation? Describe the analogy between a mechanical system and corresponding electrical system with reference to dynamic physical model.[10]
Show solved answerHide answer
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.
Models of Arrival Processes - Poisson Processes, Non-stationary Poisson Processes, Batch Arrivals
2082 · 5 marks
Explain non-stationary Poisson process in brief. [5]
2080 · 5 marks
Write short notes on: a. Non-stationary poisson process b. Poker test [5]
2076 · 5 marks
Define arrival pattern. Explain non-stationary Poisson process. [5]
Hybrid Simulation
Feedback Systems
2082 · 5 marks
What is a feedback system? Explain with suitable examples. [5]
Show solved answerHide answer
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.
Analog Computer
2081 · 5 marks
What is analog computer? Explain with suitable example. [5]
2079 · 10 marks
Why accuracy of analog computer is low? Explain analog computer with suitable example. Differentiate between analog and digital computer.[10]
Probability and Monte Carlo Simulation
2080 · 5 marks
Explain Monte Carlo simulation method with example. [5]
Show solved answerHide answer
Monte Carlo Simulation Method
Definition
Monte Carlo simulation is a computerized mathematical technique that generates random sample data based on some known distribution for numerical experiments. It is applied to risk quantitative analysis and decision making problems, and is used by professionals in finance, project management, energy, manufacturing, engineering, research & development, transportation, and other fields.
Key Characteristics
Monte Carlo method has three important characteristics:
- The output must generate random samples
- The input distribution must be known
- The result must be known while performing an experiment
Flowchart for Monte Carlo Simulation
Start
|
v
Define the Problem
|
v
Identify Input Variables
(with known distributions)
|
v
Generate Random Numbers
|
v
Simulate the Experiment
(compute output for each sample)
|
v
Repeat N times
|
v
Aggregate and Analyze Results
|
v
Stop
Example: Estimating the Value of π
Problem: Use Monte Carlo simulation to estimate the value of π.
Approach:
- Consider a unit square of side 1 and a quarter circle of radius 1 inscribed in it.
- Area of quarter circle = π/4
- Area of square = 1
Steps:
- Generate random points (x, y) where x and y are uniformly distributed between 0 and 1.
- Check if the point falls inside the quarter circle using the condition:
$$x^2 + y^2 \leq 1$$
- Count the number of points inside the circle (M) out of total points (N).
- Estimate π as:
$$\pi \approx 4 \times \frac{M}{N}$$
Numerical Illustration:
| Trial | x | y | x² + y² | Inside Circle? |
|---|---|---|---|---|
| 1 | 0.3 | 0.6 | 0.45 | Yes |
| 2 | 0.8 | 0.7 | 1.13 | No |
| 3 | 0.5 | 0.4 | 0.41 | Yes |
| 4 | 0.2 | 0.9 | 0.85 | Yes |
| 5 | 0.9 | 0.8 | 1.45 | No |
- Total points N = 5
- Points inside circle M = 3
$$\pi \approx 4 \times \frac{3}{5} = 4 \times 0.6 = \mathbf{2.4}$$
Note: As N increases (more random samples), the estimate converges closer to the true value of π ≈ 3.14159.
Applications
- Financial risk analysis
- Project scheduling and management
- Engineering design optimization
- Manufacturing process simulation
- Transportation and logistics planning
Summary
Monte Carlo simulation is a powerful technique that uses repeated random sampling to obtain numerical results. The more iterations performed, the more accurate and reliable the result becomes. It is especially useful when analytical solutions are difficult or impossible to obtain.
2079 · 5 marks
Explain the Monte Carlo simulation method with example. [5]
Show solved answerHide answer
Monte Carlo Simulation Method
Definition
Monte Carlo simulation is a computerized mathematical technique that generates random sample data based on some known distribution for numerical experiments. It is applied to risk quantitative analysis and decision making problems.
It is used by professionals in fields such as finance, project management, energy, manufacturing, engineering, research & development, and transportation.
Three Important Characteristics
- The output must generate random samples
- The input distribution must be known
- The result must be known while performing an experiment
Flowchart for Monte Carlo Simulation
Start
|
v
Define the Problem
|
v
Identify Input Variables
& their Distributions
|
v
Generate Random Numbers
|
v
Simulate the Experiment
(Compute Output)
|
v
Repeat N times? --Yes--> (back to Generate)
|
No
v
Analyze & Interpret Results
|
v
Stop
Steps in Monte Carlo Simulation
- Define the problem and identify variables
- Determine the probability distribution of each input variable
- Generate random numbers using a method (e.g., Linear Congruential Method)
- Map random numbers to input values using the known distribution
- Compute the output/result for each trial
- Repeat the experiment a large number of times
- Analyze the aggregated results statistically
Example: Using Linear Congruential Method to Generate Random Numbers
Use the formula:
$$X_{n+1} = (a \cdot X_n + c) \mod m$$
Given:
- $X_0 = 27$, $a = 17$, $c = 43$, $m = 100$
Calculations:
| Step | Formula | Result |
|---|---|---|
| $X_1$ | $(17 \times 27 + 43) \mod 100$ | $(459 + 43) \mod 100 = 502 \mod 100 = \mathbf{2}$ |
| $X_2$ | $(17 \times 2 + 43) \mod 100$ | $(34 + 43) \mod 100 = 77 \mod 100 = \mathbf{77}$ |
| $X_3$ | $(17 \times 77 + 43) \mod 100$ | $(1309 + 43) \mod 100 = 1352 \mod 100 = \mathbf{52}$ |
| $X_4$ | $(17 \times 52 + 43) \mod 100$ | $(884 + 43) \mod 100 = 927 \mod 100 = \mathbf{27}$ |
Generated sequence: 2, 77, 52, 27, ...
These random numbers (normalized as $R_n = X_n / m$) are then used as random samples to simulate real-world scenarios such as estimating probabilities, queue lengths, or financial risks.
Applications
- Estimating the value of Pi (π)
- Queue simulation (arrival and service time modeling)
- Financial risk analysis
- Project scheduling under uncertainty
Summary
Monte Carlo simulation is powerful because it allows us to model complex systems with uncertainty by running thousands of random trials and observing the distribution of outcomes, giving a probabilistic view of possible results.
2078 · 5 marks
Explain Monte Carlo simulation method with an example? [5]
Show solved answerHide answer
Monte Carlo Simulation Method
Definition
Monte Carlo simulation is a computerized mathematical technique that generates random sample data based on some known distribution for numerical experiments. It is applied to risk quantitative analysis and decision making problems, and is used by professionals in finance, project management, energy, manufacturing, engineering, research & development, transportation, and more.
Key Characteristics
The three important characteristics of the Monte Carlo method are:
- The output must generate random samples
- The input distribution must be known
- The result must be known while performing an experiment
Flowchart for Monte Carlo Simulation
Start
|
v
Define the Problem
|
v
Identify Input Variables
and their Distributions
|
v
Generate Random Numbers
|
v
Simulate the Experiment
(Repeat N times)
|
v
Collect and Analyze Output
|
v
Estimate the Result / Decision
|
v
Stop
Example: Estimating the Value of Pi (π)
Problem: Use Monte Carlo simulation to estimate the value of π.
Concept:
- Consider a unit square of side 1 and a quarter circle of radius 1 inscribed within it.
- Area of the square = 1 × 1 = 1
- Area of the quarter circle = π(1)²/4 = π/4
Steps:
Step 1: Generate N pairs of random numbers (x, y) where x, y ∈ [0, 1]
Step 2: Check if the point (x, y) falls inside the quarter circle using:
$$x^2 + y^2 \leq 1$$
Step 3: Count the number of points inside the circle (M)
Step 4: Estimate π using:
$$\frac{\text{Points inside circle}}{\text{Total points}} = \frac{\pi/4}{1}$$
$$\pi \approx 4 \times \frac{M}{N}$$
Numerical Illustration:
| Trial | x | y | x² + y² | Inside Circle? |
|---|---|---|---|---|
| 1 | 0.3 | 0.6 | 0.09+0.36 = 0.45 | Yes |
| 2 | 0.8 | 0.7 | 0.64+0.49 = 1.13 | No |
| 3 | 0.2 | 0.4 | 0.04+0.16 = 0.20 | Yes |
| 4 | 0.9 | 0.5 | 0.81+0.25 = 1.06 | No |
| 5 | 0.1 | 0.3 | 0.01+0.09 = 0.10 | Yes |
- Total points N = 5
- Points inside circle M = 3
$$\pi \approx 4 \times \frac{3}{5} = 4 \times 0.6 = \mathbf{2.4}$$
Note: As N increases (e.g., N = 10,000), the estimate converges closer to the true value of π ≈ 3.14159.
Advantages
- Can handle complex systems that are difficult to solve analytically
- Applicable to a wide range of domains
- Provides probabilistic results with confidence intervals
Summary
Monte Carlo simulation uses repeated random sampling to obtain numerical results. The larger the number of trials, the more accurate and reliable the result becomes. It is especially powerful when analytical solutions are difficult or impossible to obtain.
Discrete Event Simulation
2078 · 5 marks
Explain the concept of discrete event simulation. Explain poisson’s arrival pattern. [5]
Digital-Analog Simulators
2078 · 5 marks
Write short notes on (any two): a. Digital analog simulator b. Simulation tools [5]
Make Unit 2 stick
Practice CSC328 with flashcards & quizzes