Opened 12 years ago

Last modified 12 years ago

#1733 closed defect (fixed)

range in connect equation fails

Reported by: Frenkel TUD Owned by: Frenkel TUD
Priority: critical Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc: Frenkel, TUD, adrpo, perost

Description

For the simple Model

model IndexConnect
  connector A
    Real a;
  end A; 
  
  constant Integer n=5;
  A a[n];
equation
  a[1].a = 1;
  connect(a[1:n-1],a[2:n]);
end IndexConnect;

instantiateModel result with

class IndexConnect
  constant Integer n = 5;
  Real a[1].a;
  Real a[2].a;
  Real a[3].a;
  Real a[4].a;
  Real a[5].a;
equation
  a[1].a = 1.0;
end IndexConnect;

As you can see the connect equation is not expand to

a[1].a = a[2].a;
a[2].a = a[3].a;
a[3].a = a[4].a;
a[4].a = a[5].a;

Even try to rewrite the connect as a loop:

for i in 2:n loop
  connect(a[i-1],a[i]);
end for;

results in:

a[1].a = a[2].a;
a[1].a = a[3].a;
a[1].a = a[4].a;
a[1].a = a[5].a;

Attachments (2)

IndexConnect.mo (378 bytes) - added by Frenkel TUD 12 years ago.
IndexConnect.mos (101 bytes) - added by Frenkel TUD 12 years ago.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by Frenkel TUD

Changed 12 years ago by Frenkel TUD

comment:1 Changed 12 years ago by perost

Fixed in r11849, see test case mofiles/Connect18.

comment:2 Changed 12 years ago by sjoelund.se

  • Cc Frenkel TUD added; Frenkel TUD removed
  • Component set to Frontend
  • Milestone set to 1.9.0
Note: See TracTickets for help on using tickets.