Skip to content

Allow multiple instances of the same FMU#87

Merged
robbr48 merged 13 commits intomainfrom
issue-85-allow_multiple_instances
Apr 15, 2025
Merged

Allow multiple instances of the same FMU#87
robbr48 merged 13 commits intomainfrom
issue-85-allow_multiple_instances

Conversation

@robbr48
Copy link
Owner

@robbr48 robbr48 commented Apr 11, 2025

Separe the handle for the loaded FMU (fmiHandle, allocated by importing tool) from the handle to the FMU instance (fmiXComponent, allocated by the FMU). This should make it possible to instantiate multiple instances of the same FMU.

Resolves #85.

  • FMI1 support
  • FMI2 support
  • FMI3 support
  • Test for FMI1
  • Test for FMI2
  • Test for FMI3

@robbr48 robbr48 self-assigned this Apr 11, 2025
@robbr48
Copy link
Owner Author

robbr48 commented Apr 11, 2025

@markaren Do you think this solution will work? If so, I can extend it also for FMI 1 and FMI3.

@markaren
Copy link
Contributor

markaren commented Apr 11, 2025

I have included #86 in my project in and seems good so far (and this follows the same idea). Only thing is that the API outlined could possibly be simplified by embedding the fmiHandle pointer in the component handle or something.

@robbr48 robbr48 force-pushed the issue-85-allow_multiple_instances branch from 8e7445e to 6929b98 Compare April 14, 2025 11:43
@robbr48
Copy link
Owner Author

robbr48 commented Apr 14, 2025

I got it to work without providing two handles to the same function. Now there is one handle for the FMU, and one for each instance. I think this makes sense.

@robbr48 robbr48 marked this pull request as ready for review April 15, 2025 07:51
@robbr48
Copy link
Owner Author

robbr48 commented Apr 15, 2025

Now it works for all versions/types of FMI, and is tested by the Python tests. I will merge this later today if there are no objections.

@markaren
Copy link
Contributor

Will give it a try ASAP

@markaren
Copy link
Contributor

Builds and runs in my project as expected. Great work!

@robbr48 robbr48 merged commit 55c5aa5 into main Apr 15, 2025
4 checks passed
@robbr48 robbr48 deleted the issue-85-allow_multiple_instances branch April 15, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple instances not supported

2 participants