Example: State Space Design for Digital Bus Suspension Control

Sampling Time Selection

Continuous to Discrete Conversion

Designing the Controller

Simulating the Closed-Loop Response

In this example, we will design a digital state space controller for the bus suspension control example. First we will convert the continuous time model to a discrete time model, and then use the pole placement method to design the controller. From the bus suspension state space modeling page, the state space model of the system is:

- Where:
- * body mass (m1) = 2500 kg,

- * suspension mass (m2) = 320 kg,

- * spring constant of suspension system(k1) = 80,000 N/m,

- * spring constant of wheel and tire(k2) = 500,000 N/m,

- * damping constant of suspension system(b1) = 350 Ns/m.

- * damping constant of wheel and tire(b2) = 15,020 Ns/m.

- * control force (u) = force from the controller we are going to
design.
- The design requirements are:
- Overshoot: Output (
**X1-X2**) less than 5% of disturbance (**W**)

- Settling time: Less
than 5 seconds

m1=2500; m2=320; k1 = 80000; k2 = 500000; b1 = 350; b2 = 15020; A=[0 1 0 0 -(b1*b2)/(m1*m2) 0 ((b1/m1)*((b1/m1)+(b1/m2)+(b2/m2)))-(k1/m1) -(b1/m1) b2/m2 0 -((b1/m1)+(b1/m2)+(b2/m2)) 1 k2/m2 0 -((k1/m1)+(k1/m2)+(k2/m2)) 0]; B=[0 0 1/m1 (b1*b2)/(m1*m2) 0 -(b2/m2) (1/m1)+(1/m2) -(k2/m2)]; C=[0 0 1 0]; D=[0 0]; step(A,.1*B,C,D,2,0:0.0001:.005);This plot shows that the spring,

Add the following code to your m-file:

T=.0005; [Ad Bd Cd Dd]=c2dm(A,B,C,D,T,'zoh')

Matlab should return the following:

which represent the new discrete-time state space model.Ad = 1.0000 0.0005 0.0000 0.0000 -0.0035 1.0000 -0.0124 -0.0001 0.0234 0.0000 0.9760 0.0005 0.7705 0.0002 -0.9112 0.9998 Bd = 0.0000 0.0000 0.0000 0.0035 0.0000 -0.0234 0.0000 -0.7705 Cd = 0 0 1 0 Dd = 0 0

To add this, add the following commands in your m-file:

Ai=1; Bi=1; Ci=T; Di=T/2; [Ada,Bda,Cda,Dda]=series(Ad,Bd,Cd,Dd,Ai,Bi,Ci,Di)Matlab will return a new set of integrator-augmented state matrices, with dimension 5 rather than dimension 4. Unfortunately, the output of these equations is now the new integrated state. We must change the output Cda matrix to output the original output state. Add the following line:

Cda=[Cd 0]Since the augmented state is the last state, this outputs the same state as the unaugmented equations.

We first need to decide where to place the closed-loop poles. Since we get to place all five of the closed-loop poles, we can be very selective about where to place them. In particular, we can place them to cancel all of the plant zeros, as well as give us the desired response. First, we will find the plant zeros by converting the plant's digital state equations to a transfer function, and then finding the roots of the numerator. We will use the ss2tf command which takes the state matrices and the selected input as arguments and outputs a transfer function numerator and denominator.

Add the following code to your m-file:

[num,den]=ss2tf(Ad,Bd,Cd,Dd,1); zeros=roots(num)Matlab will return the following:

We will select these three zeros as three of our desired closed-loop poles. One of the other two will be selected at .9992 since a pole there settles in approximately 10000 samples (or 5 seconds). The last pole will be selected at z=.2 since this is sufficiently fast to be insignificant. Add the following code to your m-file:zeros = 0.9986 + 0.0065i 0.9986 - 0.0065i -0.9929

p1=.97+.13i; p2=.97-.13i; p3=-.87; p1=zeros(1); p2=zeros(2); p3=zeros(3); p4=.9992; p5=.5; K=place(Ada,Bda*[1;0],[p1 p2 p3 p4 p5])Matlab will return the following:

place: ndigits= 19 K = 1.0e+09 * 0.0548 0.0000 1.0897 0.0011 0.0009

yout=dstep(Ada-Bda*[1 0]'*K,-.1*Bda,Cda,-.1*Dda,2,10001); t=0:.0005:5; stairs(t,yout);You should see the following plot.

We can see in this plot, that the overshoot is less than 5mm, and the response settles well within 5 seconds.