How to preserve initial conditions of a model when compiling it as an FMU?

5 次查看(过去 30 天)
I have a working Simulink model where two of the output signals are passed back into the model as inputs for the next time step.
Currently I am defining the initial conditions inside integrator blocks to avoid algerbraic loop errors which works as expected. The initial conditions are stored as MATLAB variables so I can expose them to the user when compiling the model as a standalone FMU.
However, after compiling the model as a standalone FMU and importing the FMU back into the Simulink environment to test the functionality, I am now seeing algebraic loop errors and discontinuities where previously there weren't any.
See error messages below for more context.
Discontinuities detected within algebraic loop(s), may have trouble solving.
An error occurred while running the simulation and the simulation was terminated
Caused by: Algebraic state in algebraic loop containing 'Model_FMU/FMU' computed at time 0.00082000000000000009 is Inf or NaN. There may be a singularity in the solution. If the model is correct, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) or tweak the initial guess of algebraic loop variable values.
Is there something I am missing that is changing the behaviour of the model when compiling?
The source of the error may not actually be the initial conditions changing but I am making an assumption based on the error messages.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deploy Standalone Applications 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by