大红鹰dhy登录界面「网站首页」欢迎您 /en/tsmaster-hil-simulation-01/ Mon, 26 Sep 2022 08:46:53 +0000 /?p=181 Real-time simulation occupies an important position in the development and testing of automotive components, usually, to realize real-time simulation and hardware in the loop testing, it is inevitable and NI, V [...].

The post TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles first appeared on Shanghai TOSUN Technology Ltd..

]]>

Real-time simulation occupies an important position in the development and testing of automotive components. Usually, to achieve real-time simulation and hardware-in-the-loop testing, it is inevitable to work withNI, ,Veristand, ,DspaceWait for theseBigBrand software or hardware products deal with the high cost of these products, but also a certain threshold of access, and is not conducive to large-scale promotion. AndTSMasterThe emergence of the new company broke such a situation.

First of all, explain the real-time simulation in real-time simulation, it does not require how fast the simulation speed should be, but the deterministic requirements for the moment of return results of the simulation calculation tasks. For example, a task in the ECU has an execution period of 5 ms, and the basic requirement for real-time is that the task must be executed within the current 5 ms, and cannot be postponed to the next 5 ms cycle, which is only the most basic requirement. Because of the limited computing resources of the ECU processor, there are numerous tasks with different cycles that need to be completed within the specified time, which is why it is necessary to use a real-time system to perform the simulation tasks, and the real-time system completely simulates the operating environment of the ECU controller.

1銆乀SMaster's soft real-time capability

Taking the example of a 1 ms task that needs to be emulated, this task will run 1000 times in 1 second, and with the capability of TSMaster, the frequency of this task can be precisely controlled to 1000 Hz or even higher.For example, if we change the period of this message to 1 millisecond, we can see that the frequency of this frame becomes 1000 frames per second.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

 With the correct frequency, the next step is to mathematically count the hits at each task's point in time. For example, if a task is run within a time frame of plus or minus 20% at the 1 ms moment when it will be executed, the task is considered a successful hit for this run. At the end of the simulation process, we can get a hit rate of, say, 97%, which means that on average, only 3 out of every 100 task runs have errors due to timing uncertainty, so we can use the size of the hit rate as a basis for evaluating the similarity between the real-time simulation results and the expected results. The higher the hit rate, the better the simulation, and this algorithm is the basis of the HIL of TSMaster software.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles


2銆乀SMaster timing function - participate in simulation test

We can open the System Information window of TSMaster, go to the Diagnostic Information section, and there is a software performance test tool, which can evaluate the performance of the built-in timer of TSMaster, the default is 8 milliseconds timing period, the tolerance error is 10%. This means that timing moments within 7.2 ms to 8.8 ms are acceptable.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

We can directly click the "Performance Evaluation" button to see the results of the actual test. The middle is the average of the measured results, the left is the minimum average of the period, the right is the maximum average of the period, and also comes with an error ratio of 1.% several.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

Next, we open the Task Manager and see that this is our TSMaster process. With such a low error ratio as 5%, the TSMaster CPU usage is also quite low, which speaks volumes about the superior performance of the TSMaster software itself. This means that using the timing function of TSMaster in most cases you can directly participate in the real-time simulation without any further arrangement.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles


3銆丷eal-time of the same star hardware

Let's verify the real-time performance of TSMaster with a simple example of sending and receiving messages. First we create a brand new project, we choose the bus measurement template, and in this project we choose the TC1005 hardware as the bridge between our software world and the real world.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

Open the channel selector and select the two channels of the TC1005, which have been connected to each other via CAN lines before this. This means that if we send data on one of the channels, the other channel can receive it.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

Then we start the simulation, open the send window to send a message, choose a period of 5 milliseconds, that is, 1 second to send 200 frames, you can see that the frame rate is 200 on top of the TRACE window, then switch to the graphics window, add the system variable of frame rate statistics, you can see that the frame rate is also above and below 200, the change is very small.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

Of course this is only the frame rate statistics at the software level. Next we will see if the real world is the same. The oscilloscope is needed to observe the frequency and error of the frame statistics, where we have prepared the PicoScope. channel 1 of this oscilloscope has been linked to the CAN bus before, and the measurement is a differential signal, i.e. the meter pen, connected to CAN High to CAN Low.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

We will scale to 5 ms 1 frame, we can see the continuously changing waveform, then we set a simple trigger, the trigger point is placed on the first frame, we can see that there is a frame of messages at the dotted line of each frame, which means that our software at this time is trying to ensure that the messages appear at an interval of 5 ms each.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

Then we measure the frequency, the measurement frequency needs to ensure that there is enough sampling range, we switch to 10 milliseconds 1 frame, then you can see that basically there are two frames of messages in the middle of a frame, in the overall case to ensure a frequency range of 200 frames per second. Then we increase the measurement at this time and we can see that the frequency at this time is 200 Hz, which is exactly the same as the frame rate on our software. This validates the real-time nature of the TSMaster software. Based on this real time performance, we can perform real time simulation, even HIL simulation, by manipulating the bus data sending method.

TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles

The post TSMasterHIL Real-Time Simulation Series 1-Real-Time Simulation Principles first appeared on Shanghai TOSUN Technology Ltd..

]]>