Plan Cascade Tuning from the PathSim Two-Loop Example

Short answer: PathSim's official cascade example is a two-loop simulation you can reproduce, not a set of gains to copy onto another plant. In the v0.31.0 documentation, an outer PI and a faster inner PI, each implemented with a PID block whose derivative gain is 0, control two cascaded delay-free transfer functions with additive white noise. [1] The inner loop regulates the first-order plant (gain 3, pole at -2) and drives the plant input. The outer loop regulates the third-order plant (gain 10, three poles at -1) and writes the inner-loop reference. [1] A 100 s run steps the setpoint from 0 to 1 after 20 s and to 0.5 after 60 s. [1] Reproduce that published configuration first, then change one parameter at a time and inspect both loops. The documentation does not publish numerical tracking results, so do not treat the example gains as proven settings for a different plant.
What the example implements
The PathSim documentation page "Cascade Controller" in version v0.31.0 describes a two-loop cascade with an outer (primary) controller, an inner (secondary) controller, and a plant built as a subsystem of two cascaded transfer functions with noise disturbances. [1] The same example is also provided as a standalone Python file in the PathSim GitHub repository. [2]
Plant, as coded in the documentation: [1]
Inner process
p2: zero-pole-gain transfer function with no zeros, one pole at -2, and gain 3, that is 3 / (s + 2).Outer process
p1: zero-pole-gain transfer function with no zeros, three poles at -1, and gain 10, that is 10 / (s + 1)^3.Additive white noise is injected after each transfer function. On the v0.31.0 docs page, both noise blocks are
WhiteNoise(spectral_density=5e-7). [1]The plant input enters
p2first. The noisyp2output is the inner measured variable and the input top1. The noisyp1output is the outer measured variable. [1]
Both plant models are delay-free and have only stable poles. This is a cascade of stable linear processes, not an unstable-plant case study.
Controllers, setpoint and solver
The documentation describes two PathSim PID blocks and notes that the inner controller is typically tuned to be faster than the outer controller. [1] The coded gains are:
| Loop | Block | Kp | Ki | Kd | f_max |
|---|---|---|---|---|---|
| Outer (c1) | PID | 0.015 | 0.015/0.716 | 0.0 | 10.0 |
| Inner (c2) | PID | 0.244 | 0.244/0.134 | 0.0 | 10.0 |
Because Kd is 0 in both loops, the implemented controllers are PI, even though they are constructed with the PID block. [1]
In the PathSim PID API, f_max is the highest expected signal frequency, not an output saturation limit. [3] The example uses the plain PID block, not AntiWindupPID, and it does not set output limits. Do not read f_max=10.0 as a clamp on the controller output. [1][3]
The setpoint is 0 until t = 20 s, 1 after t = 20 s, and 0.5 after t = 60 s. The simulation runs for 100 s with the RKCK54 solver (Runge-Kutta-Cash-Karp 5(4)) and tolerances tolerance_lte_rel=1e-4 and tolerance_lte_abs=1e-6. [1] Scopes record the setpoint and both plant outputs, then each loop's error and controller output. [1]
The documentation says the inner loop responds faster to disturbances and that this improves the overall system response. [1] That is the example's own description. This post does not treat it as an independently measured result, because the page does not publish numeric tracking or disturbance-rejection figures.
Reproduce the baseline before you change a gain
Record the software version. The current official example page is documentation version v0.31.0. [1] On 17 Nov 2026, the latest PyPI release of pathsim was 0.31.0 (uploaded 13 Nov 2026). Releases 0.30.3 and 0.30.4 both exist and were uploaded on 10 Nov 2026. [4] The older documentation URL for v0.30.4 now returns 404. Install a stated version and open the matching example before you compare responses.
Check which noise definition you ran. The v0.31.0 docs page uses
WhiteNoise(spectral_density=5e-7)for both disturbance blocks. [1] The standalone GitHub fileexamples/example_cascade.pyusesWhiteNoise(standard_deviation=0.001, sampling_period=0.1)instead. [2] Those are different parameterizations. In the PathSim API,spectral_densityis a power spectral density andstandard_deviationis a constant-amplitude mode. [3] If a reproduced plot disagrees with a teammate's plot, compare these settings first.Map the signals. Outer error is setpoint minus the
p1output. The outer controller output is the inner-loop reference. Inner error is that reference minus thep2output. The inner controller output is the plant input. [1]Hold the published settings for the first run. Keep the plant, gains, setpoint schedule, solver, tolerances and simulation length fixed, and run the 100 s case as published. [1]
Then change one parameter at a time. For each trial, record what changed, what stayed fixed, and inspect all three scopes: both plant outputs against the setpoint, and both errors and controller outputs. An improvement in one loop is not enough if it disturbs the other loop or drives a larger command.
Do not assume saturation, delay or a robot plant. This example has no actuator limits, no time delay in the transfer functions, and no mechanical or UAV model. [1] If your loop has delay, see PID tuning with transport delay. If you are coordinating several loops or scheduled gains, see PID gain scheduling and multi-loop verification.
If a change makes a loop oscillate, work through troubleshooting PID oscillations before you keep moving gains. For whether a chosen PID structure can stabilize an unstable linear plant at all, see checking linear system stabilization conditions before PID tuning.
What the example does not prove
It is a documented simulation of one cascade, not a general tuning rule. [1]
The published gains belong to this plant and this setpoint schedule. They are not validated settings for another process.
No hardware test is described. [1]
Because output limits are not included, a reproduced run will not show windup from saturation. [1][3]
PathSim also ships other examples, including ABS braking and DC motor speed control, and separate vehicle and flight toolboxes. Those are different models and are not this cascade example.
Key takeaways
The official PathSim cascade example is a two-loop PI cascade (PID blocks with Kd = 0) around two stable, delay-free transfer functions with additive white noise. [1]
The inner loop (Kp = 0.244, Ki = 0.244/0.134) drives the plant input. The outer loop (Kp = 0.015, Ki = 0.015/0.716) writes the inner reference. [1]
The documented run lasts 100 s, with setpoint steps after 20 s and 60 s, using the RKCK54 solver. [1]
f_max=10.0is a frequency parameter in the PathSim PID block, not an output clamp. [3]The docs page and the standalone GitHub file use different white-noise settings, and the current docs version is v0.31.0. Record the version and the noise definition before comparing results. [1][2][4]
Frequently asked questions
What does the PathSim cascade example actually simulate?
It simulates two cascaded delay-free transfer functions, 3 / (s + 2) and 10 / (s + 1)^3, with additive white noise, under an outer loop that regulates the slower output and an inner loop that regulates the faster output and drives the plant input. The documented run lasts 100 s and steps the setpoint from 0 to 1 after 20 s and to 0.5 after 60 s. [1]
Are the two controllers PID or PI?
They are constructed with PathSim PID blocks, but both have Kd = 0, so the implemented laws are PI. The inner gains are Kp = 0.244 and Ki = 0.244/0.134. The outer gains are Kp = 0.015 and Ki = 0.015/0.716. [1]
Can I copy the example gains to my own cascade?
No. The gains belong to this plant, noise setup and setpoint schedule, and the documentation does not publish numeric tracking results that would support transferring them. Reproduce the published baseline, then retune against your own model and acceptance tests. [1]
Why do the documentation and package versions matter?
The current official example is documentation version v0.31.0, and the latest pathsim release on PyPI on 17 Nov 2026 was 0.31.0. [1][4] The docs page and the standalone GitHub file also define the white-noise blocks differently. [1][2] Record the installed version and the noise parameters before you interpret differences between reproduced outputs.
Sources
PathSim documentation. "Cascade Controller." Version v0.31.0. https://docs.pathsim.org/pathsim/v0.31.0/examples/cascade-controller
PathSim. "examples/example_cascade.py." https://github.com/pathsim/pathsim/blob/master/examples/example_cascade.py
PathSim documentation. PID and WhiteNoise API reference, version v0.31.0. https://docs.pathsim.org
PyPI. "pathsim" project metadata, latest release 0.31.0 as of 17 Nov 2026. https://pypi.org/project/pathsim/0.31.0/
If you have a model or IO data for one of your own loops, LabCD's guided workflow lets you tune and test a controller on your first model for free, with a qualified engineer approving every controller.
Want to try this on your own plant model?
Try LabCD free with your first model