#4795 closed defect (fixed)
Flattening error for a model with substructure
Reported by: | Niklas Worschech | Owned by: | Martin Sjölund |
---|---|---|---|
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)
by , 7 years ago
Attachment: | Log_SimpleModelWithoutSubstructure.txt added |
---|
comment:1 by , 7 years ago
comment:2 by , 7 years ago
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'.
by , 7 years ago
Attachment: | Log_SimpleModelWithSubstructure.txt added |
---|
comment:3 by , 7 years ago
Component: | Frontend → New Instantiation |
---|---|
Milestone: | Future → 2.0.0 |
Owner: | changed from | to
follow-up: 8 comment:4 by , 7 years ago
Component: | New Instantiation → Frontend |
---|---|
Milestone: | 2.0.0 → 1.13.0 |
Owner: | changed from | to
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 by , 7 years ago
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 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:8 by , 7 years ago
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
?