#4795 closed defect (fixed)
Flattening error for a model with substructure
Reported by: | niklwors | Owned by: | sjoelund.se |
---|---|---|---|
Priority: | critical | Milestone: | 1.13.0 |
Component: | Frontend | Version: | |
Keywords: | flattening error | Cc: | Bernd.Schmidt6@… |
Description
if we use this model
model SimpleModelWithSubstructure parameter Real qNom[:, 2] = [0.0, 0.0001; 5.0, 0.001; 10.0, 0.01]; parameter Integer n = size(qNom, 1); parameter Real dhydMax[n, 1] = [{Modelica.Math.Nonlinear.solveOneNonlinearEquation(function dhydCalc(qNom = qNom[i, 2]), 0, 1e-1, 1e-13) for i in 1:n}]; function dhydCalc extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; input Real qNom; algorithm y := u - 1e-3; end dhydCalc; end SimpleModelWithSubstructure;
inside a other model
model SimpleModelWithSubstructure_TC01 SimpleModelWithSubstructure simpleModelWithSubstructure1; end SimpleModelWithSubstructure_TC01;
we got the error:
Error occurred while flattening model SimpleModelWithSubstructure_TC01
The model for itself alone can be translated.
With the flags
-d=failtrace --showErrorMessages
we got the attached log file
Attachments (2)
Change History (10)
Changed 7 years ago by niklwors
comment:1 Changed 7 years ago by casella
comment:2 Changed 7 years ago by niklwors
if we use -d=newInst this leads to the error:
[Modelica.Math.Nonlinear:410:5-410:46]: Invalid type prefix 'input' on component y, due to existing type prefix 'output'.
Changed 7 years ago by niklwors
comment:3 Changed 7 years ago by casella
- Component changed from Frontend to New Instantiation
- Milestone changed from Future to 2.0.0
- Owner changed from somebody to perost
comment:4 follow-up: ↓ 8 Changed 7 years ago by sjoelund.se
- Component changed from New Instantiation to Frontend
- Milestone changed from 2.0.0 to 1.13.0
- Owner changed from perost to somebody
The problem in the new instantiation is that an input argument that is a partial function gets the input prefix propagated to the components of the function itself. Which is wrong; but the new instantiation does not support function partial application yet, right? (Do we have a ticket for that? The new instantiation ticket of language features, etc)
I don't agree with changing this to the new instantiation since the error-message there is totally different from this ticket and the actual error in this ticket would likely not appear in the new instantiation.
comment:5 Changed 7 years ago by sjoelund.se
The problem seems to be that we cannot prefix the partial function application. Unless it appears on the top-level (because then there is nothing to prefix). I will make that failtrace an internal error instead because prefixing an expression must never fail.
comment:6 Changed 7 years ago by sjoelund.se
- Owner changed from somebody to sjoelund.se
- Status changed from new to accepted
comment:7 Changed 7 years ago by sjoelund.se
- Resolution set to fixed
- Status changed from accepted to closed
Fixed with 47aed5e
comment:8 in reply to: ↑ 4 Changed 7 years ago by casella
Replying to sjoelund.se:
I don't agree with changing this to the new instantiation since the error-message there is totally different from this ticket and the actual error in this ticket would likely not appear in the new instantiation.
The rationale was that maybe the problem was already fixed in the new frontend, provided that other issues were solved. Of course if you have time to solve this in the old frontend (as it turned out to be the case) I'm just happy :)
Have you tried with -d=newInst?