Laboratory 2: Simulink Baja Model We are now ready to tackle a more advanced Simulink model, one that will give us a first experience in modeling an automotive system. The system we choose is a simplified model of the SAE Baja car as it drives up and down a hill. The car starts at rest, and proceeds at full throttle until the “track” is completed. ft fd fr m fg A free-body diagram of the car is shown above. The tractive force, Ft, pulls the car forward. Resisting this force are the air drag force, Fd, the rolling resistance, Fr, and the gravitational force, Fg, caused by the car driving uphill. Summing forces on the car gives ππ₯Μ = ππ‘ − ππ − ππ − ππ (1) Or, in Simulink form π₯Μ = 1 (π − ππ − ππ − ππ ) π π‘ (2) We will describe each of these forces in the sections that follow. For now, create the beginning of a second-order model as we’ve done previously. The signs in the summation block correspond to the signs in the equation above. Rolling Resistance We will start with the easiest forces, and work our way to the more complicated ones as the tutorial progresses. The rolling resistance is proportional to the weight of the car ππ = πππ (3) where we assume that μ has a value of 0.1. This is actually a pretty lousy rolling resistance compared with on-road vehicles and bicycles, but is a decent approximation for a Baja car driving through dirt. Since this does not change during the simulation, we can use a Constant block to model it. The figure above shows the new simulation, with rolling resistance added. Air Drag There are many models for air drag, but the one we choose here has the air drag force proportional to the square of the velocity. 1 ππ = ππΆπ π΄π₯Μ 2 2 (4) where A is the frontal area of the car, ρ is the density of air and Cd is the coefficient of drag. To calculate velocity squared, we will make use of the Product block, as shown below. Gravitational Force The gravitational force is proportional to the weight of the car and the angle of the incline ππ = ππ sin π (5) In reality, the angle of inclination, θ, is a function of the car’s position on the track, x, but we’ll leave it as a constant for now. We’ll change it to a function of position later on. Tractive Force The tractive force originates in the motor, and passes through the transmission and wheels, before being applied to the ground. This is the most complicated force in the model, and deserves the closest attention. First, the tractive force can be related to the wheel torque as ππ‘ = ππ€ π π‘ (6) where Rt is the radius of the tire. The wheel torque is related to the motor torque as (7) ππ€ = πππ where r is the transmission ratio, including the gearbox and CVT. The equation above seems simple enough, but it hides the fact that the engine torque and transmission ratio are both functions of engine speed. In fact, we should probably rewrite the equation as (8) ππ€ = π(π)ππ (π) where n is the engine speed, in rpm. CVT Model The CVT, or continuously variable transmission, acts as the “gearbox” for the Baja car by changing ratios as a function of engine speed. When the car starts out, the engine runs at a low speed (idle) and the CVT chooses a high ratio, similar to first gear in a car. As the engine speeds up, the CVT “shifts” to a higher gear (lower ratio) until it reaches a 1:1 ratio (or overdrive) when the engine is at its highest speed. A real CVT uses torque feedback to shift down when the load is high, but we will neglect this for our simple CVT model. rCVT 4 1 1000 5000 n (rpm) The graph above shows a very simple model for a CVT. The ratio is 4:1 when the engine is at idle (1000rpm) and 1:1 when the engine is at its maximum speed (5000rpm). Our simple, linear relationship can be written ππΆππ = (− 3 ) π + 4.75 4000 (9) where the engine speed, n, is in rpm. We could place this relationship directly into the Simulink model, but we would end up with a cluttered diagram. It is more effective to create a Subsystem for the CVT, as shown in the diagram below. Place the subsystem in your model, and then double-click on it to see its contents. As you can see, the most basic subsystem sends the input directly to the output, without affecting it. Our job now is to model Equation (9) in this subsystem. The first difficulty that arises is that we know only wheel speed, and not motor speed. The wheel speed and motor speed are related to each other as π = ππΆππ ππΆ ππ€ (10) where nw is the wheel speed (in rpm), and rC is the chainbox ratio, which is a constant. By combining (9) and (10), we can eliminate the motor speed and create a relation for the CVT ratio in terms of wheel speed alone ππΆππ = 4.75 3ππΆ 1 + 4000 ππ€ (11) By now you should be able to model this equation in Simulink with no difficulty by making use of product and division blocks. Note that the wheel speed (in rpm) is related to the forward velocity of the car as ππ€ = 60 π₯Μ 2π π π‘ The CVT subsystem is also a convenient place to calculate motor speed, using Equation (10). (12) m (N-m) 20 10 1000 5000 n (rpm) Motor Torque A highly simplified torque/speed model for the motor is shown above. Please note that the numbers (and model) were invented for this tutorial, and bear no relation to the genuine Baja motor! The graph shows that the torque output of the motor increases linearly with engine speed. The relationship shown in the graph can be formulated as 10 ππ = ( ) π + 7.5 4000 where n is in rpm and τm is in N-m. Use another subsystem block to create the motor model. (13) % Input file for transmission simulation in Simulink % This file calls the Baja_Car_Model_Simplified.mdl Simulink simulation clear all; close all; clc % ***** Input parameters ******************************************** g = 9.81; % Gravitational accel (m/s^2) theta = 0; % Angle of incline in degrees rc = 12; % Chain drive ratio m = 250; % Vehicle mass (kg) tireDia = 24; % Tire diameter (in) rollRes = 0.05; % Rolling resistance rho = 1.21; % Air density (kg/m^3) A = 0.5; % Cross-sectional area (m^2) Cd = 1; % Coefficient of drag mu = 0.9; % Coefficient of friction trackLen = 150; % Length of track (ft) % ***** Calculated values ******************************************* weight = m*g; % weight of car Rt = tireDia * 0.0254/2; % Tire radius (m) Fr = rollRes * weight; % Rolling resistance force frictionF = mu * weight; % Frictional force % ***** Run simulation ********************************************** sim Baja_Car_Model_Simplified plot(t,x/(0.0254*12)) grid on xlabel('Time') ylabel('Distance (ft)') title('Displacement vs Time (ft)') figure plot(t,xdot*2.237) grid on xlabel('Time') ylabel('Vehicle Speed (mph)') title('Vehicle Speed vs Time (mph)')