This article is contained in *Scilab Control Engineering Basics* study module, which is used as course material for International Undergraduate Program in Electrical-Mechanical Manufacturing Engineering, Department of Mechanical Engineering, Kasetsart University.

### Module Key Study Points

- Understand state-space representation of a system

- How to convert data between state-space and transfer function form
- Design state feedback using simple pole-placement procedure
- Append an integrator to state feedback to eliminate steady-state error

State feedback control, the topic of this study module, can be thought of as a foundation for the so-called *“modern control*”* originated since ’60. In contrast to the frequency domain analysis of the classical control theory, modern control theory formulates the time-domain data as a system of first-order differential equations in matrix form called state-space representation, which is a mathematical model of the given system as a set of input, output, and state variable.

* This terminology is commonly used in the control literature, regardless of calling a 50-year-old approach modern could sometimes create confusion to a beginner. Indeed, the modern control approach is so eternal that later developments have to be called post-modern.

First, we give some review on state-space representation, which is essential for the state feedback design discussed later on. Let us take our simple DC motor joint model as an example. A dynamic equation that governs the motion can be written as

(1)

To simplify the notation, the time dependent is omitted. Define the system states as the joint position and velocity

(2)

By using these state variables, (1) can be rewritten as a system of first order differential equations

(3)

or in matrix form as

(4)

and the output equation, with

(5)

In general, a linear time-invariant (LTI) system can be described as

(6)

(7)

where represent the state, input, and output vectors, respectively. (6) is called a *state equation*, and (7) an *output equation*. Note that this representation is not unique, but depends on how the states are defined. Moreover, though in our robot joint example the states are conveniently joint position and velocity, for the general case the states might not have any physical meaning, and hence could not be measured.

For a system represented by (6) and (7), it is easy to show that the corresponding transfer function equals

(8)

To convert between state space and transfer function in Scilab, use commands ss2tf and tf2ss. For example, for a plant transfer function

-->s=poly(0,'s'); -->P = 1/(s^2+s) P = 1 ----- 2 s + s |

This can be converted to state-space form by

-->Pss = tf2ss(P); |

Verify that the matrices conform to (4) with

-->Pss.A ans = 0. 1. 0. - 1. -->Pss.B ans = 0. 1. -->Pss.C ans = 1. 0. |

Convert back to transfer function by ss2tf

-->P1=ss2tf(Pss) P1 = 1 ----- 2 s + s |

Note that a transfer function for a physical system must be strictly proper; i.e., its frequency response must go to zero as the frequency approaches infinity. (No system could have unlimited bandwidth in reality.) This implies its state-space representation must have zero matrix.

### State Feedback Control

Obviously, a state feedback control is feasible in practice when all states are measurable, such as the robot joint dynamics in (4) with joint position and velocity as state variables. State feedback design can be performed with a scheme known as *pole placement*, or more systematic way using *Ackerman’s formula*.

The idea of pole placement is simple. Specify pole locations of the closed-loop system that yields desired stability and performance criteria. Then choose the state feedback control gains to move the closed-loop poles to such locations. A necessary condition is that the plant must be stabilizable. The details can be studied from most undergraduate control textbooks.

The state feedback controller is simply a vector of gains connecting the states to the plant input. So, for a set of specifed closed-loop poles, the design goal is to compute . To see this more clearly, assume the command input is zero. We have at the plant input

(9)

and the closed-loop state equation

(10)

The closed-loop poles can be computed from

(11)

Meanwhile, specifying the closed-loop poles yields the characteristic polynomial

(12)

Hence, we can compare (11) and (12) to solve for manually, which could be tedious for higher order equations. Scilab provides a convenient command ppol to solve for , given the matrices and a vector of desired poles as arguments.

Ex. 1: Let us design a state feedback control for the simple robot joint described by (4), (5) with . Specify the desired properties of closed-loop system as follows:

- overshoot less than 5%
- rise time less than 0.1 sec

