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

Efficient habdling zero-crossing surfaces #588

Open
masoud-najafi opened this issue Jun 30, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@masoud-najafi
Copy link
Collaborator

commented Jun 30, 2019

In the current FMI-3 specification, as well as in FMI-1 and FMI-2, in order to find and handle the state-events, the integrator monitors the zero-crossing surfaces during the numerical integration using the fmiXGetEventIndicators function in the continuous-time mode. Once the integrator finds a crossing, integration is stopped and the FMU is pushed into the Event mode to handle the state-event.
In the event-mode, the FMU should evaluate and compare its zero-crossing surfaces and find crossed surfaces and trigger the correspoding state event.
In many cases, due to numerical errors, this procedure is troublesome and errornous, and the simulator or the FMU needs to introduce a small threshold to avoid or reduce the effects of numerical errors.

What is proposed here is to give the integrator (simulator) the right to pass the vector of crossed zero-crossings to the FMU. In this way, the FMU need not reevluate the surfaces and numerical errors will be avoided. This is more important when state-events are linked to clock ticks.

What is needed is just a new API to pass crossed surfaces as well as their direction into the FMU:

if ticket (#587) is accepted for FMi-3, this API is good:
fmi3Status fmi3SetStateEvent(fmi3Component c,
const fmi3ValueReference vr[], size_t nvr,
const fmi3Int8 direction[], size_t nDirections);

otherwise this API should be used:
fmi3Status fmi3SetStateEvent(fmi3Component c, const fmi3Int8 direction[], size_t nzc); // size of direction is nz (number of zero-crossings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.