Changeset 536

Show
Ignore:
Timestamp:
08/16/2007 12:13:06 PM (17 months ago)
Author:
otter
Message:

Documentation improved

Location:
Modelica/trunk/Modelica
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • Modelica/trunk/Modelica/Blocks/Math.mo

    r535 r536  
    13511351</p> 
    13521352<pre> 
    1353     y = sqrt( u ); 
     1353    y = <b>sqrt</b>( u ); 
    13541354</pre> 
    13551355<p> 
  • Modelica/trunk/Modelica/Media/Air.mo

    r534 r536  
    3737     
    3838  redeclare function dynamicViscosity  
    39       "Simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
     39      "simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
    4040    extends Modelica.Icons.Function; 
    41     input ThermodynamicState state "Thermodynamic state record"; 
     41    input ThermodynamicState state; 
    4242    output DynamicViscosity eta "Dynamic viscosity"; 
    4343  algorithm  
    4444    eta := Incompressible.TableBased.Polynomials_Temp.evaluate({(-4.96717436974791E-011), 5.06626785714286E-008, 1.72937731092437E-005}, Cv.to_degC(state.T)); 
    45       annotation (Documentation(info="<html> 
    46 Dynamic viscosity is computed from temperature using a second order polynomial with a range of validity between 73 and 373 K. 
    47 </html>")); 
    4845  end dynamicViscosity; 
    4946     
    5047    redeclare function thermalConductivity  
    51       "Simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
    52       extends Modelica.Icons.Function; 
    53       input ThermodynamicState state "Thermodynamic state record"; 
    54       input Integer method=1 "Dummy for compatibility reasons"; 
     48      "simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
     49      extends Modelica.Icons.Function; 
     50      input ThermodynamicState state; 
     51      input Integer method=1 "1: Eucken Method, 2: Modified Eucken Method"; 
    5552      output ThermalConductivity lambda "Thermal conductivity"; 
    5653    algorithm  
    5754      lambda := Incompressible.TableBased.Polynomials_Temp.evaluate({(-4.8737307422969E-008), 7.67803133753502E-005, 0.0241814385504202},Cv.to_degC(state.T)); 
    58        
    59       annotation (Documentation(info="<html> 
    60 Thermal conductivity is computed from temperature using a second order polynomial with a range of validity between 73 and 373 K.  
    61 </html>")); 
    6255    end thermalConductivity; 
    6356     
     
    9891      p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default), 
    9992      Xi(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default))  
    100       "Moist air base properties record"  
    10193       
    10294      /* p, T, X = X[Water] are used as preferred states, since only then all 
     
    10597     is no longer possible and non-linear algebraic equations occur. 
    10698      */ 
    107       MassFraction x_water "Mass of total water/mass of dry air"; 
    108       Real phi "Relative humidity"; 
    109       annotation(structurallyIncomplete, Documentation(info="<html> 
    110 This model computes thermodynamic properties of moist air from three independent (thermodynamic or/and numerical) state variables. Preferred numerical states are temperature T, pressure p and the reduced composition vector Xi, which contains the water mass fraction only. As an EOS the <b>ideal gas law</b> is used and associated restrictions apply. The model can also be used in the <b>fog region</b>, when moisture is present in its liquid state. However, it is assumed that the liquid water volume is negligible compared to that of the gas phase. Computation of thermal properties is based on property data of <a href=Modelica:Modelica.Media.Air.DryAirNasa> dry air</a> and water (source: VDI-W&auml;rmeatlas), respectively. Besides the standard thermodynamic variables <b>absolute and relative humidity</b>, x_water and phi, respectively, are given by the model. Upper case X denotes absolute humidity with respect to mass of moist air while absolute humidity with respect to mass of dry air only is denoted by a lower case x throughout the model. See <a href=Modelica:Modelica.Media.Air.MoistAir>package description</a> for further information. 
    111 </html>")); 
     99      MassFraction x_water "mass of total water/mass of dry air"; 
     100      Real phi "relative humidity"; 
     101      annotation(structurallyIncomplete); 
    112102       
    113103    protected  
    114104      constant SI.MolarMass[2] MMX = {steam.MM,dryair.MM}  
    115         "Molar masses of components"; 
    116        
    117       MassFraction X_liquid "Mass fraction of liquid or solid water"; 
    118       MassFraction X_steam "Mass fraction of steam water"; 
    119       MassFraction X_air "Mass fraction of air"; 
     105        "molar masses of components"; 
     106       
     107      MassFraction X_liquid "mass fraction of liquid water"; 
     108      MassFraction X_steam "mass fraction of steam water"; 
     109      MassFraction X_air "mass fraction of air"; 
    120110      MassFraction X_sat  
    121         "Steam water mass fraction of saturation boundary in kg_water/kg_moistair"; 
     111        "steam water mass fraction of saturation boundary in kg_water/kg_moistair"; 
    122112      MassFraction x_sat  
    123         "Steam water mass content of saturation boundary in kg_water/kg_dryair"; 
     113        "steam water mass content of saturation boundary in kg_water/kg_dryair"; 
    124114      AbsolutePressure p_steam_sat "Partial saturation pressure of steam"; 
    125115    equation  
     
    138128       
    139129      h = specificEnthalpy_pTX(p,T,Xi); 
    140       R = dryair.R*(X_air/(1 - X_liquid)) + steam.R*X_steam/(1 - X_liquid); 
     130      R = dryair.R*(1 - X_steam/(1 - X_liquid)) + steam.R*X_steam/(1 - X_liquid); 
    141131      //                 
    142132      u = h - R*T; 
     
    155145    end BaseProperties; 
    156146     
     147    function Xsaturation  
     148      "Steam water mass fraction of saturation boundary in kg_water/kg_moistair"  
     149      input ThermodynamicState state "Thermodynamic state"; 
     150      output MassFraction X_sat "Steam mass fraction of sat. boundary"; 
     151    algorithm  
     152      X_sat := k_mair/(state.p/min(saturationPressure(state.T),0.999*state.p) - 1 + k_mair); 
     153    end Xsaturation; 
     154     
     155    function massFraction_pTphi  
     156      "Return the steam mass fraction from relative humidity and T"  
     157      input AbsolutePressure p "Pressure"; 
     158      input Temperature T "Temperature"; 
     159      input Real phi "relative humidity (0 ... 1.0)"; 
     160      output MassFraction X_steam "steam Mass fractions"; 
     161    protected  
     162      constant Real k = 0.621964713077499 "ratio of molar masses"; 
     163      AbsolutePressure psat = saturationPressure(T) "saturation pressure"; 
     164    algorithm  
     165      X_steam := phi*k/(k*phi+p/psat-phi); 
     166    end massFraction_pTphi; 
     167     
    157168    redeclare function setState_pTX  
    158       "Return thermodynamic state as function of pressure p, temperature T and composition X"  
     169      "Return thermodynamic state as function of p, T and composition X"  
    159170      extends Modelica.Icons.Function; 
    160171      input AbsolutePressure p "Pressure"; 
    161172      input Temperature T "Temperature"; 
    162173      input MassFraction X[:]=reference_X "Mass fractions"; 
    163       output ThermodynamicState state "Thermodynamic state"; 
     174      output ThermodynamicState state; 
    164175    algorithm  
    165176      state := if size(X,1) == nX then ThermodynamicState(p=p,T=T, X=X) else  
    166177             ThermodynamicState(p=p,T=T, X=cat(1,X,{1-sum(X)})); 
    167       annotation (Documentation(info="<html> 
    168 The <a href=Modelica:Modelica.Media.Air.MoistAir.ThermodynamicState>thermodynamic state record</a> is computed from pressure p, temperature T and composition X. 
    169 </html>")); 
    170178    end setState_pTX; 
    171179     
    172180    redeclare function setState_phX  
    173       "Return thermodynamic state as function of pressure p, specific enthalpy h and composition X"  
     181      "Return thermodynamic state as function of p, h and composition X"  
    174182      extends Modelica.Icons.Function; 
    175183      input AbsolutePressure p "Pressure"; 
    176184      input SpecificEnthalpy h "Specific enthalpy"; 
    177185      input MassFraction X[:]=reference_X "Mass fractions"; 
    178       output ThermodynamicState state "Thermodynamic state"; 
     186      output ThermodynamicState state; 
    179187    algorithm  
    180188      state := if size(X,1) == nX then ThermodynamicState(p=p,T=T_phX(p,h,X),X=X) else  
    181189             ThermodynamicState(p=p,T=T_phX(p,h,X), X=cat(1,X,{1-sum(X)})); 
    182       annotation (Documentation(info="<html> 
    183 The <a href=Modelica:Modelica.Media.Air.MoistAir.ThermodynamicState>thermodynamic state record</a> is computed from pressure p, specific enthalpy h and composition X. 
    184 </html>")); 
    185190    end setState_phX; 
    186      
    187     redeclare function setState_dTX  
    188       "Return thermodynamic state as function of density d, temperature T and composition X"  
    189       extends Modelica.Icons.Function; 
    190       input Density d "density"; 
    191       input Temperature T "Temperature"; 
    192       input MassFraction X[:]=reference_X "Mass fractions"; 
    193       output ThermodynamicState state "Thermodynamic state"; 
    194     algorithm  
    195       state := if size(X,1) == nX then ThermodynamicState(p=d*({steam.R,dryair.R}*X)*T,T=T,X=X) else  
    196              ThermodynamicState(p=d*({steam.R,dryair.R}*cat(1,X,{1-sum(X)}))*T,T=T, X=cat(1,X,{1-sum(X)})); 
    197       annotation (Documentation(info="<html> 
    198 The <a href=Modelica:Modelica.Media.Air.MoistAir.ThermodynamicState>thermodynamic state record</a> is computed from density d, temperature T and composition X. 
    199 </html>")); 
    200     end setState_dTX; 
    201      
    202     function Xsaturation  
    203       "Return absolute humitity per unit mass of moist air at saturation as a function of the thermodynamic state record"  
    204       input ThermodynamicState state "Thermodynamic state record"; 
    205       output MassFraction X_sat "Steam mass fraction of sat. boundary"; 
    206     algorithm  
    207       X_sat := k_mair/(state.p/min(saturationPressure(state.T),0.999*state.p) - 1 + k_mair); 
    208       annotation (Documentation(info="<html> 
    209 Absolute humidity per unit mass of moist air at saturation is computed from pressure and temperature in the state record. Note, that in contrast to X_sat in the BaseProperties model this mass fraction is with respect to mass of moist air at saturation. 
    210 </html>")); 
    211     end Xsaturation; 
    212      
    213     function xsaturation  
    214       "Return absolute humitity per unit mass of dry air at saturation as a function of the thermodynamic state record"  
    215       input ThermodynamicState state "Thermodynamic state record"; 
    216       output MassFraction x_sat "Absolute humidity per unit mass of dry air"; 
    217     algorithm  
    218       x_sat:=k_mair*saturationPressure(state.T)/max(100*Constants.eps,state.p - saturationPressure(state.T)); 
    219       annotation (Documentation(info="<html> 
    220 Absolute humidity per unit mass of dry air at saturation is computed from pressure and temperature in the thermodynamic state record. 
    221 </html>")); 
    222     end xsaturation; 
    223      
    224     function xsaturation_pT  
    225       "Return absolute humitity per unit mass of dry air at saturation as a function of pressure p and temperature T"  
    226       input AbsolutePressure p "Pressure"; 
    227       input SI.Temperature T "Temperature"; 
    228       output MassFraction x_sat "Absolute humidity per unit mass of dry air"; 
    229     algorithm  
    230       x_sat:=k_mair*saturationPressure(T)/max(100*Constants.eps,p - saturationPressure(T)); 
    231       annotation (Documentation(info="<html> 
    232 Absolute humidity per unit mass of dry air at saturation is computed from pressure and temperature. 
    233 </html>")); 
    234     end xsaturation_pT; 
    235      
    236     function massFraction_pTphi  
    237       "Return steam mass fraction as a function of relative humidity phi and temperature T"  
    238       input AbsolutePressure p "Pressure"; 
    239       input Temperature T "Temperature"; 
    240       input Real phi "Relative humidity (0 ... 1.0)"; 
    241       output MassFraction X_steam "Absolute humidity, steam mass fraction"; 
    242     protected  
    243       constant Real k = 0.621964713077499 "Ratio of molar masses"; 
    244       AbsolutePressure psat = saturationPressure(T) "Saturation pressure"; 
    245     algorithm  
    246       X_steam := phi*k/(k*phi+p/psat-phi); 
    247       annotation (Documentation(info="<html> 
    248 Absolute humidity per unit mass of moist air is computed from temperature, pressure and relative humidity. 
    249 </html>")); 
    250     end massFraction_pTphi; 
    251      
    252     function relativeHumidity_pTX  
    253       "Return relative humidity as a function of pressure p, temperature T and composition X"  
    254       input SI.Pressure p "Pressure"; 
    255       input SI.Temperature T "Temperature"; 
    256       input SI.MassFraction[:] X "Composition"; 
    257       output Real phi "Relative humidity"; 
    258     protected  
    259       SI.Pressure p_steam_sat "Saturation pressure"; 
    260       SI.MassFraction X_air "Dry air mass fraction"; 
    261     algorithm  
    262       p_steam_sat :=min(saturationPressure(T), 0.999*p); 
    263       X_air    :=1 - X[Water]; 
    264       phi :=min(1.0, p/p_steam_sat*X[Water]/(X[Water] + k_mair*X_air)); 
    265       annotation (Documentation(info="<html> 
    266 Relative humidity is computed from the pressure, temperature and composition with 1.0 as the upper limit at saturation. 
    267 </html>")); 
    268     end relativeHumidity_pTX; 
    269      
    270     function relativeHumidity  
    271       "Return relative humidity as a function of the thermodynamic state record"  
    272       input ThermodynamicState state "Thermodynamic state"; 
    273       output Real phi "Relative humidity"; 
    274     algorithm  
    275       phi:=relativeHumidity_pTX(state.p, state.T, state.X); 
    276       annotation (Documentation(info="<html> 
    277 Relative humidity is computed from the thermodynamic state with 1.0 as the upper limit at saturation. 
    278 </html>")); 
    279     end relativeHumidity; 
    280      
    281191    /*     
    282192    redeclare function setState_psX "Return thermodynamic state as function of p, s and composition X"  
     
    291201    end setState_psX; 
    292202*/ 
     203    redeclare function setState_dTX  
     204      "Return thermodynamic state as function of d, T and composition X"  
     205      extends Modelica.Icons.Function; 
     206      input Density d "density"; 
     207      input Temperature T "Temperature"; 
     208      input MassFraction X[:]=reference_X "Mass fractions"; 
     209      output ThermodynamicState state; 
     210    algorithm  
     211      state := if size(X,1) == nX then ThermodynamicState(p=d*({steam.R,dryair.R}*X)*T,T=T,X=X) else  
     212             ThermodynamicState(p=d*({steam.R,dryair.R}*cat(1,X,{1-sum(X)}))*T,T=T, X=cat(1,X,{1-sum(X)})); 
     213    end setState_dTX; 
    293214     
    294215    redeclare function extends gasConstant  
    295       "Return ideal gas constant as a function from thermodynamic state, only valid for phi<1"  
     216      "Gas constnat: computation neglects liquid fraction"  
    296217    algorithm  
    297218      R := dryair.R*(1-state.X[Water]) + steam.R*state.X[Water]; 
    298       annotation (Documentation(info="<html> 
    299 Computes the ideal gas constant for moist air from <a href=Modelica:Modelica.Media.Air.MoistAir.ThermodynamicState>thermodynamic state</a> assuming that all water is in the gas phase. 
    300 </html>")); 
    301219    end gasConstant; 
    302220     
    303     function gasConstant_X  
    304       "Return ideal gas constant as a function from composition X"  
    305       input SI.MassFraction X[:] "Gas phase composition"; 
    306       output SI.SpecificHeatCapacity R "Ideal gas constant"; 
    307     algorithm  
    308       R := dryair.R*(1-X[Water]) + steam.R*X[Water]; 
    309       annotation (Documentation(info="<html> 
    310 Computes the ideal gas constant for moist air from gas phase composition. The first entry in composition vector X is the steam mass fraction of the gas phase. 
    311 </html>")); 
    312     end gasConstant_X; 
    313      
    314221    function saturationPressureLiquid  
    315       "Return saturation pressure of water in the liquid region as a function of temperature T in the range of 273.16 to 373.16 K"  
    316        
     222      "Saturation curve valid for 273.16 <= T <= 373.16. Outside of these limits a (less accurate) result is returned"  
    317223      extends Modelica.Icons.Function; 
    318224      input SI.Temperature Tsat "saturation temperature"; 
    319225      output SI.AbsolutePressure psat "saturation pressure"; 
    320       annotation(Inline=false,smoothOrder=5, 
    321         Documentation(info="<html> 
    322 Saturation pressure of water in the liquid region is computed using an Antoine-type correlation. It's range of validity is between 
    323 273.16 and 373.16 K. Outside these limits a less accurate result is returned. 
    324 </html>")); 
     226      annotation(Inline=false,smoothOrder=5); 
    325227    algorithm  
    326228      psat := 611.657*Math.exp(17.2799 - 4102.99/(Tsat - 35.719)); 
     
    328230     
    329231    function sublimationPressureIce  
    330       "Return sublimation pressure of water in the solid region as a function of temperature T between 223.16 and 273.16 K"  
    331        
     232      "Saturation curve valid for 223.16 <= T <= 273.16. Outside of these limits a (less accurate) result is returned"  
    332233      extends Modelica.Icons.Function; 
    333234      input SI.Temperature Tsat "sublimation temperature"; 
    334235      output SI.AbsolutePressure psat "sublimation pressure"; 
    335       annotation(Inline=false,smoothOrder=5, 
    336         Documentation(info="<html> 
    337 Sublimation pressure of water in the liquid region is computed using an Antoine-type correlation. It's range of validity is between 
    338  223.16 and 273.16 K. Outside of these limits a less accurate result is returned. 
    339 </html>")); 
     236      annotation(Inline=false,smoothOrder=5); 
    340237    algorithm  
    341238      psat := 611.657*Math.exp(22.5159*(1.0 - 273.16/Tsat)); 
     
    343240     
    344241    redeclare function extends saturationPressure  
    345       "Return saturation pressure of water as a function of temperature T between 223.16 and 373.16 K"  
    346        
    347       annotation(Inline=false,smoothOrder=5, 
    348         Documentation(info="<html> 
    349 Saturation pressure of water in the liquid and the solid region is computed using an Antoine-type correlation. It's range of validity is between 223.16 and 373.16 K. Outside of these limits a (less accurate) result is returned. Functions for the  
    350 <a href=Modelica.Media.Air.MoistAir.sublimationPressureIce>solid</a> and the <a href=\"Modelica.Media.MoistAir.saturationPressureLiquid\"> liquid</a> region, respectively, are combined using the first derivative continuous <a href=Modelica.Media.MoistAir.Utilities.spliceFunction>spliceFunction</a>. 
    351 </html>")); 
     242      "Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)"  
     243       
     244      annotation(Inline=false,smoothOrder=5); 
    352245    algorithm  
    353246      psat := Utilities.spliceFunction(saturationPressureLiquid(Tsat),sublimationPressureIce(Tsat),Tsat-273.16,1.0); 
     
    355248     
    356249    function saturationTemperature  
    357       "Return saturation temperature of water as a function of (partial) pressure p"  
    358        
    359       input SI.Pressure p "Pressure"; 
    360       input SI.Temperature T_min=200 "Lower boundary of solution"; 
    361       input SI.Temperature T_max=400 "Upper boundary of solution"; 
    362       output SI.Temperature T "Saturation temperature"; 
     250      "Computes saturation temperature from (partial) pressure via numerical inversion of the function 'saturationPressure'"  
     251      input SI.Pressure p "pressure"; 
     252      input SI.Temperature T_min=200 "lower boundary of solution"; 
     253      input SI.Temperature T_max=400 "upper boundary of solution"; 
     254      output SI.Temperature T "temperature"; 
    363255       
    364256    protected  
     
    382274    algorithm  
    383275      T:=Internal.solve(p, T_min, T_max); 
    384       annotation (Documentation(info="<html> 
    385  Computes saturation temperature from (partial) pressure via numerical inversion of the function <a href=Modelica:Modelica.Media.Air.MoistAir.saturationPressure>saturationPressure</a>. Therefore additional inputs are required (or the defaults are used) for upper and lower temperature bounds.   
    386 </html>")); 
    387276    end saturationTemperature; 
    388277     
    389278   redeclare function extends enthalpyOfVaporization  
    390       "Return enthalpy of vaporization of water as a function of temperature T, 0 - 130 degC"  
     279      "Enthalpy of vaporization of water, 0 - 130 degC"  
    391280   algorithm  
    392281    /*r0 := 1e3*(2501.0145 - (T - 273.15)*(2.3853 + (T - 273.15)*(0.002969 - (T 
     
    395284   //source VDI-Waermeatlas, linear inter- and extrapolation between values for 0.01°C and 40°C. 
    396285   r0:=(2405900-2500500)/(40-0)*(T-273.16)+2500500; 
    397       annotation (Documentation(info="<html> 
    398 Enthalpy of vaporization of water is computed from temperature in the region of 0 
    399 </html>")); 
    400286   end enthalpyOfVaporization; 
    401287     
    402288    function HeatCapacityOfWater  
    403       "Return specific heat capacity of water (liquid only) as a function of temperature T"  
    404       extends Modelica.Icons.Function; 
    405       input Temperature T "Temperature"; 
    406       output SpecificHeatCapacity cp_fl "Specific heat capacity of liquid"; 
    407       annotation (Documentation(info="<html> 
    408 The specific heat capacity of water (liquid and solid) is calculated using a 
    409                  polynomial approach and data from VDI-Waermeatlas 8. Edition (Db1) 
    410 </html>")); 
     289      "Specific heat capacity of water (liquid only)"  
     290      extends Modelica.Icons.Function; 
     291      input Temperature T; 
     292      output SpecificHeatCapacity cp_fl; 
     293      annotation (Documentation(info="specific heat capacity of water (liquid and solid); 
     294                 polynomial calculated by data from VDI-Waermeatlas 8. Edition (Db1)")); 
    411295    algorithm  
    412296      cp_fl := 1e3*(4.2166 - (T - 273.15)*(0.0033166 + (T - 273.15)*(0.00010295 
     
    415299     
    416300   redeclare function extends enthalpyOfLiquid  
    417       "Return enthalpy of liquid water as a function of temperature T(use enthalpyOfWater instead)"  
    418        
    419      annotation(Inline=false,smoothOrder=5, 
    420         Documentation(info="<html> 
    421 Specific enthalpy of liquid water is computed from temperature using a polynomial approach. Kept for compatibility reasons, better use <a href=Modelica:Modelica.Media.Air.MoistAir.enthalpyOfWater>enthalpyOfWater</a> instead. 
    422 </html>")); 
     301      "Computes enthalpy of liquid water from temperature (use enthalpyOfWater instead"  
     302       
     303     annotation(Inline=false,smoothOrder=5); 
    423304   algorithm  
    424305     h := (T - 273.15)*1e3*(4.2166 - 0.5*(T - 273.15)*(0.0033166 + 0.333333*(T - 273.15)*(0.00010295 
     
    427308     
    428309   redeclare function extends enthalpyOfGas  
    429       "Return specific enthalpy of gas (air and steam) as a function of temperature T and composition X"  
    430        
    431      annotation(Inline=false,smoothOrder=5, 
    432         Documentation(info="<html> 
    433 Specific enthalpy of moist air is computed from temperature, provided all water is in the gaseous state. The first entry in the composition vector X must be the mass fraction of steam. For a function that also covers the fog region please refer to <a href=Modelica:Modelica.Media.Air.MoistAir.h_pTX>h_pTX</a>. 
    434 </html>")); 
     310      "Computes specific enthalpy of gas (air and steam) from temperature and composition"  
     311       
     312     annotation(Inline=false,smoothOrder=5); 
    435313   algorithm  
    436314     h := SingleGasNasa.h_Tlow(data=steam, T=T, refChoice=3, h_off=46479.819+2501014.5)*X[Water] 
     
    439317     
    440318   redeclare function extends enthalpyOfCondensingGas  
    441       "Return specific enthalpy of steam as a function of temperature T"  
    442      annotation(Inline=false,smoothOrder=5, 
    443         Documentation(info="<html> 
    444 Specific enthalpy of steam is computed from temperature. 
    445 </html>")); 
     319      "Computes specific enthalpy of steam from temperature"  
     320     annotation(Inline=false,smoothOrder=5); 
    446321   algorithm  
    447322     h := SingleGasNasa.h_Tlow(data=steam, T=T, refChoice=3, h_off=46479.819+2501014.5); 
     
    449324     
    450325  function enthalpyOfWater  
    451       "Computes specific enthalpy of water (solid/liquid) near atmospheric pressure from temperature T"  
    452     input SIunits.Temperature T "Temperature"; 
    453     output SIunits.SpecificEnthalpy h "Specific enthalpy of water"; 
    454   annotation (derivative=enthalpyOfWater_der, Documentation(info="<html> 
    455 Specific enthalpy of water (liquid and solid) is computed from temperature using constant properties as follows:<br> 
    456 <ul> 
    457 <li>  heat capacity of liquid water:4200 J/kg 
    458 <li>  heat capacity of solid water: 2050 J/kg 
    459 <li>  enthalpy of fusion (liquid=>solid): 333000 J/kg 
    460 </ul> 
    461 Pressure is assumed to be around 1 bar. This function is usually used to determine the specific enthalpy of the liquid or solid fraction of moist air. 
    462 </html>")); 
     326      "Computes specific enthalpy of water (solid/liquid) near atmospheric pressure from temperature"  
     327    input SIunits.Temperature T; 
     328    output SIunits.SpecificEnthalpy h; 
     329  annotation (derivative=enthalpyOfWater_der); 
    463330  algorithm  
    464331  /*simple model assuming constant properties: 
     
    470337  end enthalpyOfWater; 
    471338     
    472   function enthalpyOfWater_der "Derivative function of enthalpyOfWater"  
    473     input SIunits.Temperature T; 
    474     input SIunits.Temperature dT; 
    475     output SIunits.SpecificEnthalpy dh; 
    476   algorithm  
    477   /*simple model assuming constant properties: 
    478   heat capacity of liquid water:4200 J/kg 
    479   heat capacity of solid water: 2050 J/kg 
    480   enthalpy of fusion (liquid=>solid): 333000 J/kg*/ 
    481        
    482     //h:=Utilities.spliceFunction(4200*(T-273.15),2050*(T-273.15)-333000,T-273.16,0.1); 
    483     dh:=Utilities.spliceFunction_der(4200*(T-273.15),2050*(T-273.15)-333000,T-273.16,0.1,4200*dT,2050*dT,dT,0); 
    484   end enthalpyOfWater_der; 
    485      
    486    redeclare function extends pressure  
    487       "Returns pressure of ideal gas as a function of the thermodynamic state record"  
     339   redeclare function extends pressure "Returns pressure of ideal gas"  
    488340   algorithm  
    489341    p := state.p; 
    490       annotation (Documentation(info="<html> 
    491 Pressure is returned from the thermodynamic state record input as a simple assignment. 
    492 </html>")); 
    493342   end pressure; 
    494343     
    495    redeclare function extends temperature  
    496       "Return temperature of ideal gas as a function of the thermodynamic state record"  
     344   redeclare function extends temperature "Return temperature of ideal gas"  
    497345   algorithm  
    498346     T := state.T; 
    499       annotation (Documentation(info="<html> 
    500 Temperature is returned from the thermodynamic state record input as a simple assignment. 
    501 </html>")); 
    502347   end temperature; 
    503348     
    504   function T_phX  
    505       "Return temperature as a function of pressure p, specific enthalpy h and composition X"  
     349   redeclare function extends density "Returns density of ideal gas"  
     350   algorithm  
     351     d := state.p/(gasConstant(state)*state.T); 
     352   end density; 
     353     
     354   redeclare function extends specificEntropy  
     355      "Return specific entropy (liquid part neglected, mixing entropy included)"  
     356       annotation(Inline=false,smoothOrder=5); 
     357    protected  
     358     MoleFraction[2] Y = massToMoleFractions(state.X,{steam.MM,dryair.MM})  
     359        "molar fraction"; 
     360   algorithm  
     361     s := SingleGasNasa.s0_Tlow(dryair, state.T)*(1-state.X[Water]) 
     362       + SingleGasNasa.s0_Tlow(steam, state.T)*state.X[Water] 
     363       - gasConstant(state)*Modelica.Math.log(state.p/reference_p) 
     364       + sum(if Y[i] > Modelica.Constants.eps then -Y[i]*Modelica.Math.log(Y[i]) else  
     365                   Y[i] for i in 1:size(Y,1)); 
     366   end specificEntropy; 
     367     
     368   redeclare function extends specificHeatCapacityCp  
     369      "Returns specific heat capacity at constant pressure"  
     370     annotation(Inline=false,smoothOrder=5); 
     371   algorithm  
     372     cp:= SingleGasNasa.cp_Tlow(dryair, state.T)*(1-state.X[Water]) 
     373       + SingleGasNasa.cp_Tlow(steam, state.T)*state.X[Water]; 
     374   end specificHeatCapacityCp; 
     375     
     376  redeclare function extends specificHeatCapacityCv  
     377      "Returns specific heat capacity at constant volume"  
     378     annotation(Inline=false,smoothOrder=5); 
     379  algorithm  
     380    cv:= SingleGasNasa.cp_Tlow(dryair, state.T)*(1-state.X[Water]) + 
     381      SingleGasNasa.cp_Tlow(steam, state.T)*state.X[Water] 
     382      - gasConstant(state); 
     383  end specificHeatCapacityCv; 
     384     
     385  redeclare function extends dynamicViscosity  
     386      "Simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
     387      import Modelica.Media.Incompressible.TableBased.Polynomials_Temp; 
     388  algorithm  
     389    eta := Polynomials_Temp.evaluate({(-4.96717436974791E-011), 5.06626785714286E-008, 1.72937731092437E-005}, 
     390         Cv.to_degC(state.T)); 
     391  end dynamicViscosity; 
     392     
     393  redeclare function extends thermalConductivity  
     394      "Simple polynomial for dry air (moisture influence small), valid from 73.15 K to 373.15 K"  
     395      import Modelica.Media.Incompressible.TableBased.Polynomials_Temp; 
     396  algorithm  
     397    lambda := Polynomials_Temp.evaluate({(-4.8737307422969E-008), 7.67803133753502E-005, 0.0241814385504202}, 
     398     Cv.to_degC(state.T)); 
     399  end thermalConductivity; 
     400     
     401  function h_pTX  
     402      "Compute specific enthalpy from pressure, temperature and mass fraction"  
     403    extends Modelica.Icons.Function; 
     404    input SI.Pressure p "Pressure"; 
     405    input SI.Temperature T "Temperature"; 
     406    input SI.MassFraction X[:] "Mass fractions of moist air"; 
     407    output SI.SpecificEnthalpy h "Specific enthalpy at p, T, X"; 
     408    annotation(Inline=false,smoothOrder=1); 
     409    protected  
     410    SI.AbsolutePressure p_steam_sat "Partial saturation pressure of steam"; 
     411    SI.MassFraction x_sat "steam water mass fraction of saturation boundary"; 
     412    SI.MassFraction X_liquid "mass fraction of liquid water"; 
     413    SI.MassFraction X_steam "mass fraction of steam water"; 
     414    SI.MassFraction X_air "mass fraction of air"; 
     415  algorithm  
     416    p_steam_sat :=saturationPressure(T); 
     417    x_sat    :=k_mair*p_steam_sat/(p - p_steam_sat); 
     418    X_liquid :=max(X[Water] - x_sat/(1 + x_sat), 0.0); 
     419    X_steam  :=X[Water] - X_liquid; 
     420    X_air    :=1 - X[Water]; 
     421   /* h        := {SingleGasNasa.h_Tlow(data=steam,  T=T, refChoice=3, h_off=46479.819+2501014.5), 
     422               SingleGasNasa.h_Tlow(data=dryair, T=T, refChoice=3, h_off=25104.684)}* 
     423    {X_steam, X_air} + enthalpyOfLiquid(T)*X_liquid;*/ 
     424     h        := {SingleGasNasa.h_Tlow(data=steam,  T=T, refChoice=3, h_off=46479.819+2501014.5), 
     425                 SingleGasNasa.h_Tlow(data=dryair, T=T, refChoice=3, h_off=25104.684)}* 
     426      {X_steam, X_air} + enthalpyOfWater(T)*X_liquid; 
     427  end h_pTX; 
     428     
     429  redeclare function extends specificEnthalpy "specific enthalpy"  
     430  algorithm  
     431    h := h_pTX(state.p, state.T, state.X); 
     432  end specificEnthalpy; 
     433     
     434  redeclare function extends specificInternalEnergy  
     435      "Return specific internal energy"  
     436    extends Modelica.Icons.Function; 
     437  algorithm  
     438    u := h_pTX(state.p,state.T,state.X) - gasConstant(state)*state.T; 
     439  end specificInternalEnergy; 
     440     
     441  redeclare function extends specificGibbsEnergy "Return specific Gibbs energy"  
     442    extends Modelica.Icons.Function; 
     443  algorithm  
     444    g := h_pTX(state.p,state.T,state.X) - state.T*specificEntropy(state); 
     445  end specificGibbsEnergy; 
     446     
     447  redeclare function extends specificHelmholtzEnergy  
     448      "Return specific Helmholtz energy"  
     449    extends Modelica.Icons.Function; 
     450  algorithm  
     451    f := h_pTX(state.p,state.T,state.X) - gasConstant(state)*state.T - state.T*specificEntropy(state); 
     452  end specificHelmholtzEnergy; 
     453     
     454  function T_phX "Compute temperature from specific enthalpy and mass fraction"  
    506455    input AbsolutePressure p "Pressure"; 
    507     input SpecificEnthalpy h "Specific enthalpy"; 
    508     input MassFraction[:] X "Mass fractions of composition"; 
    509     output Temperature T "Temperature"; 
     456    input SpecificEnthalpy h "specific enthalpy"; 
     457    input MassFraction[:] X "mass fractions of composition"; 
     458    output Temperature T "temperature"; 
    510459       
    511460    protected  
     
    530479  algorithm  
    531480    T := Internal.solve(h, 200, 6000, p, X[1:nXi], steam); 
    532       annotation (Documentation(info="<html> 
    533 Temperature is computed from pressure, specific enthalpy and composition via numerical inversion of function <a href=Modelica:Modelica.Media.Air.MoistAir.h_pTX>h_pTX</a>. 
    534 </html>")); 
    535481  end T_phX; 
    536482     
    537    redeclare function extends density  
    538       "Returns density of ideal gas as a function of the thermodynamic state record"  
    539    algorithm  
    540      d := state.p/(gasConstant(state)*state.T); 
    541       annotation (Documentation(info="<html> 
    542 Density is computed from pressure, temperature and composition in the thermodynamic state record applying the ideal gas law. 
    543 </html>")); 
    544    end density; 
    545      
    546   redeclare function extends specificEnthalpy  
    547       "Return specific enthalpy of moist air as a function of the thermodynamic state record"  
    548   algorithm  
    549     h := h_pTX(state.p, state.T, state.X); 
    550