Simulink: How to run a subsystem only once per time step regardless of solver?

13 ビュー (過去 30 日間)
Hello,
I am implementing a model predictive control strategy on a Simulink model. The controller is represented by a subsytem which has for inputs the relevant state variables (x) and the control trajectory (u') calculated in the previous time step, and for outputs the new control trajectory (u) calculated for the current time step. Simplified version in the picture:
This results in a computacionally taxing subsystem which I only want to run once per time step. Simulink chooses ode3 for my model, which is what I've been using before adding the control system. Using this solver, however, means I will have the controller subsystem unnecessarily run 3 times per time step (once per evaluation).
I would wish to know how to make it so that the controller subsystem only runs once per step regardless of the solver. Ideally it should only run on the first evaluation and directly use the output obtained one for the remaining evaluations (or ignore it, since the output control is only applied in the next time step).
Thank you,
José

採用された回答

Mrunmayee Gaikwad
Mrunmayee Gaikwad 2020 年 10 月 8 日
Hi,
You can set the sample time of a block to [0, 1], it then becomes fixed-in-minor-step. For this setting, Simulink does not execute the block at the minor time steps; updates occur only at the major time steps.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by