Joint simulation method and device for data recharging based on Python
By implementing automated data recharge and closed-loop simulation of vehicle system simulation tests in Python scripts, the scattered and complicated tools in the existing technology are solved, the testing cost and cycle are reduced, and the R&D process is simplified.
Patent Information
- Application Number
- CN202411118068.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-12-27
AI Technical Summary
At this stage, the tools in vehicle system simulation tests are scattered and complicated, and cannot be operated automatically, which brings inconvenience to the test links and engineers, resulting in high testing costs and long cycles.
Using a joint simulation method based on Python, pre-processing by reading the original data of the vehicle, parsing and filtering with Python asammdf library, automatically start MATLAB/Simulink for data re-injection, optimize the controlled object model until the preset conditions are met, and the vehicle is performed. Actual test.
It realizes the automated operation of vehicle system simulation tests, reduces test costs, shortens test cycles, and simplifies the algorithm development and system simulation testing process in chassis line control.
Smart Images

Figure CN119203479A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of vehicle system simulation testing, and in particular to a joint simulation method and device for data re-injection based on Python. Background Art
[0002] In vehicle system simulation testing, the original vehicle data is currently collected through CANape or other data acquisition tools. These original vehicle data are generally in MF4 format, and then the data is parsed, analyzed or replayed offline in CANape, converted into other common data storage formats (such as csv, etc.) through CANape, and then connected to a third-party platform for data playback simulation. The third-party platform is an integrated wire control brake model built based on AMEsim and MATLAB / Simulink. Finally, the data is re-injected in MATLAB, and when re-injecting the data, the vehicle data in csv format is synchronously read according to the time frame, and then the controlled object or algorithm is called in MATLAB / Simulink to perform closed-loop system simulation.
[0003] At present, when conducting online chassis simulation tests, tools are needed to debug controller algorithms, replay and analyze test data, and perform system simulation. However, these tools are relatively scattered and complicated, and cannot be run automatically, which brings inconvenience to the testing process and test engineers. Summary of the invention
[0004] The present application provides a joint simulation method and device for data re-injection based on Python, which is implemented in Python scripts and can fully automate data re-injection and closed-loop simulation, reducing test costs and shortening test cycles. The specific technical solution is as follows.
[0005] In a first aspect, the present application provides a joint simulation method for data re-injection based on Python, which is implemented by running in a python script. The joint simulation method for data re-injection based on Python includes:
[0006] Reading in original vehicle data, and preprocessing the original vehicle data to obtain data to be injected;
[0007] Starting the matlab project, injecting the data to be injected back into the control algorithm model of the simulation platform, and obtaining the simulation result of the controlled object model;
[0008] Determine whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition;
[0009] If the preset condition is not met, the controlled object model is optimized as the next controlled object model, and the process from starting the matlab project to optimizing the controlled object model is repeated until the comparison result between the simulation result and the measured data meets the preset condition;
[0010] The controlled object model that meets the preset conditions is used to perform actual vehicle testing.
[0011] Optionally, the reading in original vehicle data and preprocessing the original vehicle data to obtain data to be injected includes:
[0012] Call the Simulink API in MATLAB to read the original vehicle data;
[0013] The original vehicle data is collected in advance using the CANape tool, and the data format is mf4 format;
[0014] The Python asammdf library is used to parse and filter the original vehicle data, and the filtered data is saved frame by frame in csv format to obtain the data to be injected.
[0015] Optionally, the vehicle raw data is parsed and filtered using the Python asammdf library, and the filtered data is saved frame by frame in csv format, and the data to be injected includes:
[0016] The vehicle raw data is parsed using the Python asammdf library to obtain parsed data;
[0017] Filtering the parsed data using a predetermined filtering condition to obtain filtered data;
[0018] Save the filtered data frame by frame in csv format to obtain the data to be injected.
[0019] Optionally, the starting of the matlab project, injecting the data to be injected back into the control algorithm model of the simulation platform, and obtaining the simulation result of the controlled object model includes:
[0020] Automatically start Simulink and AMEsim in matlab, and initialize the configuration of the control algorithm model and the controlled object model in the simulation platform through matlab API;
[0021] Call the matlab python interface to start the matlab calling function;
[0022] Call the matlab reading function to read the data to be injected in csv format frame by frame into the array in matlab;
[0023] The data to be injected into the array and the timestamp are assembled into the re-injection data, and the re-injection data is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model.
[0024] Optionally, the simulation result of the controlled object model includes simulation data generated by the controlled object model on the simulation platform under the control of the control algorithm model.
[0025] Optionally, the determining whether a comparison result between the simulation result and the measured data of the controlled object meets a preset condition includes:
[0026] Comparing the simulation data with the measured data of the controlled object to determine the similarity between the two;
[0027] If the similarity between the simulation data and the measured data of the controlled object reaches a predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object meets a predetermined condition;
[0028] If the similarity between the simulation data and the actual measured data of the controlled object does not reach the predetermined value, it is determined that the comparison result between the simulation result and the actual measured data of the controlled object does not meet the predetermined condition.
[0029] Optionally, the controlled object model is a mathematical model simulated according to the controlled object on the vehicle, and the controlled object model is developed based on AMEsim.
[0030] Optionally, the control algorithm model is developed based on MBD and encapsulated in Simulink in Matlab.
[0031] In a second aspect, the present application provides a joint simulation device for data re-injection based on Python, the device comprising a reading module, a re-injection module, a judgment module, a circulation module and a testing module, wherein the reading module, the re-injection module, the judgment module, the circulation module and the testing module are all run in a Python script;
[0032] The reading module is configured to read original vehicle data and pre-process the original vehicle data to obtain data to be injected;
[0033] The re-injection module is configured to start the matlab project, re-inject the data to be injected into the control algorithm model of the simulation platform, and obtain the simulation result of the controlled object model;
[0034] The judgment module is configured to judge whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition;
[0035] The loop module is configured to optimize the controlled object model as the next controlled object model if the preset condition is not met, and repeat the process from starting the matlab project to optimizing the controlled object model until the comparison result between the simulation result and the measured data meets the preset condition;
[0036] The test module is configured to perform actual vehicle testing using the controlled object model when the preset conditions are met.
[0037] Optionally, the reading module is specifically configured as follows:
[0038] Call the Simulink API in MATLAB to read the original vehicle data;
[0039] The original vehicle data is collected in advance using the CANape tool, and the data format is mf4 format;
[0040] The Python asammdf library is used to parse and filter the original vehicle data, and the filtered data is saved frame by frame in csv format to obtain the data to be injected.
[0041] Optionally, the reading module is specifically configured as follows:
[0042] The vehicle raw data is parsed using the Python asammdf library to obtain parsed data;
[0043] Filtering the parsed data using a predetermined filtering condition to obtain filtered data;
[0044] Save the filtered data frame by frame in csv format to obtain the data to be injected.
[0045] Optionally, the recharging module is specifically configured as follows:
[0046] Automatically start Simulink and AMEsim in matlab, and initialize the configuration of the control algorithm model and the controlled object model in the simulation platform through matlab API;
[0047] Call the matlab python interface to start the matlab calling function;
[0048] Call the matlab reading function to read the data to be injected in csv format frame by frame into the array in matlab;
[0049] The data to be injected into the array and the timestamp are assembled into the re-injection data, and the re-injection data is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model.
[0050] Optionally, the judgment module is specifically configured to:
[0051] Comparing the simulation data with the measured data of the controlled object to determine the similarity between the two;
[0052] If the similarity between the simulation data and the measured data of the controlled object reaches a predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object meets a predetermined condition;
[0053] If the similarity between the simulation data and the actual measured data of the controlled object does not reach the predetermined value, it is determined that the comparison result between the simulation result and the actual measured data of the controlled object does not meet the predetermined condition.
[0054] In a third aspect, the present application provides a computer device, including: a memory and a processor, wherein the memory and the processor are coupled;
[0055] The memory is used to store one or more computer instructions;
[0056] The processor is used to run the Python script to execute the one or more computer instructions to implement the Python-based joint simulation method for data re-injection.
[0057] The present application provides a joint simulation method and device for data re-injection based on Python, which runs in a Python script to read in the original vehicle data and then pre-process it to obtain the data to be injected; the data to be injected is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model; it is determined whether the comparison result between the simulation result and the measured data of the controlled object meets the preset conditions; if the preset conditions are not met, the controlled object model is optimized by multiple cycles of simulation until the preset conditions are met; the controlled object model is used when the preset conditions are met to perform actual vehicle testing. The present application uniformly runs the data re-injection, control algorithm and controlled object in the simulation in a python script. The automated operation of these three parts can simplify, streamline and automate the processes such as the development of difficult algorithms in chassis wire control and system simulation testing. It greatly shortens the cycle of the entire research and development process, saving time and cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative work.
[0059] Figure 1 A schematic diagram of a flow chart of a joint simulation method for data re-injection based on Python provided in an embodiment of the present application;
[0060] Figure 2 A schematic diagram of a process for obtaining data to be injected provided in an embodiment of the present application;
[0061] Figure 3 A schematic diagram of a process for parsing and filtering data provided in an embodiment of the present application;
[0062] Figure 4 A schematic diagram of a flow chart of the recharging data provided in an embodiment of the present application;
[0063] Figure 5 A schematic diagram of a process for comparing simulation data with measured data provided in an embodiment of the present application;
[0064] Figure 6 A schematic diagram of the structure of a joint simulation device for data re-injection based on Python provided in an embodiment of the present application;
[0065] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0067] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0068] The embodiment of the present application discloses a joint simulation method for data reinjection based on Python, which automatically runs data reinjection, control algorithm model and controlled object model in a unified python script, thereby shortening the entire R&D cycle and saving time and economic costs.
[0069] The purpose of this application is to automate the system simulation platform and run the data injection, control algorithm and controlled object in the simulation in a unified python script. The automated operation of these three parts can simplify, streamline and automate the more difficult algorithm development, system simulation testing and other processes in chassis wire control. It greatly shortens the cycle of the entire R&D process, saving time and cost. This application can not only be used for data injection simulation, but also can be used as a simulation platform to automatically run various cases for virtual calibration and testing.
[0070] The embodiments of the present application are described in detail below.
[0071] Figure 1 A schematic diagram of a joint simulation method for data re-injection based on Python provided in an embodiment of the present application is shown, Figure 1 As shown, the purpose of this application is to simulate and adjust the controlled object on the vehicle, and uniformly perform data feedback, operation of the controlled object model and the control algorithm model in the python script.
[0072] The present application provides a joint simulation method for data re-injection based on Python, which is implemented by running in a python script. The joint simulation method for data re-injection based on Python includes:
[0073] S101, reading in original vehicle data, and preprocessing the original vehicle data to obtain data to be injected;
[0074] The vehicle raw data of this application refers to the signal generated by the vehicle controlled object, for example, the acceleration, speed, temperature, etc. of the vehicle. These signals are generally discrete signals, so the vehicle raw data is also discrete data. The format of the read-in vehicle raw data is generally mf4 format, so it needs to be pre-processed and then saved frame by frame to facilitate subsequent data re-injection.
[0075] S102, starting the matlab project, injecting the data to be injected back into the control algorithm model of the simulation platform, and obtaining the simulation result of the controlled object model;
[0076] The simulation result includes simulation data generated by the controlled object model under the control of the control algorithm model after the data to be injected is injected. The controlled object model is a mathematical model simulated according to the controlled object on the vehicle, and the controlled object model is developed based on AMEsim.
[0077] The controlled object of the present application may be an integrated brake-by-wire (onebox), which includes mechanical transmission components, electronic components and motors, hydraulic pipeline models, etc. Any object on the vehicle that can be controlled by the algorithm may be applied to the present application.
[0078] This application will develop a control algorithm model that is the same as the actual vehicle control algorithm on the simulation platform. The control algorithm model is developed based on MBD and encapsulated in Simulink in matlab.
[0079] The controlled object model based on AMEsim in this application will be automatically called and run in Simulink in matlab to provide the feedback signal required in the control algorithm model. After the controlled object model is subsequently optimized, re-simulation will form a fully closed-loop system simulation.
[0080] This application starts the matlab project in the python script, and matlab feeds the data back into the control algorithm model of the simulation platform for simulation, so as to obtain the simulation result of the controlled object model.
[0081] S103, determining whether the comparison result between the simulation result and the measured data of the controlled object meets a preset condition;
[0082] The control algorithm model of the simulation platform in this application is consistent with the control algorithm model actually set for the vehicle, so the controlled object model needs to be adjusted. By comparing the simulation results with the measured data of the controlled object, the difference between the two can be known. If the difference between the two is large, it indicates that the controlled object model simulated by the simulation platform does not match the actual controlled object on the vehicle and needs further adjustment.
[0083] S104, if the preset condition is not met, optimizing the controlled object model as the next controlled object model, and repeating the process from starting the matlab project to optimizing the controlled object model until the comparison result between the simulation result and the measured data meets the preset condition;
[0084] It is worth noting that adjusting the controlled object model is an iterative process, and the controlled object model needs to be adjusted multiple times to make it infinitely close to the actual controlled object. Of course, it is impossible to be infinitely close in practice. This application sets a preset condition. If it is met, it is confirmed that the controlled object model of the simulation platform meets the standard and can be used to complete the subsequent actual measurement link.
[0085] S105, performing actual vehicle testing using the controlled object model when the preset conditions are met.
[0086] It is worth noting that the controlled object model when the preset conditions are met is highly similar to the actual controlled object of the vehicle. Tests that cannot be completed during the actual vehicle process can be completed on the simulation platform by inputting data, making the test safer and less costly, and obtaining more realistic and accurate test data.
[0087] This application combines all simulation methods, uses Python scripts to automatically read the vehicle's original data, and performs data re-injection closed-loop simulation, so that each simulation platform can play its own advantages, realize data re-injection simulation testing of the controlled object, and form an automated closed-loop debugging of the controlled object and the control algorithm model. It can carry out debugging, calibration, verification and other work in a multi-platform joint simulation platform, reducing testing costs and shortening testing cycles.
[0088] The present application provides a joint simulation method based on Python for data injection, which obtains the final controlled object model by running an automated simulation process in a python script, and then performs actual measurement. The system joint simulation method of the present application is automated operation. Compared with traditional simulation tests, the present application replaces human input with machine automation execution, thereby saving manpower, improving test efficiency, and saving a lot of hardware resources and time.
[0089] In one embodiment of the present application, Figure 2 As shown, S101 includes:
[0090] S101a, calling the Simulink API in MATLAB to read the original vehicle data;
[0091] The original vehicle data is collected in advance using the CANape tool, and the data format is mf4 format;
[0092] This step calls the Simulink API in matlab to load the function mdf=MDF(.mf4) respectively, so as to read the original data of the vehicle, that is, the actual measured data of the vehicle.
[0093] S101b, using the Python asammdf library to parse and filter the original vehicle data, and saving the filtered data frame by frame in a csv format to obtain data to be injected.
[0094] This application calls functions in the python script and preprocesses the original vehicle data. The purpose of the preprocessing process is to filter out some abnormal data and select the data that meets the predetermined requirements, and then save them frame by frame in csv format. In Python, the matlab engine is called to automatically start Simulink in matlab, assemble and splice the real vehicle feedback data (vehicle original data), and play it back to the entire simulation system frame by frame.
[0095] In one embodiment of the present application, Figure 3 As shown, S101b includes:
[0096] S101b1, using the Python asammdf library to parse the original vehicle data to obtain parsed data;
[0097] S101b2, filtering the parsed data using a predetermined filtering condition to obtain filtered data;
[0098] The filtering condition of this step can be set in the form of a filtering signal, and the filtering signal is expressed as short = mdf.filter (import_signals), where import_signals is the signal or data (specified by the user) that needs to be injected into the simulation platform, and is passed in through command line parameters when running the python script. Of course, the command line parameters of this application can also include the path of the controlled object model and the path of the data file. For example: python3 LogSim_run.py-modelDirD: / OneBox_BIBC / OneBox_System / -dataFile C: / Users / bibo / Downloads / logsim_data / Radar_sim_dynamic_middle_2024-02-22_11-54-04.MF4-signalListPlungerTargetPressure p_Model_FL p_Model_FR p_Model_RL p_Model_RR Hydraulic_Mode_FL Hydraulic_Mode_FR Hydraulic_Mode_RL Hydraulic_Mode_RR.
[0099] For example, assuming that the original vehicle data is 100 frames, 15 frames are abnormal data, and after removing them, there are 85 frames, and import_signals is set to 20 frames of data, so according to the filter signal, 65 frames are filtered out and 20 frames of data are retained.
[0100] S101b3, save the filtered data frame by frame in csv format to obtain the data to be injected.
[0101] In one embodiment of the present application, Figure 4 As shown, S102 includes:
[0102] S102a, automatically starting Simulink and AMEsim in matlab, and initializing the configuration of the control algorithm model and the controlled object model in the simulation platform through matlab API;
[0103] S102b, calling the matlab python interface to start the matlab calling function;
[0104] S102c, calling the matlab reading function to read the data to be injected in the csv format frame by frame into an array in matlab;
[0105] S102d, assembling the data to be injected into the array and the timestamp into the re-injection data, and re-injecting the re-injection data into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model.
[0106] The Python script in this application will automatically start Simulink and AMEsim in matlab, and the controlled object model is designed based on AMEsim. Therefore, after matlab is automatically started, it will call the MATLAB API to initialize the configuration of the control algorithm model and the controlled object model; call the MATLAB python interface to start matlab.engine and start_matlab() respectively. Then after initializing the control algorithm model, use readtable() to read the data in csv format frame by frame into an array in matlab; finally, assemble them with the timestamp to become the data to be injected back into the control algorithm model, which is the data to be injected.
[0107] The data to be injected in this application is finally loaded into the space of MATLAB through assignin('base',","") for use by Simulink.
[0108] In one embodiment of the present application, Figure 5 As shown, S103 includes:
[0109] S103a, comparing the simulation data with the measured data of the controlled object to determine the similarity between the two;
[0110] S103b, if the similarity between the simulation data and the measured data of the controlled object reaches a predetermined value, determining that the comparison result between the simulation result and the measured data of the controlled object meets a predetermined condition;
[0111] S103c: If the similarity between the simulation data and the measured data of the controlled object does not reach the predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object does not meet a predetermined condition.
[0112] Among them, the predetermined condition of the present application is that the similarity reaches a predetermined value, and the predetermined value may be 80%. Of course, it may also be adjusted according to actual conditions, and the present application does not impose any limitation on this.
[0113] This implementation requires comparing the simulation data with the measured data of the controlled object. If the two have a high degree of similarity, it means that the controlled object model is similar to the controlled object measured by the vehicle. If the similarity does not meet the predetermined condition, it is considered that the controlled object model needs to be further optimized.
[0114] refer to Figure 6 , the present application provides a joint simulation device for data re-injection based on Python, the device includes a reading module, a re-injection module, a judgment module, a circulation module and a testing module, the reading module 61, the re-injection module 62, the judgment module 63, the circulation module 64 and the testing module 65 are all run in a Python script;
[0115] The reading module 61 is configured to read original vehicle data and pre-process the original vehicle data to obtain data to be injected;
[0116] The simulation result of the controlled object model includes simulation data generated by the controlled object model of the simulation platform under the control of the control algorithm model. The controlled object model is a mathematical model simulated according to the controlled object on the vehicle, and the controlled object model is developed based on AMEsim. The control algorithm model is developed based on MBD and is encapsulated in Simulink in matlab.
[0117] The re-injection module 62 is configured to start the matlab project, re-inject the data to be injected into the control algorithm model of the simulation platform, and obtain the simulation result of the controlled object model;
[0118] The judgment module 63 is configured to judge whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition;
[0119] The loop module 64 is configured to optimize the controlled object model as the next controlled object model if the preset condition is not met, and repeat the process from starting the matlab project to optimizing the controlled object model until the comparison result between the simulation result and the measured data meets the preset condition;
[0120] The test module 65 is configured to perform actual vehicle testing using the controlled object model when the preset conditions are met.
[0121] Optionally, the reading module 61 is specifically configured as follows:
[0122] Call the Simulink API in MATLAB to read the original vehicle data;
[0123] The original vehicle data is collected in advance using the CANape tool, and the data format is mf4 format;
[0124] The Python asammdf library is used to parse and filter the original vehicle data, and the filtered data is saved frame by frame in csv format to obtain the data to be injected.
[0125] Optionally, the vehicle raw data is parsed and filtered using the Python asammdf library, and the filtered data is saved frame by frame in csv format, and the data to be injected includes:
[0126] The vehicle raw data is parsed using the Python asammdf library to obtain parsed data;
[0127] Filtering the parsed data using a predetermined filtering condition to obtain filtered data;
[0128] Save the filtered data frame by frame in csv format to obtain the data to be injected.
[0129] Optionally, the recharging module 62 is specifically configured as follows:
[0130] Automatically start Simulink and AMEsim in matlab, and initialize the configuration of the control algorithm model and the controlled object model in the simulation platform through matlab API;
[0131] Call the matlab python interface to start the matlab calling function;
[0132] Call the matlab reading function to read the data to be injected in csv format frame by frame into the array in matlab;
[0133] The data to be injected into the array and the timestamp are assembled into the re-injection data, and the re-injection data is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model.
[0134] Optionally, the judging module 63 is specifically configured as follows:
[0135] Comparing the simulation data with the measured data of the controlled object to determine the similarity between the two;
[0136] If the similarity between the simulation data and the measured data of the controlled object reaches a predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object meets a predetermined condition;
[0137] If the similarity between the simulation data and the actual measured data of the controlled object does not reach the predetermined value, it is determined that the comparison result between the simulation result and the actual measured data of the controlled object does not meet the predetermined condition.
[0138] The present application provides a joint simulation device for data re-injection based on Python, running various modules in the Python script to read in the original vehicle data and then pre-process it to obtain the data to be injected; the data to be injected is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model; it is determined whether the comparison result between the simulation result and the measured data of the controlled object meets the preset conditions; if the preset conditions are not met, the controlled object model is optimized by multiple cycles of simulation until the preset conditions are met; the controlled object model is used to perform actual vehicle testing when the preset conditions are met. The present application uniformly runs the data re-injection, control algorithm and controlled object in the simulation in the python script. The automated operation of these three parts can simplify, streamline and automate the processes such as the development of difficult algorithms in chassis wire control and system simulation testing. It greatly shortens the cycle of the entire research and development process, saving time and cost.
[0139] Next, a computer device provided by an embodiment of the present application is introduced. Figure 7 , Figure 7 A schematic diagram of a structure of a computer device provided in an embodiment of the present application, the computer device comprises: a memory 71 and a processor 72, the memory 71 and the processor 72 are coupled;
[0140] The memory 71 is used to store one or more computer instructions;
[0141] The processor 72 is used to run the Python script to execute the one or more computer instructions to implement the Python-based joint simulation method for data re-injection.
[0142] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of one embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application.
[0143] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be changed accordingly and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further divided into multiple sub-modules.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A joint simulation method for data re-injection based on Python, characterized in that: The implementation is run in a python script. The joint simulation method based on Python for data re-injection includes: Reading in original vehicle data, and preprocessing the original vehicle data to obtain data to be injected; Starting the matlab project, injecting the data to be injected back into the control algorithm model of the simulation platform, and obtaining the simulation result of the controlled object model; Determine whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition; If the preset condition is not met, the controlled object model is optimized as the next controlled object model, and the process from starting the matlab project to optimizing the controlled object model is repeated until the comparison result between the simulation result and the measured data meets the preset condition; The controlled object model is used to perform actual vehicle testing when the preset conditions are met.
2. The joint simulation method for data re-injection based on Python according to claim 1 is characterized in that: The reading in of the original vehicle data and preprocessing the original vehicle data to obtain the data to be injected comprises: Call the Simulink API in MATLAB to read the original vehicle data; The original vehicle data is collected in advance using the CANape tool, and the data format is mf4 format; The Python asammdf library is used to parse and filter the original vehicle data, and the filtered data is saved frame by frame in csv format to obtain the data to be injected.
3. The joint simulation method for data re-injection based on Python according to claim 2 is characterized in that: The vehicle raw data is parsed and filtered using the Python asammdf library, and the filtered data is saved frame by frame in csv format, and the data to be injected includes: The vehicle raw data is parsed using the Python asammdf library to obtain parsed data; Filtering the parsed data using a predetermined filtering condition to obtain filtered data; Save the filtered data frame by frame in csv format to obtain the data to be injected.
4. The joint simulation method for data re-injection based on Python according to claim 1 is characterized in that: The starting of the matlab project, injecting the data to be injected back into the control algorithm model of the simulation platform, and obtaining the simulation result of the controlled object model include: Automatically start Simulink and AMEsim in matlab, and initialize the configuration of the control algorithm model and the controlled object model in the simulation platform through matlab API; Call the matlab python interface to start the matlab calling function; Call the matlab reading function to read the data to be injected in csv format frame by frame into the array in matlab; The data to be injected into the array and the timestamp are assembled into the re-injection data, and the re-injection data is re-injected into the control algorithm model of the simulation platform to obtain the simulation result of the controlled object model.
5. The joint simulation method for data re-injection based on Python according to claim 1 is characterized in that: The simulation result of the controlled object model includes simulation data generated by the controlled object model on the simulation platform under the control of the control algorithm model.
6. The joint simulation method for data re-injection based on Python according to claim 5 is characterized in that: The step of judging whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition comprises: Comparing the simulation data with the measured data of the controlled object to determine the similarity between the two; If the similarity between the simulation data and the measured data of the controlled object reaches a predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object meets a predetermined condition; If the similarity between the simulation data and the measured data of the controlled object does not reach the predetermined value, it is determined that the comparison result between the simulation result and the measured data of the controlled object does not meet the predetermined condition.
7. The joint simulation method for data re-injection based on Python according to any one of claims 1 to 6, characterized in that: The controlled object model is a mathematical model simulated according to the controlled object on the vehicle, and the controlled object model is developed based on AMEsim.
8. The joint simulation method for data re-injection based on Python according to any one of claims 1 to 6, characterized in that: The control algorithm model is developed based on MBD and encapsulated in Simulink in Matlab.
9. A joint simulation device for data re-injection based on Python, characterized in that: The device comprises a reading module, a recharging module, a judging module, a circulation module and a testing module, wherein the reading module, the recharging module, the judging module, the circulation module and the testing module are all run in a Python script; The reading module is configured to read original vehicle data and pre-process the original vehicle data to obtain data to be injected; The re-injection module is configured to start the matlab project, re-inject the data to be injected into the control algorithm model of the simulation platform, and obtain the simulation result of the controlled object model; The judgment module is configured to judge whether the comparison result between the simulation result and the measured data of the controlled object meets the preset condition; The loop module is configured to optimize the controlled object model as the next controlled object model if the preset condition is not met, and repeat the process from starting the matlab project to optimizing the controlled object model until the comparison result between the simulation result and the measured data meets the preset condition; The test module is configured to perform actual vehicle testing using the controlled object model when the preset conditions are met.
10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are coupled; The memory is used to store one or more computer instructions; The processor is used to run the Python script to execute the one or more computer instructions to implement the joint simulation method for data reinjection based on Python as described in any one of claims 1-8.