Examples of using a real-time machine (MATLAB, Simulink, Software and hardware simulator)
Good afternoon, dear audience! In my practice, I often encounter a situation when, when I mention in conversation, a certain “real-time machine” in the eyes of my interlocutor, a million associations, unfortunately, are not related to the topic of conversation. In the first article I want to shed some light on this topic with a name that is so unusual for a Russian-speaking engineering audience.
All interested in the launch of control algorithms and physical models in the form of Simulink models in hard real-time mode with minimal effort - please under the cat! Attention, many images! ')
So, a brief definition:
A real-time machine is a computer that is designed to perform a wide range of tasks in real time .
Explanatory notes to the brief definition:
A wide range of tasks entails some versatility and redundancy in the software and hardware components. For the most part, such PCs (industrial computer, not to be confused with personal computers) have a rich set of input-output means in the form of interface cards and drivers for them.
The requirement for real-time operation translates into the fact that this PC must be running a real-time operating system. There are exceptions to this rule, nobody canceled the free account mode.
There are exceptions - there are composite simulators from several machines, and without input-output boards, and not of industrial design, and in soft real time. But, again, most often - this is an IBM compatible computer with hardware and software components that allow it to work with real-time hard.
In the Russian-language literature and everyday life, the terms hardware-software simulator and semi-natural modeling are often found. From my point of view, they are not complete. Because “model simulation” is not a single function of this device.
The list of manufacturers of such solutions is quite extensive. I will consider the products from Speedgoat , with whom I was lucky enough to work quite closely.
Below, on the basis of examples, I will try to reveal the essence of the use of such machines.
Example №1
A team of engineers is developing an electric drive. There is a model in Simulink , in which the Controller subsystem (control system) was developed by the control systems engineer, and the Plant subsystem (engine model) was developed by the physical modeling department engineer.
Task: There is no hardware prototype of the controller yet, and it is not clear when it will be. There is no prototype of the engine either, or it is terrible to connect it to a still crude control system.
Solution: Use a real-time machine for rapid prototyping of the control system. And one more machine, but more productive, for launching a physical engine model in real time. The interfaces between such machines can and should be the same as between the real engine and the controller. This bundle is called HIL - Hardware-In-The-Loop . For a simple - software and hardware simulation . It allows at early stages to integrate and test control algorithms in conjunction with the control object model in real time, taking into account the influence of the data transmission medium between devices.
The illustration below shows a diagram of such a process. The real-time machine for the control system may be protected for subsequent deployment in the field. The machine for the physical model requires more productive - shown on the right. The transfer of the algorithm and model to the real world is done in one click with the mouse and can be performed by an engineer without the help of a programmer and without deep understanding of the nuances of the RTOS.
Example 2
All the same team. There was a prototype of the engine, the prototype of the controller is still in development.
Task: It is necessary to test the control system on a real control object.
Solution: The control system has already been tested on the engine model when working on a PC. Then even more fully in HIL mode. Now, when the real prototype appeared, it is not so scary to launch it. Because most of the errors have already been caught and it is only necessary to validate the operation of the system.
It is also possible that the control object was from the very beginning. Then, a quick transition from a control system model to a working piece of hardware can be called Rapid Prototyping or Rapid Prototyping .
Example number 3
Again, the familiar team. Came out the first sample controller.
Task: It is necessary to connect the first sample to a possibly multi-kilowatted engine.
Solution: For security reasons, do not get hot, and first run a couple of tests using the engine model on a real-time machine. This will be pure Plant Simulation or Object Management Simulation .
It is possible to launch the whole model of the aircraft on a real-time machine. In aviation, such a simulator is often affectionately called the "electronic bird" .
By the way, the controller firmware must be generated necessarily from the same model that was launched on the real-time machine in the previous examples. Only in this way will we provide end-to-end traceability. Rewriting the firmware again is fraught with the introduction of new errors and reduces the previous steps to the smarco.
Below is an illustration describing the essence of solving the problem and video of the workflow with Siemens PLC as a controller, and a real-time machine as a control object.
Siemens PLC + Speedgoat real-time machine
Example 4
The final stage of development.
Task: It is necessary to conduct 100,500 tests on a real drive and document the results as soon as possible.
Solution: A real-time machine can be the heart of a test bench — generate test scripts and keep a log of the required parameters. In MATLAB, you can create a non-linear test script that can be automatically rebuilt depending on the results obtained. The documentation generator will help to generate a report in the required format automatically.
As you can see from the examples, the same machine can be reused in different use cases. But nevertheless it is impossible to completely unify these devices - there is some distribution according to functionality. The Speedgoat line, for example, has the following form :
The educational version is an immeasurable joy for any laboratory at a technical university. Having such in the laboratory, it is possible for a fixed certification period, for example, to have time to make a much more advanced project.
And I took two of the same to Naberezhnye Chelny to the department of control systems of the KFU branch.
I have another idea to highlight the following questions in more detail. Namely:
C / C ++ / Verilog / VHDL code generation
Hardware, I / O boards
Software Environment, RTOS, BIOS
Real-time debugging (External mode)
This should be reflected in the following article. I really want to hear questions and possible suggestions in the comments. In August, I plan to hold a technical webinar on this topic. The invitation will be posted on the website matlab.ru . I would be very happy if the participants will have habrousers with interesting questions!