FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed MoistAir.T_psX for size(X,1) not= nX by RaphaelGebhart · Pull Request #4781 · modelica/ModelicaStandardLibrary · GitHub

Fixed MoistAir.T_psX for size(X,1) not= nX - #4781

Open
RaphaelGebhart wants to merge 1 commit into
modelica:masterfrom
RaphaelGebhart:4771_MoistAir_T_psX
Open

Fixed MoistAir.T_psX for size(X,1) not= nX#4781
RaphaelGebhart wants to merge 1 commit into
modelica:masterfrom
RaphaelGebhart:4771_MoistAir_T_psX

Conversation

RaphaelGebhart commented Apr 28, 2026
edited
Loading

Copy link
Copy Markdown

Closes #4771.
Test example:

model MoistAirEntropy "Tests MoistAir.setState_psX()"

  replaceable package Medium = Modelica.Media.Air.MoistAir;
  Medium.AbsolutePressure p=pressureSawTooth.y;//Medium.p_default;
  Medium.Temperature T=temperatureSawTooth.y;//Medium.T_default;
  Medium.MassFraction Xi[:]={massFractionSawTooth.y};// Medium.X_default[1:Medium.nXi];
  Medium.MassFraction X[:] = {Xi[1], 1-Xi[1]}; // Medium.X_default;

  Medium.SpecificEntropy s1 = Medium.specificEntropy_pTX(p,T,Xi);
  Medium.SpecificEntropy s2 = Medium.specificEntropy_pTX(p,T,X);
  Boolean check1 = abs(s1-s2) < Modelica.Constants.eps; // Check passed

  Medium.ThermodynamicState state1 = Medium.setState_psX(p,s1,Xi); // This requires modification
  Medium.ThermodynamicState state2 = Medium.setState_psX(p,s1,X);
  Medium.Temperature T1 = Medium.temperature(state1);
  Medium.Temperature T2 = Medium.temperature(state2);
  Boolean check2 = abs(T1-T) < 1e-12; // Check passed
  Boolean check3 = abs(T2-T) < 1e-12; // Check passed

  Modelica.Blocks.Sources.SawTooth pressureSawTooth(
    amplitude=2e5,
    period=0.5,
    offset=0.5e5,
    startTime=0.1) annotation (Placement(transformation(extent={{-80,42},{-60,62}})));
  Modelica.Blocks.Sources.SawTooth temperatureSawTooth(
    amplitude=200,
    period=0.5,
    offset=273.15,
    startTime=0.2) annotation (Placement(transformation(extent={{-80,0},{-60,20}})));
  Modelica.Blocks.Sources.SawTooth massFractionSawTooth(
    amplitude=0.5,
    period=0.5,
    offset=0,
    startTime=0.3) annotation (Placement(transformation(extent={{-80,-40},{-60,-20}})));
end MoistAirEntropy;

CLAassistant commented Apr 28, 2026
edited
Loading

Copy link
Copy Markdown


All committers have signed the CLA.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Simulation error when using MoistAir.T_psX

2 participants


Back | FazBrowse Home | New Git URL