Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4852 closed defect (fixed)

Structural parameter not substituted in regular equations by the NF

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

Description

Please check the ScalableTestSuite.Electrical.TransmissionLine.ScaledExperiments.TransmissionLineModelica_N_10.

The following equation appears in the flattened model

  vol[N] = cur[N] * RL;

while the old front end correctly reports

  vol[10] = cur[10] * RL;

This in turn causes problems with the back-end, generating a bogus nonlinear equation that ultimately leads to simulation failure.

Possibly related to #4813.

Change History (6)

comment:1 by Francesco Casella, 7 years ago

In fact, this issue also affects all the failing thermal models in the ScalableTestSuite, because the NF generates the equation

  T[N] = TN;

that the back-end and code generation cannot handle properly.

I guess fixing this issue should get the number of ScalableTestSuite models that simulate to around 90.

comment:2 by Francesco Casella, 7 years ago

Priority: highcritical

This issue also affect other models that contain the linspace(a, b, N) expression. This simple model replicates the issue:

model Test
  parameter Integer N = 2;
  Real x[N];
equation
  x = linspace(0.0, 1.0, N);
end Test;

The flattened code contains:

  x = linspace(0.0, 1.0, N);

and this wreaks havoc on the later code generation stages.

comment:3 by Francesco Casella, 7 years ago

This issue also affects the BreakerNetworkDelayed models, see e.g. ScalableTestSuite.Electrical.BreakerCircuits.ScaledExperiments.BreakerNetworkDelayed_N_10, which end up with the following flattened equation:

initial equation
  Imax[N] = 1.0;

while the old front end correctly substitutes the value of N in the subscript.

Having structural parameters lingering in the flattened code probably causes a lot more failures in various stages of the code generation than those pointed out in this ticket, so I guess fixing this issue should have a high priority.

comment:4 by Per Östlund, 7 years ago

The new instantiation doesn't have any concept of structural parameter yet. I've already planned to fix that next week.

comment:5 by Per Östlund, 7 years ago

Resolution: fixed
Status: newclosed

Fixed in 4330bb7.

in reply to:  3 comment:6 by Francesco Casella, 7 years ago

Replying to casella:

This issue also affects the BreakerNetworkDelayed models, see e.g. ScalableTestSuite.Electrical.BreakerCircuits.ScaledExperiments.BreakerNetworkDelayed_N_10, which end up with the following flattened equation:

initial equation
  Imax[N] = 1.0;

This is now fixed, but the model continues to fail due to the supposed presence of a mixed-determined system, which is not triggered with the old FE. I'll open a separate ticket for that, see #4859.

Last edited 7 years ago by Francesco Casella (previous) (diff)
Note: See TracTickets for help on using tickets.