
Examples of using a real-time machine (MATLAB, Simulink, Hardware-software simulator)
Good afternoon, dear Audience!
In my practice, I often come across a situation when, when I mention a certain “real-time machine” in my conversation, a million associations slip through my interlocutor’s eyes, unfortunately unrelated to the topic of the conversation.
In the first article I want to shed some light on this topic with such an unusual sounding sound for a Russian-speaking engineering audience.

Anyone interested in launching control algorithms and physical models in the form of Simulink models in hard real-time mode with minimal labor costs - please, cut!
Attention, a lot of images!

So, a brief definition:
Explanation of the short definition:
There are exceptions - there are composite simulators from several machines, and without input / output cards, and not industrial performance, and in soft real time. But, again, more often than not - this is an IBM compatible computer with hardware and software components that allow it to work with hard real-time.
In Russian-language literature and everyday life, the terms software-hardware simulator and semi-natural modeling are often found . In my opinion, they are not complete. Because "simulation of models" is not a single function of this device.
The list of manufacturers of such solutions is quite extensive. I will take into consideration Speedgoat products , with which I was fortunate enough to work closely.
Below, based on examples, I will try to reveal the essence of the use of such machines.
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 system engineer, and the Plant subsystem (engine model) is developed by the engineer of the physical modeling department.
Task: There is no hardware prototype of the controller yet, and it is not clear when it will be. There is no engine prototype either, or it is scary to connect it to a still crude control system.
Decision:Use a real-time machine to quickly prototype a control system. And another car, but more productive, to run a physical engine model in real time. The interfaces between these machines can and should be the same as between the real engine and the controller. This bunch is called HIL - Hardware-In-The-Loop . On a simple - hardware-software simulation . It allows at the early stages to integrate and test control algorithms in conjunction with the model of the control object in real time, taking into account the influence of the data transfer medium between devices.
The illustration below shows a diagram of such a process. The real-time machine for the control system can be protected for subsequent placement in the field. The machine for the physical model requires a more productive one - shown on the right. The algorithm and model are transferred to the real world with one click of 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.

All the same team. There was a prototype engine, a prototype 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’s not so scary to launch it. Because most errors have already been caught and you only need to validate 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 Fast Prototyping or Rapid Prototyping .

Again a familiar team. The first sample controller came out.
Task: It is necessary to connect the first sample to a possibly multi-kilowatt engine.
Solution: For safety reasons, you should not get hot, but first run a couple of tests using the engine model on a real-time machine. This will be a pure Plant Simulation or a Control Object Simulation .
It is possible to launch an entire model of an airplane in 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. This is the only way to ensure end-to-end traceability. Rewriting the firmware again is fraught with the introduction of new errors and reduces the previous steps to a smarck.
Below is an illustration describing the essence of solving a problem and a video workflow with Siemens PLC as a controller, and a real-time machine as a control object.

PLC Siemens + Speedgoat real-time machine
The final stage of development.
Task: It is necessary to conduct 100500 tests on a real drive and to document the results in the shortest possible time.
Solution: A real-time machine can act as the heart of a test bench - generate test scripts and keep a log of the necessary parameters. In MATLAB, you can create a non-linear test script that can automatically be rebuilt depending on the results. The documentation generator will help to generate a report in the required format automatically.

As can be seen from the examples, the same machine can be reused in different uses. But nevertheless, it is impossible to completely unify these devices - there is a certain distribution of functionality. The Speedgoat line, for example, hasnext view : The

educational version is an immeasurable joy for any laboratory at a technical university.
Having this in the laboratory, for a fixed period of certification, for example, you can make a much more advanced project.
Speedgoat’s real-time machine inside has the MIT Cheetah Robot :
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 cover the following questions in more detail.
Namely:
This should result in the next article. I really want to listen to questions and possible wishes in the comments.
In August, I plan to hold a technical webinar on this topic. The invitation will be posted on matlab.ru . I would be extremely happy if the participants will have habrayuzery with interesting questions!
Thanks for reading!
In my practice, I often come across a situation when, when I mention a certain “real-time machine” in my conversation, a million associations slip through my interlocutor’s eyes, unfortunately unrelated to the topic of the conversation.
In the first article I want to shed some light on this topic with such an unusual sounding sound for a Russian-speaking engineering audience.

