State-Space Realization: Bridging Transfer Functions and State-Space
Deriving a transfer function from a state-space model is straightforward. However, the inverse problem—constructing an internal description from a transfer function—is less trivial. This is the focus of realization theory, which explores creating state-space models from transfer functions.
Key Concepts
-
A single transfer function can have an infinite number of state-space representations. This arises because the choice of state variables is not unique; different selections lead to different state-space models while preserving the input-output relationship captured by the transfer function.
-
Realization theory focuses on developing canonical forms, which are standardized structures for state-space representations. These forms simplify analysis and design and include:
- Controllable Canonical Form (CCF): The CCF highlights the controllability of the system, making it easier to design state feedback controllers.
- Observable Canonical Form (OCF): The OCF emphasizes the observability of the system, aiding in designing observers to estimate the system’s state from output measurements.
- Diagonal Form: This form applies when the system has distinct eigenvalues (poles). The diagonal system matrix simplifies analysis as the system’s modes are decoupled.
- Jordan Form: The Jordan form handles systems with repeated eigenvalues using a block structure in the A matrix representing the system’s modes and relationships.
- Modified Jordan Form: This form specifically addresses systems with complex conjugate eigenvalues. It uses a block structure in A to capture the oscillatory nature of these modes.
Steps for State-Space Realization
The general steps for realizing a state-space model from a transfer function are:
- Partial Fraction Expansion: Decompose the transfer function into simpler first- and second-order terms, corresponding to real and complex poles.
- Block Diagram Representation: Create a block diagram using integrators, gains, and summing junctions to represent the structure of the transfer function. Each block can be associated with a state variable.
- State Assignment: Choose appropriate state variables based on the block diagram. This selection determines the specific canonical form.
- Derive State-Space Matrices: Express the relationships between state variables, inputs, and outputs in matrix form to derive the A, B, C, and D matrices of the state-space model.
Importance of State-Space Realization
State-space realization is crucial in control design because:
- Controller Design: State-space models are extensively used in modern control techniques. Methods like pole placement, optimal control (LQR), and Kalman filtering rely on state-space representations.
- System Analysis: Canonical forms make analyzing system properties like controllability, observability, and stability easier.
- Simulation and Implementation: State-space models are well-suited for numerical simulation and digital implementation of controllers.
Example: Controllable and Observable Canonical Forms
Consider the transfer function $G(s) = \frac{b_2s^2 + b_1s + b_0}{s^3 + a_2s^2 + a_1s + a_0}$.
Controllable Canonical Form (CCF)
- State-Space Matrices:
- $A = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -a_0 & -a_1 & -a_2 \end{bmatrix}$
- $B = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}$
- $C = \begin{bmatrix} b_0 & b_1 & b_2 \end{bmatrix}$
- $D = 0$
Observable Canonical Form (OCF)
- State-Space Matrices:
- $A = \begin{bmatrix} -a_2 & 1 & 0 \\ -a_1 & 0 & 1 \\ -a_0 & 0 & 0 \end{bmatrix}$
- $B = \begin{bmatrix} b_2 \\ b_1 \\ b_0 \end{bmatrix}$
- $C = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}$
- $D = 0$
Python Demos
Controllable Canonical Form (CCF)
import numpy as np
import control as ct
# Define transfer function coefficients
b2, b1, b0 = 2, 3, 1
a2, a1, a0 = 5, 4, 2
# Construct the state space system
num = [b2, b1, b0]
den = [1, a2, a1, a0]
G = ct.tf2ss(num, den)
# Realize the state-space model in CCF
sys_ccf, T = ct.canonical_form(G, form='reachable')
# Print the state-space matrices
print("A = \n", sys_ccf.A)
print("B = \n", sys_ccf.B)
print("C = \n", sys_ccf.C)
print("D = \n", sys_ccf.D)
Observable Canonical Form (OCF)
import numpy as np
import control as ct
# Define transfer function coefficients
b2, b1, b0 = 2, 3, 1
a2, a1, a0 = 5, 4, 2
# Construct the transfer function
num = [b2, b1, b0]
den = [1, a2, a1, a0]
G = ct.tf2ss(num, den)
# Realize the state-space model in OCF
sys_ocf, T = ct.canonical_form(G, form='observable')
# Print the state-space matrices
print("A = \n", sys_ocf.A)
print("B = \n", sys_ocf.B)
print("C = \n", sys_ocf.C)
print("D = \n", sys_ocf.D)
Similar Realizations
A state-space realization of a system is not unique, and there are infinitely many ways to represent the same system. Similar realizations can be obtained through a similarity transformation.
-
Given a realization \(\Sigma\) and a nonsingular matrix \(T \in \mathbb{R}^{n \times n}\), new states can be defined as \(Tx^* = x\).
-
A new state-space model \(\Sigma^*\) can be defined as:
\(\dot{x}^*(t) = T^{-1}ATx^*(t) + T^{-1}Bu(t)\)
\(y(t) = CTx^*(t) + Du(t)\)
-
This new realization, \(\Sigma^*\), is said to be similar to \(\Sigma\) and also realizes \(G(s)\).
-
The state-space representation of \(\Sigma^*\) is given by:
\(\Sigma^* = \begin{bmatrix} T^{-1}AT & T^{-1}B \\ \hline CT & D \end{bmatrix}\)
Relation between different realizations The following two state-space representations realize the same system and are similar:
\(\Sigma = \begin{bmatrix} -a_2 & 1 & 0 & b_2 \\ -a_1 & 0 & 1 & b_1 \\ -a_0 & 0 & 0 & b_0 \\ \hline 1 & 0 & 0 & d \end{bmatrix}\), \(\Sigma^* = \begin{bmatrix} 0 & 0 & -a_0 & b_0 \\ 1 & 0 & -a_1 & b_1 \\ 0 & 1 & -a_2 & b_2 \\ \hline 0 & 0 & 1 & d \end{bmatrix}\).
The states in the two systems are related by:
- \(x^*_1 = x_3\)
- \(x^*_2 = x_2\)
- \(x^*_3 = x_1\)
or
\(x^* = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{bmatrix} x\)
It can be verified that \(A^* = T^{-1}AT\), \(B^* = T^{-1}B\), and \(C^* = CT\).
Python code example The following Python code demonstrates the similarity transformation between the two state-space models above:
import control as ct
import numpy as np
a0, a1, a2 = 80, 81, 82
b0, b1, b2 = 60, 61, 62
A = np.array([[-a2, 1, 0],[-a1, 0, 1],[-a0, 0, 0]])
B = np.array([[b2],[b1],[b0]])
C = np.array()
D = np.array()
G = ct.ss(A,B,C,D)
print(G)
T = np.array([,,])
Gt = ct.similarity_transform(G,T)
print(Gt)
In this code, the similarity_transform
function from the control
library is then used to transform the original system into a similar system Gt
using the transformation matrix T
.