From generated code (Simulink Embedded coder) to Simulink model, for verification

조회 수: 3 (최근 30일)
Luca Nanu
Luca Nanu 2020년 3월 21일
댓글: Luca Nanu 2020년 3월 27일
Good evening, I'm working with Simulink Embedded Coder and I generated a Simulink discrete time controller model into C++ code. Now I want to verify if the code works as well as the starting Simulink model: so I want to subtitute the controller using blocks and MATLAB functions with a block running the C++ generated code, and verify if the behavior of the control in the simulated plant is the same for both of them.
How I can build a Simulink block running the source and header files of the generated code?

답변 (1개)

Mark McBroom
Mark McBroom 2020년 3월 22일
Put the Simulink model in Software In the Loop Mode(SIL). When this is done, Simulink will automatically replace the Simulink model with the generated code when the "Run" button is pushed. https://www.mathworks.com/help/releases/R2020a/ecoder/ug/about-sil-and-pil-simulations.html
  댓글 수: 1
Luca Nanu
Luca Nanu 2020년 3월 27일
Starting from your link I made a research and I found a toolbox called "Simulink Test". After its intallation, in Simulink right-clicking in a model block there's a command called Test Harness, which allows to create another block in SIL or PIL verification mode. In addition to the block it is created some generated code which is exactly the one generated by Embedded Coder. I followed a video found in YouTube (https://www.youtube.com/watch?v=PRsWwIkdn5M).
Now I've another question: is it a SIL verification if I run the new SIL model (in replace of the original discrete control model), connected with the plant model (as it is), but with the Simulation in Normal mode? I thought that even in Normal model the SIL model is ran in SIL mode, is it true? Or I need to have all the Simulink system in Software-in-the-Loop mode?
Thanks in advance.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by