maestro
maestro copied to clipboard
Error handling and auto-cleanup
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.
Also, freeInstance is not called on FMUs.
see #290