Simulation of Continuous System
Open in the Padhaiko app3.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.
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
- Chemical Reaction Model (First-Order Coupled ODEs): In a batch reactor where substance converts to at rate and converts to at rate :
- Automobile Wheel Suspension (Second-Order State-Space Form): Starting from , define state variables (position) and (velocity):
- 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
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
| Component | Mathematical Operation | Key Notes |
|---|---|---|
| Potentiometer (Coefficient Multiplier) | () | Passive voltage divider; scales signals down by constant gain |
| Sign Inverter | Unity-gain inverting op-amp () | |
| Summing Amplifier (Summer) | Weighted addition with sign inversion (, typically or ) | |
| Integrator | Uses 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:
- Isolate the highest-order derivative on the left-hand side:
- 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 .
- Apply initial conditions to each integrator with signs matching its output variable (e.g., on Integrator 1, on Integrator 2).
- 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
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
- Role of the Analog Subsystem: Performs parallel, high-bandwidth integration of stiff or fast continuous differential equations (aerodynamics, engine dynamics, power-grid transients) without step-size lag.
- Role of the Digital Subsystem: Stores arbitrary nonlinear lookup tables, executes complex branching logic, controls parameter sweeps/Monte-Carlo loops, logs data, and automates potentiometer calibration.
- Hardware-in-the-Loop (HIL): Widely used in aerospace flight-control testing, automotive ABS/ECU validation, and nuclear plant operator training simulators, where physical hardware interacts in real time with simulated continuous dynamics.
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.
- Historical Systems: MIDAS (Modified Integration Digital Analog Simulator, 1964), PACTOLUS (1964), and MIMIC (1965).
- Block-Oriented Paradigm: The user writes a text netlist connecting predefined functional blocks (
INTGRLfor integration,SUM,GAIN,MULT,CONST), and the simulator automatically sorts the blocks into an executable computation order and steps forward numerically. - Key Limitation Overcome: Digital-analog simulators removed voltage saturation and wiring errors, though early versions lacked flexible procedural loops and conditional statements—leading directly to CSSLs.
3.6 Continuous system simulation languages (CSSLs)
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:
| Segment | Execution Timing | Purpose |
|---|---|---|
| INITIAL | Executed once before time starts () | Set parameters, constants, and initial state values |
| DYNAMIC (containing DERIVATIVE) | Executed repeatedly at every integration step | Define algebraic equations and state derivatives (DERIVATIVE equations are auto-sorted by data dependency) |
| TERMINAL | Executed once after the stop condition () | Compute summary metrics, print reports, or trigger another optimization run |
- Representative CSSLs: IBM CSMP III (Continuous System Modeling Program), ACSL (Advanced Continuous Simulation Language), DYNAMO, and modern environments such as MATLAB/Simulink and Modelica.
3.7 Feedback systems
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.
| Aspect | Open-Loop System | Closed-Loop (Feedback) System |
|---|---|---|
| Feedback Path | None; control action ignores output | Sensor feeds output back to summing junction |
| Accuracy & Disturbance Rejection | Sensitive to parameter drift and external disturbances | Automatically reduces steady-state error and rejects disturbances |
| Stability Risk | Inherently stable if plant is stable | Excessive loop gain or phase lag can cause oscillation/instability |
| Example | Timed washing machine, open-loop toaster | Thermostat-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
1
Consider the continuous system model governed by the initial-value problem:
- Simulate the system from to using Euler's method with step size .
- 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 :
- Euler simulation gives and .
- Exact value is , so the absolute discretization error is .
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:
- Summer: Produces by summing three inputs: constant , , and .
- Integrator 1: Takes and outputs , initialized at .
- Sign Inverter: Takes and outputs (for feedback to the summer with gain ).
- Integrator 2: Takes and outputs , initialized at . Feed back to the summer with gain .
Analog netlist representation and steady-state check:
[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!)
The analog setup uses one summing amplifier, two integrators (initialized at and ), and one sign inverter to compute , with steady-state output .
3
A unity negative feedback control system () has forward-path transfer function and a unit step input for , with .
- Find the closed-loop transfer function , the closed-loop ODE, steady-state output , and steady-state error .
- 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:
- , ODE , steady-state output , steady-state error .
- Euler simulation gives and .
Exercises
Practice Exercises — Simulation of Continuous System
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.
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.
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:
- 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.
- Parameter sweeps and Monte-Carlo studies over stiff continuous ODEs (analog solves each trajectory rapidly while digital updates parameters and collects statistics).
- Systems needing large function tables or complex discrete logic alongside continuous high-frequency integration.
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.
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;
DERIVATIVEspecifies 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.
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.
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 :
Euler's method yields and , compared to the exact value (absolute error ).
A unity negative feedback control system has forward-path transfer function with gain .
- Find the closed-loop transfer function , the closed-loop time constant , and the steady-state output for a unit step input .
- 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 .
- For : , , , .
- Reducing to slows the response () and increases steady-state error to .