PadhaikoAll subjects

Simulation of Continuous System

Simulation and Modeling (ENCT 353)

Open in the Padhaiko app

3.1 Continuous system models

A continuous system is one whose state variables vary smoothly over time according to differential equations. Simulating a continuous system on a digital computer requires converting continuous differential equations into numerical update steps (such as Euler's method or Runge–Kutta methods), whereas analog computers integrate them directly using continuous voltages.

Definition

State-Space Representation of Continuous Models

Any -th order ordinary differential equation (or system of coupled ODEs) can be rewritten as a system of first-order ODEs in state-space form:

where is the state vector and is the input vector.

Standard Continuous Model Examples

  1. Chemical Reaction Model (First-Order Coupled ODEs): In a batch reactor where substance converts to at rate and converts to at rate :
  1. Automobile Wheel Suspension (Second-Order State-Space Form): Starting from , define state variables (position) and (velocity):
  1. Numerical Integration on Digital Computers: Given step size and :
    • Euler's Method: (first-order accuracy, local error ).
    • Classical 4th-Order Runge–Kutta (RK4):

where , , , and .


3.2 Analog computer

Definition

Analog Computer

An electronic analog computer solves continuous differential equations by representing physical variables (position, temperature, pressure) as continuous DC voltages inside an interconnected network of operational-amplifier (op-amp) circuits—performing addition, scaling, sign inversion, and continuous integration simultaneously in real time.

Fundamental Analog Computer Building Blocks

Standard Electronic Analog Computer Components
ComponentMathematical OperationKey Notes
Potentiometer (Coefficient Multiplier) ()Passive voltage divider; scales signals down by constant gain
Sign InverterUnity-gain inverting op-amp ()
Summing Amplifier (Summer)Weighted addition with sign inversion (, typically or )
IntegratorUses feedback capacitor (); inverts sign and holds initial condition
Analog Multiplier / Function Generator or Required for nonlinear differential equations (e.g., predator–prey terms)

3.3 Analog methods

The analog method is a systematic procedure for wiring an analog computer block diagram directly from an -th order linear differential equation:

  1. Isolate the highest-order derivative on the left-hand side:
  1. Assume the highest derivative is available at the input of a chain of integrators. Each op-amp integrator multiplies by as it integrates:
    • Integrator 1 takes and outputs .
    • Integrator 2 takes and outputs , alternating signs down to .
  2. Apply initial conditions to each integrator with signs matching its output variable (e.g., on Integrator 1, on Integrator 2).
  3. Close the feedback loop by feeding the scaled lower-order derivatives, , and forcing function (using inverters where sign reversal is required) into a summing amplifier whose inverted output equals the highest derivative assumed in step 2.

3.4 Hybrid simulation

Definition

Hybrid Simulation

A hybrid simulation couples a high-speed analog computer with a stored-program digital computer through Analog-to-Digital Converters (ADCs), Digital-to-Analog Converters (DACs), and timing/control logic so both continuous integration and discrete logic run together.

Division of Labor and Applications


3.5 Digital-analog simulators

Before modern ODE solvers and graphical block tools, digital-analog simulators were developed to give engineers the familiar block-diagram workflow of an analog computer on a general-purpose digital computer—eliminating patch cords, op-amp drift, and voltage scaling limits.


3.6 Continuous system simulation languages (CSSLs)

Definition

Continuous System Simulation Language (CSSL)

A Continuous System Simulation Language (CSSL) is a high-level language designed for simulating continuous dynamic systems defined by ODEs, combining equation-based parallel blocks with procedural control and automatic numerical integration (Euler, Adams, RK4, stiff solvers).

In 1967, the Simulation Councils Inc. (SCI) defined the CSSL standard structure, dividing a simulation program into three logical segments:

Standard Segments of a CSSL Program
SegmentExecution TimingPurpose
INITIALExecuted once before time starts ()Set parameters, constants, and initial state values
DYNAMIC (containing DERIVATIVE)Executed repeatedly at every integration stepDefine algebraic equations and state derivatives (DERIVATIVE equations are auto-sorted by data dependency)
TERMINALExecuted once after the stop condition ()Compute summary metrics, print reports, or trigger another optimization run

3.7 Feedback systems

Definition

Feedback System

A feedback (closed-loop) system measures its actual output , compares it against a desired reference input to compute an error signal , and uses that error to drive the plant so the output tracks the reference despite disturbances.

AspectOpen-Loop SystemClosed-Loop (Feedback) System
Feedback PathNone; control action ignores outputSensor feeds output back to summing junction
Accuracy & Disturbance RejectionSensitive to parameter drift and external disturbancesAutomatically reduces steady-state error and rejects disturbances
Stability RiskInherently stable if plant is stableExcessive loop gain or phase lag can cause oscillation/instability
ExampleTimed washing machine, open-loop toasterThermostat-controlled oven, cruise control, PLL

Canonical Closed-Loop Formula and Simulation

For a feedback loop with forward-path transfer function and feedback-path transfer function :

For unity negative feedback (), the error is , and in a PID controller the control effort is:

Simulating feedback systems reveals rise time, overshoot, settling time, steady-state error, and stability boundaries as loop gain varies.


Worked Out Examples

Example 1

1

Consider the continuous system model governed by the initial-value problem:

  1. Simulate the system from to using Euler's method with step size .
  2. Compare the simulated value at against the exact analytical solution and find the absolute error.

Euler step from to : Here , , , and :

Euler step from to :

Comparing with the exact analytical solution at :

Answer:
  1. Euler simulation gives and .
  2. Exact value is , so the absolute discretization error is .
Example 2

2

Design an analog computer block diagram (and signal flow equations) to simulate the second-order continuous system:

Also find the steady-state value as .

Isolating the highest derivative:

Setting up the integrator chain and sign inverters:

  1. Summer: Produces by summing three inputs: constant , , and .
  2. Integrator 1: Takes and outputs , initialized at .
  3. Sign Inverter: Takes and outputs (for feedback to the summer with gain ).
  4. Integrator 2: Takes and outputs , initialized at . Feed back to the summer with gain .

Analog netlist representation and steady-state check:

Analog Computer Signal FlowText
[Constant -16] ──(gain 1)──┐
[+dy/dt]       ──(gain 4)──┼──> [Summer (-)] ──(+d2y/dt2)──> [Integrator 1, IC=0] ──(-dy/dt)──> [Integrator 2, IC=+2] ──(+y)
[+y]           ──(gain 8)──┘                                         │                                                           │
    ▲                                                                ▼                                                           │
    └────────────────────────── [Inverter (-1)] <────────────────────┘                                                           │
    └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

At steady state (): . (Because and , the system starts directly at equilibrium!)

Answer:

The analog setup uses one summing amplifier, two integrators (initialized at and ), and one sign inverter to compute , with steady-state output .

Example 3

3

A unity negative feedback control system () has forward-path transfer function and a unit step input for , with .

  1. Find the closed-loop transfer function , the closed-loop ODE, steady-state output , and steady-state error .
  2. Simulate and using Euler's method with .

Deriving closed-loop transfer function and ODE:

Cross-multiplying and taking the inverse Laplace transform gives:

Steady-state output and error: At steady state ():

Euler simulation with :

  • At : , , so:
  • At : , so:
Answer:
  1. , ODE , steady-state output , steady-state error .
  2. Euler simulation gives and .

Exercises

Practice Exercises — Simulation of Continuous System

Question 1

Explain the roles of the potentiometer, sign inverter, summing amplifier, and integrator in an electronic analog computer, and explain why magnitude scaling and time scaling are required.

Roles of Core Analog Components:

  • Potentiometer: Multiplies an input voltage by a constant fraction .
  • Sign Inverter: Multiplies an input voltage by .
  • Summing Amplifier: Outputs the negated weighted sum of multiple input voltages.
  • Integrator: Outputs the negated time integral , holding the initial condition on its feedback capacitor.

Need for Magnitude and Time Scaling:

  • Magnitude Scaling: Op-amps clip/saturate outside their linear voltage range (e.g., ). Scaling keeps all amplifier outputs within safe bounds while avoiding tiny signals lost to noise.
  • Time Scaling: Very fast phenomena (microseconds) or very slow processes (hours/days) are scaled via so the simulation runs cleanly in seconds.
Answer:

Potentiometers scale coefficients, inverters flip signs, summers compute negated weighted sums, and integrators integrate continuously with initial conditions. Magnitude scaling prevents op-amp saturation/noise, while time scaling matches the physical speed of the system to convenient laboratory run durations.

Question 2

Compare pure analog simulation, digital-analog simulators, and hybrid simulation. State three situations where hybrid simulation is superior to pure digital simulation.

Comparing Simulation Paradigms:

  • Pure Analog: Parallel continuous op-amp hardware; ultra-fast integration but limited precision, tedious patching, and poor memory/logic.
  • Digital-Analog Simulators: Block-oriented software (e.g., MIDAS, CSMP) emulating analog blocks numerically on a digital CPU; high precision and easy setup without hardware drift.
  • Hybrid Simulation: Combines analog continuous integration with digital control/memory via ADC and DAC interfaces.

When Hybrid Simulation Excels:

  1. Real-time Hardware-in-the-Loop (HIL) testing of aircraft autopilots or missile seekers where stiff continuous dynamics must run faster than real-time digital solvers allowed.
  2. Parameter sweeps and Monte-Carlo studies over stiff continuous ODEs (analog solves each trajectory rapidly while digital updates parameters and collects statistics).
  3. Systems needing large function tables or complex discrete logic alongside continuous high-frequency integration.
Answer:

Pure analog runs in parallel via op-amps; digital-analog simulators mimic block diagrams numerically; hybrid simulation pairs analog integration with digital logic via ADC/DAC. Hybrid simulation excels in real-time HIL testing, fast Monte-Carlo parameter sweeps of stiff ODEs, and mixed continuous-logic systems.

Question 3

Describe the three standard structural segments of a Continuous System Simulation Language (CSSL) (INITIAL, DYNAMIC/DERIVATIVE, and TERMINAL) and explain why equation sorting is performed inside the DERIVATIVE section.

Three CSSL Segments:

  • INITIAL: Runs once at to assign physical constants, compute derived parameters, and set initial state values.
  • DYNAMIC / DERIVATIVE: Runs repeatedly at each time step; DERIVATIVE specifies the continuous algebraic equations and ODE derivatives , which the numerical integrator advances.
  • TERMINAL: Runs once after the termination criterion ( or state condition) to print summary statistics or initiate subsequent runs.

Why Equation Sorting Matters: Analog systems execute all blocks simultaneously, so users write equations in any order. A digital computer executes statements sequentially; sorting equations in the DERIVATIVE block topologically by data dependencies ensures every variable is computed before it is referenced on the right-hand side of another derivative.

Answer:

A CSSL program has INITIAL (one-time setup), DYNAMIC/DERIVATIVE (step-by-step continuous model equations), and TERMINAL (post-run reporting). The translator sorts DERIVATIVE equations by dependency so sequential digital execution matches parallel continuous causality.

Question 4

Using Euler's method with step size , simulate the continuous differential equation:

up to . Compare your simulated result with the exact solution .

Euler step from to :

Euler step from to :

Comparing with the exact analytical solution at :

Answer:

Euler's method yields and , compared to the exact value (absolute error ).

Question 5

A unity negative feedback control system has forward-path transfer function with gain .

  1. Find the closed-loop transfer function , the closed-loop time constant , and the steady-state output for a unit step input .
  2. If is reduced to while keeping the plant pole at , what happens to the steady-state error and the closed-loop time constant ?

Closed-loop transfer function for :

The closed-loop pole is at , so the closed-loop time constant is . For a unit step input , by the Final Value Theorem:

Effect of reducing gain to :

  • New time constant: (twice as slow).
  • New steady-state output: , so steady-state error doubles from to .
Answer:
  1. For : , , , .
  2. Reducing to slows the response () and increases steady-state error to .
← Physical and Mathematical ModelsSimulation of Queuing System →