Main Goal
Modify the Local variables exposed in the FMU under ModelExchange with FMPy.
Approach
First step
FMU is loaded perfectly, can modify all the values declared as casuality= "input" or "output" also some with variability = "tunable".
The problem
Variables declares as casuality= "Local" cant be modified, and I would like to be able to interact with some of these variables to be able to access the internal states of the model, these states are all declared as local, according to the documentation they are internal variables used by the FMU.
This is how looks the variable in the XML
I have tried to modified it via fmi2setReal:
but then i get the next error:
My question
could be that variable modified in any way?
In event mode, this is definitely not possible. According to the FMI 2.0.1 specification, page 127-128, only variables with "input" causality or "parameter" causality and "tunable" variability can be changed using fmi2SetReal
.
In continuous-time mode, it could be possible to set indirectly the value of a local continuous variable, if it is also a continuous-time state variable, refereed to by another scalar variable listed under the ModelStructure
Derivatives
tag. This can be done by calling the fmi2SetContinuousStates
function.
Regarding the case you showed, this local variable seems to be an (internal) input variable of a Simcenter Amesim DYNMUX submodel, and as such it it a purely internal variable that cannot be modified. However, if this input variable is connected to another submodel which has a state variable as output, it could be possible to change its value.