why external initial condition (1/s) slow simulation a lot ?

3 次查看(过去 30 天)
Hello
I have a model of an hydraulic penstock, using 300 continus integrator (1/s) with internal condition for initialisation.
If I déclare thoses blocs with external condition with a constant bloc connected on it (with the same value), my simulation need 237 s VS 28 s with internal condition ! sic !
why ?
with profiler, I can see that simulink seem to calcul 2* more time jacobian :
I do not understand : for me it should be the same
Fabien
PS1 : the purpose of this change is to use signal spécification and conversion of units on integrator state, and link this with 'promote' functionnality of simulink mask.
PS2 : I cannot use "initialize function" bloc because my subsystems cannot be atomic
PS3 : the solution I would prefer would be to convert X0 value from expected units (propote) to SI units (for calculations) inside the mask, but there is no conversion methode like "unit conversion" bloc

回答(1 个)

Raj
Raj 2023-9-7
编辑:Raj 2023-9-7
Hi,
I understand you are noticing significant increase in simulation time while using external condition as compared to internal condition set in your integrator block.
When the internal condition is used, the integrator block starts from a known internal state, typically a predefined value. This initialization happens at the beginning of the simulation, allowing the solver to proceed without any extra computation.
However, applying an external condition requires the solver to consider the initial condition provided by an external source. This introduces additional communication and synchronization between the external source and the simulation environment. The solver must wait for the external condition, incorporate it into the simulation, and only then proceed. This process can cause delays and slow down the simulation.
To summarize, the use of external conditions in an integrator block slows down the simulation compared to using internal conditions for initialization due to the need for communication, synchronization, and the potential complexity introduced by external sources.
I hope this solves your query!!

类别

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

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by