Method for simulating sending, execution and response of VCU instruction of whole vehicle
By building a simulation system in Matlab and Simulink environments, the complex and time-consuming problems of the entire vehicle's VCU instruction testing equipment are solved, and the instruction sending and response simulation is realized when it is separated from hardware, reducing the testing cost and risk.
Patent Information
- Application Number
- CN202310608134.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-26
- Publication Date
- 2024-11-26
AI Technical Summary
The test of existing VCU instructions for the entire vehicle requires the actual vehicle to run. The equipment is complex and time-consuming, and there is a risk and the risk of equipment damage, resulting in an increase in testing costs.
Build a simulation system in Matlab and Simulink environments to generate methods that can be used to simulate the sending, executing and responding to VCU instructions in the whole vehicle. By setting up a compiler, building a motor control part, inverter circuit, motor part, and communication part, simulate CAN reports by simulating a compiler, configuring a motor control part, inverter circuit, motor part, and communication part. Instructions and control vehicle movement.
It realizes running the controller application layer code without hardware, verifying logic and control correctness, simulating the sending and response of VCU instructions in the whole vehicle, reducing the testing time and cost, and avoiding the risk of real-time operation.
Smart Images

Figure CN119024805A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of electronic data processing, in particular to a method for simulating the sending, execution and response of a VCU instruction of a whole vehicle. Background Art
[0002] At present, the testing of the VCU instructions of the whole vehicle requires real vehicle operation, the equipment used is complex and time-consuming, and the acquisition and processing of data are inconvenient. In addition, there is a risk of danger and equipment damage when testing directly on the whole vehicle. With the rapid development of electronic control system technology, the application field of ECU in vehicles is becoming more and more extensive, the algorithm is becoming more and more complex, and the functions are gradually increasing. In response to the growing demand for ECU functional testing, electronic control testing requires more testing time, resulting in a gradual increase in the cost of vehicle testing. Software-in-the-loop simulation (SIL) can achieve online or offline simulation of the target controller algorithm by setting the relevant signals of the ECU to connect to the simulation platform, thereby saving time and reducing costs for the development of the algorithm of the electronic control system. Summary of the invention
[0003] In order to overcome the defects of the prior art and provide a whole vehicle simulation method with good simulation effect, the present invention discloses a method for simulating the sending, execution and response of VCU instructions of the whole vehicle.
[0004] The present invention achieves the purpose of the invention through the following technical solutions: A method for simulating the sending, execution and response of a vehicle VCU command is implemented in the following steps: i. Build the system: Set up the compiler in the MATLAB environment and generate the motor control code into a file that can be used by the module; The motor control part built in simulink; The VCU controls the power part of the motor control, and the power part controls the formula power part or the physical power part; ii. Set the compiler: When installing microsft visual studio 2015, enter the following command in Matlab: mex-setup, then click "2" to set the compiler to vs compilation. The m file contains the code to be compiled. After the compiler is set up, run the m file to generate sil_wrapper.mexw64; iii. Creation and connection of inverter circuit and motor part: The modules for building the power section are in the following library path: Simulink Library Browser->Simscape->Electrical->Specialized PowerSystems->Fundamental Blocks, Click Electrical Sources, select DC Voltage Source and drag it into the model. Click Machines, select Permanent Magnet Synchronous Machine and drag it into the model. Click Power Electronics and select Universal Bridge. Click Measurements, select Current Measurement and Voltage Measurement, and drag them into the model to measure current and voltage respectively. Then link it; Enter powergui in the Simulink Library Browser, drag it to the model, double-click and set the sampling time to 1e-6s. Controller Hardware mainly uses Ta, Tb, and Tc output by software motor control to generate PWM waveforms; iv. Communication section: Enter CAN Pack and Unpack in the Simulink Library Browser, drag them into the model, import the dbc file, and simulate VCU sending CAN message instructions; Car model: Select the car model in the routine in matlab; The load controlled by the VCU selects the motor and the vehicle model, sets the mode of the motor to the torque mode, and the VCU controls the motor, which in turn drives the vehicle, and then the VCU controls the vehicle to produce acceleration and deceleration effects on the vehicle by adding and subtracting torque.
[0005] The method for simulating the sending, execution and response of the whole vehicle VCU command is characterized by: In step i, set the compiler to Microsoft Visual Studio in the MATLAB environment, and generate the motor control code into a file with the suffix mexw64 that can be used by the Simulink S-function module; The power part, inverter circuit and motor in the motor control built in simulink; The VCU controls the power part in the motor control, and the power part controls the formula power part or the physical power part.
[0006] The present invention can run the code logic of the controller application layer without hardware to verify the correctness of logic and control. It can run the voltage loop, current loop, and torque loop on the actual test bench. It can simulate the vehicle VCU to send CAN message instructions to our controller, and execute and respond to the instructions.
[0007] The present invention has the following beneficial effects: except for the pure underlying driver code, other software frameworks running on the actual test bench are completely run on this model. Including state machine, communication, motor control, etc., it can be used only to simulate motors and controllers without connecting to the car model. It can also be connected to the car model to observe the influence of control on the acceleration and deceleration of the car movement. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 This is a schematic diagram of calling sil_wrapper.mexw64 in the present invention. Figure 2 It is the power part of the motor control built in simulink in the present invention. Figure 3 is a schematic diagram of the present invention, Figure 4 yes Figure 3 Schematic diagram of the internal structure of 4. Figures 5 to 19 yes Figure 4 Parameter selection of each component in. Implementation
[0009] The present invention is further described below by means of specific examples. Example
[0010] A method for simulating the sending, execution and response of a vehicle VCU command is implemented in the following steps: In the MATLAB environment, set the compiler to Microsoft Visual Studio, and generate the motor control code into a file with the suffix mexw64 that can be used by the Simulink S-function module, such as Figure 1 The following shows the call to sil_wrapper.mexw64; like Figure 2 As shown: The power part, inverter circuit and motor in the motor control built in Simulink. The inside of the red box is Figure 1 The motor control code shown in the call module; The whole system is like Figure 3As shown: VCU1 controls the power part 2 in the motor control, the power part 2 controls the formula power part 3 or the physical power part 4, The formula power part 3 and the physical power part 4 are both parts of the vehicle power model, one is a formula and the other is a physical form. During use, Figure 2 and Figure 3 Choose one of the two: Formula Dynamics Part 3 and Physical Dynamics Part 4; Compiler settings: When installing microsft visual studio 2015, enter the following command in Matlab: mex-setup, such as Figure 3 Click "1" in the dialog box, and then click "2" to set the compiler to VS. The m file contains the code to be compiled. After the compiler is set up, run the m file to generate sil_wrapper.mexw64; Creation and connection of inverter circuit and motor part: The modules for building the power section are in the following library path: Simulink Library Browser->Simscape->Electrical->Specialized PowerSystems->Fundamental Blocks, Click Electrical Sources, select DC Voltage Source and drag it into the model. Click Machines, select Permanent Magnet Synchronous Machine and drag it into the model. Click Power Electronics and select Universal Bridge. Click Measurements, select Current Measurement and Voltage Measurement, and drag them into the model to measure current and voltage respectively. Then link it; Enter powergui in the Simulink Library Browser, drag it to the model, double-click and set the sampling time to 1e-6s. Controller Hardware mainly uses Ta, Tb, and Tc output by software motor control to generate PWM waveforms; Communication part: Enter CAN Pack and Unpack in the Simulink Library Browser, drag them into the model, import the dbc file, and simulate VCU1 sending CAN message instructions; Car model: Select the car model in the routine in matlab; The load controlled by VCU1 selects a motor and a vehicle model, sets the mode of the motor to a torque mode, VCU1 controls the motor, and the motor drives the vehicle, and then VCU1 controls the vehicle to produce acceleration and deceleration effects on the vehicle by adding and subtracting torque.
[0011] in Figure 4 The parameters of each component are selected as follows Figures 5 to 19 shown.
[0012] like Figure 5 As shown in the figure, select Torque Tm as the Mechinal input in the motor model, and then you can connect the physical model of the whole vehicle.
[0013] like Figure 6 to Figure 19 As shown in the figure: through the control of VCU1, the motor outputs torque, and drives the whole vehicle to run through the shaft connection. Figure 3 The physical dynamics part 4.
Claims
1. A method for simulating the sending, execution and response of a vehicle VCU command is implemented in the following steps: i. Build the system: Set up the compiler in the MATLAB environment and generate the motor control code into a file that can be used by the module; The motor control part built in simulink; The VCU (1) controls the power part (2) in the motor control, and the power part (2) controls the formula power part (3) or the physical power part (4); ii. Set the compiler: When installing microsft visual studio 2015, enter the following command in Matlab: mex-setup, then click "2" to set the compiler to vs compilation. The m file contains the code to be compiled. After the compiler is set up, run the m file to generate sil_wrapper.mexw64; iii. Creation and connection of inverter circuit and motor part: The modules for building the power section are in the following library path: Simulink Library Browser->Simscape->Electrical->Specialized PowerSystems->Fundamental Blocks, Click Electrical Sources, select DC Voltage Source and drag it into the model. Click Machines, select Permanent Magnet Synchronous Machine and drag it into the model. Click Power Electronics and select Universal Bridge. Click Measurements, select Current Measurement and Voltage Measurement, and drag them into the model to measure current and voltage respectively. Then link it; Enter powergui in the Simulink Library Browser, drag it to the model, double-click and set the sampling time to 1e-6s. Controller Hardware mainly uses Ta, Tb, and Tc output by software motor control to generate PWM waveforms; iv. Communication section: Enter CAN Pack and Unpack in the Simulink Library Browser, drag them into the model, import the dbc file, and simulate VCU (1) to send CAN message instructions; Car model: Select the car model in the routine in matlab; The load controlled by the VCU (1) is a motor and a vehicle model. The mode of the motor is set to a torque mode. The VCU (1) controls the motor, which in turn drives the vehicle. The VCU (1) then controls the vehicle to produce an acceleration and deceleration effect on the vehicle by adding and subtracting torque.
2. The method for simulating the sending, execution and response of a vehicle VCU command as claimed in claim 1, Its characteristics are: In step i, set the compiler to Microsoft Visual Studio in the MATLAB environment, and generate the motor control code into a file with the suffix mexw64 that can be used by the Simulink S-function module; The power part, inverter circuit and motor in the motor control built in simulink; The VCU (1) controls the power part (2) in the motor control, and the power part (2) controls the formula power part (3) or the physical power part (4).
