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

Error handling and auto-cleanup #277

Open
CThuleHansen opened this issue Jun 28, 2021 · 2 comments
Open

Error handling and auto-cleanup #277

CThuleHansen opened this issue Jun 28, 2021 · 2 comments

Comments

@CThuleHansen
Copy link
Contributor

CThuleHansen commented Jun 28, 2021

Our current error handling is taking place via while (global_execution_continue) and related breaks.
However, when a spec is created with a module that expects some cleanup, then it does not work!

For example, datawriter expects a close call.

DataWriter dataWriter = builder.getDataWriter();
DataWriter.DataWriterInstance dataWriterInstance = dataWriter.createDataWriterInstance();
WhileMaBLScope whileScope = scope.enterWhile(time.toMath().addition(stepsize).lessEqualTo(endTime));
        {
            adder.set(real_a, DoubleExpressionValue.of(2.0));
            adder.set(real_b, DoubleExpressionValue.of(1.0));

            adder.step(time, stepsize);

            adder.getAndShare();

            time.setValue(time.toMath().addition(stepsize));
            dataWriterInstance.log(time);
            whileScope.leave();
        }

dataWriterInstance.close();

However, if an FMI2Error occurs within the whileScope then dataWriterInstance.close(); is always issued. However, the automatically inserted error handling will already have cleaned up the dataWriterInstance!

This implies, that we need a much more rich meta-level when generating the specification.

@CThuleHansen
Copy link
Contributor Author

Also, freeInstance is not called on FMUs.

@CThuleHansen
Copy link
Contributor Author

see #290

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