Opened 4 years ago
Closed 3 years ago
#6101 closed defect (fixed)
Issue with arrays of components containing conditional components in the NF
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | blocker | Milestone: | 1.19.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: | Andrea Bartolini |
Description
Please consider the attached package, also reported here for convenience.
package TestConditionalArray3 connector C Real x; flow Real y; end C; model M1 C c; equation c.x = 10; end M1; model M2 parameter Boolean act; C c; M3 m3 if act; M4 m4 if not act; equation connect(c, m3.c); connect(c, m4.c); end M2; model M3 C c; equation c.y = 1; end M3; model M4 C c; equation c.y = 2; end M4; model S parameter Integer N = 3; parameter Boolean act[3] = {true, true, false}; M1 m1; M2 m2[N](act = act); equation for i in 1:N loop connect(m1.c, m2[i].c); end for; end S; end TestConditionalArray3;
Try to compile model S
. The NF complains that
[TestConditionalArray3: 16:5-16:17]: The conditional expression {true, true, false} could not be evaluated.
while the OF processes the model without a hiccup. I understand this is perfectly legal, so it should also be handled by the NF.
Attachments (1)
Change History (7)
by , 4 years ago
Attachment: | TestConditionalArray3.mo added |
---|
comment:1 by , 4 years ago
comment:6 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This was fixed a few weeks ago in 78435df8.
Note:
See TracTickets
for help on using tickets.
The issue is that there's only one node for e.g.
m2.m3
andm2.m4
in the instance tree, and the NF handles deleted conditional components by replacing their node with a deleted component node. So currently the NF can't handle the case where only some elements in a structured array is deleted.To handle this we'll have to add information to the deleted component node that indicates which scalar elements are deleted (which is a bit more complicated than it might sound like), and take the subscripts into account when checking for deleted components during connection handling.