Opened 16 years ago

Last modified 14 years ago

#1096 closed defect (fixed)

References to outer components with flow connectors produce additional connection equations.

Reported by: rruusu Owned by: rruusu
Priority: high Milestone:
Component: Version:
Keywords: Cc: rruusu,

Description

References to outer components seem to be handled like local components in generation of connection equations for flow variables.

Example model:

connector C
  flow Real f;
end C;

model M
  Real v;
  C c;
equation
  der(v) = c.f;
end M;

model Child
  C c;
  M innerM;
  Real v_total = innerM.v + outerM.v;
protected
  outer M outerM;
equation
  connect(c, innerM.c);
end Child;

model Test
  inner M outerM(v(start=10.0));
  Child child;
equation
  connect(outerM.c, child.c);
  der(outerM.v) = -1.0;
end Test;

Result:

fclass Test
Real outerM.v(start = 10.0);
Real outerM.c.f;
Real child.c.f;
Real child.innerM.v;
Real child.innerM.c.f;
Real child.v_total;
equation
  der(outerM.v) = outerM.c.f;
  der(child.innerM.v) = child.innerM.c.f;
  child.v_total = child.innerM.v + outerM.v;
  -child.c.f + child.innerM.c.f = 0.0;
  outerM.c.f = 0.0;  //<------------------------ Extra equation!!!!
  der(outerM.v) = -1.0;
  outerM.c.f + child.c.f = 0.0;
end Test;

{{outerM}} and {{child.outerM}} refer to the same component. An extra equation ({{outerM.c.f = 0.0;}}) is produced, presumably to handle the locally unconnected component {{child.outerM}}, which actually is just a reference to the outer component, and should thus not be locally terminated.

Change History (2)

comment:1 by rruusu, 16 years ago

NOTE: This affects the use of the World component in the Mechanics.MultiBody package. The World component has a single frame, which contains force and torque fields. This results in termination equations being created for each component with a reference to the outer World component.

comment:2 by Martin Sjölund, 14 years ago

Works in 1.5.0 and beyond (including simulation).

Note: See TracTickets for help on using tickets.