Buildings.Fluid.DXSystems.Cooling.BaseClasses.Functions

Package with functions

Information

This package contains functions that are used in Buildings.Fluid.DXSystems.BaseClasses.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.DXSystems.Cooling.BaseClasses.Functions.nominalValuesToString nominalValuesToString Converts the nominal values to a string representation
Buildings.Fluid.DXSystems.Cooling.BaseClasses.Functions.speedShift speedShift Interpolates value between two speeds
Buildings.Fluid.DXSystems.Cooling.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.DXSystems.Cooling.BaseClasses.Functions.nominalValuesToString Buildings.Fluid.DXSystems.Cooling.BaseClasses.Functions.nominalValuesToString

Converts the nominal values to a string representation

Information

Returns a string representation of the nominal values.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
NominalValuesnomVal Nominal values

Outputs

TypeNameDescription
StringsA string representation of the nominal values

Modelica definition

function nominalValuesToString "Converts the nominal values to a string representation" extends Modelica.Icons.Function; input Buildings.Fluid.DXSystems.Cooling.AirSource.Data.Generic.BaseClasses.NominalValues nomVal "Nominal values"; output String s "A string representation of the nominal values"; algorithm s :="Nominal values: Q_flow_nominal = " + String(nomVal.Q_flow_nominal) + " COP_nominal = " + String(nomVal.COP_nominal) + " m_flow_nominal = " + String(nomVal.m_flow_nominal) + " TEvaIn_nominal = " + String(nomVal.TEvaIn_nominal) + " (= " + String(nomVal.TEvaIn_nominal-273.15) + " degC) TConIn_nominal = " + String(nomVal.TConIn_nominal) + " (= " + String(nomVal.TConIn_nominal-273.15) + " degC) phiIn_nominal = " + String(nomVal.phiIn_nominal) + " tWet = " + String(nomVal.tWet) + " gamma = " + String(nomVal.gamma) + " p_nominal = " + String(nomVal.p_nominal) + " "; end nominalValuesToString;

Buildings.Fluid.DXSystems.Cooling.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.DXSystems.Cooling.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; assert( retVal == 0, "*** 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 + ".", level = AssertionLevel.warning); end warnIfPerformanceOutOfBounds;