Skip to content

Add missing each to array attributes of Media.Common.ThermoFluidSpecial records - #4852

Open
hubertus65 wants to merge 1 commit into
modelica:masterfrom
hubertus65:fix-Media-ThermoFluidSpecial-each
Open

hubertus65 wants to merge 1 commit into
modelica:masterfrom
hubertus65:fix-Media-ThermoFluidSpecial-each

Conversation

@hubertus65

Copy link
Copy Markdown
Member

Modelica.Media.Common.ThermoFluidSpecial.ThermoBaseVars and ThermoProperties declare arrays with scalar attribute modifiers but without each. For example:

SI.Pressure[n] p(
  min=PMIN,
  max=PMAX,
  nominal=PNOM) "Pressure";

A scalar modifier of an array element attribute needs each. OpenModelica rejects both records when they are instantiated:

Error: Non-array modification 'Modelica.Media.Common.MASSXMIN' for array component 'min', possibly due to missing 'each'.

This PR adds each to min, max and nominal of all 24 affected declarations: 19 in ThermoBaseVars and 5 in ThermoProperties.

It also changes the nominal values of the rates dZ and rZ in ThermoBaseVars. Both declared nominal=0.0, which Modelon Impact (OCT) rejects in a copy of the record (it accepts the read-only MSL 4.1.0 it ships):

The attribute nominal for the variable dZ is set to '0.0', evaluating to 0.0. A nominal value of zero is not meaningful.

Both now use each nominal=1.0, like the other rates and mole numbers of the record (MDOTNOM, MOLNOM).

Verification

The test model fills both records from IF97 water properties: a ThermoProperties record and a two-cell ThermoBaseVars record.

Tool Before After
OpenModelica 1.27.1 rejected (missing each) checks and simulates
OCT (Modelon Impact, copies of the records with MSL 4.1.0) rejected (nominal of zero) simulates, same values as OpenModelica

Nothing else in the MSL uses these records; they are covered by the new ModelicaTest test ModelicaTest.Media.ThermoFluidSpecialRecords on branch coverage-improvement.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT

ThermoBaseVars and ThermoProperties declare 24 arrays with scalar min, max
and nominal modifiers but without each, which OpenModelica rejects. The rates
dZ and rZ of ThermoBaseVars also had nominal=0, which Modelon Impact rejects
("A nominal value of zero is not meaningful"); use nominal 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UmNZkRw6HV9CeBvNk36AzT

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant