Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Problem in initial equations with large parameters

Problem in initial equations with large parameters

Hello,

I am having a problem with variables being set to large parameter values in an initial equation block. I have added a simple model demonstrating this problem.

Code:


model SubModel
  parameter Real fillFactor_start = 0.5;
  parameter Real Qtotal;
 
  Real fillFactor;
  Real Qcurrent;
initial equation
  Qcurrent = fillFactor_start * Qtotal; 
equation 
  fillFactor = Qcurrent / Qtotal;
  der(Qcurrent) = 100000;
end SubModel;

model Test
  SubModel m1(Qtotal=60000000000.0);
  SubModel m2(Qtotal=30000000000.0);
end Test;

Depending on the value to be set init the initial equation block I get different results at time=0:

m1.fillFactor = -0.124999999975
m2.fillFactor = 0.5

Looking at the generated code it seems as OpenModelica is calculating the initial residuals for Qcurrent, which I do not think is necessary in this case.

Note also that the values result from wrong calculations for the initial residual using the "nelder_mead_ex" method. Switching to "simplex" method gives the correct results.

I am currently using OpenModelica 1.8.1 (r11436).


Regards,

Michael

Edited by: mburisch - Mar-15-12 14:57:49
There are 0 guests and 0 other users also viewing this topic
You are here: