I define
type Enum = enumeration(A, B, C);
and
partial model PM
parameter Real[Enum] a;
...
end PM;
and
model M
extends PM(a = {1, 2, 3});
...
end M;
which gives an error. My best guess is that the a = {1, 2, 3}
is the culprit. Is this indeed illegal, and if so, how can I set a
in M
?
UPDATE
Upon further examination I've found that everything above is indeed legal. Let me just go the whole hog:
type Enum = enumeration(A, B, C);
connector Conn
Real[Enum] a;
flow Real[Enum] f;
end Conn;
model M1
Conn conn;
equation
conn.f = -conn.a;
end M1;
model M2
Conn conn;
initial equation
conn.a = {1, 2, 3};
equation
der(conn.a) = conn.f;
end M2;
model M3
M1 m1;
M2 m2;
equation
connect(m1.conn, m2.conn);
end M3;
This fails to build. But if I just change each Enum
in the connector class to 3
, then it works.
The example is (as far as I can tell) legal, and some tools already handle it (assuming there is nothing else hidden).
Since you need a tool-specific work-around you need to specify which tool.
The legality will be clarified further in later versions of the Modelica specification since it was unclear - https://trac.modelica.org/Modelica/ticket/2212#comment:3