- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » different generated fmu code when...
different generated fmu code when changing the order of equation
different generated fmu code when changing the order of equation
Hello,
The following two models are mathematically similar. However when i look at the generated code of the created FMUs, i see that for test1, in which der(x1) and der(x2) appear in the same order in both if and else statements, there is no linear system detected (i.e. test1_03lsy.c is empty) while for test2, it considers the if/else statement as one system of equation. I concluded that, when the order of equations in if/else statements are not in the same order OpenModelica's Symbolic engine is not smart enough to map equations with the if/else statement.
please clarify me with this subject.
Thanks,
Arvin
Code:
model test1
Integer flg;
Real u, y;
Real x1, x2;
initial equation
x1=1;
x2=1;
equation
u = 1;
flg = if time<1 then 0 else 1;
if flg == 0 then
der(x1)=-x1+x2^2;
der(x2)= -2*x2;
else
der(x1)=-x1+x2^2;
der(x2)= -2*x2+u;
end if;
y= x1;
end test1;
Code:
model test2
Integer flg;
Real u, y;
Real x1, x2;
initial equation
x1=1;
x2=1;
equation
u = 1;
flg = if time<1 then 0 else 1;
if flg == 0 then
der(x1)=-x1+x2^2;
der(x2)= -2*x2;
else
der(x2)= -2*x2+u;
der(x1)=-x1+x2^2;
end if;
y= x1;
end test2;
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » different generated fmu code when...