1

I am trying to set the value of a parameter in JModelica using the approach given in section 4.4.1 of the user manual; however when I load an fmu and try to change the value I get the message:

File "src\pyfmi\fmi.pyx", line 209, in pyfmi.fmi.ModelBase.set 
(src\pyfmi\fmi.c:4707)
  File "src\pyfmi\fmi.pyx", line 1397, in pyfmi.fmi.FMUModelBase._set 
(src\pyfmi\fmi.c:17750)
  File "src\pyfmi\fmi.pyx", line 1099, in pyfmi.fmi.FMUModelBase.set_real 
(src\pyfmi\fmi.c:14891)
FMUException: Failed to set the Real values.

I am able to set some parameters of the fmu using this approach, but this one just doesn't want to work. I have also tried to set the parameter with the same variable directly read from the fmu using .get() and the error still occurs.

Does anyone know what is causing this error and how it can be resolved?

Edit: I tried with a few other parameters and it seems that the error only occurs with parameters with units assigned to them i.e. parameters of Power and Mass [W] Flow [kg/s] units. Does this mean that it is only possible to change parameters in the FMU that are Real and that do not have units using this approach??

alkey
  • 986
  • 4
  • 16
  • 33
  • What does the log say? – Christian Winther Aug 22 '19 at 07:21
  • FMIL: module = Model, log level = 2: [ERROR][FMU status:Error] Cannot set Real structural parameter "Nominal_Power" – alkey Aug 22 '19 at 08:10
  • @ChristianWinther is there any other information I can provide? – alkey Aug 22 '19 at 09:34
  • By the looks of it, the compiler treats the parameter "Nominal_Power" as a structural paramter (i.e. it may impact array sizes or something else that changes the problem size) and these cannot be changed after a compilation – Christian Winther Aug 22 '19 at 10:14
  • 1
    @ChristianWinther is there a way to confirm this? The parameters are quite high level and it's surprising that they would influence the structure of the problem; however, I am using components from an external library so it's possible but it seems the error only occurs to parameters with units assigned to them. Is there a way around this other than to recompile every time? – alkey Aug 22 '19 at 11:53

0 Answers0