Mathematical FormulationΒΆ
SimuPy assumes systems have no direct feedthrough between inputs and outputs; this discpline avoids algebraic loops. You can simulate a system model that includes a feedthrough by augmenting the system. Augment the system using the input by including input components in the state and using derivatives of those signals in the control input. You can augment the system using the output by including the original output components in the state and using integrals of those signals in the system output. However, there is no requirement for the system to have a state, so
and
are both valid formulations. Here, \(t\) is the time variable, \(x\) is the system state, \(u\) is the system input, and \(y\) is the sytem output. We call \(f\) the state equation and \(h\) the output equation. SimuPy can also handle discrete-time systems with sample period \(\Delta t\) of the form
and
where \([k]\) indicates signal values over the half-open interval \((k\, \Delta t, (k+1) \Delta t]\) which are updated at time \(t=k\, \Delta t\) for discrete-time systems and \((k)\) indicates a zero-order hold sample of the signal at time \(k \, \Delta t\) for continuous-time systems. This formulation gives the expected results for models with only discrete-time sub-systems of the same update rate \(\Delta t\) which can be combined into a single system of the form
and makes sense in general for hybrid-time simulation.
This formulation is also consistent with common linear, time-invariant (LTI) system algebras and transformations. For example, the dynamics of the LTI system
with state-feedback
are the same as the autonomous system
Similarly, timing transformations are consistent. The discrete-time equivalent of the continuous-time LTI system above,
will travel through the same state trajectory at times \(k\, \Delta t\) if both are subject to the same piecewise constant inputs and the state and input matrices are related by the zero-order hold transformation
The accuracy of these algebras and transformations are demonstrated in the
discrete_lti.py
example and are incorporated into the
test_block_diagram.py
tests.