![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1755909/27fe3868a2014f0393cceb50932526aa.png)
Why there is a time delay of one time step while co-simulating a FMU in Simulink?
23 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2021-1-19
编辑: MathWorks Support Team
2024-8-20,0:59
I exported an FMU from a Simulink model with Simulink Compiler and imported it into Simulink with FMU Import block.
In the results, when comparing the Simulink output and the FMU output, I see that they do not match with a one-time step difference/one-time step delay.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1755904/df0f16ce869c858d13f58a5e1e7a9fd8.png)
What is causing this behavior?
采纳的回答
MathWorks Support Team
2024-8-20,0:00
编辑:MathWorks Support Team
2024-8-20,0:59
The delay you see in co-simulation is a documented behavior for co-simulation of FMUs and standardized in the FMI standard.
Here is a reference in our documentation:
https://www.mathworks.com/help/slcompiler/gs/export-simulink-models-to-functional-mock-up-units.html
"You might experience an expected time delay in the exported FMU for Co-Simulation mode."
Due to co-simulation, there must be a time delay for communication between the local solver of the FMU and the Simulink solver. This is analogously the case in other simulation software when the FMU is co-simulated.
Here you can find more information about this and also ways how this can be intercepted under certain circumstances with special FMUs (which have certain properties) by so-called Numerical Compensation:
By the way, you define the step size of this delay via the Communication Step Size:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1755909/27fe3868a2014f0393cceb50932526aa.png)
By using FMI 3.0 Export (available from R2023b) which leverages the event mode, you can generate an FMU which does not have the one time step delay.
0 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!