Package with functions
Information
This package contains functions that are used in
Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Interpolates value between two speeds
Information
This function interpolates data for intermediate compressor speeds
using cubic hermite splines with linear extrapolation.
To avoid linear extrapolation below minimum standard speed,
the origin is added to the modified arrays.
Inputs
Type | Name | Default | Description |
Real | spe | | Speed of compressor |
Real | speSet[:] | | Array of standard compressor speeds |
Real | u[:] | | Array to be interpolated |
Outputs
Type | Name | Description |
Real | y | Interpolated value |
Modelica definition
function speedShift "Interpolates value between two speeds"
//x in cubic Hermite function
input Real spe "Speed of compressor";
//x1, x2 in cubic Hermite function
input Real speSet[:] "Array of standard compressor speeds";
//y1, y2 in cubic Hermite function
input Real u[:] "Array to be interpolated";
output Real y "Interpolated value";
protected
Integer n= size(u,1)+1 "Number of elements in modified array";
Real derv[n] "deriative";
Integer i=1 "Integer to select data interval";
Real modSpeSet[n] "Speed set with origin";
Real modU[n];
algorithm
//y1d, y2d in cubic Hermite function
modSpeSet:= cat(1, {0.00}, speSet);
modU := cat(1, {0.00}, u);
//Derivatives at standard speeds
derv := Buildings.Utilities.Math.Functions.splineDerivatives(
x=modSpeSet,
y=modU,
ensureMonotonicity=Buildings.Utilities.Math.Functions.isMonotonic(x=modU,
strict=false));
//locate the range between which compressor operates
for j in 1:size(modSpeSet, 1) - 1 loop
if spe > modSpeSet[j] then
i :=j;
end if;
end for;
y :=Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation(
x=spe,
x1=modSpeSet[i],
x2=modSpeSet[i + 1],
y1=modU[i],
y2=modU[i + 1],
y1d=derv[i],
y2d=derv[i + 1]);
end speedShift;
Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1
Information
This function checks if the numeric argument is outside of the
interval 0.9 to 1.1.
If this is the case, the function writes a warning.
Inputs
Type | Name | Default | Description |
Real | x | | Argument to be checked |
String | msg | | String to be added to warning message |
String | curveName | | Name of the curve that was tested |
Outputs
Type | Name | Description |
Integer | retVal | 0 if x is inside bounds, -1 if it is below bounds, or +1 if it is above bounds |
Modelica definition
function warnIfPerformanceOutOfBounds
"Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1"
input Real x "Argument to be checked";
input String msg "String to be added to warning message";
input String curveName "Name of the curve that was tested";
output Integer retVal
"0 if x is inside bounds, -1 if it is below bounds, or +1 if it is above bounds";
algorithm
if (x > 1.1) then
retVal :=1;
elseif ( x < 0.9) then
retVal :=-1;
else
retVal :=0;
end if;
if (retVal <> 0) then
Modelica.Utilities.Streams.print("************************************************************************************");
Modelica.Utilities.Streams.print("*** Warning: DX coil performance curves at nominal conditions are outside of bounds.");
Modelica.Utilities.Streams.print(msg + " is outside of bounds 0.9 to 1.1.");
Modelica.Utilities.Streams.print("The value of the curve fit is " + String(x));
Modelica.Utilities.Streams.print("Check the coefficients of the function " + curveName);
Modelica.Utilities.Streams.print("************************************************************************************");
end if;
end warnIfPerformanceOutOfBounds;
Automatically generated Mon May 4 10:21:25 2015.