You are on page 1of 13

Design Project - Phase 1

MATLAB/SIMULINK MODELING

ECE 5440 Digital Control Systems Winter 2000

Wayne State University


Objectives: You are given the equations of motion for a vehicle traveling at a constant longitudinal velocity with both front and rear steering wheel angle inputs. This model is suitable for investigating the handling performance of four-wheel steered vehicles. This second-order state contains the lateral velocity and yawrate states. The goal of this project is to implement several controller and estimator combinations in an automobile 4WS control system application. Professor Anthony B. Will

Part 1
Four-Wheel Steering System

Figure 1.0 - Four wheel steer (4WS) control system diagram The objective of a four-wheel steering (4WS) system is to enhance a vehicle's handling performance. A 4WS system operates by steering the rear wheels as a function of the front steer angle. Much of the research literature in 4WS has been in developing various control schemes that control the magintude and phasing of the rear wheels as a function of the front wheels. As seen in the many 4WS application, the magnitude and direction of rear steering, in-phase or out-of-phase, is a function of the vehicle's longitudinal speed. For instance, at low speeds the rear wheels are steered out-of-phase with respect to the front wheels to reduce the vehicle turning radius, and thereby improve maneuverability. For highway speeds, the rear wheels are steered in-phase with the front wheels to improve the vehicle's steerability. With in-phase steering, a 4WS vehicle translates more easily and with less yaw rotation than a corresponding two wheel steer vehicle. For the case of evasive or emergency maneuvers, such as steering to avoid an object on a highway, a combination of both out-ofphase and in-phase rear wheel steering is advantageous. This is because out-of-phase rear wheel steering excites the vehicle's yaw rate that causes the vehicle to rotate about its yaw axis. The in-phase rear wheel steering, on the other hand, dampens the yaw rate and laterally stabilizes the vehicle. In this project, we will only consider high speed 4WS performance. A physical diagram of a 4WS control system is shown in Figure 1.0. In the diagram, the essential components of a 4WS system are shown. The components include the electronic control unit(ECU), sensors (lateral acceleration, yaw rate sensors, handwheel), a rear steering actuator, and steerable rear suspension system. The main function of the 4WS ECU is to provide control for the operation of the rear
2

steering system by regulating the rate and position of the rear steering angle to achieve the desired vehicle handling response. A detailed description for the derivation of this four wheel steering vehicle model is found in the paper Modeling and Control of an Autonomous Vehicle , this reference will be handed out as supplemental material. Vehicle Linear State Model The continuous-time state model for the two-input vehicle model is a system is given as

where the state variables x1(t) = x3(t) = , be the yaw angle.

and x2(t) =

are the lateral velocity and yaw rate, respectfully. Let

However, these state variables are in the vehicle reference frame. For plotting the path of the vehicle in the global X-Y coordinate frame, we have the following two equations:

. The vehicle parameters for this simulation study are given in the Table 1.0 Table 1.0 - Vehicle Parameters Parameter a b Cf = Cr Iz mtot U g Value 1.203 1.217 50000 2500 1495 20 9.81 Units m m N/rad kg m s2 kg m/s m/s2

Part II
Develop a MATLAB/SIMULINK model for the 4WS system. Note that in the block diagram below is a Matlab/Simulink model. You will need to create a MATLAB S-Function( for details type type sfunc at the Matlab prompt). The S-function allows the user to take their own equations of state (motion, flow) and use the integrators and blocks of Matlab/Simulink. This function will allow you write the equations of motion of your system are
3

written into an S-File. The S-File is reference in the S-Function block. Once you have this block you may access the various inputs and output states of your system in the SIMULINK environment. The Matlab Function Block can represent any user defined function using an M-file( a sample Mfile representing a Matlab function is given later) performs various functions accepts inputs that are assigned to functions The DEMUX block de-multiplezes the state vector into its individual components. It takes the output state vector and makes it available for you to use in your simulations. Given below is a sample Matlab/Simulink model that you can used to develop your control systems.

Figure 2.0 - SIMULINK BLOCK DIAGRAM Matlab S-file Below is a commented S-file (bike.m) to aid you in developing your MATLAB/Simulink model. The Sfile is read by the S-function block. % This M-file represents the 2 DOF linear vehicle model developed % by Will and Zak. This model has lateral and yaw degrees of freedom. The % tire model chosen % is a linear tire model. % % Programmer: : Anthony B. Will % File name bike.m % Date June 3, 1998 % %
4

function [sys, x0] = bike(t,x,u,flag);% in the matlab programming language % % x - state vector of size determined by the number of states % % % Vehicle Parameter Assignment % % % a = 1.203; %distance from front tires to CG b = 1.217; %distance from rear tires to CG l = a+b; %wheelbase L = l ; g = 9.81; %gravitational acceleration ms = 1280; %sprung mass muf = 119; %unsprung mass front mur = 96; %unsprung mass rear Icg = 2500; %Cg moment of inertia Iz = Icg; Iroll = 750.0; %Roll axis moment of inertia

beta = 2600.0; %Roll axis damping tf = 1.5; %tread width front tr = 1.5; %tread width rear Ux = 20.0; %constant forward speed m/s mtot = ms + muf + mur; mtot = ms + muf + mur; B1 = [1 0];% u1 : front steer input B2 = [0 1];% u2 : rear steer input % % S-Function Structure % % C1f = 50000; C1r = 50000; a1 = -2*(C1f+C1r)/(Ux*mtot);
6

a2 = -2*(a*C1f-b*C1r)/(Ux*mtot) -Ux; a3 = -2*(a*C1f-b*C1r)/(Iz*Ux); a4 = -2*(a*a*C1f + b*b*C1r)/(Iz * Ux); bf1 = 2*C1f/mtot ; bf2 = 2*a*(C1f)/Iz; br1 = 2*C1r/mtot; br2 = -2*b*C1r/Iz; aa=[a1 a2;a3 a4]; b= [bf1 br1;bf2 br2]; % % uf = B1*u (this is the front steer input) % ur = B2*u (this is the rear steer input) % since the input vector u=[uf ur] - is 2x1, then we must pick-off the components % by forming the products if abs(flag) == 1,; % return derivatives % sys(1) =aa(1,1)*x(1) +aa(1,2)*x(2) + b(1,1)*B1*u + b(2,1)*B2*u; % sys(2) =aa(2,1)*x(1) +aa(2,2)*x(2) + b(2,1)*B1*u + b(2,2)*B2*u; %
7

sys(3) = -Ux*sin(x(2)) - x(1)*cos(x(2)) ;% Y-global coor.(rev. 7/16/96) % sys(4) = Ux*cos(x(2)) - x(1)*sin(x(2)) ;% X-global coor.(rev. 7/16/96) sys(5) = x(2); ;% yaw angle % % % elseif flag ==3 sys =x; elseif flag == 0, % Return initial conditions sys = [5;0;5;2;0;0];% this variable indicates to simulink % that the system has: 5continuous-states % 0-discrete-states % 5-outputs % 2-inputs
8

% time step (for discrete systems) % x0 = [0;0;0;0;0]; % initial condition on the state vector x=[x(1) x(2) x(3) x(4) x(5)] else sys = [ ]; end MATLAB Function M-File Below is an M-File. This is given as an example for to show the syntax for creating a Matlab function. function y = fedbck(x) % % % Programmer: : Anthony B. Will % File name : fedbck.m % Date : Feb. 18, 1997 % % this model also includes the neural network based % model reference command generator % % x is a 4 X 1 vector that is passed to this function. %
9

% Vehicle Parameter Assignment % % % Enter your feedback control algorithm here d_theta = [1 0 0 0]*x; % the yaw rate d_y = [0 1 0 0]*x; % the lateral velocity ur = 0.0; %default is zero % ur = uf*0.1; % this control the rear angle is a fraction of the front % angle y = ur ; % this output is the rear wheel angle

Part III
1.Compute the poles of the system for with the following forward velocitites: a.U = 20 m/s b.U = 40 m/s c. U = 60 m/s. 2. From the continuous system model in Part I, determine the discrete-time system model in the form. Let T = 0.05. ,

10

Part IV
1. Using a sinusoidal front-steering input with frequency 2 rad/s and magnitude 2p / 180 (this is 2 degrees of steering at the road wheels. In an actual vehicle with a 15:1 steering ratio the drive steering input would be 30 degrees). Simulate for 3 seconds. At the Matlab prompt type the following: load proj1 who Your variables are: x size(x) ans = plot(x(6,:),x(5,:)):title('Global X-Y coordinates for Linear Vehicle'):xlabel('X - meters'):ylabel('Y meters') You should get the following plot.

Figure 2.0 X-Y path of the vehicle

Part V
11

The final portion of Phase I is to augment the vehicle dynamics simulation model with a driver model. The driver model is controller that attempts to model the behavior of a driver trying to maintain a prescribed course.

Vehicle Driver Model The vehicle driver model used in the simulations studies was adopted from the work by Senger and Schwartz. In their 4WS work, they investigated the behaviour of the driver in vehicles that have oversteer, neutral steer and oversteer characteristics. Their driver model is shown in the block diagram in Figure 5.0. This driver model uses feedback consisting of the both the lateral displacement and yaw angle. The parameters in this model are Ky, TL, and Ky, which are the driver's yaw gain, stability time constant, and lateral steering gain. The transfer functions for the driver are given as: Yy(s) = (y(K1 + sTL) e-ts) e1(s) and Yy(s) = Ky e2(s), where the lateral position error, e1(s) is e1(s) = y_desired - y_actual, and the yaw angle error, e2(s) is e2(s) = Ky e1(s) - q_actual. In your simulation examples, let Ky = 7.01, TL = 0.16, and Ky = 0.05, and t = 0.1.
12

Use the following path. Think about how to create path in MATLAB, and then lets share some ideas.

13