2 Simulation Of Continuous And Discrete System

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.

Simulation of Continuous and Discrete System: notes

Continuous System Models

A continuous system model describes a system whose attributes are controlled by continuous functions of time, typically one or more differential equations. When those equations are linear with constant coefficients, they can often be solved directly without simulation at all; simulation becomes necessary once non-linearities are introduced, since closed-form solutions then become difficult or impossible to obtain. Continuous simulation is the practice of modeling such a system's evolution over time by numerically evaluating these equations at successive instants rather than solving them symbolically.

Analog Computer

An analog computer simulates a continuous mathematical model directly in hardware, using devices such as adders and integrators built from high-gain DC amplifiers, in which voltages are made to stand for the model's mathematical variables. The coefficients of the model's equations are realized through scale factors built into the circuit. An integrator circuit produces the time integral of a single input voltage or of a sum of input voltages; a sign inverter reverses the sign of a signal wherever the model's equations require it. Analog computers are fast but provide only limited numerical accuracy, since every quantity is represented by a physical voltage subject to drift and noise.

Analog Methods

The general method for applying an analog computer to a continuous system model is to rearrange the governing differential equation to isolate its highest-order derivative, then build it up from four basic components: an integrator, a differentiator, a summer that adds several input voltages, and a sign inverter, alongside multipliers and dividers where the equation calls for them. For the mechanical system of unit 1, $$M x'' + D x' + K x = K F(t),$$ solving for the highest derivative gives $$M x'' = K F(t) - D x' - K x.$$ An input voltage representing $F(t)$, together with voltages already representing $-x$ and $-x'$, is scaled and summed to produce $M x''$. Integrating this with a scale factor of $1/M$ produces $x'$; a sign inverter changes it to $-x'$; a second integration produces $-x$; and a final sign inverter recovers $+x$ as the circuit's output. This chain of summer, integrator, inverter, integrator, inverter is the standard analog wiring pattern for any second-order linear system.

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 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:

TypeDescription
Static Physical ModelA scaled-down model that does not change with time (e.g., an architect's building design)
Dynamic Physical ModelA 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 QuantitySymbolElectrical QuantitySymbol
MassMInductanceL
Damping CoefficientBResistanceR
Spring ConstantKReciprocal of Capacitance1/C
ForceF(t)VoltageV(t)
DisplacementxChargeq
Velocitydx/dtCurrentdq/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.

Open this answer on its own page →

Models of Arrival Processes - Poisson Processes, Non-stationary Poisson Processes, Batch Arrivals

2082 · 5 marks

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 definition is identical to the stationary Poisson process except ...

Open this answer on its own page →

2080 · 5 marks

Write short notes on: a. Non-stationary poisson process b. Poker test [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 definition is identical to the stationary Poisson process except th...

Open this answer on its own page →

2076 · 5 marks

Define arrival pattern. Explain non-stationary Poisson process. [5]

An arrival pattern describes the manner in which customers (or entities) arrive at a service system over time. It characterizes: - The rate at which customers arrive (e.g., average number per unit time) - The statistical distribution governing inter-arrival times - Whether the arrival rate is con...

Open this answer on its own page →

Hybrid Simulation

2082 · 5 marks

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 discrete in nature. The simulation provided by hybrid computers ...

Open this answer on its own page →

Feedback Systems

2082 · 5 marks

What is a feedback system? Explain with suitable examples. [5]

Show solved 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

ComponentDescription
Input (Reference)The desired value or goal
Process/SystemThe actual system being controlled
OutputThe result produced by the system
Feedback PathThe path that carries output information back to input
ComparatorCompares actual output with desired input
ControllerTakes 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

  1. Positive Feedback: The feedback signal adds to the input, amplifying the output (less common in control systems).
  2. 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.

Open this answer on its own page →

2080 · 5 marks

What is feedback system? Explain with example. [5]

A feedback system is a system in which a coupling occurs between the input and output of the system. In other words, the output of the system is fed back and compared with the desired input (reference value), and the difference is used to control or adjust the system's behavior. Feedback is the p...

Open this answer on its own page →

Analog Computer

2081 · 5 marks

What is analog computer? Explain with suitable example. [5]

Analog computers are those computers that are unified with devices like adders and integrators so as to simulate the continuous mathematical model of a system, which generates continuous outputs. The electronic analog computer is based on the use of high gain DC amplifiers and is the most widely ...

Open this answer on its own page →

2079 · 10 marks

Why accuracy of analog computer is low? Explain analog computer with suitable example. Differentiate between analog and digital computer.[10]

--- Analog computers work by equating voltages to mathematical variables. The accuracy of an analog computer is inherently limited due to the following reasons: - Physical component limitations: The electronic components such as resistors, capacitors, and high-gain DC amplifiers used in analog co...

Open this answer on its own page →

Probability and Monte Carlo Simulation

2080 · 5 marks

Explain Monte Carlo simulation method with example. [5]

Show solved 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:

  1. The output must generate random samples
  2. The input distribution must be known
  3. 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:

  1. Generate random points (x, y) where x and y are uniformly distributed between 0 and 1.
  2. Check if the point falls inside the quarter circle using the condition:

$$x^2 + y^2 \leq 1$$

  1. Count the number of points inside the circle (M) out of total points (N).
  2. Estimate π as:

$$\pi \approx 4 \times \frac{M}{N}$$

Numerical Illustration:

Trialxyx² + y²Inside Circle?
10.30.60.45Yes
20.80.71.13No
30.50.40.41Yes
40.20.90.85Yes
50.90.81.45No
  • 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.

Open this answer on its own page →

2079 · 5 marks

Explain the Monte Carlo simulation method with example. [5]

Show solved 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

  1. The output must generate random samples
  2. The input distribution must be known
  3. 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

  1. Define the problem and identify variables
  2. Determine the probability distribution of each input variable
  3. Generate random numbers using a method (e.g., Linear Congruential Method)
  4. Map random numbers to input values using the known distribution
  5. Compute the output/result for each trial
  6. Repeat the experiment a large number of times
  7. 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:

StepFormulaResult
$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.

Open this answer on its own page →

2078 · 5 marks

Explain Monte Carlo simulation method with an example? [5]

Show solved 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:

  1. The output must generate random samples
  2. The input distribution must be known
  3. 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:

Trialxyx² + y²Inside Circle?
10.30.60.09+0.36 = 0.45Yes
20.80.70.64+0.49 = 1.13No
30.20.40.04+0.16 = 0.20Yes
40.90.50.81+0.25 = 1.06No
50.10.30.01+0.09 = 0.10Yes
  • 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.

Open this answer on its own page →

Discrete Event Simulation

2078 · 5 marks

Explain the concept of discrete event simulation. Explain poisson’s arrival pattern. [5]

--- A Discrete Event Simulation (DES) is a simulation model used for discrete systems where the state of the system changes only at discrete points in time, triggered by specific events. The model used in discrete event simulation has a set of numbers to represent the state of the system. A numbe...

Open this answer on its own page →

Digital-Analog Simulators

2078 · 5 marks

Write short notes on (any two): a. Digital analog simulator b. Simulation tools [5]

Digital-Analog Simulators refer to the use of programming languages on a digital computer to simulate continuous systems (which were traditionally handled by analog computers). - The simulation language is composed of macro-instructions that are capable of acting as fundamental analog computer co...

Open this answer on its own page →