test_linearTimeInvariantSystem

test_linearTimeInvariantSystem.test_linearTimeInvariantSystemFirstOrder(usePythonSubclass: bool, showPlots: bool = False)[source]

Unit test for LinearTimeInvariantSystem:

  • When usePythonSubclass == False:

    Uses the C++ SingleActuatorLTI subclass.

  • When usePythonSubclass == True:

    Uses a Python subclass of LinearTimeInvariantSystem that overrides readInput and writeOutput via directors.

Both implement the same first order system:

x_dot = -a x + a u, y = x, u = 1 (constant step)

so that in continuous time:

x(t) = 1 - exp(-a t)

test_linearTimeInvariantSystem.test_linearTimeInvariantSystemSecondOrder(showPlots: bool = False)[source]

Unit test for an LTI model configured as a second-order system.

This test sets up a critically damped second-order linear time-invariant (LTI) system with natural frequency wn = 10 rad/s and damping ratio zeta = 1.0. The system is driven by a constant unit step input (u = 1.0). The test verifies:

  1. The final output value approaches 1.0 (steady-state response).

  2. The output does not overshoot beyond a small numerical margin (no overshoot for critical damping).

  3. The output time history closely matches the analytic step response for a critically damped system: y(t) = 1 - exp(-wn * t) * (1 + wn * t)