Real-time simulation with C2000 device

10 ビュー (過去 30 日間)
Eduard Monlleo
Eduard Monlleo 2019 年 3 月 21 日
コメント済み: Antonin 2022 年 8 月 18 日
Hello,
I am trying to do a Real-time simulation with a F28004 DSP.
I am currently using the PIL block to check a component running on the DSP while simulating the work environment on the computer, but it has been noticed that the speed that runs the model on the device is around 15 ms instead of 10 us (for example).
Is there any way to make it Real-Time?
Thank you.

回答 (1 件)

Antonin
Antonin 2019 年 3 月 22 日
Hi Eduard,
PIL is not meant to be realtime. The primary use case for PIL is verification of the results produced by the generated code vs simulation.
If you are looking for a way to monitor signals in Simulink while the model runs in realtime on the hardware, you should use External mode.
Please refer to the answer provided on this page, it shows 3 different techniques to achieve this and points to a video where I demonstrate how to visualize variables updated at 200kHz (5µs).
I hope it helps,
Thanks,
Antonin.
  3 件のコメント
chagamreddy venkatasubbareddy
chagamreddy venkatasubbareddy 2022 年 8 月 18 日
Hello Antonin, I am using extrnal mode control in c2000 embedded simulink. I constructed sine pwm to run motor with 50hz frequency. In build and deployment mode motor running with rated speed but in external mode it is running less than half of rated speed with same module I. E 50hz frequency. What I observed is in external mode 30sec simulation time takes to 60 sec real time. Thats why even though i gave 50hz reference sine wave it is running at 25hz frequency in real time world. How to synchronize simulation time with real time during external mode. Thanks Regard
Antonin
Antonin 2022 年 8 月 18 日
Hi Chagamreddy,
One common root cause of what you are observing is an overrun on the base rate or one of the subrates of the model. Make sure that the code is not overrunning and finishes execution within the given sample time. Enabling sample time colors on the model helps understand which part of the model is running at what rate. Make sure that all your sample times are multiples of each other, otherwise Simulink will have to find a common denominator base rate that may have to run very often just to keep track of the different which kills performance and may lead to what you are observing.
I hope it helps,
Thanks,
Antonin.

サインインしてコメントする。

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by