You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I'm using FMI.jl to call FMI2 functions in an illegal call sequence.
When the FMU is in event mode it should not be allowed to call fmi2SetReal on a non-input variable.
I'm not sure if I want this to get fixed, because I'm doing it wrong by changing a non-input variable that is not a state
and need this capability of FMI.jl.
How to reproduce
Create a FMI 2 ModelExchange FMU with e.g. OpenModelica for
model simpleLoopReal r(min=0);
Real s(min=-sqrt(2), max=sqrt(2));
Real x(start=1.0), y(start=0.5);
Real x_ref, y_ref;
equation
r =1+time;
s =sqrt((2-time)*0.9);
r^2= x^2+ y^2;
r*s = x + y;
x_ref = r * (s/2+sqrt(1/2-s^2/4));
y_ref = r*s - x_ref;
end simpleLoop;
Here variables r and s should have default variability continuous and causality local:
Judging from the State Machine of Calling Sequence (FMI Specification 2.0.2 section 3.2.3) it is only allowed to call fmi2SetReal on a real input variables.
So if it has causality=input and variability=continuous
or it has causality=input and variability=discrete
or variability=tunable.
As far as I can tell FMI.jl is not stopping me from calling fmiSet on r or s.
Jap, we can check for that.
However most FMUs return warnings/errors if calling sequence is violated - in some cases variables are settable without issues (and applied) even if it's against the calling sequence (e.g. because the properties defined in the model description aren't 100% correct), so we should not prevent the user from doing so if the FMU can handle it. Warning seems a nice in-between.
Description
I think I'm using FMI.jl to call FMI2 functions in an illegal call sequence.
When the FMU is in event mode it should not be allowed to call
fmi2SetReal
on a non-input variable.I'm not sure if I want this to get fixed, because I'm doing it wrong by changing a non-input variable that is not a state
and need this capability of FMI.jl.
How to reproduce
Create a FMI 2 ModelExchange FMU with e.g. OpenModelica for
Here variables
r
ands
should have default variabilitycontinuous
and causalitylocal
:Judging from the State Machine of Calling Sequence (FMI Specification 2.0.2 section 3.2.3) it is only allowed to call
fmi2SetReal
on a real input variables.So if it has
causality=input
andvariability=continuous
or it has
causality=input
andvariability=discrete
or
variability=tunable
.As far as I can tell FMI.jl is not stopping me from calling fmiSet on
r
ors
.Expected Result
Throw an error when calling fmi2SetReal is not allowed and add a flag to allow illegal call sequences anyway.
Versions 'n Stuff
The text was updated successfully, but these errors were encountered: