LTI¶
- class pathsim.blocks.lti.StateSpace(A=-1.0, B=1.0, C=-1.0, D=1.0, initial_value=None)[source]¶
Bases:
BlockThis block defines a linear time invariant (LTI) multi input multi output (MIMO) state space model with the structure
\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]where A, B, C and D are the state space matrices, x is the state, u the input and y the output vector.
Example
A SISO state space block with two internal states can be initialized like this:
S = StateSpace( A=-np.eye(2), B=np.ones((2, 1)), C=np.ones((1, 2)), D=1.0 )
and a MIMO (2 in, 2 out) state space block with three internal states can be initialized like this:
S = StateSpace( A=-np.eye(3), B=np.ones((3, 2)), C=np.ones((2, 3)), D=np.ones((2, 2)) )
- Parameters:
A (array_like) – real valued state space matrices
B (array_like) – real valued state space matrices
C (array_like) – real valued state space matrices
D (array_like) – real valued state space matrices
initial_value (array_like, None) – initial state / initial condition
- op_dyn¶
internal dynamic operator for state equation
- Type:
- op_alg¶
internal algebraic operator for mapping to outputs
- Type:
- class pathsim.blocks.lti.TransferFunctionPRC(Poles=[], Residues=[], Const=0.0)[source]¶
Bases:
StateSpaceThis block defines a LTI (MIMO for pole residue) transfer function.
The transfer function is defined in pole-residue-constant (PRC) form
\[\mathbf{H}(s) = \mathbf{C} + \sum_n^N \frac{\mathbf{R}_n}{s - p_n}\]where ‘Poles’ are the scalar (possibly complex conjugate) poles of the transfer function and ‘Residues’ are the possibly matrix valued (in MIMO case) and complex conjugate residues of the transfer function. ‘Const’ has same shape as ‘Residues’.
Upon initialization, the state space realization of the transfer function is computed using a minimal gilbert realization.
The resulting state space model of the form
\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]is handled the same as the ‘StateSpace’ block, where A, B, C and D are the state space matrices, x is the internal state, u the input and y the output vector.
- Parameters:
Poles (array) – transfer function poles
Residues (array) – transfer function residues
Const (array, float) – constant term of transfer function
- class pathsim.blocks.lti.TransferFunction(Poles=[], Residues=[], Const=0.0)[source]¶
Bases:
TransferFunctionPRCAlias for TransferFunctionPRC.
Deprecated since version 1.0.0: Use
TransferFunctionPRC()instead.
- class pathsim.blocks.lti.TransferFunctionZPG(Zeros=[], Poles=[-1], Gain=1.0)[source]¶
Bases:
StateSpaceThis block defines a LTI (SISO) transfer function.
The transfer function is defined in zeros-poles-gain (ZPG) form
\[\mathbf{H}(s) = k \frac{(s - z_1)(s - z_2)\cdots(s - z_m)}{(s - p_1)(s - p_2)\cdots(s - p_n)}\]where Zeros are the scalar (possibly complex conjugate) zeros of the transfer function, and Poles are the poles (denominator zeros) of the transfer function. Gain is the scalar factor k.
Upon initialization, the state space realization of the transfer function is computed using scipy.signal.ZerosPolesGain(Zeros, Poles, Gain).to_ss().
The resulting state space model of the form
\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]is handled the same as the ‘StateSpace’ block, where A, B, C and D are the state space matrices, x is the internal state, u the input and y the output vector.
- Parameters:
Poles (array_like) – transfer function poles
Zeros (array_like) – transfer function zeros
Gain (float) – gain term of transfer function
- class pathsim.blocks.lti.TransferFunctionNumDen(Num=[1], Den=[1, 1])[source]¶
Bases:
StateSpaceThis block defines a LTI (SISO) transfer function.
The transfer function is defined in polynomial (numerator-denominator) form
\[\mathbf{H}(s) = \frac{b_n + b_{n-1} s + \dots + b_{0} s^n}{a_m + a_{m-1} s + \dots + a_{0} s^m}\]where Num is the list of numerator polynomial coefficients and Den the list of denominator coefficients.
Upon initialization, the state space realization of the transfer function is computed using scipy.signal.TransferFunction(Num, Den).to_ss().
The resulting state space model of the form
\[\begin{split}\begin{eqnarray} \dot{x} &= \mathbf{A} x + \mathbf{B} u \\ y &= \mathbf{C} x + \mathbf{D} u \end{eqnarray}\end{split}\]is handled the same as the ‘StateSpace’ block, where A, B, C and D are the state space matrices, x is the internal state, u the input and y the output vector.
- Parameters:
Num (array_like) – numerator polynomial coefficients
Den (array_like) – denominator polynomial coefficients