"

11 State Space Modeling

Hongbo Zhang

State space is an important tool for effective control. The capability of modeling a system using the state space is an important skill to control the system. The conversion of a real-world system to state space is the first step in the process of modeling of a system. Overall, modeling the system can provide insights into the system behavior. The system dynamics can be revealed through the modeling process. Hence, the modeling process can enhance our understanding of the underlying system.
Modeling of the underlying system typically starts with the understanding the nature of the system.  All systems have effort and flow.  For a mechanical system, we need to understand the force and torque (effort), as well as position and speed (flow) of the system.  Similarly, for a electrical system, we must understand the voltage (effort) and current (flow) relationships of different components of the circuit in order to provide insights into how the circuit should work.

1) Modeling of Mechanical System State Space

Modeling a mechanical system is useful for understanding the interactions between the components. These interactions can be considered states. State space is particularly good at capturing such trivial relationships between the state variables. An example of the mechanical state space is illustrated through the following example, shown in Figure 11.1.
The graph shows you an example of diagram of the mechanical system to show you the process of deriving state space.
Figure 11.1: The overview of the mechanical system for state space modeling

In this example, the image shows a mechanical system with two masses, M1 and M2, shown in Figure 11.1. The two masses are connected to a spring and damper. An external force F(t) is imposed on the system. Based on the system, there are two states, X1 and X2, shown in Figure 11.2. The two states are correlated. Object 1 is associated with position X1, and object 2 is associated with position X2. The modeling process starts with analysis of M1 and M2.  M1 is associated with two different motions: X1 on the left, and both X1 and X2 on the right. This is similarly true for M2, which is associated with X1 and X2 on the left.  However, it is associated with F(t) on the right.

Overview of the mechanical system, showing the system dynamics equations
Figure 11.2: Overview of the mechanical system, showing the system dynamics equations
Crucial to the modeling are the signs of X1 and X2. For M1, X1 is the position of the object itself. However, X2, is not the position of the object itself; therefore, the X2 sign needs to be negative, and the X1 sign needs to be positive if all terms were on the left side of the equation. In contrast, for M2, the X2 motion should be positive, and X1 needs to be negative. Based on this analysis, we have the following two equations shown in Figure 11.2. These two equations describe the system dynamics of the spring, damper, and mass system. It is evident that for M1 and M2, we have to be very careful when considering X1 and X2 motions at the same time.

In this example, it is easy to ignore the motion associated with the object. For example, mass M1 is associated with X1 and X2 of the spring motion located on the right side of M1. In this case, spring motion X1 is positive and X2 is negative. On the other hand, M2 motion is denoted as X2. On the left side of the M2, the spring is associated with the motions X2 and X1.  Figure 11.2 shows these two different motions.

The state space of the mechanical system shown in Figure 11.2 can be derived through the following steps. First, conduct the variable replacement as shown in Figure 11.3. The purpose of the variable replacement is to reduce the second order equation to two first order equations. 

The state space derivation of the mechanical system.
Figure 11.3: The state space derivation of the mechanical system.

For this:

(1)   \begin{equation*} \dot{x}_1 =V_1(t) \quad \dot{x}_1 =V_2(t) \end{equation*}

Therefore the second order derivative of the equation is

(2)   \begin{equation*} \ddot{x}_1 = \dot{V}_{1}(t) \quad \ddot{x}_1 = \dot{V}_{2}(t) \end{equation*}

With these two variable replacements, we can easily substitute V_1(t) , \dot{V_1}(t), V_2(t) , \dot{V_2}(t) back into the system dynamics equations to obtain the substituted system equations.

(3)   \begin{equation*} \dot{V}_1 = 1/M_1 * (-DV_1 - KX_1 + KX_2) \end{equation*}

(4)   \begin{equation*} \dot{V}_2 = 1/M_2 * (- KX_1 + KX_1 + f(t)) \end{equation*}

Finally, we can write the state space format to represent these equations in the state space format shown in Figure 11.3 above.

2) Modeling of Electrical System State Space

