Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.Functions

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

Name Description
Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.Functions.speedShift speedShift Interpolates value between two speeds
Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.Functions.warnIfPerformanceOutOfBounds warnIfPerformanceOutOfBounds Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1

Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.Functions.speedShift

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

TypeNameDefaultDescription
Realspe Speed of compressor
RealspeSet[:] Array of standard compressor speeds
Realu[:] Array to be interpolated

Outputs

TypeNameDescription
RealyInterpolated 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;

Buildings.Fluid.HeatExchangers.DXCoils.BaseClasses.Functions.warnIfPerformanceOutOfBounds

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

TypeNameDefaultDescription
Realx Argument to be checked
Stringmsg String to be added to warning message
StringcurveName Name of the curve that was tested

Outputs

TypeNameDescription
IntegerretVal0 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("*** Warning: DX coil performance curves at nominal conditions are outside of bounds. " + msg + " is outside of bounds 0.9 to 1.1. The value of the curve fit is " + String(x) + " Check the coefficients of the function " + curveName + "."); end if; end warnIfPerformanceOutOfBounds;