Reputation: 165
I created a model in OpenModelica and would like to create a FMU from it.
Inside OpenModelica, I can initialize the parameters the following:
model r_ctrl
parameter Real startTime(start = 0.1);
parameter SI.Resistance u_ref(start = 230);
parameter SI.Power p_ref(start = 1000);
parameter Real r_start(start = u_ref*u_ref/p_ref);
...
This works without any problems, during the simulation, all parameters have the values they are supposed to have
When I create the FMU, the following error appears in the terminal:
[CodegenUtil.tpl:178:14-178:14:writable] Error: Template Fehler: initial value of unknown type: r_ctrl.u_ref ^ 2.0 / r_ctrl.p_ref.
Is there a way to set the parameters dependent of each other, but without getting errors in the FMU generation process?
Upvotes: 1
Views: 226
Reputation: 3523
The following should work (I suppose the above should as well, but requires OpenModelica to automatically translate it into something like the following):
model r_ctrl
parameter Real startTime = 0.1;
parameter SI.Resistance u_ref = 230;
parameter SI.Power p_ref = 1000;
parameter Real r_start(fixed=false);
initial equation
r_start = u_ref*u_ref/p_ref;
Upvotes: 1