Changeset 712
- Timestamp:
- 10/16/2007 05:21:34 PM (15 months ago)
- Location:
- Modelica/trunk/Modelica/Media
- Files:
-
- 2 modified
-
Air.mo (modified) (4 diffs)
-
IdealGases/Common/package.mo (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Modelica/trunk/Modelica/Media/Air.mo
r704 r712 93 93 constant IdealGases.Common.DataRecord dryair = IdealGases.Common.SingleGasesData.Air; 94 94 constant IdealGases.Common.DataRecord steam = IdealGases.Common.SingleGasesData.H2O; 95 constant SI.MolarMass[2] MMX = {steam.MM,dryair.MM} 96 "Molar masses of components"; 95 97 96 98 import Modelica.Media.Interfaces; … … 124 126 125 127 protected 126 constant SI.MolarMass[2] MMX = {steam.MM,dryair.MM}127 "Molar masses of components";128 129 128 MassFraction X_liquid "Mass fraction of liquid or solid water"; 130 129 MassFraction X_steam "Mass fraction of steam water"; … … 816 815 Specific entropy is calculated from the thermodynamic state record, assuming ideal gas behavior and including entropy of mixing. Liquid or solid water is not taken into account, the entire water content X[1] is assumed to be in the vapor state (relative humidity below 1.0). 817 816 </html>")); 817 818 818 protected 819 MoleFraction[2] Y = massToMoleFractions(state.X,{steam.MM,dryair.MM})819 MoleFraction[2] Y = massToMoleFractions(state.X,{steam.MM,dryair.MM}) 820 820 "molar fraction"; 821 821 algorithm 822 s :=SingleGasNasa.s0_Tlow(dryair, state.T)*(1-state.X[Water])822 s:=SingleGasNasa.s0_Tlow(dryair, state.T)*(1-state.X[Water]) 823 823 + SingleGasNasa.s0_Tlow(steam, state.T)*state.X[Water] 824 - gasConstant(state)*Modelica.Math.log(state.p/reference_p) 825 + sum(if Y[i] > Modelica.Constants.eps then -Y[i]*Modelica.Math.log(Y[i]) else 826 Y[i] for i in 1:size(Y,1)); 824 - (state.X[Water]*Modelica.Constants.R/MMX[Water]*(if state.X[Water]<Modelica.Constants.eps then state.X[Water] else Modelica.Math.log(Y[Water]*state.p/reference_p)) 825 + (1-state.X[Water])*Modelica.Constants.R/MMX[Air]*(if (1-state.X[Water])<Modelica.Constants.eps then (1-state.X[Water]) else Modelica.Math.log(Y[Air]*state.p/reference_p))); 827 826 end specificEntropy; 828 827 … … 1050 1049 1051 1050 //trigger events 1052 pd[i] = medium_T[i].Xi[1]*medium_T[i].MM/ medium_T[i].MMX[1]*p_const;1051 pd[i] = medium_T[i].Xi[1]*medium_T[i].MM/MMX[1]*p_const; 1053 1052 fog[i] = pd[i] >= Medium.saturationPressure(T_const[i]); 1054 1053 end for; -
Modelica/trunk/Modelica/Media/IdealGases/Common/package.mo
r704 r712 918 918 redeclare function extends specificEntropy "Return specific entropy" 919 919 extends Modelica.Icons.Function; 920 algorithm 921 s := s_TX(state.T, state.X) - gasConstant(state)*Modelica.Math.log(state.p/reference_p) 922 + MixEntropy(massToMoleFractions(state.X,data.MM)); 920 protected 921 Real[nX] Y(unit="mol/mol")=massToMoleFractions(state.X, data.MM) 922 "Molar fractions"; 923 algorithm 924 s := s_TX(state.T, state.X) - sum(state.X[i]*Modelica.Constants.R/MMX[i]* 925 (if Y[i]>=Modelica.Constants.eps then Modelica.Math.log(Y[i]*state.p/ 926 reference_p) else Y[i]) for i in 1:nX); 927 923 928 end specificEntropy; 924 929
