What is the most effective way of representing and solving complex systems in a way that is software programming friendly?
State-space models describe the behaviour of dynamic systems as a set of first order differential equations (ODEs). They solve many of the limitations of classical control theory that uses transfer functions: they replace an nth order differential equation with a single first order matrix differential equation. This is very useful for computer simulation. Hence the number of state variables is equal with the order of ODE describing the system; and the number of state variables is also equal with the number of conditions needed to completely solve the system.
[image]
The first equation (containing A & B) is the state equation
The second equation (containing C & D) is the output equation
X is the state vector
U is the input vector
A is the state matrix
B is the input matrix
Y is the output vector
C is the output matrix
D is the direct transmission
Example 1: translational mass with spring and damper (zero friction) [1]
To obtain the State Space equations we follow this process:
Example 2: translational mass with two springs (zero friction) [2]
The choice of state variables is not unique. We can choose.
There are 3 energy storage elements so we expect 3 state equations.
For convenience we choose:
x: because spring2 energy is 1/2*k2*x^2
x_dot: because mass energy is 1/2*m*v^2
z: because spring1 energy is 1/2*k1*(z-x)^2
Example 3: mass with spring and damper
m*z_dot_dot + c*z_dot + k*z = F
z_dot_dot + c/m*z_dot + k/m*z = F
x1 = z
x2 = z_dot
x1_dot = z_dot = x2
x2_dot = z_dot_dot = 1/m*f - k/m*x1 - c/m*x2
therefore:
x1_dot = x2
x2_dot = 1/m*f - k/m*x1 - c/m*x2
Matrix: X_dot = Ax + Bu
| x1_dot | = | 0 1 | | x1 | + | 0 |*F
| x2_dot | = | -k/m -c/m | | x2 | | 1/m |
y = C*X
where C*X is the output we want
For displacement output:
y = | 1 0 | * | x1 |
| x2 |
For velocity output:
y = | 0 1 | * | x1 |
| x2 |
Example 4: two rotating masses [2]
The choice of state variables is not unique. We can choose.
There are 3 energy storage elements so we expect 3 state equations.
For convenience we choose:
theta_1: because spring2 energy is 1/2*kr*theta_1^2
theta_1_dot: because mass1 energy is 1/2*J1*alpha_1^2
theta_2_dot: because mass2 energy is 1/2*J2*alpha_2^2