Opened 7 years ago

Closed 7 years ago

#4858 closed defect (fixed)

Issue with String arrays and iterators in NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description (last modified by Per Östlund)

Please check the model ScalableTestSuite.Electrical.BreakerCircuits.ScaledExperiments.BreakerNetwork_N_10_M_10. The compilation with the NF fails in the CodeGen phase, but the root cause is in the NF, as demonstrated by this simple test case, which fails with the same error message:

package Test
  model M
    parameter String name;
  end M;
 
  model P
    parameter Integer N = 2;
    M m[N](name={String(i) for i in 1:N});
  end P;
end Test;

Flattening model Test.P with the old FE gives

class Test.P
  parameter Integer N = 2;
  parameter String m[1].name = "1";
  parameter String m[2].name = "2";
end Test.P;

while the new FE gives

class Test.P
  parameter Integer N = 2;
  parameter String m[1].name = array(String(i, 0, true) for i in 1:2)[1];
  parameter String m[2].name = array(String(i, 0, true) for i in 1:2)[2];
end Test.P;

Is this because of the still missing function evaluation feature?

Change History (3)

in reply to:  description comment:1 by Per Östlund, 7 years ago

Replying to casella:

Is this because of the still missing function evaluation feature?

No, that's only for userdefined functions, which neither array nor String is. This is just due to missing evaluation of reductions and some of the builtin functions (like String).

comment:2 by Per Östlund, 7 years ago

Description: modified (diff)

comment:3 by Francesco Casella, 7 years ago

Resolution: fixed
Status: newclosed

Fixed in 3f638304b, see report

Note: See TracTickets for help on using tickets.