diff --git a/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropy.mo b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropy.mo new file mode 100644 index 00000000..2afb2572 --- /dev/null +++ b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropy.mo @@ -0,0 +1,32 @@ +within ThermofluidStream.Media.Tests.MoistAirDiscussion; +model MoistAirEntropy "Find PsiXmax concerning entropy, found that entropy is continous and therefor not as critical as kappa" + extends Modelica.Icons.Example; + package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + "Medium model"; + + Medium.ThermodynamicState state; + //SI.SpecificEntropy s2 = Medium.specificEntropy_pTX(state.p,state.T,state.X); + SI.SpecificEntropy s1 = Medium.specificEntropy(state); + Real XSaturation "Saturation of state3"; + parameter SI.Pressure p0 = 1e5; + parameter SI.Temperature T0 = 273.15+20; + parameter SI.TemperatureDifference dT = 20; + parameter Real x0 = Medium.xsaturation_pT(p0,T0); + parameter SI.MassFraction X0 = x0/(1+x0); + parameter SI.MassFraction dX0 = X0; + parameter SI.AngularFrequency omega0 = 10; + Real phi; +protected + constant SI.Time unitTime=1; +equation + state.p = p0; + state.T = T0; + state.X = {X0, 1-X0} - {dX0, 1-dX0}*(2*time-1); + XSaturation = Medium.Xsaturation(state); + phi = Medium.relativeHumidity(state); + annotation (experiment(StopTime=1.0, Tolerance=1e-005), Documentation(info=" +

Check specific entropy s and relative humidity phi versus time.

+

Since there is no kink in specific entropy s at satuarion (X_sat = X), i assume, that MoistAir uses the specific entropy of vapor also for condensed water. +Of course this is wrong, but the error is proportional to the amount of condensed water, and therefor the calculation of specific entropy is not as critial as the calculation of isentropic coefficient kappa, which jumps at saturation.

+")); +end MoistAirEntropy; diff --git a/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropyAndIsentropicExponent.mo b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropyAndIsentropicExponent.mo new file mode 100644 index 00000000..e7ca43b4 --- /dev/null +++ b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirEntropyAndIsentropicExponent.mo @@ -0,0 +1,27 @@ +within ThermofluidStream.Media.Tests.MoistAirDiscussion; +model MoistAirEntropyAndIsentropicExponent "Warning check for moist air concerning entropy and kappa, compare XSaturation with state.X to check if oversaturated" + extends Modelica.Icons.Example; + package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + "Medium model"; + + Medium.ThermodynamicState state; + //SI.SpecificEntropy s2 = Medium.specificEntropy_pTX(state.p,state.T,state.X); + SI.SpecificEntropy s = Medium.specificEntropy(state); + Real kappa = Medium.isentropicExponent(state); + Real XSaturation "Saturation of state3"; + parameter SI.Temperature T0 = 273.15+20; + parameter SI.TemperatureDifference dT = 20; + parameter SI.MassFraction X0 = 10e-3; + parameter SI.AngularFrequency omega0 = 10; +protected + constant SI.Time unitTime=1; +equation + state.p = 1.e5; + state.T = T0 + dT*cos(omega0*time); + state.X = {X0, 1-X0}; + XSaturation = Medium.Xsaturation(state); + annotation (experiment(StopTime=1.0, Tolerance=1e-005), Documentation(info=" +

Check isentropic exponent kappa, mass fraction of water X0 and mass fraction of water at saturation XSaturation versus time.

+

Pressure and water mass fraction are constant, whereas temperature is changed peridically, and therefor saturation is changed periodically

+

For (over)saturated state both Medium.specificEntropy(state), Medium.specificEntropy_pTX(p,T,X) and Medium.isentropicCoefficient will give a warning

")); +end MoistAirEntropyAndIsentropicExponent; diff --git a/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirIsentropicExponent.mo b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirIsentropicExponent.mo new file mode 100644 index 00000000..d451a389 --- /dev/null +++ b/ThermofluidStream/Media/Tests/MoistAirDiscussion/MoistAirIsentropicExponent.mo @@ -0,0 +1,35 @@ +within ThermofluidStream.Media.Tests.MoistAirDiscussion; +model MoistAirIsentropicExponent "Find PsiXmax concerning kappa (found to be 0.998)" + extends Modelica.Icons.Example; + package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + "Medium model"; + + Medium.ThermodynamicState state; + //SI.SpecificEntropy s2 = Medium.specificEntropy_pTX(state.p,state.T,state.X); + //SI.SpecificEntropy s1 = Medium.specificEntropy(state); + Real kappa = Medium.isentropicExponent(state); + Real XSaturation "Saturation of state3"; + parameter SI.Pressure p0 = 1e5; + parameter SI.Temperature T0 = 273.15+20; + parameter SI.TemperatureDifference dT = 20; + parameter Real x0 = Medium.xsaturation_pT(p0,T0); + parameter SI.MassFraction X0 = x0/(1+x0); + parameter SI.MassFraction dX0 = 1e-2*X0; + parameter SI.AngularFrequency omega0 = 10; + Real phi; + parameter Real kappa0 = 1.39811; + Real e_kappa_real = (kappa-kappa0)/kappa0; + SI.SpecificEntropy s1 = Medium.specificEntropy(state); +protected + constant SI.Time unitTime=1; +equation + state.p = p0; + state.T = T0; + state.X = {X0, 1-X0} - {dX0, 1-dX0}*time; + XSaturation = Medium.Xsaturation(state); + phi = Medium.relativeHumidity(state); + annotation (experiment(StopTime=1.0, Tolerance=1e-005), Documentation(info=" +

Check isentropic exponent kappa and relative humidity phi versus time.

+

Isentropic exponent kappa 'jumps' at approximatly phi=1. Therefor the calculation of isentropic exponent kappa should be limited. +I suggest a limit of phimax=0.998, we could of course also choose one that is more on the 'safe side', but phimax may not be 1!

")); +end MoistAirIsentropicExponent; diff --git a/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.mo b/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.mo new file mode 100644 index 00000000..ed871092 --- /dev/null +++ b/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.mo @@ -0,0 +1,6 @@ +within ThermofluidStream.Media.Tests; +package MoistAirDiscussion + extends Modelica.Icons.ExamplesPackage; + + +end MoistAirDiscussion; diff --git a/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.order b/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.order new file mode 100644 index 00000000..c6bf8b09 --- /dev/null +++ b/ThermofluidStream/Media/Tests/MoistAirDiscussion/package.order @@ -0,0 +1,3 @@ +MoistAirEntropyAndIsentropicExponent +MoistAirIsentropicExponent +MoistAirEntropy diff --git a/ThermofluidStream/Media/Tests/package.order b/ThermofluidStream/Media/Tests/package.order index 025ce1f6..46a52cdd 100644 --- a/ThermofluidStream/Media/Tests/package.order +++ b/ThermofluidStream/Media/Tests/package.order @@ -1 +1,2 @@ TestXRGMedia +MoistAirDiscussion diff --git a/ThermofluidStream/Media/myMedia/Air/MoistAir.mo b/ThermofluidStream/Media/myMedia/Air/MoistAir.mo index 8dac15fe..2b6d80d0 100644 --- a/ThermofluidStream/Media/myMedia/Air/MoistAir.mo +++ b/ThermofluidStream/Media/myMedia/Air/MoistAir.mo @@ -880,7 +880,11 @@ Derivative function for