Opened 14 years ago
Last modified 13 years ago
#1733 closed defect (fixed)
range in connect equation fails
| Reported by: | Jens Frenkel | Owned by: | Jens Frenkel |
|---|---|---|---|
| Priority: | critical | Milestone: | 1.9.0 |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: | Frenkel, TUD, Adrian Pop, Per Östlund |
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)
Change History (4)
by , 14 years ago
| Attachment: | IndexConnect.mo added |
|---|
by , 14 years ago
| Attachment: | IndexConnect.mos added |
|---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
| Cc: | added; removed |
|---|---|
| Component: | → Frontend |
| Milestone: | → 1.9.0 |
Note:
See TracTickets
for help on using tickets.

Fixed in r11849, see test case mofiles/Connect18.