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

Sampling Time Selection

The first step in the design of a discrete-time controller is to convert the continuous plant to its discrete time equivalent. First, we need to pick an appropriate sampling time, T. In this example, selection of sampling time is very important since a step in the road surface very quickly affects the output. Physically, what happens is the road surface suddenly lifts the wheel, compressing the spring, K2, and the damper, b2. Since the suspension mass is relatively low, and the spring fairly stiff, the suspension mass rises quickly, increasing X2 almost immediately. Since the controller can only see the effect of the disturbance after a complete sampling period, we have to pick a sampling time, T, short enough so that the output (X1-X2) does not exceed the 5% requirement in one sampling period. To pick the sampling period, we need to closely examine the beginning of the step response. If you remember from the modeling page, the output quickly goes negative in response to a step disturbance, and then begins to oscillate. We will simulate just the beginning of this response by setting the time vector input to the step function to range from 0 to .005. The response to a .1m step input is simulated by multiplying the B matrix by .1. Create a new m-file and enter the following code:

This plot shows that the spring, K1 compresses very quickly, and exceeds our requirement of 5mm in response to a .1m step after only a little more than 0.001s. Therefore, we will set T=.0005s in order to give the controller a chance to respond.

Continuous to Discrete Conversion

Now that we have selected a sampling time, we can convert the plant to discrete time. MATLAB can be used to convert the above state space model, sus, to a discrete state space model, sus_d, by using the c2d command. The c2d command takes three arguments: the continuous time system, the sampling time, T, and the type of hold circuit. In this example we will use zero-order hold ('zoh'). Refer to the Digital Control Tutorials page for more information.

Add the following code to your m-file:

MATLAB should return the following:

which represent the new discrete-time state space model.

Adding an Integrator

In this example, we will need to add an integrator to the system in order to drive the steady-state response to zero. We will add this integrator in series with the plant. This will have the effect of adding another state to the plant. An integrator in discrete time state space can be represented as a trapezoidal approximation of integration over each sample period as follows:

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

Designing the Controller

The structure of the controller is similar to the structure of the
continuous-time state space controller. We will now use the place command to compute the gain matrix, K, which will, in feedback, give us the desired closed-loop poles.

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 they go. 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 tfdata command which takes a system (sus_d) as its argument and outputs a transfer function numerator and denominator. Since the suspension system (sus_d) has two inputs, only one input must be selected. Notice how the first input is selected in the following code.

Add the following code to your m-file:

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=.5 since this is sufficiently fast to be insignificant. Add the following code to your m-file: MATLAB will return the following:

Simulating the Closed-Loop Response

We can use the step command to simulate the closed-loop response. Since multiplying the state vector by K in our controller only returns a single signal, u, we need to add a row of zeros to K by multiplying it by [1 0]T. This is identical to what was done in the continuous design to compensate for the fact that there are two inputs to the plant, but only one is a control input. We will simulate with a negative .1m step disturbance in the road to give us a positive deflection of the bus for aesthetic reasons. Enter the following code into your m-file: 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.


Digital Control Examples
Cruise Control | Motor Speed | Motor Position | Bus Suspension | Inverted Pendulum | Pitch Controller | Ball and Beam

Bus Suspension Examples
Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control | Simulink

Tutorials

MATLAB Basics | MATLAB Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control | Simulink Basics | Simulink Modeling | Examples