필터 지우기
필터 지우기

how to use run-time object in simulink model?

조회 수: 8 (최근 30일)
Yandy Ma
Yandy Ma 2017년 7월 25일
댓글: Yandy Ma 2017년 7월 25일
I would like to control my simulink model from a matlab script by using set_param. And I would like to have some pause time in between. If I use pause(), the pausing time will be a real time. However, I would like to pause it according to simulation. For example: I would to set_param at simulation time = 5. And someone recommend me to use a 'run-time object'. And I have no idea how can I use it. Can someone give me an example of using the run-time object?

답변 (1개)

jpai
jpai 2017년 7월 25일
By the looks of it you want to be able to pause a running simulation through a command. It may not be necessary for you to use a run-time object at all in order to achieve the operation that you desire. As a matter of fact, you can continue using set_param to control your simulation.
For your specific case, you can use:
set_param('mymodel','SimulationCommand','pause')
This will pause the currently running model mymodel (or whatever your running model's name is).
To continue running the model, you can simply use:
set_param('mymodel', 'SimulationCommand','continue')
As the third parameter suggests, this will resume the paused model.
For more information on SimulationCommands, please refer to the following link:
https://www.mathworks.com/help/releases/R2017a/simulink/slref/model-parameters.html (Search for "SimulationCommand" in the Model Parameters table)
Hope this helps!
  댓글 수: 1
Yandy Ma
Yandy Ma 2017년 7월 25일
Thanks for answering my question! However, I would like to keep the model running, while using the set_param for every 5sec of simulation time. Coz I would like to observe the transience of the model if I change the parameter within the model for every few seconds of simulation time while the model should be kept running. Do you have any recommendation for me? Really thanks a lot!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by