Vehicle longitudinal speed control Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at Austin February 10, 2015
1 Introduction 2 Control concepts Open vs. Closed Loop Control Closed loop equations Torque-driven wheel model and simulation 3 PID control Basic control actions based on error Closed loop control of linear vehicle model Simulation of PID controls 4 Examples
Introduction For estimating vehicle performance, we developed models useful in assessing how sources (engines, motors, etc.) drive against vehicle loads. We used these models to estimate dynamic and steady-state performance, namely vehicle forward speed. If there are parameter variations in the vehicle (e.g., mass, rolling resistance, drag, etc.), in the grade, or in the source characteristics, then variability is expected in the vehicle response. External disturbances/forces will also cause performance estimates and design predictions to be off. Systems and controls concepts are useful for modeling vehicles and analyzing their behavior. These system models provide a basis for implementing control actions designed to achieve desired performance requirements.
Controlling vehicle speed The forward speed of a vehicle reaches an equilibrium or steady-state value when the driving forces balance the loads. Controlling the forward speed requires adjusting the source to meet changes in loads that result from external factors or by operational demands. In addition to making sure that power sources and drivetrain are properly matched to enable speed control, use of feedback control principles may also be required. These notes describe how these methods can be applied.
Steady-state vehicle performance If source and load (e.g., driveline + vehicle) characteristics intersect, a steady-state speed can be achieved, as illustrated graphically below. The source and load lines are equations of effort (torque or force) versus flow (angular velocity or velocity). The intersection represents a solution of two simultaneous equations, which defines a steady-state (operating) condition. This is a classical concept that applies to any source-load problem.
Control of speed by changes in source or load A vehicle with a given source characteristic may reach equilibrium for load line at (a). If the loads increase, the speed drops to new equilibrium B. Loads can t be controlled, but sources can be throttled. So as load increases, the source line can be increased to achieve equilibrium C, returning to original speed, f o. Changing the source to maintain speed requires feeding back information about the vehicle speed.
Open vs. Closed Loop Control Open loop: May or may not have a desired reference Can operate with large errors (relative to some desired operating condition) because of: Disturbances to the system Variation in system parameters Some examples: Timed processes (e.g., toasters, most dryers, etc.) In vehicle systems, many traction/braking systems and steering systems are clearly open-loop Closed loop: provides for disturbance rejection reduces sensitivity to parameter variations enables using error signal for dynamic tracking enhances accuracy and extends bandwidth Introducing feedback can also cause the system to oscillate or become unstable, so analysis tools are needed to evaluate the closed loop response.
Identifying feedback control In his monograph outlining the historical origins of feedback control, Otto Mayr presents a concise way to interpret feedback control systems based on three key elements. Just because a system has feedback does not mean it is a feedback control system. Mayr suggests identifying the following [2]: 1 The purpose of a feedback control system is to carry out commands; the system maintains the controlled variable equal to the command signal in spite of external disturbances. 2 System operates as a closed loop with negative feedback. 3 The system includes a sensing element and a comparator, at least one of which can be distinguished as a physically separate element.
Standard closed loop block diagram For reference, consider the SISO (single-input-single-output) closed loop control system with standard key elements labeled (below). Feedback error dictates a control action. Plant any physical system to be controlled Controller can generate inputs to the plant to achieve a desired objective Sensor means by which plant output is transformed to feedback information
Closed loop equations Using block diagram algebra, you can derive the closed-loop output, y, in terms of the transfer functions for the model components, as shown below. y = G p 1 + G c G p H u G c G p d + 1 + G c G p H r The output depends on the two inputs: the reference, r, and the disturbance, u d.
Outline Introduction Control concepts PID control References Examples Example: Does this speed governed mouse use feedback control? [1] A definitive answer can be obtained using Mayr s criteria, understanding the closed-loop control diagram, and insight from a little physical modeling.
Modeling the mouse drivetrain Some may be able to intuitively assess the nature of this system. It is preferred to develop a model. Basic performance model as studied before. Assume no slipping in wheel/ground contact. As shaft speed increases, the force between the governor washers and the drum increases, so the torque exerted on the power-train shaft can be modeled as, T g = f g (ω)sgn(ω), where f(ω) is likely a quadratic function. (Do you agree?) The speed governor limits the shaft speed through a centrifugal-like brake.
Speed-governed mouse drivetrain model Rotational dynamics: ḣ = J ω = T spring Longitudinal dynamics: m v x = F x Bv x (assuming linear loads) r GR F x T g For rolling, ω = GRv x /r, so m v x = mr ω/gr = F x Brω/GR and, F x = mr Br ω + GR GR ω Now, J ω = T spring α (α ω + Bαω) T g where, α r/gr, so, ( J + mα 2 ) ω+bα 2 ω = T spring T g (ω) Now the first order model equation can be written as, τ ω + ω = (T spring T g (ω))/(bα 2 ) or, τ v x + v x = (T spring T g (v x ))/(Bα) The torque from the governor, a speed-dependent (nonlinear) damping torque, works to counter the spring torque.
Is this a feedback control system? Assess according to Mayr s criteria: 1 Does it carry out (speed) command? 2 Is there negative feedback?, and 3 Does a comparator exist? (remember, at least 2 or 3 must be a distinguishable physical element) Rewrite the model, first as, (τs + 1)v x = (T spring T g (v x ))/K where K = 1/(Bα). Then solve for v x, v x = K τs + 1 T g(v x )+ K τs + 1 T spring and compare to the general closed-loop control relation, y = G p 1 + G c G p H u G c G p d + 1 + G c G p H r 1 Ans. No speed command. 2 Ans. No closed loop with negative feedback. 3 Ans. The governor responds to but does not sense speed, and no comparator.
Speed-governed mouse block diagram Contrast the block diagram for the speed-governed mouse with the standard block diagram. Plant - longitudinal model, responds to difference between spring and governor torques Controller - no, does not try to achieve a desired objective Sensor - no, speed-dependent governor is a nonlinear brake, not a sensor
Torque-driven wheel model The speed-governed mouse model is similar to the torque-driven wheel. Recall for no-slip the model took the form, v x = [ m v + I ] 1 [ ] d 1 rw 2 T d f(v x ) = 1 [T d /r w f(v x )] r w m eff where T d is drive torque, f(v x ) are total loads, and I d is driveline inertia. Below we see that the block diagram is similar to that for the speed-governed mouse. This model will be used to quantitatively study open and closed loop control of forward speed.
Linear model for open loop control Consider linear road loads, f(v x ) = B r v x, so model in standard form is, τ v x + v x = KT d where τ = m eff /B r, K = 1/(r w B r ). With K known, no slip or additional loads, the torque needed to achieve steady-state speed v xss is found by setting v x = 0 (equilibrium condition) and solving, T d = v xss /K. An open loop control diagram using a linear transfer function model is shown below. The steady state velocity will vary if K changes. The torque required, T d, needs to be generated by a power source, so it will have practical limits. Quick study of the response considering these issues is possible with a simulation file.
Simulation of linear open loop vehicle (Matlab) Simulation file global K tau rw Br ton Vssd (insert parameter list here) ton = 1.0; Vssd = 0.1; to = 0; tf = 20; N = 100; dt = (tf-to)/n; [t,vx] = rk4fixed( lin_vehicle_ol_m,[to tf],0,n); N = length(t); y = zeros(n,1); for i = 1:N [xd Td(i)] = lin_vehicle_ol_m(t(i),vx(i)); end figure(1) subplot(2,1,1), plot(t,td*1000) ylabel( Torque, mnm ) subplot(2,1,2), plot(t,vx) ylabel( Velocity, m/s ) xlabel( Time, sec ) Model function file function [xdot y] = lin_vehicle_ol_m(t,x) global K tau rw Br ton Vssd v = x; if t>=ton Td = Vssd/K; else Td = 0; end xdot = [-v/tau+k*td/tau]; y = Td; Note: The simulation file requires parameter values not shown here.
Comments on linear vehicle and simulation 1 The loads are modeled as linear to simplify the model for example study. Real loads follow nonlinear relations with velocity. 2 The simulation code is readily adapted to consider nonlinear models, as well as for studying closed loop control. 3 The open loop model provides a good basis for studying the effect of changes in parameters and external disturbances, and motivating use of closed loop control. 4 For example, if the open loop case specifies a T d based on a presumed K, it is clear that the steady-state velocity will be in error if K changes.
Basic control actions Proportional (P) control generates a control action proportional to error. u = K p e; G c = K p Integral control reduces or eliminates steady-state error, but has reduced stability. u = K i edt; G c = K i /s Derivative control yields an increase in effective damping, improving stability. u = K d de dt ; G c = K d s PID control is most common in practical application. de u = K p e + K i edt + K d dt Expect to see these control actions implemented in various ways.
Close the loop on linear vehicle example In closing the loop, the idea is to let a controller, G c, specify the drive torque according to the error, formed by e vx = r v x, where r is a reference (desired) velocity. It is next shown how to simulate the closed loop control using code. There are some platforms that allow block diagrams to be used directly. We may look at these later.
Mixed linear and nonlinear descriptions of systems Sidebar: linear and nonlinear elements are commonly mixed in block diagrams. The model below for a hydraulic actuator control system is a good example. Commercial simulation environments (Matlab/Simulink, LabVIEW CD&S, EASY5, etc.) have adopted this engineering paradigm.
Get comfortable with time s-domain As you take models and implement code, you should feel comfortable representing systems in time or s-domain.
Example: How do you select proportional gain? One benefit of linear models is to allow formulating explicit closed loop relations. For example, from the closed loop transfer function for the torque-driven wheel, v x = G p 1 + G c G p H T G c G p disturbance + 1 + G c G p H v r where r = v r is the reference velocity. For proportional control of the linear, torque-driven wheel, G c = 1, H = 1 (ideal measurement), and G p = K/(τs + 1). For the case of T disturbance = 0 (no disturbance torques), v x v r = KK p τs + 1 + KK p So if you want, say, to have the steady-state speed within 5% of the desired value, you can show that (make s = 0 for steady-state), K p K = 0.05 K p = 19 1 + KK p K
Closed loop (P) control of linear vehicle (Matlab) Simulation file global K tau rw Br ton Vssd Kp (insert parameter list here) Kp = 19/K; ton = 0.5; Vssd = 0.1; to = 0; tf = 2; N = 500; dt = (tf-to)/n; [t,vx] = rk4fixed( lin_vehicle_cl_p_m,[to tf],0,n); N = length(t); y = zeros(n,2); for i = 1:N [xd y(i,:)] = lin_vehicle_cl_p_m(t(i),vx(i,:)); end e = y(:,1); Td = y(:,2); figure(1) subplot(2,1,1), plot(t,td*1000) ylabel( Torque, mnm ) subplot(2,1,2), plot(t,vx) ylabel( Velocity, m/s ) xlabel( Time, sec ) Model function file function [xdot y] = lin_vehicle_cl_p_m(t,x) global K tau rw Br ton Vssd Kp v = x; if t>=ton r = Vssd; else r = 0; end e = r-v; % NOTE error calculation Td = Kp*e; % proportional control xdot = [-v/tau+k*td/tau]; y(1) = e; y(2) = Td; Note:Same parameters as before, add Kp
Simulation results for P control The response with P control alone is shown below. Note because of how K p was selected there is a 5% steady-state error. This can be reduced by increasing K p, or by adding some integral control.
Comments on linear vehicle and simulation 1 This model specifies a drive torque needed to make the error in velocity go to zero. 2 This model does not include actual source dynamics (e.g., engine or electric drive, etc.), driveline dynamics, or traction effects. 3 The controller does provide an estimate of what kind of torque is needed to achieve the response desired. At this early stage, however, the torque response can be compared to what can be provided by a real motor. 4 The model simulation allows you to experiment with controller design, and to begin narrowing in on proper controller gains.
Implementing PI Control To implement the I part of PI control, the error must be integrated at each time step. The integral of the error can be found during a simulation by creating a state equation, I e = edt di e dt = e Continuing with the linear vehicle example, adding the integral control changes the code as follows. Model function file function [xdot y] = lin_vehicle_cl_pi_m(t,x) global K tau rw Br ton Vssd Kp Ki v = x(1); ie = x(2); % NOTE: new state! if t>=ton r = Vssd; else r = 0; end e = r-v; Td = Kp*e + Ki*ie; % PI control vdot = -v/tau+k*td/tau; iedot = e; xdot = [vdot;iedot]; y(1) = e; y(2) = Td;
Implementing derivative control - 1 Implementing the derivative of error in a PID controller can be tricky. In general, when you take the derivative of a signal you can run into problems because if there are any abrupt changes or noise then the derivative will generate very large values. This can cause problems in controllers and can lead to very large errors and cause simulations to fail. You may recall there are some simple approximations to derivatives using basic differences. For example, D e = de. = e(t i) e(t i 1 ) dt t The problem with these approaches is that when we use function files in Matlab, for example, it is not possible to keep previous values.
Implementing derivative control - 2 It turns out that a good way to approximate a derivative is by using a high pass filter. We can pass the error into a high pass filter and the output is an estimate of the error derivative, for example, d e e = s τ d s + 1 This is a transfer function between the approximate derivative of the error, d e, and the error, e. The time constant, τ d, should be chosen to define a frequency range up to which you expect to see error signal fluctuations. Also, recall, τ d = 1/ω d. So, how do you code this (in simulation or a controller)?
Implementing derivative control - 3 First, you want to avoid having to take an actual derivative of the error. For example, the typical way to convert a transfer function to time-domain is as follows: d e e = s τ d s + 1 d e (τ d s + 1) = se τ d d e + d e = ė This is not what we want. We don t want to take a derivative of the error directly! Here is the trick: split up the transfer function by defining two new transfer functions, d e e = s [ s ] [ ] τ d s + 1 = 1 }{{} 1 τ d s + 1 de z } {{ } z e Use this to define a time-domain system using the intermediate variable, z.
Implementing derivative control - 4 First, note that the approximated derivative of the error is now found from the direct derivative of the new variable z, d e z = s 1 d e = sz d e = ż And now use the second transfer function to define z, z e = 1 τ d s + 1 z (τ ds + 1) = e τ d ż + z = e This is easy to add to our system of equations, and note: no direct derivative of e! So, the state (differential) equation for z is, ż = ( z + e)/τ d, and the output equation gives the approximate derivative, d e = ż = ( z + e)/τ d Multiply d e by a derivative gain and add to the P and I controls.
Implementing PID Control To add D to PI control, new state equations need to be added. The derivative of the error is found as the output of a filtering state equation. Again, we apply to the linear vehicle example with the code as shown. This approach to implementing PID control is applicable both to code-based simulation as well as controller implementation. Model function file function [xdot y] = lin_vehicle_cl_pid_m(t,x) global K tau rw Br ton Vssd Kp Ki Kd taud v = x(1); ie = x(2); z = x(3); % NOTE: another new state if t>=ton r = Vssd; else r = 0; end e = r-v; de = (-z+e)/taud; % derivative of error! Td = Kp*e + Ki*ie + Kd*de; % PID control vdot = -v/tau+k*td/tau; iedot = e; zdot = (-z+e)/taud; % new state equation xdot = [vdot;iedot;zdot]; y(1) = e; y(2) = Td; y(3) = de;
Tuning the PID Controller Tuning the gains on a PID controller requires that you specify the type of response you want to achieve. Specifications are sometimes provided in terms of steady-state values, time of response, and peak excursions, for example. We will discuss some methods as we experiment both with simulations and in the lab. A classical method that works for some systems is Ziegler-Nichols tuning.
Summary These slides provide a quick overview of open and closed-loop control concepts, especially as applied to controlling longitudinal vehicle speed control. Methods for representing control systems as block diagrams and system components in forms that are convenient for this representation have been presented. These are common ways to communicate systems. We also discussed how to formulate numerical implementations of control systems either for use in an actual controller or for simulation. Methods for applying these methods, tuning controllers, and assessing stability - a very critical aspect of controlled systems - will be discussed in subsequent lectures.
References [1] D. Macaulay, The Way Things Work, Houghton Mifflin/Walter Lorraine Books, 1988. [2] O. Mayr, Origins of Feedback Control, MIT Press, 1970. [3] K.J. Aström and T. Hägglund, PID Controllers: Theory, Design, and Tuning, Instrument Society of America, Research Triangle Park, NC, 1995 (2nd edition). [4] K.J. Aström and R.M. Murray, Feedback Systems: An Introduction for Scientists and Engineers, Princeton University Press, 2008. Also available online at http://www.cds.caltech.edu/ murray/amwiki
Examples - to be added