Why co-sim FMU generated from Dymola is giving different results when simulated in Simulink ?

12 visualizaciones (últimos 30 días)
I have a co-sim FMU generated from Dymola which uses CVODE solver of Dymola. I am importing this FMU in Simulink and solving with auto variable step solver. The control inputs to the FMU are generated from Dymola source model from which the FMU is created. I am getting deviation in the simulation results of FMU and the source model of Dymola. The simulation results are matching for most of the time except at the end of simulation where it is diverging. I am using the communication step size as 0.1, even by changing this step size to 0.01 the results are same. If someone has faced a similar issue in past and able to solve it, please help me in solving the issue.

Respuestas (1)

Hari
Hari el 25 de Mzo. de 2024
Hi SWAROOP H P,
I understand that you are experiencing discrepancies between the simulation results of a co-simulation FMU generated from Dymola and its corresponding source model when the FMU is imported and simulated in Simulink.
I assume you have ensured that the FMU and the Dymola source model are correctly configured and that there are no errors in the control inputs being fed into the FMU in Simulink.
The following can be the reasons for the discrepancies you are observing:
  1. Solver Configuration: Differences in solver configurations between Dymola and Simulink can lead to discrepancies. Ensure that the solver used in Simulink closely matches the characteristics of the CVODE solver used in Dymola in terms of accuracy and numerical methods.
  2. Communication Step Size: Although you've experimented with this, the choice of communication step size is crucial for co-simulation FMUs. A smaller step size generally leads to higher accuracy at the cost of longer simulation times. However, too small a step size can introduce numerical instability. Finding an optimal step size may require further experimentation.
  3. Initial Conditions and Parameters: Ensure that all initial conditions and parameters in the Simulink model exactly match those in the Dymola source model. Even slight differences can lead to divergences, especially over long simulation periods.
  4. State Events and Discontinuities: If your model involves state events or discontinuities (e.g., switches, relays), ensure that these are accurately captured and handled in Simulink. Discrepancies in handling these events can lead to significant deviations in results.
  5. Advanced Solver Settings: Explore advanced solver settings in Simulink, such as tolerance levels and maximum step sizes. Adjusting these settings can sometimes mitigate discrepancies in simulation results.
References:
Hope this helps!

Categorías

Más información sobre Create Standalone FMU en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by