By standard analysis of 2nd order system, we have that the specification (1) translates to damping ratio , and using the relation , we have for (2) that rad/s.. Substituting these two values to the closed-loop characteristic polynomials yields

(13)

with poles at . The above procedure can be carried out by the following Scilab commands

-->z=0.7; wn=18; -->lamda = s^2+2*z*wn*s+wn^2; -->clpoles = roots(lamda) clpoles = - 12.6 + 12.854571i - 12.6 - 12.854571i |

and with the plant data from Pss calculated earlier, the state feedback gains can be computed by this command

-->K=ppol(Pss.A,Pss.B,clpoles) K = 324. 24.2 |

Construct Xcos model in Figure 1, or download ppol.zcos, to simulate the system. Notice in the diagram that the plant is conveniently represented in transfer function form since the joint velocity and angle can be accessed. Also, in computing the state feedback gains, we do not take into consideration the command input. Hence the step response will have nonzero steady-state error that needs to be compensated with a feedforward gain. An easy way to compute this gain is by checking the DC gain of feedback system

-->cltf=ss2tf(syslin('c',Pss.A-Pss.B*K,Pss.B,Pss.C)) cltf = 1 --------------- 2 324 + 25.2s + s |

which can be found by letting ,and at the result is . So, to compensate this DC offset, we apply a feedforward gain of 324 to both the step and disturbance inputs. With the disturbance of magnitude 0.1 enters the system at time t = 1 sec, the simulation yields the step response in Figure 2. We see that the transient period conforms to the desired spec; i.e., (1) overshoot less than 5% (2) rise time less than 0.1 sec. However, the closed-loop system cannot get rid of the constant disturbance of 0.1 after t = 1 sec. This result is predictable, because the state feedback is just a pair of static gains with no dynamics to compensate the disturbance entering at the plant input. In the next example, we suggest a way to circumvent this drawback.

Ex. 2: From the PID example discussed earlier, we show the advantage of integral term in eliminating the steady-state error. This principle can be applied to the state feedback scheme by augmenting an integrator as shown in Figure 3. There exist some systematic procedure to augment an integrator and design all gains simultaneously, but that means the second-order relationship in the previous example is no longer applicable. So in this example we still use the pole-placement for second-order system as before, and then adjust the integral gain afterwards to achieve the desired response.

Notice that the integrator replaces the DC gain compensation in Figure 1 to correct the response to the target steady-state value. Using the same state feedback gains results in slower transient response than Figure 2, so we redesign the pole-placement step by increasing to 40 rad/s.

-->z=0.7; wn = 40; -->lamda = s^2+2*z*wn*s+wn^2; -->clpoles = roots(lamda) clpoles = - 28. + 28.565714i - 28. – 28.565714i |

This yields a new pair of state feedback gains.

-->K = ppol(Pss.A,Pss.B,clpoles) K = 1600. 55. |

The DC gain of closed-loop system

-->cltf=clean(ss2tf(syslin(‘c’,Pss.A-Pss.B*K,Pss.B,Pss.C))) cltf = 1 ------------- 2 1600 + 56s + s |

equals . So a gain of is applied as compensation to the disturbance input to yield the same level as in previous example; i.e., . By experimenting with the integral gain, we select , which gives the response as in Figure 4. The rise time and overshoot satisfy the specification given in Ex. 2, while the system recovers to the desired value after the disturbance is applied at t = 1 sec.

### Summary

In this module, we discuss state-space representation, using the robot joint driven by DC motor model as an example. The two state variables are the joint position and velocity, which are measurable in a real application. Hence the state feedback design scheme is suitable for this system. Joint position is normally obtained from an encoder using hardware or software readouts. Joint velocity may be measured via a tachometer, or obtained indirectly by counting encoder pulses per known time period. Finally, we show how to append an integrator to a state feedback design to eliminate steady-state error.

### References

- V.Toochinda. Robot Analysis and Control with Scilab and RTSX. Mushin Dynamics, 2014.