Block Diagram Algebra & Interconnections¶
algebra
¶
System interconnection and block diagram algebra functions.
series
¶
Connect two or more systems in series (cascade).
The output of each system is connected to the input of the next system:
.. math::
u \longrightarrow G_1(s) \longrightarrow G_2(s) \longrightarrow \cdots \longrightarrow G_n(s) \longrightarrow y
The equivalent transfer function is the product of individual blocks:
.. math::
G_{\text{total}}(s) = G_n(s) \cdots G_2(s) G_1(s)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*systems
|
LinearTimeInvariant | float | int | number
|
Two or more systems (or scalar gains) to cascade in order. |
()
|
Returns:
| Type | Description |
|---|---|
LinearTimeInvariant
|
The resulting series-connected system. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no systems are provided. |
Source code in src/ctrlpy/algebra.py
parallel
¶
Connect two or more systems in parallel.
Inputs are connected together and outputs are summed:
.. math::
y(t) = \sum_{i=1}^n y_i(t)
The equivalent transfer function is the sum of individual blocks:
.. math::
G_{\text{total}}(s) = G_1(s) + G_2(s) + \cdots + G_n(s)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*systems
|
LinearTimeInvariant | float | int | number
|
Two or more systems (or scalar gains) to connect in parallel. |
()
|
Returns:
| Type | Description |
|---|---|
LinearTimeInvariant
|
The resulting parallel-connected system. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no systems are provided. |
Source code in src/ctrlpy/algebra.py
feedback
¶
Connect two systems in a closed-loop feedback interconnection.
The closed-loop system relates reference \(r(t)\) to output \(y(t)\):
.. math::
e(t) = r(t) + \text{sign} \cdot (H y)(t), \quad y(t) = (G e)(t)
The closed-loop transfer function is given by:
.. math::
T(s) = \frac{G(s)}{1 - \text{sign} \cdot G(s) H(s)}
For standard negative feedback (\(\text{sign} = -1\)):
.. math::
T(s) = \frac{G(s)}{1 + G(s) H(s)}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sys1
|
LinearTimeInvariant | float | int | number
|
Forward path system \(G(s)\). |
required |
sys2
|
LinearTimeInvariant | float | int | number
|
Feedback path system \(H(s)\), defaults to 1 (unity feedback). |
1
|
sign
|
int | float
|
Feedback sign. Defaults to -1 for standard negative feedback. |
-1
|
Returns:
| Type | Description |
|---|---|
LinearTimeInvariant
|
Closed-loop system \(T(s)\). |