Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Change the reference enthalpy and reference entropy of Ideal gas model

Change the reference enthalpy and reference entropy of Ideal gas model

Given the following simple model:

Code:

 

model Test "Model based on built-in, ideal-gas model from Modelica.Media"
  package Medium = Modelica.Media.IdealGases.SingleGases.NH3 "Medium model";
  parameter Medium.AbsolutePressure p = 0.1e5;
  parameter Medium.Temperature T0 = 300;
  parameter Real dTdt (unit = "K/s") = 100;
  Medium.BaseProperties medium;
  Medium.Temperature T = medium.T;
  Medium.SpecificEnthalpy h = medium.h;
  Medium.SpecificInternalEnergy u = medium.u;
  Medium.SpecificEntropy s = Medium.specificEntropy(medium.state);
equation
  medium.p = p;
  T = T0 + dTdt * time;
  annotation(experiment(StartTime = 0, StopTime = 1, Tolerance = 0.0001, Interval = 0.0002));
end Test;

I would like to change the reference enthalpy and reference entropy of the medium. From what I could understand, the reference enthalpy is fixed in package Modelica.Media.IdealGases.Common.Functions:

Code:


constant Boolean excludeEnthalpyOfFormation=true;
constant Modelica.Media.Interfaces.Choices.ReferenceEnthalpy referenceChoice=Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.ZeroAt0K;
constant Modelica.Media.Interfaces.Types.SpecificEnthalpy h_offset=0.0;

But I don't understand how to override these constants in my model.

For the reference entropy, I couldn't find where it is fixed in the code.

Thanks!

There are 0 guests and 0 other users also viewing this topic
You are here: