Struggling with simulation flow control commands in Simulink!

1 回表示 (過去 30 日間)
Pouya Jamali
Pouya Jamali 2017 年 4 月 29 日
コメント済み: Pouya Jamali 2017 年 4 月 29 日
Dear Community,
Some time ago I found Set_param to control Simulation flow of my Simulink block diagram through an m-file. It is an interesting tool specially for control engineering applications. After some time benefiting from this tool I found an inefficiency in it and would like to explain — may one has a solution. I already tried to report the problem in a previous thread but it seems it couldn't get noticed. So, I will try a different wording here.
I have a Constant block in my diagram connected to a continuous subsystem as the input. The solver is set to be ode45 and I need to feed my plant on a discrete basis with 0.01 as the sampling rate. There is an assertion block in my diagram that runs set_param(mdl, 'SimulationCommand', 'pause') at every sampling instant to pause the simulation flow and give time to the m-file to compute the next input. After computing the next input, the m-file writes it to the constant block and updates the simulation command. Here I notice that the block variable gets updated but its output signal doesn't. When I continue the simulation flow the new value will take effect since the next sampling instant (I don't know why). Many might not even notice this but in a control engineering application this adds an undesired pure delay to the system.
It seems to me that set_param(mdl, 'SimulationComand', 'update') fails to update signals immediately after the block parameter value is updated.
I guess there might be a solution to this maybe by accessing methods of the class simulink.BlockDiagram.
I run MATLAB 2016a on WIN 8.1.
  1 件のコメント
Pouya Jamali
Pouya Jamali 2017 年 4 月 29 日
If only block run-time objects were not read-only!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by