Opened 16 years ago
Last modified 13 years ago
#1102 closed defect (fixed)
Problems with complex flow components: a) flow arrtibute not propagated; b) extra incorrect equations.
Reported by: | AlexeyLebedev | Owned by: | AlexeyLebedev |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Instantiation | Version: | |
Keywords: | Cc: | AlexeyLebedev, |
Description
Consider the following example:
record Rec
Real r;
flow Real fr;
end Rec;
connector C
flow Rec rec;
end C;
class Test
C c1, c2;
equation
connect(c1,c2);
end Test;
It is translated to the following flat Modelica:
fclass Test
Real c1.rec.r;
Real c1.rec.fr;
Real c2.rec.r;
Real c2.rec.fr;
equation
(-c1.rec.fr) + (-c2.rec.fr) = 0.0;
c1.rec.r = c2.rec.r;
c2.rec = 0.0;
c1.rec = 0.0;
end Test;
I.e., we see that
a) flow atribute of rec is not propagated to its components - c1.rec.r and c2.rec.r are treated as non-flow variables (and the corresponding DAE.VARs have NON_FLOW attribute).
b) extra incorrect (and meaningles) equations for "unconnected flow variables" c1.rec and c2.rec are created.
(By the way, about this part:
record Rec
...
flow Real fr;
end Rec;
Is it legal, according to specifications? I mean a non-connector class (Rec) having a component (fr) of non-connector class (Real) with flow prefix - what does "flow" mean in this case?)
Fixed in r8934. The 3.2 specification says:
So the given example is invalid since the record already contains elements with the flow prefix. I have fixed the propagation of flow and stream when it's legal to do so, and in this case an error message is now output.
As for whether it's legal to have a flow element in a non-connector class I'm not sure. The specification explicitly says that it's not allowed for stream, but no such restrictions seems to apply for flow from what I can see.