Collection of models that illustrate model use and test models
Information
This package contains examples for the use of models that can be found in
Annex60.Utilities.Psychrometrics.Functions.BaseClasses.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
DewPointTemperatureDerivativeCheck
|
Model to test correct implementation of derivative |
DewPointTemperatureDerivativeCheck_amb
|
Model to test correct implementation of derivative |
InverseDewPointTemperatureDerivativeCheck_amb
|
Model to test correct implementation of derivative |
SaturationPressureDerivativeCheck
|
Model to test correct implementation of derivative |
WaterVaporPressureDerivativeCheck
|
Model to test correct implementation of derivative |
Model to test correct implementation of derivative
Information
This example checks whether the function derivative
is implemented correctly. If the derivative implementation
is not correct, the model will stop with an assert statement.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model DewPointTemperatureDerivativeCheck
extends Modelica.Icons.Example;
Real y ;
Real y_comp ;
Real err ;
Modelica.SIunits.Temperature T ;
initial equation
y=y_comp;
equation
T = 273.15 + 50 + time^3 * 50;
y=
Annex60.Utilities.Psychrometrics.Functions.pW_TDewPoi(T=T);
der(y)=
der(y_comp);
err = y-y_comp;
assert(
abs(err)/
max(1,
abs(y)) < 1E-2, "Derivative implementation has an error or solver tolerance is too low.");
end DewPointTemperatureDerivativeCheck;
Model to test correct implementation of derivative
Information
This example checks whether the function derivative
is implemented correctly. If the derivative implementation
is not correct, the model will stop with an assert statement.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model DewPointTemperatureDerivativeCheck_amb
extends Modelica.Icons.Example;
Real y ;
Real y_comp ;
Real err ;
Modelica.SIunits.Temperature T ;
initial equation
y=y_comp;
equation
T = 273.15 + 50 + time^3 * 50;
y=
Annex60.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb(T=T);
der(y)=
der(y_comp);
err = y-y_comp;
assert(
abs(err)/
max(1,
abs(y)) < 1E-2, "Derivative implementation has an error or solver tolerance is too low.");
end DewPointTemperatureDerivativeCheck_amb;
Model to test correct implementation of derivative
Information
This example checks whether the function derivative
is implemented correctly. If the derivative implementation
is not correct, the model will stop with an assert statement.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model InverseDewPointTemperatureDerivativeCheck_amb
extends Modelica.Icons.Example;
Real y ;
Real y_comp ;
Real err(unit="K", displayUnit="K") ;
Modelica.SIunits.Pressure p_w ;
initial equation
y=y_comp;
equation
p_w = 611 + (7383-661)/2 + (7383-661)/2 * time^3;
y =
Annex60.Utilities.Psychrometrics.Functions.TDewPoi_pW_amb(p_w=p_w);
der(y) =
der(y_comp);
err = y-y_comp;
assert(
abs(err) < 1E-2, "Derivative implementation has an error or solver tolerance is too low.");
end InverseDewPointTemperatureDerivativeCheck_amb;
Model to test correct implementation of derivative
Information
This example checks whether the function derivative
is implemented correctly. If the derivative implementation
is not correct, the model will stop with an assert statement.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Modelica definition
model SaturationPressureDerivativeCheck
extends Modelica.Icons.Example;
parameter Modelica.SIunits.Temperature TMin = 190 ;
parameter Modelica.SIunits.Temperature TMax = 373.16 ;
Real y ;
Real y_comp ;
Real err ;
Modelica.SIunits.Temperature T ;
initial equation
y=y_comp;
equation
T = TMin + (TMax-TMin)/2 + (TMax-TMin)/2*time^3;
y=
Annex60.Utilities.Psychrometrics.Functions.saturationPressure(TSat=T);
der(y)=
der(y_comp);
err = y-y_comp;
assert(
abs(err)/
max(1,
abs(y)) < 1E-2, "Derivative implementation has an error or solver tolerance is too low.");
end SaturationPressureDerivativeCheck;
Model to test correct implementation of derivative
Information
This example checks whether the function derivative
is implemented correctly. If the derivative implementation
is not correct, the model will stop with an assert statement.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model WaterVaporPressureDerivativeCheck
extends Modelica.Icons.Example;
Real y ;
Real y_comp ;
Real err ;
Modelica.SIunits.MassFraction X_w
;
Modelica.SIunits.Pressure p ;
initial equation
y=y_comp;
equation
X_w = 1.001 + 0.999/2*time^3;
p = 101325+300*time^3;
y=
Annex60.Utilities.Psychrometrics.Functions.pW_X(X_w=X_w, p=p);
der(y)=
der(y_comp);
err = y-y_comp;
assert(
abs(err)/
max(1,
abs(y)) < 1E-2, "Derivative implementation has an error or solver tolerance is too low.");
end WaterVaporPressureDerivativeCheck;
http://iea-annex60.org