Modeling Bus Suspension Transfer Function
Modeling Bus Suspension Transfer Function
Zidarta - [email protected]
Physical setup
Photo courtesy: Eisenhower Center
Designing an automatic suspension system for a bus turns out to be an interesting control problem. When the suspension system is designed, a 1/4 bus model (one of the four wheels) is used to simplify the problem to a one dimensional spring-damper system. A diagram of this system is shown below: 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.
Design requirements:
A good bus suspension system should have satisfactory road holding ability, while still providing comfort when riding over bumps and holes in the road. When the bus is experiencing any road disturbance (i.e. pot holes, cracks, and uneven pavement),the bus body should not have large oscillations, and the oscillations should dissipate quickly. Since the distance X1-W is very difficult to measure, and the deformation of the tire (X2-W) is negligible, we will use the distance X1-X2 instead of X1-W as the output in our problem. Keep in mind that this is an estimation. The road disturbance (W) in this problem will be simulated by a step input. This step could represent the bus coming out of a pothole. We want to design a feedback controller so that the output (X1-X2) has an overshoot less than 5% and a settling time shorter than 5 seconds. For example, when the bus runs onto a 10 cm high step, the bus body will oscillate within a range of +/- 5 mm and return to a smooth ride within 5 seconds.
Equations of motion:
From the picture above and Newton's law, we can obtain the dynamic equations as the following:
Laplace Transform of the above equations. The derivation from above equations of the Transfer Functions G1(s) and G2(s) of output,X1-X2, and two inputs,U and W, are as follows.
Find the inverse of matrix A and then multiple with inputs U(s)and W(s) on the right hand side as the following:
When we want to consider input U(s) only, we set W(s) = 0. Thus we get the transfer function G1(s) as the following:
When we want to consider input W(s) only, we set U(s) = 0. Thus we get the transfer function G2(s) as the following:
Also we can express and derive the above equations in state-space form. Even though this approach will express the first two equations above in the standard form of matrix, it will simplify the transfer function without going through any algebra, because we can use a function ss2tf to transform from state-space form to transfer function form for both inputs
Now, let's create a new m-file and enter the following code:
m1=2500; m2=320; k1=80000; k2=500000; b1 = 350; b2 = 15020; nump=[(m1+m2) b2 k2]; denp=[(m1*m2) (m1*(b1+b2))+(m2*b1) (m1*(k1+k2))+(m2*k1)+(b1*b2) (b1*k2)+(b2*k1) k1*k2]; 'G(s)1' printsys(nump,denp) num1=[-(m1*b2) -(m1*k2) 0 0]; den1=[(m1*m2) (m1*(b1+b2))+(m2*b1) (m1*(k1+k2))+(m2*k1)+(b1*b2) (b1*k2)+(b2*k1) k1*k2]; 'G(s)2' printsys(0.1*num1,den1)
Open-loop response
We can use Matlab to display how the original open-loop system performs (without any feedback control). Add the following commands into the m-file and run it in the Matlab command window to see the response of unit step actuated force input and unit step disturbance input.Note that the step command will generate the unit step inputs for each input.
step(nump,denp)
From this graph of the open-loop response for a unit step actuated force, we can see that the system is underdamped. People sitting in the bus will feel very small amount of oscillation and the steady-state error is about 0.013 mm. Moreover, the bus takes very unacceptably long time for it to reach the steady state or the settling time is very large. The solution to this problem is to add a feedback controller into the system's block diagram.
step(0.1*num1,den1)
From this graph of open-loop response for 0.1 m step disturbance, we can see that when the bus passes a 10 cm high bump on the road, the bus body will oscillate for an unacceptably long time(100 seconds) with larger amplitude, 13 cm, than the initial impact. People sitting in the bus will not be comfortable with such an oscillation. The big overshoot (from the impact itself) and the slow settling time will cause damage to the suspension system. The solution to this problem is to add a feedback controller into the system to improve the performance. The schematic of the closedloop system is the following:
From the above transfer functions and schematic, we can draw the bus-system block diagram as the following:
From the schematic above we see that: Plant = nump/denp F * Plant=num1/den1 so that F=num1/(den1*Plant)
(1) where u is the force from the engine. For this example, let's assume that
Design requirements
The next step in modeling this system is to come up with some design criteria. When the engine gives a 500 Newton force, the car will reach a maximum velocity of 10 m/s (22 mph). An automobile should be able to accelerate up to that speed in less than 5 seconds. Since this is only a cruise control system, a 10% overshoot on the velocity will not do much damage. A 2% steady-state error is also acceptable for the same reason. Keeping the above in mind, we have proposed the following design criteria for this problem: Rise time < 5 sec Overshoot < 10% Steady state error < 2%
Matlab representation
1. Transfer Function
To find the transfer function of the above system, we need to take the Laplace transform of the modeling equations (1). When finding the transfer function, zero initial conditions must be assumed. Laplace transforms of the two equations are shown below.
Since our output is the velocity, let's substitute V(s) in terms of Y(s)
To solve this problem using Matlab, copy the following commands into an new m-file:
m=1000; b=50; u=500; num=[1]; den=[m b];
These commands will later be used to find the open-loop response of the system to a step input. But before getting into that, let's take a look at another representation, the state-space.
2. State-Space
We can rewrite the first-order modeling equation (1) as the state-space model.
To use Matlab to solve this problem, create an new m-file and copy the following commands:
m b u A B C D = = = = = = = 1000; 50; 500; [-b/m]; [1/m]; [1]; 0;
Note: It is possible to convert from the state-space representation to the transfer function or vise versa using Matlab. To learn more about the conversion, click Conversion
Open-loop response
Now let's see how the open-loop system responds to a step input. Add the following command onto the end of the m-file written for the tranfer function (the m-file with num and den matrices) and run it in the Matlab command window: step (u*num,den) You should get the following plot:
To use the m-file written for the state-space (the m-file with A, B, C, D matrices), add the following command at the end of the m-file and run it in the Matlab command window: step (A,u*B,C,D) You should get the same plot as the one shown above. From the plot, we see that the vehicle takes more than 100 seconds to reach the steady-state speed of 10 m/s. This does not satisfy our rise time criterion of less than 5 seconds.
The transfer function in the plant is the transfer function derived above {Y(s)/U(s)=1/ms+b}. The controller will to be designed to satisfy all design criteria. Four different methods to design the controller are listed at the bottom of this page. You may choose on PID, Root-locus, Frequency response, or State-space.
A common actuator in control systems is the DC motor. It directly provides rotary motion and, coupled with wheels or drums and cables, can provide transitional motion. The electric circuit of the armature and the free body diagram of the rotor are shown in the following figure: For this example, we will assume the following values for the physical parameters. These values were derived by experiment from an actual motor in Carnegie Mellon's undergraduate controls lab. * moment of inertia of the rotor (J) = 0.01 kg.m^2/s^2 * damping ratio of the mechanical system (b) = 0.1 Nms * electromotive force constant (K=Ke=Kt) = 0.01 Nm/Amp * electric resistance (R) = 1 ohm * electric inductance (L) = 0.5 H * input (V): Source Voltage * output (theta): position of shaft * The rotor and shaft are assumed to be rigid The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by the following equations: In SI units (which we will use), Kt (armature constant) is equal to Ke (motor constant). From the figure above we can write the following equations based on Newton's combined with Kirchhoff's law: law
1. Transfer Function
Using Laplace Transforms, the above modeling equations can be expressed in terms of s.
By eliminating I(s) we can get the following open-loop transfer function, where the rotational speed is the output and the voltage is the input.
2. State-Space
In the state-space form, the equations above can be expressed by choosing the rotational speed and electric current as the state variables and the voltage as an input. The output is chosen to be the rotational speed.
Design requirements
First, our uncompensated motor can only rotate at 0.1 rad/sec with an input voltage of 1 Volt (this will be demonstrated later when the open-loop response is simulated). Since the most basic requirement of a motor is that it should rotate at the desired speed, the steady-state error of the motor speed should be less than 1%. The other performance requirement is that the motor must accelerate to its steady-state speed as soon as it turns on. In this case, we want it to have a settling time of 2 seconds. Since a speed faster than the reference may damage the equipment, we want to have an overshoot of less than 5%. If we simulate the reference input (r) by an unit step input, then the motor speed output should have:
Settling time less than 2 seconds Overshoot less than 5% Steady-state error less than 1%
Now let's see how the original open-loop system performs. Add the following commands onto the end of the mfile and run it in the Matlab command window:
step(num,den,0:0.1:3) title('Step Response for the Open Loop System')
From the plot we see that when 1 volt is applied to the system, the motor can only achieve a maximum speed of 0.1 rad/sec, ten times smaller than our desired speed. Also, it takes the motor 3 seconds to reach its steady-state speed; this does not satisfy our 2 seconds settling time criterion.
2. State-Space
We can also represent the system using the state-space equations. Try the following commands in a new m-file.
J=0.01; b=0.1; K=0.01; R=1; L=0.5; A=[-b/J K/J -K/L -R/L]; B=[0 1/L]; C=[1 0]; D=0; step(A, B, C, D)
Run this m-file in the Matlab command window, and you should get the same output as the one shown above.
System Equations
The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by the following equations:
In SI units (which we will use), Kt (armature constant) is equal to Ke (motor constant). From the figure above we can write the following equations based on Newton's law combined with Kirchhoff's law:
1. Transfer Function
Using Laplace Transforms the above equations can be expressed in terms of s.
By eliminating I(s) we can get the following transfer function, where the rotating speed is the output and the voltage is an input.
However during this example we will be looking at the position, as being the output. We can obtain the position by integrating Theta Dot, therefore we just need to divide the transfer function by s.
2. State Space
These equations can also be represented in statespace form. If we choose motor position, motor speed, and armature current as our state variables, we can write the equations as follows:
Design requirements
We will want to be able to position the motor very precisely, thus the steady-state error of the motor position should be zero. We will also want the steady-state error due to a disturbance, to be zero as well. The other performance requirement is that the motor reaches its final position very quickly. In this case, we want it to have a settling time of 40ms. We also want to have an overshoot smaller than 16%. If we simulate the reference input (R) by a unit step input, then the motor speed output should have:
Settling time less than 40 milliseconds Overshoot less than 16% No steady-state error No steady-state error due to a disturbance
Now let's see how the original open-loop system performs. Add the following command onto the end of the m-file and run it in the Matlab command window:
step(num,den,0:0.001:0.2)
You should get the following plot: From the plot we see that when 1 volt is applied to the system, the motor position changes by 6 radians, six times greater than our desired position. For a 1 volt step input the motor should spin through 1 radian. Also, the motor doesn't reach a steady state which does not satisfy our design criteria
2. State Space
We can put the state space equations into Matlab by defining the system's matrices as follows:
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6; A=[0 1 0 0 -b/J K/J 0 -K/L -R/L]; B=[0 ; 0 ; 1/L]; C=[1 0 0]; D=[0];
There are numerical scaling problems with this representation of the dynamic equations. To fix the problem, we scale time by tscale = 1000. Now the output time will be in milliseconds rather than in seconds. The equations are given by
tscale = 1000; J=3.2284E-6*tscale^2;
b=3.5077E-6*tscale; K=0.0274*tscale; R=4*tscale; L=2.75E-6*tscale^2; A=[0 1 0 0 -b/J K/J 0 -K/L -R/L]; B=[0 ; 0 ; 1/L]; C=[1 0 0]; D=[0];
The output appears the same as when obtained through the transfer function, but the time vector must be divided by tscale.
[y,x,t]=step(A,B,C,D); plot(t/tscale,y) ylabel('Amplitude') xlabel('Time (sec)')
M m b l I F x theta
mass of the cart 0.5 kg mass of the pendulum 0.5 kg friction of the cart 0.1 N/m/sec length to pendulum center of mass 0.3 m inertia of the pendulum 0.006 kg*m^2 force applied to the cart cart position coordinate pendulum angle from vertical
For the PID, root locus, and frequency response sections of this problem we will be only interested in the control of the pendulums position. This is because the techniques used in these tutorials can only be applied for a single-input-single-output (SISO) system. Therefore, none of the design criteria deal with the cart's position. For these sections we will assume that the system starts at equilibrium, and experiences an impulse force of 1N. The pendulum should return to its upright position within 5 seconds, and never move
more than 0.05 radians away from the vertical. The design requirements for this system are:
Settling time of less than 5 seconds. Pendulum angle never more than 0.05 radians from the vertical.
However, with the state-space method we are more readily able to deal with a multi-output system. Therefore, for this section of the Inverted Pendulum example we will attempt to control both the pendulum's angle and the cart's position. To make the design more challenging we will be applying a step input to the cart. The cart should achieve it's desired position within 5 seconds and have a rise time under 0.5 seconds. We will also limit the pendulum's overshoot to 20 degrees (0.35 radians), and it should also settle in under 5 seconds. The design requirements for the Inverted Pendulum state-space example are:
Settling time for x and theta of less than 5 seconds. Rise time for x of less than 0.5 seconds. Overshoot of theta less than 20 degrees (0.35 radians).
Summing the forces in the Free Body Diagram of the cart in the horizontal direction, you get the following equation of motion:
Note that you could also sum the forces in the vertical direction, but no useful information would be gained. Summing the forces in the Free Body Diagram of the pendulum in the horizontal direction, you can get an equation for N:
If you substitute this equation into the first equation, you get the first equation of motion for this system: (1) To get the second equation of motion, sum the forces perpendicular to the pendulum. Solving the system along this axis ends up saving you a lot of algebra. You should get the following equation:
To get rid of the P and N terms in the equation above, sum the moments around the centroid of the pendulum to get the following equation:
Combining these last two equations, you get the second dynamic equation: (2) Since Matlab can only work with linear functions, this set of equations should be linearized about theta = Pi. Assume that theta = Pi + ( represents a small angle from the vertical upward direction). Therefore, cos(theta) = -1, sin(theta) = -, and (d(theta)/dt)^2 = 0. After linearization the two equations of motion become (where u represents the input):
1. Transfer Function
To obtain the transfer function of the linearized system equations analytically, we must first take the Laplace transform of the system equations. The Laplace transforms are:
NOTE: When finding the transfer function initial conditions are assumed to be zero. Since we will be looking at the angle Phi as the output of interest, solve the first equation for X(s),
is:
From the transfer function above it can be seen that there is both a pole and a zero at the origin. These can be canceled and the transfer function becomes:
2. State-Space
After a little algebra, the linearized system equations equations can also be represented in state-space form:
The C matrix is 2 by 4, because both the cart's position and the pendulum's position are part of the output. For the state-space design problem we will be controlling a multi-output system so we will be observing the cart's position from the first row of output and the pendulum's with the second row.
-(M+m)*m*g*l/q
To observe the system's velocity response to an impulse force applied to the cart add the following lines at the end of your m-file:
t=0:0.01:5; impulse(num,den,t) axis([0 1 0 60])
Note: Matlab commands from the control system toolbox are highlighted in red. You should get the following velocity response plot:
As you can see from the plot, the response is entirely unsatisfactory. It is not stable in open loop. You can change the axis to see more of the response if you need to convince yourself that the system is unstable.
1. State-Space
Below, we show how the problem would be set up using Matlab for the state-space model. If you copy the following text into a m-file (or into a '.m' file located in the same directory as Matlab) and run it, Matlab will give you the A, B, C, and D matrices for the state-space model and a plot of the response of the cart's position and pendulum angle to a step input of 0.2 m applied to the cart.
M m b i g l = = = = = = .5; 0.2; 0.1; 0.006; 9.8; 0.3;
p = i*(M+m)+M*m*l^2; %denominator for the A and B matricies A = [0 1 0 0; 0 -(i+m*l^2)*b/p (m^2*g*l^2)/p 0; 0 0 0 1; 0 -(m*l*b)/p m*g*l*(M+m)/p 0] B = [ 0; (i+m*l^2)/p; 0; m*l/p] C = [1 0 0 0; 0 0 1 0] D = [0; 0] T=0:0.05:10; U=0.2*ones(size(T)); [Y,X]=lsim(A,B,C,D,U,T); plot(T,Y) axis([0 2 0 100])
You should see the following output after running the m-file:
A =
0 0 0 0 0 1.8182 0 4.5455 1 0 0 0 0 0
0 2.6727 0 31.1818
0 0 1.0000 0
B =
C =
0 1
0 0
D =
The blue line represents the cart's position and the green line represents the pendulum's angle. It is obvious from this plot and the one above that some sort of control will have to be designed to improve the dynamics of the system. Four example controllers are included with these tutorials: PID, root locus, frequency response, and state space. Select from below the one you would like to use.
Note: The solutions shown in the PID, root locus and frequency response examples may not yield a workable controller for the inverted pendulum problem. As stated previously, when we put this problem into the singleinput, single-output framework, we ignored the x position of the cart. The pendulum can be stabilized in an inverted position if the x position is constant or if the cart moves at a constant velocity (no acceleration). Where possible in these examples, we will show what happens to the cart's position when our controller is implemented on the system. We emphasize that the purpose of these examples is to demonstrate design and analysis techniques using Matlab; not to actually control an inverted pendulum.
Physical setup and system equations Design requirements Transfer function and state-space Matlab representation and open-loop response Closed-loop transfer function
Assume that the aircraft is in steady-cruise at velocity; thus, the thrust and drag cancel out and balance out each other. Also, assume that change does not change the speed of an aircraft under circumstance (unrealistic but simplifies the a bit). Under these assumptions, the longitudinal equations of motion of an aircraft can be written as:
constant altitude and the lift and weight in pitch angle any problem
(1)
Please refer to any aircraft-related textbooks for the explanation of how to derive these equations. Also, click Variables to see what each variable represents. For this system, the input will be the elevator deflection angle, and the output will be the pitch angle.
Design requirements
The next step is to set some design criteria. We want to design a feedback controller so that the output has an overshoot of less than 10%, rise time of less than 2 seconds, settling time of less than 10 seconds, and the steady-state error of less than 2%. For example, if the input is 0.2 rad (11 degress), then the pitch angle will not
exceed 0.22 rad, reaches 0.2 rad within 2 seconds, settles 2% of the steady-state within 10 seconds, and stays within 0.196 to 0.204 rad at the steady-state.
Overshoot: Less than 10% Rise time: Less than 2 seconds Settling time: Less than 10 seconds Steady-state error: Less than 2%
(2)
These values are taken from the data from one of the Boeing's commercial aircraft.
1. Transfer function
To find the transfer function of the above system, we need to take the Laplace transform of the above modeling equations (2). Recall from your control textbook, when finding a transfer function, zero initial conditions must be assumed. The Laplace transform of the above equations are shown below.
After few steps of algebra, you should obtain the following transfer function.
2. State-space
Knowing the fact that the modeling equations (2) are already in the state-variable form, we can rewrite them into the state-space model.
Since our output is the pitch angle, the output equation is:
step (de*num,den) Running this m-file in the Matlab command window should give you the following plot. From the plot, we see that the open-loop response does not satisfy the design criteria at all. In fact the open-loop response is unstable.
If you noticed, the above m-file uses the numerical values from the transfer function. To use the state-space model, enter the following commands into a new m-file (instead of the one shown above) and run it in the command window.
de=0.2; A=[-0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0]; B=[0.232; 0.0203; 0]; C=[0 0 1]; D=[0];
step(A,B*de,C,D) You should get the same response as the one shown above. Note: It is possible to convert from the state-space to transfer function, or vice versa using Matlab. To learn more about conversions, see Conversions
A controller needs to be designed so that the step response satisfies all design requirements. Four different methods to design a controller are listed at the bottom of this page. You may choose: PID, Root-locus, Frequency response, or State-space.
Problem Setup
A ball is placed on a beam, see figure below, where it is allowed to roll with 1 degree of freedom along the length of the beam. A lever arm is attached to the beam at one end and a servo gear at the other. As the servo gear turns by an angle theta, the lever changes the angle of the beam by alpha. When the angle is changed from the vertical position, gravity causes the ball to roll along the beam. A controller will be designed for this system so that the ball's position can be manipulated.
For this problem, we will assume that the ball rolls without slipping and friction between the beam and ball is negligible. The constants and variables for this example are defined as follows: M R d g L J r alpha theta mass of the ball 0.11 kg radius of the ball 0.015 m lever arm offset 0.03 m gravitational acceleration 9.8 m/s^2 length of the beam 1.0 m ball's moment of inertia 9.99e-6 kgm^2 ball position coordinate beam angle coordinate servo gear angle The design criteria for this problem are:
System Equations
The Lagrangian equation of motion for the ball is given by the following:
Linearization of this equation about the beam angle, alpha = 0, us the following linear approximation of the system: The equation which relates the beam angle to the angle of the gear be approximated as linear by the equation below:
gives can
1. Transfer Function
Taking the Laplace transform of the equation above, the following equation is found: NOTE: When taking the Laplace transform to find the transfer function initial conditions are assumed to be zero. Rearranging we find the transfer function from the gear angle (theta(s)) to the ball position (R(s)).
It should be noted that the above plant transfer function is a integrator. As such it is marginally stable and will provide a challenging control problem.
double
2. State-Space
The linearized system equations can also be represented in state-space form. This can be done by selecting the ball's position (r) and velocity (rdot) as the state variables and the gear angle (theta) as the input. The state-space representation is shown below: However, for our state-space example we will be using a slightly different model. The same equation for the ball still applies but instead of controlling the position through the gear angle, theta, we will control alphadoubledot. This is essentially controlling the torque of the beam. Below is the representation of this system:
Note: For this system the gear and lever arm would not be used, instead a motor at the center of the beam will apply torque to the beam, to control the ball's position.
%simplifies input
Now, we would like to observe the ball's response to a step input of 0.25 m. To do this you will need to add the following line to your m-file: step(0.25*num,den) NOTE: Matlab commands from the control system toolbox are highlighted in red. You should see the following plot showing the balls position as a function of time:
From this plot it is clear that the system is unstable in open-loop causing the ball to roll right off the end of the beam. Therefore, some method of controlling the ball's position in this system is required. Three examples of controller design are listed below for the transfer function problem. You may select from PID, Root Locus, and Frequency Response.
2. State-Space
The state-space equations can be represented in Matlab with the following commands (these equations are for the torque control model).
m R g J = = = = 0.111; 0.015; -9.8; 9.99e-6;
The step response to a 0.25m desired position can be viewed by running the command below: step(A,B*.25,C,D) Your output should look like the following: Like the plot for the transfer function this plot shows that the system is unstable and the ball will roll right off the end of the beam.
Therefore, we will require some method of controlling the ball's position in this system. The State-Space example below shows how to implement a controller for this type of system. If you are interested in knowing how to convert state-space representations to transfer function representations, and vice versa, please refer to the Conversions page. Autor: