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

Ensure that we always!!! free instances and unload FMUs #290

Closed
CThuleHansen opened this issue Jul 9, 2021 · 4 comments
Closed

Ensure that we always!!! free instances and unload FMUs #290

CThuleHansen opened this issue Jul 9, 2021 · 4 comments

Comments

@CThuleHansen
Copy link
Contributor

CThuleHansen commented Jul 9, 2021

The local error handling will clean up the instance that fails but leave the other instances.
The other instances will be cleaned up in the end.

This involves creating a linked list with the componentinstances.

Remember to handle i.e. faultinject

@CThuleHansen
Copy link
Contributor Author

See #277

@CThuleHansen
Copy link
Contributor Author

CThuleHansen commented Aug 2, 2021

Terminology

Some terminology:

  • root scope: The outermost scope. When this scope terminates, the co-simulation terminates.
  • final cleanup: The cleanup immediately before the root scope terminates and thereby the termination of the co-simulation
  • top: In the root scope above the FMI initialization and simulation parts of the specification.

Proposal

Storing FMUs and instances

All FMUs and instances thereof shall be stored in iterable containers at the top.
This also holds for the fault-injected wrappers of the FMU instances.
This makes all FMUs and their instances available to the subsequent logic.

Error handling

If an FMI error occurs, then global_execution_continue shall be set to false followed by a series of break statements conditioned on global_execution_continue==false. This will eventually lead to the root scope and final cleanup.
Question
Shall the instance be cleaned up immediately, or shall we leave it to the final cleanup?
Example: If an error occurs, shall the given instance be freed in the immediate error-handling with instanceOwner.freeInstance(instance) and set to null or removed from the list of instances of the given FMU? This also holds if the given instance is fault-injected, see question 2

Final clean-up

At the final cleanup, all instances has to be freed and all FMUs has to be unloaded.

Fault-injection notes

  1. If an FMU X instance XY is fault-injected into XZ, then X.freeInstance(XZ) leads to the freeing of instance XY, as internally, the interpreter invokes getModule from XZ, which in turn invokes getModule from XY. Thereby, the original instance is freed. Both XY and XZ shall be set to null in this case.

Mixture of MaBL and Expansion

How do we handle a mixture of MaBL and Expansion? Shall we annotate these special arrays and define a methodology for doing it correct? Example: JacobianStepBuilderTest with stabilization

Methdology

Clearly express WHAT is needed in order for the plugins to function correctly. I.e. if we create a builder for an expansion module where custom mabl is written above, then how do we bridge the two?

@CThuleHansen
Copy link
Contributor Author

CThuleHansen commented Aug 9, 2021

Casper: Implement map notation above wrapper stuff.
Make use of map notation above wrapper stuff.

Kenneth: Implement try-finally and get it to work with builder and stuff

@CThuleHansen
Copy link
Contributor Author

Implemented try-finally in java.

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

No branches or pull requests

1 participant