Dynamics change depending on whether simulation is run in Simulink or Simulink Real-Time (normal run button)

1 回表示 (過去 30 日間)
I'm doing a state-space simulation in Simulink. The results are as expected, until I change to Simulink Real-Time. All of the sudden, the results depend on the configured 'Stop Time'. I'm using the standard Run button in the Simulation tab, not the 'Run on Target' button. For a large enough Stop Time, the system goes unstable. Obviously, the dynamics of a system should not change because of this. What could have caused this behaviour?
  2 件のコメント
Benjamin Thompson
Benjamin Thompson 2022 年 7 月 6 日
Can you post the model? Maybe you use small sized integers somewhere that can be overrun if time gets too big?
Ama Nesciri
Ama Nesciri 2022 年 7 月 6 日
編集済み: Ama Nesciri 2022 年 7 月 6 日
A = [0 0 -2; 0 0 2; 1 -1 0];
B = [0.25 0; 0 0.25; 0 0];
C = eye(3);
D = zeros(3,2);
K = -place(A,B,[-0.1 -0.2 -0.3]);

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

回答 (1 件)

Poorna
Poorna 2023 年 12 月 6 日
Hi Ama Nesciri,
I understand that you are getting different results when run using Simulink Real-Time compared to the normal Simulink simulation.
Simulink Real-Time involves generating code from the Simulink model and executing it on real-time target. So, one of the reasons the results differ might be with the solver settings. Code generation requires a fixed step solver while the normal simulation might be using a variable step solver.
So, try to ensure the solver settings are same for both the simulations and then compare the results.
Please refer to the following documentation to know different steps in performing a real time simulation including changing solver settings.
Hope this Helps!
Best regards,
Poorna

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by