Opened 6 years ago
Closed 5 years ago
#5213 closed defect (fixed)
Backend can't handle nested record assignment
Reported by: | Per Östlund | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
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 by , 6 years ago
Cc: | added |
---|
comment:2 by , 5 years ago
comment:3 by , 5 years ago
Milestone: | Future → 1.16.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
I guess we can close this ticket.
Regarding the initialization issues, you may want to wait until #5770 is fixed.
comment:4 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → 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