You are currently viewing TSMasterHIL实时仿真系列3-脱离RT的车辆模型的实时仿真

TSMasterHIL Real-Time Simulation Series 3 - Real-Time Simulation of Vehicle Models without RT

This article introduces the third chapter of the TSMaster HIL real-time simulation series. It shares how the ECU algorithms interact at the data level, based on an understanding of how the embedded code for the ECU is automatically generated and integrated into the TSMaster real-time runtime environment.

I. Real-time simulation out of RT

Whether our ABS algorithm is in the TSMaster applet or in the real ECU hardware, its operation necessarily requires the input of signals such as wheel speed provided by the external environment, and its output must be applied to the external environment, in this case the vehicle and other controllers. Obviously, we need a vehicle model to participate in the simulation process, and in general, this vehicle model is the RT version of CarSim.


Based on the real-time discussion in Chapter 1, we can also use a non-RT version of CarSim and simply call the CarSim-related API functions in real time to move the entire vehicle model to a personal computer and run it.

II. Carsim Controller

In this example, we used our CarSim Controller, which is the equivalent of the RT version of CarSim, with the ability to simulate vehicle models on a PC with high accuracy.


We first open the CarSim automation instance through the CarSim Controller and select the vehicle model configuration that needs to be run in CarSim. Here we also use a folio pavement and can see that the left side is a high attached right side is a low attached sprinkler tile.

We switch back to CarSim Controller and click the Run button to see the simulation in real time.

Currently we see that the vehicle is moving slowly, due to the fact that the vehicle is at idle. We switch to the input interface table where we can browse through CarSim's traffic interface variables, which are equivalent to CarSim's function inputs in Simulink, and filter the interface variables that have been assigned to see our pre-configured inputs such as throttle and auto. We can control this vehicle model in real time through the interface as well as through the API.

If we want to stop giving throttle and apply automatic pressure to the left front wheel, say 15 MPa, switching to the video you can see that the left front wheel is holding while the other wheels are still rolling normally, and the above is the manual control function of the vehicle dynamics.

III. TSMaster's automatic control of the model

We can of course apply reproducible automatic control to the vehicle model via TSMaster, which requires TSMaster to load a client for CarSim Controller, the CarSim engine applet library.

When we open the applet library, we can see that the CarSim engine applet library has a series of automated API functions, which are responsible for the automatic modification of various parameters of the CarSim vehicle, real-time control of the dynamics model, and other unattended automated commands. Thus, it is possible to perform real-time simulations such as CarSim RT using only a PC. The benefits of running HIL directly from a PC are obvious, as the configuration and deployment of all kinds of parameters are local and can be done instantly compared to traditional HIL deployment.


The TSMaster-based software platform allows us to easily intervene with any variable in the ECU algorithm. It is important to note that CarSim Controller is only one of the millions of ways to make a dynamics software CarSim real-time. Based on this principle, other dynamics software such as Carmaker can also be controlled in real time.