PUT Motorsport Vehicle Performance group project of Torque Vectoring algorithm using CarMaker and Simulink.
- Start simulation
- Model description
- Variables description
- IPGDriver's Learning and Adaptation Mechanisms
Downlad src_cm4sl.zip file and unpack this. To start the simulation, first we have to link Matlab (Simulink) with CarMaker. Open Matlab and choose working directory to src_cm4sl folder. Now run 2 scripts: cmenv.m - this script links Matlab and Simulink with CarMaker package installed on our computer. We have to make sure that IPG CarMaker package is installed in correct directory. The default directory for CarmMaker is
C:/IPG/carmaker/win64-12.0.1
If we have different path to our IPG package, we must change cminstdir variable to your destination. After running cmenv.m script, we can run the script.m file. This file contains constants values for our model. Further description of these values is availble in Variable Description section.
Next step is opening the exact model we are working on. Run OPENXWD.mdl which is Simulink model of the car. Click on Open CarMaker GUI. CarMaker window is going to pop up, where we have to choose model of the car. Then choose the track. Now CarMaker is ready to run. We can make it by either pressing start button in CarMaker GUI or by running Simulink, but there is one more thing to do and it's driver adaptation. Firstly, change driver type to racing driver. There are 2 types of driver adaptation programs. The first one is to learn the basic steering of the car and it lasts for about half an hour. TO shorten this time we ca change the speed of simulation. Second one is to learn the track and it's optional (the first training is enough for the driver to be consistent and fast). More about behavior and training of the driver can be read in Driver training and behavior section. Navigation to Torque Vectoring model: CarMaker -> IPG Vehicle -> TV
The Reference Generator converts the driver’s inputs into control references. The key inputs are the acceleration pedal input (
The formulas for the reference generation are:
where:
-
$v_x$ is the longitudinal velocity, -
$L$ is the wheelbase, -
$K_u$ is the desired understeer gradient, -
$T_{max}$ is the maximum torque output of all motors combined.
The Upper Controller is responsible for controlling the vehicle dynamics by adhering to the control references (e.g.,
The controller equation is:
where:
-
$k_p$ is the proportional gain, -
$k_i$ is the integral gain, -
$e_{\gamma} = \gamma_{ref} - \gamma$ is the yaw rate error.
Normal load transfer occurs during maneuvers involving longitudinal or lateral acceleration due to inertia. This process is essential for the torque vectoring algorithm.
The normal loads
where
The torque allocator distributes the total torque demand
The dynamic distribution adjusts the torques based on the ratio of the vertical load of each wheel to the total vertical load
where:
-
$T_{FL}$ ,$T_{FR}$ ,$T_{RL}$ ,$T_{RR}$ are the torques for the front-left, front-right, rear-left, and rear-right wheels respectively, -
$F_{zFL}$ ,$F_{zFR}$ ,$F_{zRL}$ ,$F_{zRR}$ are the vertical loads on these wheels, -
$F_{zT} = F_{zFL} + F_{zFR} + F_{zRL} + F_{zRR}$ is the total vertical load, -
$r_w$ is the wheel radius, -
$l_s$ is the half-width of the vehicle.
All variables you can find in file script.m
List of variables and their placement:
ki=0.05; % gain of integrating controller - Upper Controller
kp=0.5; % gain of proportional controller - Upper Controller
g=9.81; % gravity acceleration - Torque distribution - FZFL, FZFR, etc. and T_FL, T_FR, etc.
L=2.6; % axle base - Reference Generator and Torque distribution - FZFL, FZFR, etc.
lr=0.5; % distance between rear axle to CoG - Torque distribution - FZFL, FZFR, etc.
lf=2.1; % distance between front axle to CoG - Torque distribution - FZFL, FZFR, etc.
h=0.25; % height of CoG - Torque distribution - FZFL, FZFR, etc.
m=180; % car mass - Torque distribution - FZFL, FZFR, etc. and T_FL, T_FR, etc.
ls=1.242; % wheelbase - Torque distribution - FZFL, FZFR, etc. and T_FL, T_FR, etc.
rw=0.217; % wheel radius - Speed Estimator and Torque distribution - T_FL, T_FR, etc.
drive_ratio=10; % ratio of main gearbox - Torque distribution
IPGDriver incorporates a detailed learning procedure designed to ensure the driver model accurately reflects real-world driving behavior through systematic learning and adaptation. This procedure is essential for ensuring that the driver in the simulation can handle various driving conditions consistently and predictably.
Basic Knowledge Phase:
This phase involves initial parameter estimation based on simple maneuvers. For example, a step input is applied to the steering wheel, and the system measures the vehicle's response times. These responses help in determining the preview times (tPreview) and other crucial parameters. The driver model adjusts its parameters iteratively to better match the desired course. For instance, if the vehicle initially deviates from a U-turn, adjustments are made until the model can accurately and consistently follow the desired path. Longitudinal Dynamics:
This aspect of the learning involves optimizing acceleration and braking responses. The system learns how to manage speed based on the vehicle's dynamics and the required driving task, such as maintaining a specific speed profile or achieving a target velocity efficiently. Parameters like throttle response and braking force are fine-tuned to ensure smooth and realistic longitudinal control, minimizing deviations from the desired speed. Lateral Dynamics:
In lateral dynamics, the system focuses on steering accuracy. By collecting data on how the vehicle responds to steering inputs, the model can adjust its steering behavior to follow the intended path more closely. The system uses gathered data to refine preview times and steering angles, ensuring the vehicle can navigate turns and maintain lane position accurately.
IPGDriver's adaptation mechanisms ensure that the driver model evolves and improves its performance over time, learning from each simulation run.
The driver model adapts to the vehicle's specific characteristics, such as its handling and response to inputs. This adaptation is crucial for ensuring that the model can handle the vehicle under various conditions consistently. The adaption process includes continuous learning from the vehicle's reactions, which helps in fine-tuning the control actions for steering, throttle, and braking. Race Driver Adaption:
For high-performance scenarios, such as racing, the driver model undergoes specialized adaption. This phase involves optimizing the driver model to achieve the best possible performance on a track, focusing on maximizing speed while maintaining control. This optimization process includes monitoring and adjusting parameters related to longitudinal and lateral slip, ensuring that the vehicle can navigate the track at high speeds with precision.
Several use cases illustrate how IPGDriver's learning and adaptation ensure repeatability and accuracy in simulations.
The ISO lane change use case highlights the system's ability to improve performance through learning. Initially, an untrained driver model may struggle to follow the lane change maneuver accurately. However, after the learning process, the driver model can execute the lane change with high precision, demonstrating the system's ability to reduce variability and enhance control.
In scenarios where the vehicle needs to follow a predefined speed profile, IPGDriver can maintain the desired speed with minimal deviation. This capability is a direct result of the driver model's learning and adaptation, which ensures that the vehicle's velocity closely aligns with the target speed throughout the simulation.
The process of refining preview times and other parameters through iterative adjustment ensures that the driver's behavior is consistent. The iterative nature of this adjustment process is designed to eliminate randomness.
By gathering data on how the vehicle responds to specific inputs and adjusting parameters accordingly, IPGDriver ensures that future responses are based on learned behavior rather than random variability.
The adaptation process involves learning from the vehicle's specific handling characteristics, further ensuring that the driver’s responses are based on empirical data and optimized parameters.