-------------------------------------------------------------------------------- -- -- HySAT model of a Renault Clio 1.9 DTI RXE, equipped with Cruise Controller. -- -- Original model by Bemporad and Torrisi. -- Adapted from HYSDEL code reported in Torrisi's PhD thesis. -- -- Author : Christian Herde -- -- Last Modified : -- Sun Oct 9 16:40:46 CEST 2005 -------------------------------------------------------------------------------- DECL ---------------------------------------------------------------------------- -- Definition of constants used in the CAR model. --------------------------------------------------------------------------- -- Sampling rate of the model in [s]. define ts = 0.3; -- Mass of car in [kg]. define mass = 1020; -- Friction force is approcimated by F_r = beta_friction * speed, where -- beta_friction is a constant which takes into account all frictions -- (i.e. aerodynamics, tires deformation, drive train). In [kg*m^2/s]. define beta_friction = 25; -- Gear ratio corresponding to the i-th gear. define rgear1 = 3.7271; define rgear2 = 2.048; define rgear3 = 1.321; define rgear4 = 0.971; define rgear5 = 0.756; -- Radius of a wheel in [m]: wheel_radius = 0.2916 -- Final drive ratio: rfinal = 3.294 -- Drive train efficiency level: loss = 0.925 -- Speed of car is given by speed = speed_factor * (1 / rgeari) * w, -- where w is the engine speed in [rad/s] and -- speed_factor = (loss * wheel_radius) / rfinal. define speed_factor = 0.0819; -- Maximum deceleration in [m/s^2]: max_brake = 8.53 -- Maximum braking force in [N]: max_brake_force = mass * max_brake -- (This is *not* the braking force applied by the engine !) define max_brake_force = 8700.6; -- Minimum / Maximum engine speed in [rad/s]. define wemin = -10.4719; define wemax = 628.3185; -- Piecewise linear approximation of torque nonlinearity C+(w) in [Nm]: -- C+(w) = apwl(i+1) + bpwl(i+1) * w for w \in [wpwl(i), wpwl(i+1)]. define apwl1 = 0.0000; define apwl2 = 58.1070; define apwl3 = 158.7513; define apwl4 = 192.8526; define apwl5 = 259.9484; define bpwl1 = 1.3281; define bpwl2 = 0.6344; define bpwl3 = 0.0755; define bpwl4 = -0.0880; define bpwl5 = -0.2883; define wpwl1 = 83.7733; define wpwl2 = 167.5467; define wpwl3 = 251.3200; define wpwl4 = 335.0933; -- The engine brake torque is approximated by -- C-(w) = -alpha1 - beta1 * w. Unit is [Nm]. define alpha1 = 10; define beta1 = 0.3; ---------------------------------------------------------------------------- -- Declaration of variables used in the CAR model. --------------------------------------------------------------------------- -- Global time. float [-10000, 10000] t; -- State variable: Position of the car. float [-10000, 10000] position; -- State variable: Speed of the car. -- Minimum speed is -50 km/h, maximum speed 220 km/h. float [-13.9, 61.1] speed; -- Input variable: Engine torque. float [-200.0, 200.0] torque; -- Input variable: Braking force. float [0.0, 9000] f_brake; -- Input variables: Which gear is active ? boole gear1; boole gear2; boole gear3; boole gear4; boole gear5; -- Auxiliary variables: float [-10000, 10000] fe; float [-10000, 10000] w; float [-10000, 10000] ce; ---------------------------------------------------------------------------- -- Definition of constants used in the CRUISE CONTROLLER model. --------------------------------------------------------------------------- -- Setpoint of the controller. -- Desired speed is 100 [km/h] = 27.78 [m/s]. define vr = 27.78; -- The gear is shifted up if the engine speed is faster than -- wu = 3500 [RPM] = 366.52 [rad/s]. It is shifted down if -- the speed is lower than wl = 1500 [RPM] = 157.08 [rad/s]. define wu = 366.52; define wl = 157.08; -- To track the desired speed vr the throttle and the brakes are operated -- by PI controllers. Controlled variables are 'torque' and 'f_brake'. -- Factors P and I of the PI controller which controls the torque. define kt = 70.0; define it = 10.0; -- Factors P and I of the PI controller which controls the braking force. define kb = 20.0; define ib = 0.0; ---------------------------------------------------------------------------- -- Declaration of variables used in the CRUISE CONTROLLER model. --------------------------------------------------------------------------- -- The controller sets su (sd) to command a shift up (shift down). boole su; boole sd; -- Commanded torque and commanded braking force. float [-10000, 10000] zut; float [-10000, 10000] zub; -- The controlled variables are saturated against the maximum torque -- and breaking force, respectively. The integrators in the PI controllers -- use an anti-windup scheme: The error is integrated only when the control -- inputs are not saturated. The following variables indicate saturation. boole sat_torque; boole sat_f_brake; -- True iff neither torque nor braking force are saturated. boole no_sat; -- The following variable indicates whether we should apply 'torque' -- (verr=false) or 'f_brake' (verr=true) to track the desired speed. boole verr; -- Integrated error. float [-10000, 10000] ierr; INIT t = 0.0; position = 0.0; speed = 0.0; ierr = 0.0; gear1; !gear2; !gear3; !gear4; !gear5; TRANS ---------------------------------------------------------------------------- -- CAR model. --------------------------------------------------------------------------- -- At each time exactly one gear is engaged. gear1' + gear2' + gear3' + gear4' + gear5' >= 1; gear1' + gear2' + gear3' + gear4' + gear5' <= 1; -- Relations between a) engine force and torque, and b) engine -- speed and speed of the car depend on the chosen gear. gear1 -> fe * speed_factor - torque * rgear1 = 0.0 and w * speed_factor - speed * rgear1 = 0.0; gear2 -> fe * speed_factor - torque * rgear2 = 0.0 and w * speed_factor - speed * rgear2 = 0.0; gear3 -> fe * speed_factor - torque * rgear3 = 0.0 and w * speed_factor - speed * rgear3 = 0.0; gear4 -> fe * speed_factor - torque * rgear4 = 0.0 and w * speed_factor - speed * rgear4 = 0.0; gear5 -> fe * speed_factor - torque * rgear5 = 0.0 and w * speed_factor - speed * rgear5 = 0.0; -- Bounds on engine speed. w <= wemax; w >= wemin; -- Bounds on breaking force. f_brake <= max_brake_force; f_brake >= 0; -- Bounds on torque. A small tolerance has been added to the -- upper bound to have initial torque when starting moving. torque >= -(alpha1 + beta1 * w); torque <= ce + 1.0; -- The maximum force deliverable at a certain engine speed -- is approximated by a piecewise linear function. -- (w < wpwl1) -> ce = apwl1 + bpwl1 * w; (w < wpwl1) -> ce = 111.22; (w >= wpwl1) and (w < wpwl2) -> ce = apwl2 + bpwl2 * w; (w >= wpwl2) and (w < wpwl3) -> ce = apwl3 + bpwl3 * w; (w >= wpwl3) and (w < wpwl4) -> ce = apwl4 + bpwl4 * w; (w >= wpwl4) -> ce = apwl5 + bpwl5 * w; -- Update state variables. t' = t + ts; position' = position + ts * speed; mass * speed' = mass * speed + ts * (fe - f_brake - beta_friction * speed); ---------------------------------------------------------------------------- -- CRUISE CONTROLLER model. --------------------------------------------------------------------------- -- Shifting is only possible between adjacent gears and -- is triggered when engine speed leaves a certain interval. (w >= wu) <-> su; (w <= wl) <-> sd; gear1' <-> (gear2 and sd) or (gear1 and !su); gear2' <-> (gear1 and su) or (gear3 and sd) or (gear2 and !su and !sd); gear3' <-> (gear2 and su) or (gear4 and sd) or (gear3 and !su and !sd); gear4' <-> (gear3 and su) or (gear5 and sd) or (gear4 and !su and !sd); gear5' <-> (gear4 and su) or (gear5 and !su and !sd); -- Do we have saturation ? sat_torque <-> (zut >= ce); sat_f_brake <-> (zub >= max_brake_force); no_sat <-> (!sat_torque and !sat_f_brake) and verr; -- Do we have to decelerate (f_brake) or to accelerate (torque) ? -- Note that threshold is 2 m/s over the target speed, therefore the -- fine tracking of the setpoint is performed only using the throttle. verr <-> (speed <= vr + 2); -- Compute values of controlled inputs. verr -> (zut = kt * (vr - speed) + it * ierr) and (zub = 0.0); !verr -> (zub = -kb * (vr - speed) - ib * ierr) and (zut = 0.0); sat_torque -> (torque = ce + 1.0); !sat_torque -> (torque = zut); sat_f_brake -> (f_brake = max_brake_force); !sat_f_brake -> (f_brake = zub); -- Integrate error. no_sat -> (ierr' = ierr + ts * (vr - speed)); !no_sat -> (ierr' = ierr); TARGET -- Can we reach of XXX m/s in less than YYY seconds ? t <= 10.0; speed >= vr - 1.0;