Following the modeling of the mechanical system, it is time to consider modeling of an electrical system. In order to model an electrical system, it is important to understand the relationships between current, voltage, and charge.  These relationships are important for us to be able to model capacitors, inductors, and resistors in a circuit. The relationships of current, voltage, and charge for capacitors, inductors, and resistors are shown in Figure 11.4.

 

Capacitor, inductor, and resistor current, voltage, and charge equations
Figure 11.4: Capacitor, inductor, and resistor current, voltage, and charge equations

In Figure 11.4, you can find a strong pattern showing an inverse relationship between capacitor current and voltage equations.  The capacitor current equation is a derivative equation.  However, its voltage equation is an integral equation.   Similarly, the inductor current equation is a derivative equation, while the voltage equation is an integral equation.  By understanding the patterns, it becomes easy for us to use these equations effectively.

To be most effective in remembering or using the equations, start by remembering the capacitor charge equation. It is a simple equation: Q=CV, where Q = \int i(t) \ dt. It shows that a capacitor behaves similarly to a battery. It accepts a charge from a power source. The voltage is proportional to the charge on the capacitor. On the other hand, charge is the result of the continuous accumulation of current to the capacitor. These two equations are the most fundamental equations in an electrical circuit. These two equations are located at the top right of Figure 4. Understanding these two equations will help you understand the other equations in Figure 11.4.

The first example of the circuit’s state space is shown in Figure 11.5. This example demonstrates a typical RLC circuit.  In this example, the resistor and capacitor are in parallel.  An inductor is in series with the capacitor and resistor lines. The question asks us to find the state space consisting of two states X1 = V_c(t) and X2 = I_l(t). The output Y is I_R(t).

RLC circuit
Figure 11.5: Solve the RLC circuit state space

To solve the state space of an electrical circuit problem, we need to follow the following three steps.

Step 1: Define the goal.  The goal is to find the state space equations for the system. By defining the state space, we can identify the “good” variables, which are the state space variables.

Step 2: Replace “bad” variables with “good” variables.  Here, “bad” variables are the variables irrelevant to the state space. We need to replace these “bad” variables irrelevant to the state space with the “good” variables relevant to the state space.

Step 3: Confirm the state space. Following the replacement of “bad” variables with “good” variables, the state space will be obtained.

 

For this example, we need to follow these specific three steps.

Step 1 (Figure 11.6):  The example of the RLC state space starts by understanding the target of the state space. The target of the state space is a two-by-two matrix. This two-by-two matrix essentially consists of two equations. These two equations are functions of the V_c(t), i_L(t), and input U The input U here is V(t). As such, step 1 is to understand the targeted state space. Once we understand the targeted state space, we start step 2.

Step 2 (Figure 11.7):  The key idea of step 2 is to replace “bad” variables with “good” variables. Step 2 starts by listing V_c(t) and i_L(t). It should be noted that for V_c(t), there is a “bad” variable i_c.  We can easily replace this “bad” variable with V_c and R, which are both “good” variables.  Similarly, for i_L, there is a “bad” variable, V_l. However, V_l can be replaced by the “good” variables V_t and V_c.

Step 3 (Figure 11.8):  Following the replacement of the “bad” variables with “good” variables, we can obtain the targeted state space A and B matrices. Through step 3, we also can obtain the C and D matrices. To calculate the C and D matrices, the Y value must be calculated. Y is i_R. Similarly, for calculation of i_R, the “bad” variable V_R can be replaced by the “good” variables V_C and R. Through the replacement, the C and D matrices will be obtained.

 

Step 1 of the RLC circuit state space
Figure 11.6:  Step 1 of the RLC circuit state space
Step 2 of the RLC circuit state space
Figure 11.7: Step 2 of the RLC circuit state space
Step 3 of the RLC circuit state space
Figure 11.8: Step 3 of the RLC circuit state space

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Robotics and Controls Engineering Copyright © by Hongbo Zhang; Elissa Ledoux; and Vishwas Bedekar is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.