How do I run a simulink model in real-time in normal mode

조회 수: 13 (최근 30일)
bethel o
bethel o 2012년 3월 14일
댓글: Jan Houska 2013년 11월 14일
I can't seem to figure out how to run a simulink model in real-time in 'Normal' mode
The Mathworks guides says "In your Real-Time Windows Target model, set values for the Sample Time and Maximum Missed Ticks block parameters to prevent missed ticks."
but how to you find this 'Real-Time Windows Target model' that should contain 'Sample Time' and 'Maximum Missed Ticks'.
My models works well in 'External' but as soon as I change to 'Normal' mode it runs in nun real time.
Is there suppose to be a sync block or other blocks that need to be added in my model
I have spent hours on this please help me anybody?
Thanks Behel

답변 (3개)

Titus Edelhofer
Titus Edelhofer 2012년 3월 14일
Hi Behel,
not sure, if I fully understand: Real-Time Windows Target is a compiled Simulink model. The model runs in real-time and Simulink (in External mode) is "only" used to control the real-time application. When you change to "Normal mode", Simulink is again in charge and Simulink always executes simulations as fast as possible (usually therefore faster than real-time ;-)). If you want to run Simulink models in Simulink in "soft" real-time, there are methods to slow down the simulation (typically by using an S-function that compares the system time with the simulation time, and waits in between). Many examples are on the file exchange, see e.g. this one.
Titus

bethel o
bethel o 2012년 3월 14일
편집: John Kelly 2013년 11월 13일
Thank you Titus for your reply

Doug Eastman
Doug Eastman 2012년 3월 14일
Running in real-time in normal mode is a new feature of Real-Time Windows Target in R2012a. To run in real-time you do need to add the Real-Time Synchronization block. The rtvdp model shows an example of using this block.
  댓글 수: 2
bethel o
bethel o 2012년 3월 14일
Thanks Doug,
Ok this clears up a lot of things because I was using R2011a. Its crazy how one gets left behind by technology in no time.
I guess I have wasted my time for nothing because I cannot even properly work in the 'External' mode because the 'make' process of the 'build' keeps giving an error regarding the sfunction for my external device. I officially hate computers SMASH SMASH
Jan Houska
Jan Houska 2013년 11월 14일
If you update to R2012a or later, you will not need to compile your model to run it in Normal Mode. Hence there will be no compiler error for the S-function and everything should just work.

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

카테고리

Help CenterFile Exchange에서 Simulink Desktop Real-Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by