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

combined modification and redeclaration

combined modification and redeclaration

Code:


model M1
  parameter Real a = 1;
  parameter Real b = 1;
end M1;

model M0
  parameter Real a = 0;
  parameter Real b = 0;
end M0;

model N
  replaceable M0 m;
end N;

model B
  N n(m.a = 3, redeclare M1 m, m.b = 3);
end B;

I simulated model B in OpenModelica revision19412.
it turned out that:
n.m.a = 3
n.m.b = 1

To my understanding the order of modification should not matter, so I guess this is a bug.
I read the Modelica spec chapter 7, about inheritance, modification, and redeclaration and it doesn't mention combined modification and redeclaration specifically, so I guess B should be equivalent to:
model B
  N n(redeclare M1 m(a = 3,b = 3));
end B;

There are 0 guests and 0 other users also viewing this topic
You are here: