#3089 closed defect (fixed)
Flattening error concerning records of records
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | critical | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: |
Description
Consider the attached Save Total file. When compiling, eventually OMC issues the following error:
[D:/Temp/CentrifugalPumpTotal.mo:2682:9-2682:64:writable] Error: Variable sat.liq.d not found in scope Cryogenics.Components.CentrifugalPump$pump.Medium.setSat_p
Now, pump.Medium
is Cryogenics.Media.HeliumHelmholtz
, which extends HelmholtzMedia.HelmholtzFluids.Helium
, which extends Interfaces.PartialHelmholtzMedium
, which contains the two declarations
redeclare record extends ThermodynamicState(phase(start=0)) // inherits phase integer Temperature T "Temperature of medium"; AbsolutePressure p "Absolute pressure of medium"; Density d "Density of medium"; SpecificEnergy u "Specific inner energy of medium"; SpecificEnthalpy h "Specific enthalpy of medium"; SpecificEntropy s "Specific entropy of medium"; end ThermodynamicState; redeclare record extends SaturationProperties // inherits Tsat and psat ThermodynamicState liq; ThermodynamicState vap; end SaturationProperties;
and the redeclaration of setSat_p
containing the offending statement:
redeclare function setSat_p input AbsolutePressure p; output SaturationProperties sat; ... algorithm ... sat.liq.d := 1.02*Ancillary.bubbleDensity_T(T=sat.Tsat);
According to the above declarations, sat.liq.d
and sat.vap.d
should be well-defined.
The model compiles and runs in Dymola.
Attachments (4)
Change History (18)
by , 10 years ago
Attachment: | CentrifugalPumpTotal.zip added |
---|
comment:1 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:2 by , 10 years ago
I was not able to open the Save Total File in OpenModelica, there were some warnings (it did open in Dymola), but the error about not finding sat.liq.h or some other variables can as well be reproduced by running any of the examples from HemlholtzMedia, e.g. HelmholtzMedia.Examples.BranchingDynamicPipes
Flattening records of records seems to work in simpler examples (see attached example MiniMedium), so I am unsure what exactly goes wrong in the more complex case.
comment:3 by , 10 years ago
The save total works for me, just invoke omc from the command line with the attached .mos script
by , 10 years ago
Attachment: | Ancillary_StartValues.mo added |
---|
Extremely reduced test case based on HelmholtzMedia.Examples.ConvergenceTest.Ancillary_StartValues
comment:4 by , 10 years ago
Added test case which was produced from a save total of the HelmholtzMedia.Examples.ConvergenceTest.Ancillary_StartValues model. Using omc it produces the same error message as for the original test case, but it should be easier to debug.
comment:7 by , 9 years ago
Using the latest nightly build (OpenModelica-v1.9.5-dev-13-g0fe3fc5.exe) on windows the CentrifugalPumpTotal model still errors out with the same error message as reported by the OP.
comment:10 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:11 by , 7 years ago
Component: | Frontend → New Instantiation |
---|---|
Milestone: | 1.12.0 → 2.0.0 |
Owner: | changed from | to
Status: | new → assigned |
follow-up: 13 comment:12 by , 6 years ago
newInst status:
https://libraries.openmodelica.org/branches/newInst/HelmholtzMedia/HelmholtzMedia.html
Is this the same issue as #5225 ?
comment:13 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to Matthis Thorade <matthis.thorade@…>:
newInst status:
https://libraries.openmodelica.org/branches/newInst/HelmholtzMedia/HelmholtzMedia.html
Is this the same issue as #5225 ?
No, #5225 is a completely different issue. This ticket is about the old frontend failing to look up a name used in the model, due to redeclare or extends issues. In #5225 the model has passed successfully through both the new frontend and the backend, but the code generator generates invalid code because it can't handle nested records in some cases.
Since all the mentioned models in this ticket seems to work fine with the new frontend I guess we might as well close this ticket. Neither the Cryogenics och Helmholtz models mentioned simulates yet, but that seems to be due to other issues.
comment:14 by , 6 years ago
Apologies for my limited understanding...
Yes, that sounds like this ticket can be closed.
Save Total file