Anyone interested in launching control algorithms and physical models in the form of Simulink models in hard real-time mode with minimal labor costs - please, cut!
Attention, a lot of 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 .
Explanation of the short definition:
- A wide range of tasks entails some universality and redundancy in the software and hardware components. For the most part, such PCs (an industrial computer, not to be confused with a personal one) have a rich set of input / output tools in the form of interface cards and drivers for them.
- The requirement for real-time operation results in the fact that this PC must be running a real-time operating system. There are exceptions to this rule; no one has canceled the free account mode.
There are exceptions - there are composite simulators from several machines, and without input / output cards, and not industrial performance, and in soft real time. But, again, more often than not - this is an IBM compatible computer with hardware and software components that allow it to work with hard real-time.
In Russian-language literature and everyday life, the terms software-hardware simulator and semi-natural modeling are often found . In my opinion, they are not complete. Because "simulation of models" is not a single function of this device.
The list of manufacturers of such solutions is quite extensive. I will take into consideration Speedgoat products , with which I was fortunate enough to work closely.
Below, based on examples, I will try to reveal the essence of the use of such machines.
Example No. 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 system engineer, and the Plant subsystem (engine model) is developed by the engineer of the physical modeling department.
Task: There is no hardware prototype of the controller yet, and it is not clear when it will be. There is no engine prototype either, or it is scary to connect it to a still crude control system.
Decision:Use a real-time machine to quickly prototype a control system. And another car, but more productive, to run a physical engine model in real time. The interfaces between these machines can and should be the same as between the real engine and the controller. This bunch is called HIL - Hardware-In-The-Loop . On a simple - hardware-software simulation . It allows at the early stages to integrate and test control algorithms in conjunction with the model of the control object in real time, taking into account the influence of the data transfer medium between devices.
The illustration below shows a diagram of such a process. The real-time machine for the control system can be protected for subsequent placement in the field. The machine for the physical model requires a more productive one - shown on the right. The algorithm and model are transferred to the real world with one click of 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 No. 2
All the same team. There was a prototype engine, a prototype 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’s not so scary to launch it. Because most errors have already been caught and you only need to validate 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 Fast Prototyping or Rapid Prototyping .

Example No. 3
Again a familiar team. The first sample controller came out.
Task: It is necessary to connect the first sample to a possibly multi-kilowatt engine.
Solution: For safety reasons, you should not get hot, but first run a couple of tests using the engine model on a real-time machine. This will be a pure Plant Simulation or a Control Object Simulation .
It is possible to launch an entire model of an airplane in 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. This is the only way to ensure end-to-end traceability. Rewriting the firmware again is fraught with the introduction of new errors and reduces the previous steps to a smarck.
Below is an illustration describing the essence of solving a problem and a video workflow with Siemens PLC as a controller, and a real-time machine as a control object.

PLC Siemens + Speedgoat real-time machine
Example No. 4
The final stage of development.
Task: It is necessary to conduct 100500 tests on a real drive and to document the results in the shortest possible time.
Solution: A real-time machine can act as the heart of a test bench - generate test scripts and keep a log of the necessary parameters. In MATLAB, you can create a non-linear test script that can automatically be rebuilt depending on the results. The documentation generator will help to generate a report in the required format automatically.

As can be seen from the examples, the same machine can be reused in different uses. But nevertheless, it is impossible to completely unify these devices - there is a certain distribution of functionality. The Speedgoat line, for example, hasnext view : The

educational version is an immeasurable joy for any laboratory at a technical university.
Having this in the laboratory, for a fixed period of certification, for example, you can make a much more advanced project.
Speedgoat’s real-time machine inside has the MIT Cheetah Robot :
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 cover the following questions in more detail.
Namely:
- C / C ++ / Verilog / VHDL Code Generation
- Hardware, I / O cards
- Software environment, RTOS, BIOS
- Real-time debugging (External mode)
This should result in the next article. I really want to listen to questions and possible wishes in the comments.
In August, I plan to hold a technical webinar on this topic. The invitation will be posted on matlab.ru . I would be extremely happy if the participants will have habrayuzery with interesting questions!
Thanks for reading!