Running Simulink in steps and in Real Time.

3 ビュー (過去 30 日間)
MRR
MRR 2015 年 5 月 11 日
編集済み: MRR 2015 年 5 月 12 日
Hi,
I have a GUI and a Simulink model running in background, in a similar way as this example does:
In addition I have set up a timer (a timer object) whose callback ('TimerFcn') is executed a defined period of time. Each time the callback is executed it takes some values from the simulink model, I simply use the sentence str2num(get(handles.curState,'string'), which takes the value that was passed from Simulink to the GUI. So, as you can see I only take values at predefined steps of time. I have two questions:
1- Is it possible to run Simulink in real time mode? I notice when simulating time "goes faster", and I do not want that. So far there is no hardware involved, everything is in simulation.
2- I am thinking in another approach. Instead of a continuous simulation (as the example I am based on does and as I am doing), I am wondering if it is possible to run a set of simulations, where the end conditions of the last simulation are the initial conditions of the next one, based on the period of time defined by the timer. Here is an example:
My timer has a period of 3 seconds. Then I run simulink for 3 seconds and take the output values, and so for. Is there any recommended approach to do this? I think something can be done by pausing and restarting the simulation.
Regards. -M

採用された回答

Sebastian Castro
Sebastian Castro 2015 年 5 月 11 日
For your first question, there is a Real-Time Pacer block on the File Exchange which will slow your model down to "soft" real-time (that is, an approximation or "slowing down" to real-time).
For the second question, there is indeed a way to do that using what is known as SimState. As you asked, this lets you pause or stop a simulation, collect data, and then pick up from where you left off.
Hope this helps!
- Sebastian
  1 件のコメント
MRR
MRR 2015 年 5 月 12 日
編集済み: MRR 2015 年 5 月 12 日
Sebastián. Thank your for your answer. That's exactly what I was looking for!
Regards,
-Mario

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by