Opened 11 years ago

Closed 11 years ago

#1945 closed defect (fixed)

unbalanced models by duplicate inheritance

Reported by: cschubert Owned by: perost
Priority: critical Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: connection unbalanced Cc: adrpo

Description

The attached model F uses duplicate inheritance and generates redundant equations of the form

2 (1): e.port.f = 0.0
3 (1): e.d.port.f = 0.0
4 (1): e.d.port.f - e.port.f = 0.0

where there is one equation too many. This may also be related to Brunos problem.

Attachments (2)

Unbalanced.mo (384 bytes) - added by cschubert 11 years ago.
Unbalanced.mos (108 bytes) - added by cschubert 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by cschubert

Changed 11 years ago by cschubert

comment:1 Changed 11 years ago by adrpo

Just a bit more explanation...
This equation should not be generated:

e.d.port.f = 0.0;

Somehow it seems that e.d.port.f is added to a connection set as inside connector because is flow, but then when the connection to e.port.f is done is not detected that we already have a set containing e.d.port.f and a new set is created with the connection to e.port.f.

adrpo@ida-liu050 /c/dev/avm
$ time ~/dev/OpenModelica/build/bin/omc +locale=C +d=showEquationSource Unbalanced.mo
class F
  Real e.port.p "potential Variable";
  Real e.port.f "flow Variable";
  Real e.d.port.p "potential Variable";
  Real e.d.port.f "flow Variable";
equation
  e.d.port.f = e.d.port.p /* models: {D} connects: {} */;
  e.port.f = 0.0 " add inside flow(e.port.f)" /* models: {Conn} connects: {} */;
  e.d.port.f = 0.0 " add inside flow(e.d.port.f)" /* models: {Conn} connects: {} */;
  (-e.port.f) + e.d.port.f = 0.0 " add inside flow(e.d.port.f)" /* models: {E, Conn} connects: {connect(d.port.f,port.f)} */;
  e.d.port.p = e.port.p /* models: {E} connects: {connect(e.d.port.p,e.port.p), connect(d.port.p,port.p)} */;
end F;

New output from +d=showEquationSource.
So it seems e.d.port.f is added as inside flow to a set in Conn, then the connect comes in E, which adds the port.f to the same connection set but somehow the old connection set is still kept. It might be something wrong with the prefixing.

Last edited 11 years ago by adrpo (previous) (diff)

comment:2 Changed 11 years ago by perost

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r13982.

Note: See TracTickets for help on using tickets.