Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference FMU reports communicationPoint mismatch #507

Open
dirk-runge opened this issue May 24, 2024 · 2 comments
Open

Reference FMU reports communicationPoint mismatch #507

dirk-runge opened this issue May 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dirk-runge
Copy link

dirk-runge commented May 24, 2024

The Feedthrough.fmu (for FMI 2.0, version 0.0.30) reports communicationPoint mismatches at random times in the simulation. For example:

Expected currentCommunicationPoint = 11958.34 but was 11958.35.

The CoSimulation runs with a fixed step size of 0.001s. The master calculates the communication point by iteration * h i.e. no numeric noise is accumulated. If this is a problem due to numeric inaccuracies, I would expect the error to appear always at the same time in the simulation (once the added-up inaccuracies have become larger than some threshold). However, this is not the case. The problematic communicationPoint is different each time the simulation is run.

At first I thought that there might be a problem with my simulation master implementation but when I run the FMU in FMPy, it shows the same problem. Hence, it's more likely that the implementation in the FMU is not correct or not tolerant enough.

@t-sommer
Copy link
Collaborator

Can you share steps to reproduce the problem?

@dirk-runge
Copy link
Author

I found out that there is a race condition in the master program that can lead to the communicationPoint being incremented before it was processed by the FMU. Since multiple threads are involved, this also explains why the issue appears at random simulation times.

However, I was (mis-) lead to believe that the reference FMUs are at fault because there actually is a similar / related problem when running them in FMPy. To reproduce the problem, you just need to set unusually long simulation times and sooner or later the communicationPoint mismatch will appear. When re-running the simulation, the mismatch will appear at exactly the same time as before. However, when restarting FMPy (the Python process, not just the simulation) the mismatch will appear at another time.

currentCommunicationPoint2
currentCommunicationPoint

@t-sommer t-sommer added the bug Something isn't working label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants