#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 , 7 years ago
comment:2 by , 7 years ago
Priority: | high → critical |
---|
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.
follow-up: 6 comment:3 by , 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 , 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:6 by , 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.
In fact, this issue also affects all the failing thermal models in the
ScalableTestSuite
, because the NF generates the equationthat 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.