Opened 5 years ago
Closed 4 years ago
#5213 closed defect (fixed)
Backend can't handle nested record assignment
Reported by: | perost | Owned by: | mahge930 |
---|---|---|---|
Priority: | high | Milestone: | 1.16.0 |
Component: | Backend | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: | matthis.thorade@… |
Description
Many HelmHoltzMedia models (such as HelmholtzMedia.Examples.MediaTestModels.ButaneTestModel_dT) currently fail with error messages such as (using -d=newInst, the old frontend can't handle the models):
Warning: SimCodeUtil.makeSES_SIMPLE_ASSIGN failed for: Medium.ThermodynamicState( fixedMassFlowRate.medium.sat.liq.phase, fixedMassFlowRate.medium.sat.liq.T, fixedMassFlowRate.medium.sat.liq.p, fixedMassFlowRate.medium.sat.liq.d, fixedMassFlowRate.medium.sat.liq.u, fixedMassFlowRate.medium.sat.liq.h, fixedMassFlowRate.medium.sat.liq.s) = $TMP_Medium_SaturationProperties74.liq
This seems to be due to the flattened equation:
fixedMassFlowRate.medium.sat = HelmholtzMedia.Examples.MediaTestModels.ButaneTestModel_dT.Medium.setSat_p(fixedMassFlowRate.medium.p);
that the backend expands to:
Medium.SaturationProperties( fixedMassFlowRate.medium.sat.psat, fixedMassFlowRate.medium.sat.Tsat, Medium.ThermodynamicState( fixedMassFlowRate.medium.sat.liq.phase, fixedMassFlowRate.medium.sat.liq.T, fixedMassFlowRate.medium.sat.liq.p, fixedMassFlowRate.medium.sat.liq.d, fixedMassFlowRate.medium.sat.liq.u, fixedMassFlowRate.medium.sat.liq.h, fixedMassFlowRate.medium.sat.liq.s), Medium.ThermodynamicState( fixedMassFlowRate.medium.sat.vap.phase, fixedMassFlowRate.medium.sat.vap.T, fixedMassFlowRate.medium.sat.vap.p, fixedMassFlowRate.medium.sat.vap.d, fixedMassFlowRate.medium.sat.vap.u, fixedMassFlowRate.medium.sat.vap.h, fixedMassFlowRate.medium.sat.vap.s)) = HelmholtzMedia.Examples.MediaTestModels.ButaneTestModel_dT.Medium.setSat_p(volume.medium.p)
But it seems like the case for Record() = f() in SimCodeUtil.createSingleComplexEqnCode2 can't handle the nested records and calls makeSES_SIMPLE_ASSIGN with a record as the lhs causing it to fail.
Change History (4)
comment:1 Changed 5 years ago by Matthis Thorade <matthis.thorade@…>
- Cc matthis.thorade@… added
comment:2 Changed 4 years ago by matthis.thorade@…
comment:3 Changed 4 years ago by casella
- Milestone changed from Future to 1.16.0
- Owner changed from lochel to mahge930
- Status changed from new to assigned
I guess we can close this ticket.
Regarding the initialization issues, you may want to wait until #5770 is fixed.
comment:4 Changed 4 years ago by casella
- Resolution set to fixed
- Status changed from assigned to closed
Since this commit
https://github.com/OpenModelica/OpenModelica/commit/80ac1a491c0b0bc5c15e878636f0f0245295830d
most models are now compiling fine, and most also simulate, some fail during initialization:
https://libraries.openmodelica.org/branches/newInst/HelmholtzMedia/HelmholtzMedia.html