diff --git a/src/EnergyPlus/ChillerElectricEIR.cc b/src/EnergyPlus/ChillerElectricEIR.cc index 82fab144acb..6c4537241f8 100644 --- a/src/EnergyPlus/ChillerElectricEIR.cc +++ b/src/EnergyPlus/ChillerElectricEIR.cc @@ -65,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -78,6 +77,7 @@ #include #include #include +#include #include #include #include @@ -114,19 +114,6 @@ namespace ChillerElectricEIR { // REFERENCES: // 1. DOE-2 Engineers Manual, Version 2.1A, November 1982, LBL-11353 - // Using/Aliasing - using namespace DataPrecisionGlobals; - using namespace DataLoopNode; - using DataGlobals::DisplayExtraWarnings; - using DataHVACGlobals::SmallWaterVolFlow; - using DataPlant::PlantLoop; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - using General::RoundSigDigits; - using General::TrimSigDigits; - - // Data - // MODULE PARAMETER DEFINITIONS: // Chiller type parameters int const AirCooled(1); int const WaterCooled(2); @@ -141,97 +128,40 @@ namespace ChillerElectricEIR { static std::string const BlankString; // MODULE VARIABLE DECLARATIONS: - int NumElectricEIRChillers(0); // Number of electric EIR chillers specified in input - Real64 CondMassFlowRate(0.0); // Condenser mass flow rate [kg/s] - Real64 EvapMassFlowRate(0.0); // Evaporator mass flow rate [kg/s] - Real64 CondOutletTemp(0.0); // Condenser outlet temperature [C] - Real64 CondOutletHumRat(0.0); // Condenser outlet humidity ratio [kg/kg] - Real64 EvapOutletTemp(0.0); // Evaporator outlet temperature [C] - Real64 EvapWaterConsumpRate(0.0); // Evap condenser water consumption rate [m3/s] - Real64 Power(0.0); // Rate of chiller electric energy use [W] - Real64 QEvaporator(0.0); // Rate of heat transfer to the evaporator coil [W] - Real64 QCondenser(0.0); // Rate of heat transfer to the condenser coil [W] - Real64 QHeatRecovered(0.0); // Rate of heat transfer to the heat recovery coil [W] - Real64 HeatRecOutletTemp(0.0); // Heat recovery outlet temperature [C] - Real64 CondenserFanPower(0.0); // Condenser Fan Power (fan cycles with compressor) [W] - Real64 ChillerCapFT(0.0); // Chiller capacity fraction (evaluated as a function of temperature) - Real64 ChillerEIRFT(0.0); // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature - Real64 ChillerEIRFPLR(0.0); // Chiller EIR as a function of part-load ratio (PLR) - Real64 ChillerPartLoadRatio(0.0); // Chiller part-load ratio (PLR) - Real64 ChillerCyclingRatio(0.0); // Chiller cycling ratio - Real64 BasinHeaterPower(0.0); // Basin heater power (W) - Real64 ChillerFalseLoadRate(0.0); // Chiller false load over and above the water-side load [W] - Real64 AvgCondSinkTemp(0.0); // condenser temperature value for use in curves [C] - - Array1D_bool CheckEquipName; - - bool GetInputEIR(true); // When TRUE, calls subroutine to read input file. - bool ChillerIPLVOneTimeFlag(true); - Array1D_bool ChillerIPLVFlagArr; - bool getInputAllocatedFlag(false); - bool InitMyOneTimeFlag(true); - // SUBROUTINE SPECIFICATIONS FOR MODULE ChillerElectricEIR - // PUBLIC SimEIRChillerHeatRecovery + int NumElectricEIRChillers(0); // Number of electric EIR chillers specified in input + bool getInputFlag(true); // When TRUE, calls subroutine to read input file. // Object Data Array1D ElectricEIRChiller; // Dimension to number of machines - Array1D ElectricEIRChillerReport; - - // MODULE SUBROUTINES: - - // Beginning of Electric EIR Chiller Module Driver Subroutine - //************************************************************************* // Functions void clear_state() { NumElectricEIRChillers = 0; // Number of electric EIR chillers specified in input - CondMassFlowRate = 0.0; // Condenser mass flow rate [kg/s] - EvapMassFlowRate = 0.0; // Evaporator mass flow rate [kg/s] - CondOutletTemp = 0.0; // Condenser outlet temperature [C] - CondOutletHumRat = 0.0; // Condenser outlet humidity ratio [kg/kg] - EvapOutletTemp = 0.0; // Evaporator outlet temperature [C] - EvapWaterConsumpRate = 0.0; // Evap condenser water consumption rate [m3/s] - Power = 0.0; // Rate of chiller electric energy use [W] - QEvaporator = 0.0; // Rate of heat transfer to the evaporator coil [W] - QCondenser = 0.0; // Rate of heat transfer to the condenser coil [W] - QHeatRecovered = 0.0; // Rate of heat transfer to the heat recovery coil [W] - HeatRecOutletTemp = 0.0; // Heat recovery outlet temperature [C] - CondenserFanPower = 0.0; // Condenser Fan Power (fan cycles with compressor) [W] - ChillerCapFT = 0.0; // Chiller capacity fraction (evaluated as a function of temperature) - ChillerEIRFT = 0.0; // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature - ChillerEIRFPLR = 0.0; // Chiller EIR as a function of part-load ratio (PLR) - ChillerPartLoadRatio = 0.0; // Chiller part-load ratio (PLR) - ChillerCyclingRatio = 0.0; // Chiller cycling ratio - BasinHeaterPower = 0.0; // Basin heater power (W) - ChillerFalseLoadRate = 0.0; // Chiller false load over and above the water-side load [W] - AvgCondSinkTemp = 0.0; // condenser temperature value for use in curves [C] - CheckEquipName.deallocate(); - GetInputEIR = true; - ChillerIPLVOneTimeFlag = true; - getInputAllocatedFlag = false; - InitMyOneTimeFlag = true; - ChillerIPLVFlagArr.deallocate(); + getInputFlag = true; ElectricEIRChiller.deallocate(); - ElectricEIRChillerReport.deallocate(); } - void SimElectricEIRChiller(std::string const &EP_UNUSED(EIRChillerType), // Type of chiller - std::string const &EIRChillerName, // User specified name of chiller - int const EquipFlowCtrl, // Flow control mode for the equipment - int &CompIndex, // Chiller number pointer - int const LoopNum, // plant loop index pointer - bool const RunFlag, // Simulate chiller when TRUE - bool const FirstIteration, // Initialize variables when TRUE - bool &InitLoopEquip, // If not zero, calculate the max load for operating conditions - Real64 &MyLoad, // Loop demand component will meet - Real64 &MaxCap, // Maximum operating capacity of chiller [W] - Real64 &MinCap, // Minimum operating capacity of chiller [W] - Real64 &OptCap, // Optimal operating capacity of chiller [W] - bool const GetSizingFactor, // TRUE when just the sizing factor is requested - Real64 &SizingFactor, // sizing factor - Real64 &TempCondInDesign, - Real64 &TempEvapOutDesign) + PlantComponent *ElectricEIRChillerSpecs::factory(std::string const &objectName) + { + // Process the input data if it hasn't been done already + if (getInputFlag) { + GetElectricEIRChillerInput(); + getInputFlag = false; + } + // Now look for this particular object in the list + for (auto &obj : ElectricEIRChiller) { + if (obj.Name == objectName) { + return &obj; + } + } + // If we didn't find it, fatal + ShowFatalError("LocalElectEIRChillerFactory: Error getting inputs for object named: " + objectName); // LCOV_EXCL_LINE + // Shut up the compiler + return nullptr; // LCOV_EXCL_LINE + } + + void ElectricEIRChillerSpecs::simulate(const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) { // SUBROUTINE INFORMATION: // AUTHOR Richard Raustad @@ -244,99 +174,73 @@ namespace ChillerElectricEIR { // model, initializes simulation variables, calls the appropriate model and sets // up reporting variables. - // Using/Aliasing - using DataPlant::TypeOf_Chiller_ElectricEIR; - using PlantUtilities::UpdateChillerComponentCondenserSide; - using PlantUtilities::UpdateComponentHeatRecoverySide; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int EIRChillNum; // Chiller number pointer - int LoopSide; - - if (GetInputEIR) { - GetElectricEIRChillerInput(); - GetInputEIR = false; + if (calledFromLocation.loopNum == this->CWLoopNum) { + this->initialize(RunFlag, CurLoad); + this->calculate(CurLoad, RunFlag); + this->update(CurLoad, RunFlag); + + } else if (calledFromLocation.loopNum == this->CDLoopNum) { + PlantUtilities::UpdateChillerComponentCondenserSide(calledFromLocation.loopNum, + this->CDLoopSideNum, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->CondInletNodeNum, + this->CondOutletNodeNum, + this->QCondenser, + this->CondInletTemp, + this->CondOutletTemp, + this->CondMassFlowRate, + FirstHVACIteration); + + } else if (calledFromLocation.loopNum == this->HRLoopNum) { + PlantUtilities::UpdateComponentHeatRecoverySide(this->HRLoopNum, + this->HRLoopSideNum, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->HeatRecInletNodeNum, + this->HeatRecOutletNodeNum, + this->QHeatRecovered, + this->HeatRecInletTemp, + this->HeatRecOutletTemp, + this->HeatRecMassFlow, + FirstHVACIteration); } + } - // Find the correct Chiller - if (CompIndex == 0) { - EIRChillNum = UtilityRoutines::FindItemInList(EIRChillerName, ElectricEIRChiller); - if (EIRChillNum == 0) { - ShowFatalError("SimElectricEIRChiller: Specified Chiller not one of Valid EIR Electric Chillers=" + EIRChillerName); - } - CompIndex = EIRChillNum; + void ElectricEIRChillerSpecs::getDesignCapacities(const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) + { + if (calledFromLocation.loopNum == this->CWLoopNum) { + MinLoad = this->RefCap * this->MinPartLoadRat; + MaxLoad = this->RefCap * this->MaxPartLoadRat; + OptLoad = this->RefCap * this->OptPartLoadRat; } else { - EIRChillNum = CompIndex; - if (EIRChillNum > NumElectricEIRChillers || EIRChillNum < 1) { - ShowFatalError("SimElectricEIRChiller: Invalid CompIndex passed=" + TrimSigDigits(EIRChillNum) + - ", Number of Units=" + TrimSigDigits(NumElectricEIRChillers) + ", Entered Unit name=" + EIRChillerName); - } - if (CheckEquipName(EIRChillNum)) { - if (EIRChillerName != ElectricEIRChiller(EIRChillNum).Name) { - ShowFatalError("SimElectricEIRChiller: Invalid CompIndex passed=" + TrimSigDigits(EIRChillNum) + ", Unit name=" + EIRChillerName + - ", stored Unit Name for that index=" + ElectricEIRChiller(EIRChillNum).Name); - } - CheckEquipName(EIRChillNum) = false; - } + MinLoad = 0.0; + MaxLoad = 0.0; + OptLoad = 0.0; } + } - if (InitLoopEquip) { - TempEvapOutDesign = ElectricEIRChiller(EIRChillNum).TempRefEvapOut; - TempCondInDesign = ElectricEIRChiller(EIRChillNum).TempRefCondIn; + void ElectricEIRChillerSpecs::getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) + { + TempDesCondIn = this->TempRefCondIn; + TempDesEvapOut = this->TempRefEvapOut; + } - InitElectricEIRChiller(EIRChillNum, RunFlag, MyLoad); + void ElectricEIRChillerSpecs::getSizingFactor(Real64 &sizFac) + { + sizFac = this->SizFac; + } - if (LoopNum == ElectricEIRChiller(EIRChillNum).CWLoopNum) { - SizeElectricEIRChiller(EIRChillNum); - MinCap = ElectricEIRChiller(EIRChillNum).RefCap * ElectricEIRChiller(EIRChillNum).MinPartLoadRat; - MaxCap = ElectricEIRChiller(EIRChillNum).RefCap * ElectricEIRChiller(EIRChillNum).MaxPartLoadRat; - OptCap = ElectricEIRChiller(EIRChillNum).RefCap * ElectricEIRChiller(EIRChillNum).OptPartLoadRat; - } else { - MinCap = 0.0; - MaxCap = 0.0; - OptCap = 0.0; - } - if (GetSizingFactor) { - SizingFactor = ElectricEIRChiller(EIRChillNum).SizFac; - } - return; - } + void ElectricEIRChillerSpecs::onInitLoopEquip(const PlantLocation &calledFromLocation) + { + bool runFlag = true; + Real64 myLoad = 0.0; + + this->initialize(runFlag, myLoad); - if (LoopNum == ElectricEIRChiller(EIRChillNum).CWLoopNum) { - InitElectricEIRChiller(EIRChillNum, RunFlag, MyLoad); - CalcElectricEIRChillerModel(EIRChillNum, MyLoad, RunFlag, FirstIteration, EquipFlowCtrl); - UpdateElectricEIRChillerRecords(MyLoad, RunFlag, EIRChillNum); - - } else if (LoopNum == ElectricEIRChiller(EIRChillNum).CDLoopNum) { - LoopSide = ElectricEIRChiller(EIRChillNum).CDLoopSideNum; - UpdateChillerComponentCondenserSide(LoopNum, - LoopSide, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).CondInletNodeNum, - ElectricEIRChiller(EIRChillNum).CondOutletNodeNum, - ElectricEIRChillerReport(EIRChillNum).QCond, - ElectricEIRChillerReport(EIRChillNum).CondInletTemp, - ElectricEIRChillerReport(EIRChillNum).CondOutletTemp, - ElectricEIRChillerReport(EIRChillNum).Condmdot, - FirstIteration); - - } else if (LoopNum == ElectricEIRChiller(EIRChillNum).HRLoopNum) { - UpdateComponentHeatRecoverySide(ElectricEIRChiller(EIRChillNum).HRLoopNum, - ElectricEIRChiller(EIRChillNum).HRLoopSideNum, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum, - ElectricEIRChiller(EIRChillNum).HeatRecOutletNodeNum, - ElectricEIRChillerReport(EIRChillNum).QHeatRecovery, - ElectricEIRChillerReport(EIRChillNum).HeatRecInletTemp, - ElectricEIRChillerReport(EIRChillNum).HeatRecOutletTemp, - ElectricEIRChillerReport(EIRChillNum).HeatRecMassFlow, - FirstIteration); + if (calledFromLocation.loopNum == this->CWLoopNum) { + this->size(); } } - // End Electric EIR Chiller Module Driver Subroutine - //****************************************************************************** - void GetElectricEIRChillerInput() { // SUBROUTINE INFORMATION: @@ -346,120 +250,101 @@ namespace ChillerElectricEIR { // PURPOSE OF THIS SUBROUTINE: // This routine will get the input required by the Electric EIR Chiller model. - // Using/Aliasing - using DataGlobals::MaxNameLength; - using namespace DataIPShortCuts; // Data for field names, blank numerics - using BranchNodeConnections::TestCompSet; - using CurveManager::CurveValue; - using CurveManager::GetCurveIndex; - using DataGlobals::AnyEnergyManagementSystemInModel; - using DataSizing::AutoSize; - using FluidProperties::FindGlycol; - using General::RoundSigDigits; - using General::TrimSigDigits; - using GlobalNames::VerifyUniqueChillerName; - using NodeInputManager::GetOnlySingleNode; - using OutAirNodeManager::CheckAndAddAirNodeNumber; - using PlantUtilities::RegisterPlantCompDesignFlow; - using ScheduleManager::GetScheduleIndex; - - // Locals - // PARAMETERS static std::string const RoutineName("GetElectricEIRChillerInput: "); // include trailing blank space - // LOCAL VARIABLES - int EIRChillerNum; // Chiller counter - int NumAlphas; // Number of elements in the alpha array - int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine - static bool ErrorsFound(false); // True when input errors are found - Real64 CurveVal; // Used to verify EIR-FT and CAP-FT curves equal 1 at reference conditions - static bool FoundNegValue(false); // Used to evaluate PLFFPLR curve objects - static int CurveCheck(0); // Used to evaluate PLFFPLR curve objects - Array1D CurveValArray(11); // Used to evaluate PLFFPLR curve objects - Real64 CurveValTmp; // Used to evaluate PLFFPLR curve objects - std::string StringVar; // Used for EIRFPLR warning messages - int CurveValPtr; // Index to EIRFPLR curve output - - bool Okay; + bool ErrorsFound(false); // True when input errors are found // Formats static ObjexxFCL::gio::Fmt Format_530("('Curve Output = ',11(F7.2))"); - // FLOW - - if (getInputAllocatedFlag) return; - cCurrentModuleObject = "Chiller:Electric:EIR"; - NumElectricEIRChillers = inputProcessor->getNumObjectsFound(cCurrentModuleObject); + DataIPShortCuts::cCurrentModuleObject = "Chiller:Electric:EIR"; + NumElectricEIRChillers = inputProcessor->getNumObjectsFound(DataIPShortCuts::cCurrentModuleObject); if (NumElectricEIRChillers <= 0) { - ShowSevereError("No " + cCurrentModuleObject + " equipment specified in input file"); + ShowSevereError("No " + DataIPShortCuts::cCurrentModuleObject + " equipment specified in input file"); ErrorsFound = true; } // ALLOCATE ARRAYS ElectricEIRChiller.allocate(NumElectricEIRChillers); - ElectricEIRChillerReport.allocate(NumElectricEIRChillers); - CheckEquipName.dimension(NumElectricEIRChillers, true); - getInputAllocatedFlag = true; // Load arrays with electric EIR chiller data - for (EIRChillerNum = 1; EIRChillerNum <= NumElectricEIRChillers; ++EIRChillerNum) { - inputProcessor->getObjectItem(cCurrentModuleObject, + for (int EIRChillerNum = 1; EIRChillerNum <= NumElectricEIRChillers; ++EIRChillerNum) { + int NumAlphas; // Number of elements in the alpha array + int NumNums; // Number of elements in the numeric array + int IOStat; // IO Status when calling get input subroutine + inputProcessor->getObjectItem(DataIPShortCuts::cCurrentModuleObject, EIRChillerNum, - cAlphaArgs, + DataIPShortCuts::cAlphaArgs, NumAlphas, - rNumericArgs, + DataIPShortCuts::rNumericArgs, NumNums, IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); + DataIPShortCuts::lNumericFieldBlanks, + DataIPShortCuts::lAlphaFieldBlanks, + DataIPShortCuts::cAlphaFieldNames, + DataIPShortCuts::cNumericFieldNames); + UtilityRoutines::IsNameEmpty(DataIPShortCuts::cAlphaArgs(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueChillerName(cCurrentModuleObject, cAlphaArgs(1), ErrorsFound, cCurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueChillerName( + DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), ErrorsFound, DataIPShortCuts::cCurrentModuleObject + " Name"); - ElectricEIRChiller(EIRChillerNum).Name = cAlphaArgs(1); + ElectricEIRChiller(EIRChillerNum).Name = DataIPShortCuts::cAlphaArgs(1); // Performance curves - ElectricEIRChiller(EIRChillerNum).ChillerCapFT = GetCurveIndex(cAlphaArgs(2)); - if (ElectricEIRChiller(EIRChillerNum).ChillerCapFT == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + " \"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); + ElectricEIRChiller(EIRChillerNum).ChillerCapFTIndex = CurveManager::GetCurveIndex(DataIPShortCuts::cAlphaArgs(2)); + if (ElectricEIRChiller(EIRChillerNum).ChillerCapFTIndex == 0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + " \"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(2) + '=' + DataIPShortCuts::cAlphaArgs(2)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).ChillerEIRFT = GetCurveIndex(cAlphaArgs(3)); - if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFT == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(3) + '=' + cAlphaArgs(3)); + ElectricEIRChiller(EIRChillerNum).ChillerEIRFTIndex = CurveManager::GetCurveIndex(DataIPShortCuts::cAlphaArgs(3)); + if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFTIndex == 0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(3) + '=' + DataIPShortCuts::cAlphaArgs(3)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR = GetCurveIndex(cAlphaArgs(4)); - if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); + ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex = CurveManager::GetCurveIndex(DataIPShortCuts::cAlphaArgs(4)); + if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex == 0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(4) + '=' + DataIPShortCuts::cAlphaArgs(4)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).EvapInletNodeNum = GetOnlySingleNode( - cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - ElectricEIRChiller(EIRChillerNum).EvapOutletNodeNum = GetOnlySingleNode( - cAlphaArgs(6), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Outlet, 1, ObjectIsNotParent); - TestCompSet(cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(5), cAlphaArgs(6), "Chilled Water Nodes"); - - if (UtilityRoutines::SameString(cAlphaArgs(9), "WaterCooled")) { + ElectricEIRChiller(EIRChillerNum).EvapInletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(5), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Inlet, + 1, + DataLoopNode::ObjectIsNotParent); + ElectricEIRChiller(EIRChillerNum).EvapOutletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(6), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Outlet, + 1, + DataLoopNode::ObjectIsNotParent); + BranchNodeConnections::TestCompSet(DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataIPShortCuts::cAlphaArgs(5), + DataIPShortCuts::cAlphaArgs(6), + "Chilled Water Nodes"); + + if (UtilityRoutines::SameString(DataIPShortCuts::cAlphaArgs(9), "WaterCooled")) { ElectricEIRChiller(EIRChillerNum).CondenserType = WaterCooled; - } else if (UtilityRoutines::SameString(cAlphaArgs(9), "AirCooled")) { + } else if (UtilityRoutines::SameString(DataIPShortCuts::cAlphaArgs(9), "AirCooled")) { ElectricEIRChiller(EIRChillerNum).CondenserType = AirCooled; - } else if (UtilityRoutines::SameString(cAlphaArgs(9), "EvaporativelyCooled")) { + } else if (UtilityRoutines::SameString(DataIPShortCuts::cAlphaArgs(9), "EvaporativelyCooled")) { ElectricEIRChiller(EIRChillerNum).CondenserType = EvapCooled; } else { - ShowSevereError(RoutineName + cCurrentModuleObject + ": " + cAlphaArgs(1)); - ShowContinueError("Invalid " + cAlphaFieldNames(9) + '=' + cAlphaArgs(9)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + ": " + DataIPShortCuts::cAlphaArgs(1)); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(9) + '=' + DataIPShortCuts::cAlphaArgs(9)); ShowContinueError("Valid entries are AirCooled, WaterCooled, or EvaporativelyCooled"); ErrorsFound = true; } @@ -468,84 +353,112 @@ namespace ChillerElectricEIR { // Connection not required for air or evap cooled condenser // If the condenser inlet is blank for air cooled and evap cooled condensers then supply a generic name // since it is not used elsewhere for connection - if (lAlphaFieldBlanks(7)) { - if (len(cAlphaArgs(1)) < MaxNameLength - 25) { // protect against long name leading to > 100 chars - cAlphaArgs(7) = cAlphaArgs(1) + " INLET NODE FOR CONDENSER"; + if (DataIPShortCuts::lAlphaFieldBlanks(7)) { + if (len(DataIPShortCuts::cAlphaArgs(1)) < DataGlobals::MaxNameLength - 25) { // protect against long name leading to > 100 chars + DataIPShortCuts::cAlphaArgs(7) = DataIPShortCuts::cAlphaArgs(1) + " INLET NODE FOR CONDENSER"; } else { - cAlphaArgs(7) = cAlphaArgs(1).substr(0, 75) + " INLET NODE FOR CONDENSER"; + DataIPShortCuts::cAlphaArgs(7) = DataIPShortCuts::cAlphaArgs(1).substr(0, 75) + " INLET NODE FOR CONDENSER"; } } - if (lAlphaFieldBlanks(8)) { - if (len(cAlphaArgs(1)) < MaxNameLength - 26) { // protect against long name leading to > 100 chars - cAlphaArgs(8) = cAlphaArgs(1) + " OUTLET NODE FOR CONDENSER"; + if (DataIPShortCuts::lAlphaFieldBlanks(8)) { + if (len(DataIPShortCuts::cAlphaArgs(1)) < DataGlobals::MaxNameLength - 26) { // protect against long name leading to > 100 chars + DataIPShortCuts::cAlphaArgs(8) = DataIPShortCuts::cAlphaArgs(1) + " OUTLET NODE FOR CONDENSER"; } else { - cAlphaArgs(8) = cAlphaArgs(1).substr(0, 74) + " OUTLET NODE FOR CONDENSER"; + DataIPShortCuts::cAlphaArgs(8) = DataIPShortCuts::cAlphaArgs(1).substr(0, 74) + " OUTLET NODE FOR CONDENSER"; } } - ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = GetOnlySingleNode(cAlphaArgs(7), - ErrorsFound, - cCurrentModuleObject, - cAlphaArgs(1), - NodeType_Air, - NodeConnectionType_OutsideAirReference, - 2, - ObjectIsNotParent); - CheckAndAddAirNodeNumber(ElectricEIRChiller(EIRChillerNum).CondInletNodeNum, Okay); + ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = + NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(7), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Air, + DataLoopNode::NodeConnectionType_OutsideAirReference, + 2, + DataLoopNode::ObjectIsNotParent); + bool Okay; + OutAirNodeManager::CheckAndAddAirNodeNumber(ElectricEIRChiller(EIRChillerNum).CondInletNodeNum, Okay); if (!Okay) { - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Adding OutdoorAir:Node=" + cAlphaArgs(7)); + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Adding OutdoorAir:Node=" + DataIPShortCuts::cAlphaArgs(7)); } - ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = GetOnlySingleNode( - cAlphaArgs(8), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Outlet, 2, ObjectIsNotParent); + ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(8), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Air, + DataLoopNode::NodeConnectionType_Outlet, + 2, + DataLoopNode::ObjectIsNotParent); } else if (ElectricEIRChiller(EIRChillerNum).CondenserType == WaterCooled) { // Condenser inlet node name is necessary for water-cooled condenser - if (lAlphaFieldBlanks(7) || lAlphaFieldBlanks(8)) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + if (DataIPShortCuts::lAlphaFieldBlanks(7) || DataIPShortCuts::lAlphaFieldBlanks(8)) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError("Condenser Inlet or Outlet Node Name is blank."); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = GetOnlySingleNode( - cAlphaArgs(7), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - - ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = GetOnlySingleNode( - cAlphaArgs(8), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); - - TestCompSet(cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(7), cAlphaArgs(8), "Condenser Water Nodes"); + ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(7), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Inlet, + 2, + DataLoopNode::ObjectIsNotParent); + + ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(8), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Outlet, + 2, + DataLoopNode::ObjectIsNotParent); + + BranchNodeConnections::TestCompSet(DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataIPShortCuts::cAlphaArgs(7), + DataIPShortCuts::cAlphaArgs(8), + "Condenser Water Nodes"); } else { // Condenser inlet node name is necessary (never should reach this part of code) - if (lAlphaFieldBlanks(7) || lAlphaFieldBlanks(8)) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + if (DataIPShortCuts::lAlphaFieldBlanks(7) || DataIPShortCuts::lAlphaFieldBlanks(8)) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError("Condenser Inlet or Outlet Node Name is blank."); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = GetOnlySingleNode(cAlphaArgs(7), - ErrorsFound, - cCurrentModuleObject, - cAlphaArgs(1), - NodeType_Unknown, - NodeConnectionType_Inlet, - 2, - ObjectIsNotParent); - - ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = GetOnlySingleNode(cAlphaArgs(8), - ErrorsFound, - cCurrentModuleObject, - cAlphaArgs(1), - NodeType_Unknown, - NodeConnectionType_Outlet, - 2, - ObjectIsNotParent); - - TestCompSet(cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(7), cAlphaArgs(8), "Condenser (unknown?) Nodes"); + ElectricEIRChiller(EIRChillerNum).CondInletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(7), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Unknown, + DataLoopNode::NodeConnectionType_Inlet, + 2, + DataLoopNode::ObjectIsNotParent); + + ElectricEIRChiller(EIRChillerNum).CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(8), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Unknown, + DataLoopNode::NodeConnectionType_Outlet, + 2, + DataLoopNode::ObjectIsNotParent); + + BranchNodeConnections::TestCompSet(DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataIPShortCuts::cAlphaArgs(7), + DataIPShortCuts::cAlphaArgs(8), + "Condenser (unknown?) Nodes"); } { - auto const SELECT_CASE_var(cAlphaArgs(10)); + auto const SELECT_CASE_var(DataIPShortCuts::cAlphaArgs(10)); if (SELECT_CASE_var == "CONSTANTFLOW") { ElectricEIRChiller(EIRChillerNum).FlowMode = ConstantFlow; } else if (SELECT_CASE_var == "LEAVINGSETPOINTMODULATED") { @@ -553,8 +466,8 @@ namespace ChillerElectricEIR { } else if (SELECT_CASE_var == "NOTMODULATED") { ElectricEIRChiller(EIRChillerNum).FlowMode = NotModulated; } else { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); - ShowContinueError("Invalid " + cAlphaFieldNames(10) + '=' + cAlphaArgs(10)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\","); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(10) + '=' + DataIPShortCuts::cAlphaArgs(10)); ShowContinueError("Available choices are ConstantFlow, NotModulated, or LeavingSetpointModulated"); ShowContinueError("Flow mode NotModulated is assumed and the simulation continues."); ElectricEIRChiller(EIRChillerNum).FlowMode = NotModulated; @@ -562,122 +475,139 @@ namespace ChillerElectricEIR { } // Chiller rated performance data - ElectricEIRChiller(EIRChillerNum).RefCap = rNumericArgs(1); - if (ElectricEIRChiller(EIRChillerNum).RefCap == AutoSize) { + ElectricEIRChiller(EIRChillerNum).RefCap = DataIPShortCuts::rNumericArgs(1); + if (ElectricEIRChiller(EIRChillerNum).RefCap == DataSizing::AutoSize) { ElectricEIRChiller(EIRChillerNum).RefCapWasAutoSized = true; } - if (rNumericArgs(1) == 0.0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cNumericFieldNames(1) + '=' + RoundSigDigits(rNumericArgs(1), 2)); + if (DataIPShortCuts::rNumericArgs(1) == 0.0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cNumericFieldNames(1) + '=' + + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(1), 2)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).RefCOP = rNumericArgs(2); - if (rNumericArgs(2) == 0.0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cNumericFieldNames(2) + '=' + RoundSigDigits(rNumericArgs(2), 2)); + ElectricEIRChiller(EIRChillerNum).RefCOP = DataIPShortCuts::rNumericArgs(2); + if (DataIPShortCuts::rNumericArgs(2) == 0.0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cNumericFieldNames(2) + '=' + + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(2), 2)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).TempRefEvapOut = rNumericArgs(3); - ElectricEIRChiller(EIRChillerNum).TempRefCondIn = rNumericArgs(4); - ElectricEIRChiller(EIRChillerNum).EvapVolFlowRate = rNumericArgs(5); - if (ElectricEIRChiller(EIRChillerNum).EvapVolFlowRate == AutoSize) { + ElectricEIRChiller(EIRChillerNum).TempRefEvapOut = DataIPShortCuts::rNumericArgs(3); + ElectricEIRChiller(EIRChillerNum).TempRefCondIn = DataIPShortCuts::rNumericArgs(4); + ElectricEIRChiller(EIRChillerNum).EvapVolFlowRate = DataIPShortCuts::rNumericArgs(5); + if (ElectricEIRChiller(EIRChillerNum).EvapVolFlowRate == DataSizing::AutoSize) { ElectricEIRChiller(EIRChillerNum).EvapVolFlowRateWasAutoSized = true; } - ElectricEIRChiller(EIRChillerNum).CondVolFlowRate = rNumericArgs(6); - if (ElectricEIRChiller(EIRChillerNum).CondVolFlowRate == AutoSize) { + ElectricEIRChiller(EIRChillerNum).CondVolFlowRate = DataIPShortCuts::rNumericArgs(6); + if (ElectricEIRChiller(EIRChillerNum).CondVolFlowRate == DataSizing::AutoSize) { ElectricEIRChiller(EIRChillerNum).CondVolFlowRateWasAutoSized = true; } - ElectricEIRChiller(EIRChillerNum).MinPartLoadRat = rNumericArgs(7); - ElectricEIRChiller(EIRChillerNum).MaxPartLoadRat = rNumericArgs(8); - ElectricEIRChiller(EIRChillerNum).OptPartLoadRat = rNumericArgs(9); - ElectricEIRChiller(EIRChillerNum).MinUnloadRat = rNumericArgs(10); - ElectricEIRChiller(EIRChillerNum).SizFac = rNumericArgs(15); + ElectricEIRChiller(EIRChillerNum).MinPartLoadRat = DataIPShortCuts::rNumericArgs(7); + ElectricEIRChiller(EIRChillerNum).MaxPartLoadRat = DataIPShortCuts::rNumericArgs(8); + ElectricEIRChiller(EIRChillerNum).OptPartLoadRat = DataIPShortCuts::rNumericArgs(9); + ElectricEIRChiller(EIRChillerNum).MinUnloadRat = DataIPShortCuts::rNumericArgs(10); + ElectricEIRChiller(EIRChillerNum).SizFac = DataIPShortCuts::rNumericArgs(15); if (ElectricEIRChiller(EIRChillerNum).SizFac <= 0.0) ElectricEIRChiller(EIRChillerNum).SizFac = 1.0; if (ElectricEIRChiller(EIRChillerNum).MinPartLoadRat > ElectricEIRChiller(EIRChillerNum).MaxPartLoadRat) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(7) + " [" + RoundSigDigits(rNumericArgs(7), 3) + "] > " + cNumericFieldNames(8) + " [" + - RoundSigDigits(rNumericArgs(8), 3) + ']'); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(7) + " [" + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(7), 3) + + "] > " + DataIPShortCuts::cNumericFieldNames(8) + " [" + + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(8), 3) + ']'); ShowContinueError("Minimum part load ratio must be less than or equal to the maximum part load ratio "); ErrorsFound = true; } if (ElectricEIRChiller(EIRChillerNum).MinUnloadRat < ElectricEIRChiller(EIRChillerNum).MinPartLoadRat || ElectricEIRChiller(EIRChillerNum).MinUnloadRat > ElectricEIRChiller(EIRChillerNum).MaxPartLoadRat) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(10) + " = " + RoundSigDigits(rNumericArgs(10), 3)); - ShowContinueError(cNumericFieldNames(10) + " must be greater than or equal to the " + cNumericFieldNames(7)); - ShowContinueError(cNumericFieldNames(10) + " must be less than or equal to the " + cNumericFieldNames(8)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(10) + " = " + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(10), 3)); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(10) + " must be greater than or equal to the " + + DataIPShortCuts::cNumericFieldNames(7)); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(10) + " must be less than or equal to the " + + DataIPShortCuts::cNumericFieldNames(8)); ErrorsFound = true; } if (ElectricEIRChiller(EIRChillerNum).OptPartLoadRat < ElectricEIRChiller(EIRChillerNum).MinPartLoadRat || ElectricEIRChiller(EIRChillerNum).OptPartLoadRat > ElectricEIRChiller(EIRChillerNum).MaxPartLoadRat) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(9) + " = " + RoundSigDigits(rNumericArgs(9), 3)); - ShowContinueError(cNumericFieldNames(9) + " must be greater than or equal to the " + cNumericFieldNames(7)); - ShowContinueError(cNumericFieldNames(9) + " must be less than or equal to the " + cNumericFieldNames(8)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(9) + " = " + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(9), 3)); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(9) + " must be greater than or equal to the " + + DataIPShortCuts::cNumericFieldNames(7)); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(9) + " must be less than or equal to the " + + DataIPShortCuts::cNumericFieldNames(8)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).CondenserFanPowerRatio = rNumericArgs(11); - ElectricEIRChiller(EIRChillerNum).CompPowerToCondenserFrac = rNumericArgs(12); + ElectricEIRChiller(EIRChillerNum).CondenserFanPowerRatio = DataIPShortCuts::rNumericArgs(11); + ElectricEIRChiller(EIRChillerNum).CompPowerToCondenserFrac = DataIPShortCuts::rNumericArgs(12); if (ElectricEIRChiller(EIRChillerNum).CompPowerToCondenserFrac < 0.0 || ElectricEIRChiller(EIRChillerNum).CompPowerToCondenserFrac > 1.0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(12) + " = " + RoundSigDigits(rNumericArgs(12), 3)); - ShowContinueError(cNumericFieldNames(12) + " must be greater than or equal to zero"); - ShowContinueError(cNumericFieldNames(12) + " must be less than or equal to one"); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(12) + " = " + General::RoundSigDigits(DataIPShortCuts::rNumericArgs(12), 3)); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(12) + " must be greater than or equal to zero"); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(12) + " must be less than or equal to one"); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).TempLowLimitEvapOut = rNumericArgs(13); + ElectricEIRChiller(EIRChillerNum).TempLowLimitEvapOut = DataIPShortCuts::rNumericArgs(13); // These are the heat recovery inputs - ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate = rNumericArgs(14); - if (ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate == AutoSize) { + ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate = DataIPShortCuts::rNumericArgs(14); + if (ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate == DataSizing::AutoSize) { ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRateWasAutoSized = true; } if ((ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate > 0.0) || - (ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate == AutoSize)) { + (ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate == DataSizing::AutoSize)) { ElectricEIRChiller(EIRChillerNum).HeatRecActive = true; - ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum = GetOnlySingleNode( - cAlphaArgs(11), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Inlet, 3, ObjectIsNotParent); + ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(11), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Inlet, + 3, + DataLoopNode::ObjectIsNotParent); if (ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(11) + '=' + cAlphaArgs(11)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(11) + '=' + DataIPShortCuts::cAlphaArgs(11)); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).HeatRecOutletNodeNum = GetOnlySingleNode(cAlphaArgs(12), - ErrorsFound, - cCurrentModuleObject, - cAlphaArgs(1), - NodeType_Water, - NodeConnectionType_Outlet, - 3, - ObjectIsNotParent); + ElectricEIRChiller(EIRChillerNum).HeatRecOutletNodeNum = NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(12), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Outlet, + 3, + DataLoopNode::ObjectIsNotParent); if (ElectricEIRChiller(EIRChillerNum).HeatRecOutletNodeNum == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(12) + '=' + cAlphaArgs(12)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(12) + '=' + DataIPShortCuts::cAlphaArgs(12)); ErrorsFound = true; } if (ElectricEIRChiller(EIRChillerNum).CondenserType != WaterCooled) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError("Heat Recovery requires a Water Cooled Condenser."); ErrorsFound = true; } - TestCompSet(cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(11), cAlphaArgs(12), "Heat Recovery Nodes"); + BranchNodeConnections::TestCompSet(DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataIPShortCuts::cAlphaArgs(11), + DataIPShortCuts::cAlphaArgs(12), + "Heat Recovery Nodes"); // store heat recovery volume flow for plant sizing if (ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate > 0.0) { - RegisterPlantCompDesignFlow(ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum, - ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate); // CR 6953 + PlantUtilities::RegisterPlantCompDesignFlow(ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum, + ElectricEIRChiller(EIRChillerNum).DesignHeatRecVolFlowRate); // CR 6953 } if (NumNums > 17) { - if (!lNumericFieldBlanks(18)) { - ElectricEIRChiller(EIRChillerNum).HeatRecCapacityFraction = rNumericArgs(18); + if (!DataIPShortCuts::lNumericFieldBlanks(18)) { + ElectricEIRChiller(EIRChillerNum).HeatRecCapacityFraction = DataIPShortCuts::rNumericArgs(18); } else { ElectricEIRChiller(EIRChillerNum).HeatRecCapacityFraction = 1.0; } @@ -686,11 +616,12 @@ namespace ChillerElectricEIR { } if (NumAlphas > 13) { - if (!lAlphaFieldBlanks(14)) { - ElectricEIRChiller(EIRChillerNum).HeatRecInletLimitSchedNum = GetScheduleIndex(cAlphaArgs(14)); + if (!DataIPShortCuts::lAlphaFieldBlanks(14)) { + ElectricEIRChiller(EIRChillerNum).HeatRecInletLimitSchedNum = + ScheduleManager::GetScheduleIndex(DataIPShortCuts::cAlphaArgs(14)); if (ElectricEIRChiller(EIRChillerNum).HeatRecInletLimitSchedNum == 0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError("Invalid " + cAlphaFieldNames(14) + '=' + cAlphaArgs(14)); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError("Invalid " + DataIPShortCuts::cAlphaFieldNames(14) + '=' + DataIPShortCuts::cAlphaArgs(14)); ErrorsFound = true; } } else { @@ -701,15 +632,16 @@ namespace ChillerElectricEIR { } if (NumAlphas > 14) { - if (!lAlphaFieldBlanks(15)) { - ElectricEIRChiller(EIRChillerNum).HeatRecSetPointNodeNum = GetOnlySingleNode(cAlphaArgs(15), - ErrorsFound, - cCurrentModuleObject, - cAlphaArgs(1), - NodeType_Water, - NodeConnectionType_Sensor, - 1, - ObjectIsNotParent); + if (!DataIPShortCuts::lAlphaFieldBlanks(15)) { + ElectricEIRChiller(EIRChillerNum).HeatRecSetPointNodeNum = + NodeInputManager::GetOnlySingleNode(DataIPShortCuts::cAlphaArgs(15), + ErrorsFound, + DataIPShortCuts::cCurrentModuleObject, + DataIPShortCuts::cAlphaArgs(1), + DataLoopNode::NodeType_Water, + DataLoopNode::NodeConnectionType_Sensor, + 1, + DataLoopNode::ObjectIsNotParent); } else { ElectricEIRChiller(EIRChillerNum).HeatRecSetPointNodeNum = 0; } @@ -722,65 +654,67 @@ namespace ChillerElectricEIR { ElectricEIRChiller(EIRChillerNum).DesignHeatRecMassFlowRate = 0.0; ElectricEIRChiller(EIRChillerNum).HeatRecInletNodeNum = 0; ElectricEIRChiller(EIRChillerNum).HeatRecOutletNodeNum = 0; - if (!lAlphaFieldBlanks(11) || !lAlphaFieldBlanks(12)) { - // IF (cAlphaArgs(11) /= ' ' .or. cAlphaArgs(12) /= ' ') THEN - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + if (!DataIPShortCuts::lAlphaFieldBlanks(11) || !DataIPShortCuts::lAlphaFieldBlanks(12)) { + // IF (DataIPShortCuts::cAlphaArgs(11) /= ' ' .or. DataIPShortCuts::cAlphaArgs(12) /= ' ') THEN + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError("Since Reference Heat Reclaim Volume Flow Rate = 0.0, heat recovery is inactive."); ShowContinueError("However, node names were specified for heat recovery inlet or outlet nodes."); } } // Check the CAP-FT, EIR-FT, and PLR curves and warn user if different from 1.0 by more than +-10% - if (ElectricEIRChiller(EIRChillerNum).ChillerCapFT > 0) { - CurveVal = CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerCapFT, - ElectricEIRChiller(EIRChillerNum).TempRefEvapOut, - ElectricEIRChiller(EIRChillerNum).TempRefCondIn); + if (ElectricEIRChiller(EIRChillerNum).ChillerCapFTIndex > 0) { + Real64 CurveVal = CurveManager::CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerCapFTIndex, + ElectricEIRChiller(EIRChillerNum).TempRefEvapOut, + ElectricEIRChiller(EIRChillerNum).TempRefCondIn); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError( "Capacity ratio as a function of temperature curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); - ShowContinueError("Curve output at reference conditions = " + TrimSigDigits(CurveVal, 3)); + ShowContinueError("Curve output at reference conditions = " + General::TrimSigDigits(CurveVal, 3)); } } - if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFT > 0) { - CurveVal = CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFT, - ElectricEIRChiller(EIRChillerNum).TempRefEvapOut, - ElectricEIRChiller(EIRChillerNum).TempRefCondIn); + if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFTIndex > 0) { + Real64 CurveVal = CurveManager::CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFTIndex, + ElectricEIRChiller(EIRChillerNum).TempRefEvapOut, + ElectricEIRChiller(EIRChillerNum).TempRefCondIn); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError( "Energy input ratio as a function of temperature curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); - ShowContinueError("Curve output at reference conditions = " + TrimSigDigits(CurveVal, 3)); + ShowContinueError("Curve output at reference conditions = " + General::TrimSigDigits(CurveVal, 3)); } } - if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR > 0) { - CurveVal = CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR, 1.0); + if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex > 0) { + Real64 CurveVal = CurveManager::CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError( "Energy input ratio as a function of part-load ratio curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); - ShowContinueError("Curve output at reference conditions = " + TrimSigDigits(CurveVal, 3)); + ShowContinueError("Curve output at reference conditions = " + General::TrimSigDigits(CurveVal, 3)); } } - if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR > 0) { - FoundNegValue = false; - for (CurveCheck = 0; CurveCheck <= 10; ++CurveCheck) { - CurveValTmp = CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLR, double(CurveCheck / 10.0)); + if (ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex > 0) { + bool FoundNegValue = false; + Array1D CurveValArray(11); // Used to evaluate PLFFPLR curve objects + for (int CurveCheck = 0; CurveCheck <= 10; ++CurveCheck) { + Real64 CurveValTmp = CurveManager::CurveValue(ElectricEIRChiller(EIRChillerNum).ChillerEIRFPLRIndex, double(CurveCheck / 10.0)); if (CurveValTmp < 0.0) FoundNegValue = true; CurveValArray(CurveCheck + 1) = int(CurveValTmp * 100.0) / 100.0; } + std::string StringVar; // Used for EIRFPLR warning messages if (FoundNegValue) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); ShowContinueError("Energy input ratio as a function of part-load ratio curve shows negative values."); ShowContinueError("EIR as a function of PLR curve output at various part-load ratios shown below:"); ShowContinueError("PLR = 0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00"); ObjexxFCL::gio::write(StringVar, "'Curve Output = '"); static ObjexxFCL::gio::Fmt fmtF72("((F7.2),$)"); - for (CurveValPtr = 1; CurveValPtr <= 11; ++CurveValPtr) { + for (int CurveValPtr = 1; CurveValPtr <= 11; ++CurveValPtr) { ObjexxFCL::gio::write(StringVar, fmtF72) << CurveValArray(CurveValPtr); } ObjexxFCL::gio::write(StringVar); @@ -789,314 +723,231 @@ namespace ChillerElectricEIR { } } // Basin heater power as a function of temperature must be greater than or equal to 0 - ElectricEIRChiller(EIRChillerNum).BasinHeaterPowerFTempDiff = rNumericArgs(16); - if (rNumericArgs(16) < 0.0) { - ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(16) + " must be >= 0"); + ElectricEIRChiller(EIRChillerNum).BasinHeaterPowerFTempDiff = DataIPShortCuts::rNumericArgs(16); + if (DataIPShortCuts::rNumericArgs(16) < 0.0) { + ShowSevereError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(16) + " must be >= 0"); ErrorsFound = true; } - ElectricEIRChiller(EIRChillerNum).BasinHeaterSetPointTemp = rNumericArgs(17); + ElectricEIRChiller(EIRChillerNum).BasinHeaterSetPointTemp = DataIPShortCuts::rNumericArgs(17); if (ElectricEIRChiller(EIRChillerNum).BasinHeaterPowerFTempDiff > 0.0) { if (NumNums < 17) { ElectricEIRChiller(EIRChillerNum).BasinHeaterSetPointTemp = 2.0; } if (ElectricEIRChiller(EIRChillerNum).BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(RoutineName + cCurrentModuleObject + " \"" + cAlphaArgs(1) + "\""); - ShowContinueError(cNumericFieldNames(17) + " is less than 2 deg C. Freezing could occur."); + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + " \"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowContinueError(DataIPShortCuts::cNumericFieldNames(17) + " is less than 2 deg C. Freezing could occur."); } } - if (!lAlphaFieldBlanks(13)) { - ElectricEIRChiller(EIRChillerNum).BasinHeaterSchedulePtr = GetScheduleIndex(cAlphaArgs(13)); + if (!DataIPShortCuts::lAlphaFieldBlanks(13)) { + ElectricEIRChiller(EIRChillerNum).BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(DataIPShortCuts::cAlphaArgs(13)); if (ElectricEIRChiller(EIRChillerNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\""); - ShowWarningError(cAlphaFieldNames(13) + " \"" + cAlphaArgs(13) + + ShowWarningError(RoutineName + DataIPShortCuts::cCurrentModuleObject + "=\"" + DataIPShortCuts::cAlphaArgs(1) + "\""); + ShowWarningError(DataIPShortCuts::cAlphaFieldNames(13) + " \"" + DataIPShortCuts::cAlphaArgs(13) + "\" was not found. Basin heater operation will not be modeled and the simulation continues"); } } if (NumAlphas > 15) { - ElectricEIRChiller(EIRChillerNum).EndUseSubcategory = cAlphaArgs(16); + ElectricEIRChiller(EIRChillerNum).EndUseSubcategory = DataIPShortCuts::cAlphaArgs(16); } else { ElectricEIRChiller(EIRChillerNum).EndUseSubcategory = "General"; } } if (ErrorsFound) { - ShowFatalError("Errors found in processing input for " + cCurrentModuleObject); + ShowFatalError("Errors found in processing input for " + DataIPShortCuts::cCurrentModuleObject); } + } - for (EIRChillerNum = 1; EIRChillerNum <= NumElectricEIRChillers; ++EIRChillerNum) { - SetupOutputVariable("Chiller Part Load Ratio", - OutputProcessor::Unit::None, - ElectricEIRChillerReport(EIRChillerNum).ChillerPartLoadRatio, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Cycling Ratio", - OutputProcessor::Unit::None, - ElectricEIRChillerReport(EIRChillerNum).ChillerCyclingRatio, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Electric Power", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).Power, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Electric Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).Energy, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "ELECTRICITY", - "Cooling", - ElectricEIRChiller(EIRChillerNum).EndUseSubcategory, - "Plant"); - - SetupOutputVariable("Chiller Evaporator Cooling Rate", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).QEvap, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Evaporator Cooling Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).EvapEnergy, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "ENERGYTRANSFER", - "CHILLERS", - _, - "Plant"); - SetupOutputVariable("Chiller False Load Heat Transfer Rate", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).ChillerFalseLoadRate, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller False Load Heat Transfer Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).ChillerFalseLoad, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Evaporator Inlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).EvapInletTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Evaporator Outlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).EvapOutletTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Evaporator Mass Flow Rate", - OutputProcessor::Unit::kg_s, - ElectricEIRChillerReport(EIRChillerNum).Evapmdot, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - - SetupOutputVariable("Chiller Condenser Heat Transfer Rate", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).QCond, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Condenser Heat Transfer Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).CondEnergy, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "ENERGYTRANSFER", - "HEATREJECTION", - _, - "Plant"); - SetupOutputVariable("Chiller COP", - OutputProcessor::Unit::W_W, - ElectricEIRChillerReport(EIRChillerNum).ActualCOP, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - - SetupOutputVariable("Chiller Capacity Temperature Modifier Multiplier", - OutputProcessor::Unit::None, - ElectricEIRChillerReport(EIRChillerNum).ChillerCapFT, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller EIR Temperature Modifier Multiplier", - OutputProcessor::Unit::None, - ElectricEIRChillerReport(EIRChillerNum).ChillerEIRFT, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller EIR Part Load Modifier Multiplier", - OutputProcessor::Unit::None, - ElectricEIRChillerReport(EIRChillerNum).ChillerEIRFPLR, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - - // Condenser mass flow and outlet temp are valid for water cooled - if (ElectricEIRChiller(EIRChillerNum).CondenserType == WaterCooled) { - SetupOutputVariable("Chiller Condenser Inlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).CondInletTemp, + void ElectricEIRChillerSpecs::setupOutputVars() + { + SetupOutputVariable("Chiller Part Load Ratio", OutputProcessor::Unit::None, this->ChillerPartLoadRatio, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Cycling Ratio", OutputProcessor::Unit::None, this->ChillerCyclingRatio, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Electric Power", OutputProcessor::Unit::W, this->Power, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Electric Energy", + OutputProcessor::Unit::J, + this->Energy, + "System", + "Sum", + this->Name, + _, + "ELECTRICITY", + "Cooling", + this->EndUseSubcategory, + "Plant"); + + SetupOutputVariable("Chiller Evaporator Cooling Rate", OutputProcessor::Unit::W, this->QEvaporator, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Evaporator Cooling Energy", + OutputProcessor::Unit::J, + this->EvapEnergy, + "System", + "Sum", + this->Name, + _, + "ENERGYTRANSFER", + "CHILLERS", + _, + "Plant"); + + SetupOutputVariable( + "Chiller False Load Heat Transfer Rate", OutputProcessor::Unit::W, this->ChillerFalseLoadRate, "System", "Average", this->Name); + + SetupOutputVariable("Chiller False Load Heat Transfer Energy", OutputProcessor::Unit::J, this->ChillerFalseLoad, "System", "Sum", this->Name); + + SetupOutputVariable("Chiller Evaporator Inlet Temperature", OutputProcessor::Unit::C, this->EvapInletTemp, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Evaporator Outlet Temperature", OutputProcessor::Unit::C, this->EvapOutletTemp, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Evaporator Mass Flow Rate", OutputProcessor::Unit::kg_s, this->EvapMassFlowRate, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Condenser Heat Transfer Rate", OutputProcessor::Unit::W, this->QCondenser, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Condenser Heat Transfer Energy", + OutputProcessor::Unit::J, + this->CondEnergy, + "System", + "Sum", + this->Name, + _, + "ENERGYTRANSFER", + "HEATREJECTION", + _, + "Plant"); + + SetupOutputVariable("Chiller COP", OutputProcessor::Unit::W_W, this->ActualCOP, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Capacity Temperature Modifier Multiplier", OutputProcessor::Unit::None, this->ChillerCapFT, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller EIR Temperature Modifier Multiplier", OutputProcessor::Unit::None, this->ChillerEIRFT, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller EIR Part Load Modifier Multiplier", OutputProcessor::Unit::None, this->ChillerEIRFPLR, "System", "Average", this->Name); + + // Condenser mass flow and outlet temp are valid for water cooled + if (this->CondenserType == WaterCooled) { + SetupOutputVariable( + "Chiller Condenser Inlet Temperature", OutputProcessor::Unit::C, this->CondInletTemp, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Condenser Outlet Temperature", OutputProcessor::Unit::C, this->CondOutletTemp, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Condenser Mass Flow Rate", OutputProcessor::Unit::kg_s, this->CondMassFlowRate, "System", "Average", this->Name); + + // If heat recovery is active then setup report variables + if (this->HeatRecActive) { + SetupOutputVariable( + "Chiller Total Recovered Heat Rate", OutputProcessor::Unit::W, this->QHeatRecovered, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Total Recovered Heat Energy", + OutputProcessor::Unit::J, + this->EnergyHeatRecovery, "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Condenser Outlet Temperature", + "Sum", + this->Name, + _, + "ENERGYTRANSFER", + "HEATRECOVERY", + _, + "Plant"); + + SetupOutputVariable( + "Chiller Heat Recovery Inlet Temperature", OutputProcessor::Unit::C, this->HeatRecInletTemp, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Heat Recovery Outlet Temperature", OutputProcessor::Unit::C, this->HeatRecOutletTemp, "System", "Average", this->Name); + + SetupOutputVariable( + "Chiller Heat Recovery Mass Flow Rate", OutputProcessor::Unit::kg_s, this->HeatRecMassFlow, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Effective Heat Rejection Temperature", OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).CondOutletTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Condenser Mass Flow Rate", - OutputProcessor::Unit::kg_s, - ElectricEIRChillerReport(EIRChillerNum).Condmdot, + this->ChillerCondAvgTemp, "System", "Average", - ElectricEIRChiller(EIRChillerNum).Name); + this->Name); + } - // If heat recovery is active then setup report variables - if (ElectricEIRChiller(EIRChillerNum).HeatRecActive) { - SetupOutputVariable("Chiller Total Recovered Heat Rate", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).QHeatRecovery, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Total Recovered Heat Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).EnergyHeatRecovery, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "ENERGYTRANSFER", - "HEATRECOVERY", - _, - "Plant"); - SetupOutputVariable("Chiller Heat Recovery Inlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).HeatRecInletTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Heat Recovery Outlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).HeatRecOutletTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Heat Recovery Mass Flow Rate", - OutputProcessor::Unit::kg_s, - ElectricEIRChillerReport(EIRChillerNum).HeatRecMassFlow, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Effective Heat Rejection Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).ChillerCondAvgTemp, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - } + } else { + SetupOutputVariable( + "Chiller Condenser Inlet Temperature", OutputProcessor::Unit::C, this->CondInletTemp, "System", "Average", this->Name); - } else { - SetupOutputVariable("Chiller Condenser Inlet Temperature", - OutputProcessor::Unit::C, - ElectricEIRChillerReport(EIRChillerNum).CondInletTemp, + if (this->CondenserFanPowerRatio > 0) { + SetupOutputVariable( + "Chiller Condenser Fan Electric Power", OutputProcessor::Unit::W, this->CondenserFanPower, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Condenser Fan Electric Energy", + OutputProcessor::Unit::J, + this->CondenserFanEnergyConsumption, "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - if (ElectricEIRChiller(EIRChillerNum).CondenserFanPowerRatio > 0) { - SetupOutputVariable("Chiller Condenser Fan Electric Power", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).CondenserFanPowerUse, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Condenser Fan Electric Energy", + "Sum", + this->Name, + _, + "ELECTRICITY", + "Cooling", + _, + "Plant"); + } + if (this->CondenserType == EvapCooled) { + SetupOutputVariable("Chiller Evaporative Condenser Water Volume", + OutputProcessor::Unit::m3, + this->EvapWaterConsump, + "System", + "Sum", + this->Name, + _, + "Water", + "Cooling", + _, + "System"); + + SetupOutputVariable("Chiller Evaporative Condenser Mains Supply Water Volume", + OutputProcessor::Unit::m3, + this->EvapWaterConsump, + "System", + "Sum", + this->Name, + _, + "MainsWater", + "Cooling", + _, + "System"); + + if (this->BasinHeaterPowerFTempDiff > 0.0) { + SetupOutputVariable( + "Chiller Basin Heater Electric Power", OutputProcessor::Unit::W, this->BasinHeaterPower, "System", "Average", this->Name); + + SetupOutputVariable("Chiller Basin Heater Electric Energy", OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).CondenserFanEnergyConsumption, + this->BasinHeaterConsumption, "System", "Sum", - ElectricEIRChiller(EIRChillerNum).Name, + this->Name, _, - "ELECTRICITY", - "Cooling", + "Electric", + "CHILLERS", _, "Plant"); } - if (ElectricEIRChiller(EIRChillerNum).CondenserType == EvapCooled) { - SetupOutputVariable("Chiller Evaporative Condenser Water Volume", - OutputProcessor::Unit::m3, - ElectricEIRChillerReport(EIRChillerNum).EvapWaterConsump, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "Water", - "Cooling", - _, - "System"); - SetupOutputVariable("Chiller Evaporative Condenser Mains Supply Water Volume", - OutputProcessor::Unit::m3, - ElectricEIRChillerReport(EIRChillerNum).EvapWaterConsump, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "MainsWater", - "Cooling", - _, - "System"); - if (ElectricEIRChiller(EIRChillerNum).BasinHeaterPowerFTempDiff > 0.0) { - SetupOutputVariable("Chiller Basin Heater Electric Power", - OutputProcessor::Unit::W, - ElectricEIRChillerReport(EIRChillerNum).BasinHeaterPower, - "System", - "Average", - ElectricEIRChiller(EIRChillerNum).Name); - SetupOutputVariable("Chiller Basin Heater Electric Energy", - OutputProcessor::Unit::J, - ElectricEIRChillerReport(EIRChillerNum).BasinHeaterConsumption, - "System", - "Sum", - ElectricEIRChiller(EIRChillerNum).Name, - _, - "Electric", - "CHILLERS", - _, - "Plant"); - } - } - } - if (AnyEnergyManagementSystemInModel) { - SetupEMSInternalVariable( - "Chiller Nominal Capacity", ElectricEIRChiller(EIRChillerNum).Name, "[W]", ElectricEIRChiller(EIRChillerNum).RefCap); } } + if (DataGlobals::AnyEnergyManagementSystemInModel) { + SetupEMSInternalVariable("Chiller Nominal Capacity", this->Name, "[W]", this->RefCap); + } } - void InitElectricEIRChiller(int const EIRChillNum, // Number of the current electric EIR chiller being simulated - bool const RunFlag, // TRUE when chiller operating - Real64 const MyLoad // current load put on chiller - ) + void ElectricEIRChillerSpecs::initialize(bool const RunFlag, Real64 const MyLoad) { // SUBROUTINE INFORMATION: @@ -1111,300 +962,222 @@ namespace ChillerElectricEIR { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // Using/Aliasing - using DataGlobals::AnyEnergyManagementSystemInModel; - using DataGlobals::BeginEnvrnFlag; - using DataPlant::DualSetPointDeadBand; - using DataPlant::LoopFlowStatus_NeedyIfLoopOn; - using DataPlant::PlantFirstSizesOkayToFinalize; - using DataPlant::PlantLoop; - using DataPlant::SingleSetPoint; - using DataPlant::TypeOf_Chiller_ElectricEIR; - using EMSManager::CheckIfNodeSetPointManagedByEMS; - using EMSManager::iTemperatureSetPoint; - using PlantUtilities::InitComponentNodes; - using PlantUtilities::InterConnectTwoPlantLoopSides; - using PlantUtilities::ScanPlantLoopsForObject; - using PlantUtilities::SetComponentFlowRate; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static std::string const RoutineName("InitElectricEIRChiller"); - static Array1D_bool MyFlag; // TRUE in order to set component location - static Array1D_bool MyEnvrnFlag; // TRUE when new environment is started - int EvapInletNode; // Node number for evaporator water inlet node - int EvapOutletNode; // Node number for evaporator water outlet node - int CondInletNode; // Node number for condenser water inlet node - int CondOutletNode; // Node number for condenser water outlet node - int HeatRecInNode; // Node number for heat recovery water inlet node - int HeatRecOutNode; // Node number for heat recovery water outlet node - Real64 rho; // local fluid density - Real64 mdot; // local fluid mass flow rate - Real64 mdotCond; // local fluid mass flow rate for condenser - Real64 THeatRecSetPoint(0.0); // tests set point node for proper set point value - int LoopNum; - int LoopSideNum; - int BranchIndex; - int CompIndex; - bool FatalError; - bool errFlag; - // FLOW: - - // Do the one time initializations - if (InitMyOneTimeFlag) { - MyEnvrnFlag.allocate(NumElectricEIRChillers); - MyFlag.allocate(NumElectricEIRChillers); - MyEnvrnFlag = true; - MyFlag = true; - InitMyOneTimeFlag = false; - } - - EvapInletNode = ElectricEIRChiller(EIRChillNum).EvapInletNodeNum; - EvapOutletNode = ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum; - CondInletNode = ElectricEIRChiller(EIRChillNum).CondInletNodeNum; - CondOutletNode = ElectricEIRChiller(EIRChillNum).CondOutletNodeNum; + // Init more variables + if (this->oneTimeFlag) { - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - HeatRecInNode = ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum; - HeatRecOutNode = ElectricEIRChiller(EIRChillNum).HeatRecOutletNodeNum; - } + this->setupOutputVars(); - // Init more variables - if (MyFlag(EIRChillNum)) { // Locate the chillers on the plant loops for later usage - errFlag = false; - ScanPlantLoopsForObject(ElectricEIRChiller(EIRChillNum).Name, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum, - errFlag, - ElectricEIRChiller(EIRChillNum).TempLowLimitEvapOut, - _, - _, - ElectricEIRChiller(EIRChillNum).EvapInletNodeNum, - _); - if (ElectricEIRChiller(EIRChillNum).CondenserType != AirCooled && ElectricEIRChiller(EIRChillNum).CondenserType != EvapCooled) { - ScanPlantLoopsForObject(ElectricEIRChiller(EIRChillNum).Name, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - ElectricEIRChiller(EIRChillNum).CDBranchNum, - ElectricEIRChiller(EIRChillNum).CDCompNum, - errFlag, - _, - _, - _, - ElectricEIRChiller(EIRChillNum).CondInletNodeNum, - _); - InterConnectTwoPlantLoopSides(ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - TypeOf_Chiller_ElectricEIR, - true); - } - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - ScanPlantLoopsForObject(ElectricEIRChiller(EIRChillNum).Name, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).HRLoopNum, - ElectricEIRChiller(EIRChillNum).HRLoopSideNum, - ElectricEIRChiller(EIRChillNum).HRBranchNum, - ElectricEIRChiller(EIRChillNum).HRCompNum, - errFlag, - _, - _, - _, - ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum, - _); - InterConnectTwoPlantLoopSides(ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).HRLoopNum, - ElectricEIRChiller(EIRChillNum).HRLoopSideNum, - TypeOf_Chiller_ElectricEIR, - true); - } - - if (ElectricEIRChiller(EIRChillNum).CondenserType != AirCooled && ElectricEIRChiller(EIRChillNum).CondenserType != EvapCooled && - ElectricEIRChiller(EIRChillNum).HeatRecActive) { - InterConnectTwoPlantLoopSides(ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - ElectricEIRChiller(EIRChillNum).HRLoopNum, - ElectricEIRChiller(EIRChillNum).HRLoopSideNum, - TypeOf_Chiller_ElectricEIR, - false); + bool errFlag = false; + PlantUtilities::ScanPlantLoopsForObject(this->Name, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum, + errFlag, + this->TempLowLimitEvapOut, + _, + _, + this->EvapInletNodeNum, + _); + if (this->CondenserType != AirCooled && this->CondenserType != EvapCooled) { + PlantUtilities::ScanPlantLoopsForObject(this->Name, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->CDLoopNum, + this->CDLoopSideNum, + this->CDBranchNum, + this->CDCompNum, + errFlag, + _, + _, + _, + this->CondInletNodeNum, + _); + PlantUtilities::InterConnectTwoPlantLoopSides( + this->CWLoopNum, this->CWLoopSideNum, this->CDLoopNum, this->CDLoopSideNum, DataPlant::TypeOf_Chiller_ElectricEIR, true); + } + if (this->HeatRecActive) { + PlantUtilities::ScanPlantLoopsForObject(this->Name, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->HRLoopNum, + this->HRLoopSideNum, + this->HRBranchNum, + this->HRCompNum, + errFlag, + _, + _, + _, + this->HeatRecInletNodeNum, + _); + PlantUtilities::InterConnectTwoPlantLoopSides( + this->CWLoopNum, this->CWLoopSideNum, this->HRLoopNum, this->HRLoopSideNum, DataPlant::TypeOf_Chiller_ElectricEIR, true); + } + + if (this->CondenserType != AirCooled && this->CondenserType != EvapCooled && this->HeatRecActive) { + PlantUtilities::InterConnectTwoPlantLoopSides( + this->CDLoopNum, this->CDLoopSideNum, this->HRLoopNum, this->HRLoopSideNum, DataPlant::TypeOf_Chiller_ElectricEIR, false); } if (errFlag) { ShowFatalError("InitElectricEIRChiller: Program terminated due to previous condition(s)."); } - if (ElectricEIRChiller(EIRChillNum).FlowMode == ConstantFlow) { + if (this->FlowMode == ConstantFlow) { // reset flow priority - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum) - .LoopSide(ElectricEIRChiller(EIRChillNum).CWLoopSideNum) - .Branch(ElectricEIRChiller(EIRChillNum).CWBranchNum) - .Comp(ElectricEIRChiller(EIRChillNum).CWCompNum) - .FlowPriority = LoopFlowStatus_NeedyIfLoopOn; + DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).FlowPriority = + DataPlant::LoopFlowStatus_NeedyIfLoopOn; } - if (ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated) { + if (this->FlowMode == LeavingSetPointModulated) { // reset flow priority - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum) - .LoopSide(ElectricEIRChiller(EIRChillNum).CWLoopSideNum) - .Branch(ElectricEIRChiller(EIRChillNum).CWBranchNum) - .Comp(ElectricEIRChiller(EIRChillNum).CWCompNum) - .FlowPriority = LoopFlowStatus_NeedyIfLoopOn; + DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).FlowPriority = + DataPlant::LoopFlowStatus_NeedyIfLoopOn; // check if setpoint on outlet node - if ((Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPoint == SensedNodeFlagValue) && - (Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPointHi == SensedNodeFlagValue)) { - if (!AnyEnergyManagementSystemInModel) { - if (!ElectricEIRChiller(EIRChillNum).ModulatedFlowErrDone) { - ShowWarningError("Missing temperature setpoint for LeavingSetpointModulated mode chiller named " + - ElectricEIRChiller(EIRChillNum).Name); + if ((DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint == DataLoopNode::SensedNodeFlagValue) && + (DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi == DataLoopNode::SensedNodeFlagValue)) { + if (!DataGlobals::AnyEnergyManagementSystemInModel) { + if (!this->ModulatedFlowErrDone) { + ShowWarningError("Missing temperature setpoint for LeavingSetpointModulated mode chiller named " + this->Name); ShowContinueError( " A temperature setpoint is needed at the outlet node of a chiller in variable flow mode, use a SetpointManager"); ShowContinueError(" The overall loop setpoint will be assumed for chiller. The simulation continues ... "); - ElectricEIRChiller(EIRChillNum).ModulatedFlowErrDone = true; + this->ModulatedFlowErrDone = true; } } else { // need call to EMS to check node - FatalError = false; // but not really fatal yet, but should be. - CheckIfNodeSetPointManagedByEMS(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum, iTemperatureSetPoint, FatalError); - if (FatalError) { - if (!ElectricEIRChiller(EIRChillNum).ModulatedFlowErrDone) { - ShowWarningError("Missing temperature setpoint for LeavingSetpointModulated mode chiller named " + - ElectricEIRChiller(EIRChillNum).Name); + bool fatalError = false; // but not really fatal yet, but should be. + EMSManager::CheckIfNodeSetPointManagedByEMS(this->EvapOutletNodeNum, EMSManager::iTemperatureSetPoint, fatalError); + if (fatalError) { + if (!this->ModulatedFlowErrDone) { + ShowWarningError("Missing temperature setpoint for LeavingSetpointModulated mode chiller named " + this->Name); ShowContinueError( " A temperature setpoint is needed at the outlet node of a chiller evaporator in variable flow mode"); ShowContinueError(" use a Setpoint Manager to establish a setpoint at the chiller evaporator outlet node "); ShowContinueError(" or use an EMS actuator to establish a setpoint at the outlet node "); ShowContinueError(" The overall loop setpoint will be assumed for chiller. The simulation continues ... "); - ElectricEIRChiller(EIRChillNum).ModulatedFlowErrDone = true; + this->ModulatedFlowErrDone = true; } } } - ElectricEIRChiller(EIRChillNum).ModulatedFlowSetToLoop = true; - Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPoint = - Node(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).TempSetPointNodeNum).TempSetPoint; - Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPointHi = - Node(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).TempSetPointNodeNum).TempSetPointHi; + this->ModulatedFlowSetToLoop = true; + DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint = + DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPoint; + DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi = + DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPointHi; } } - MyFlag(EIRChillNum) = false; + this->oneTimeFlag = false; } - if (MyEnvrnFlag(EIRChillNum) && BeginEnvrnFlag && (PlantFirstSizesOkayToFinalize)) { - - rho = GetDensityGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidName, - DataGlobals::CWInitConvTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidIndex, - RoutineName); - - ElectricEIRChiller(EIRChillNum).EvapMassFlowRateMax = ElectricEIRChiller(EIRChillNum).EvapVolFlowRate * rho; - - InitComponentNodes(0.0, - ElectricEIRChiller(EIRChillNum).EvapMassFlowRateMax, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); - - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - - rho = GetDensityGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidName, - ElectricEIRChiller(EIRChillNum).TempRefCondIn, - PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidIndex, - RoutineName); - ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax = rho * ElectricEIRChiller(EIRChillNum).CondVolFlowRate; - InitComponentNodes(0.0, - ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax, - CondInletNode, - CondOutletNode, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - ElectricEIRChiller(EIRChillNum).CDBranchNum, - ElectricEIRChiller(EIRChillNum).CDCompNum); - Node(CondInletNode).Temp = ElectricEIRChiller(EIRChillNum).TempRefCondIn; + this->EquipFlowCtrl = DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).FlowCtrl; + + if (this->MyEnvrnFlag && DataGlobals::BeginEnvrnFlag && (DataPlant::PlantFirstSizesOkayToFinalize)) { + + Real64 rho = FluidProperties::GetDensityGlycol(DataPlant::PlantLoop(this->CWLoopNum).FluidName, + DataGlobals::CWInitConvTemp, + DataPlant::PlantLoop(this->CWLoopNum).FluidIndex, + RoutineName); + + this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; + + PlantUtilities::InitComponentNodes(0.0, + this->EvapMassFlowRateMax, + this->EvapInletNodeNum, + this->EvapOutletNodeNum, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum); + + if (this->CondenserType == WaterCooled) { + + rho = FluidProperties::GetDensityGlycol(DataPlant::PlantLoop(this->CDLoopNum).FluidName, + this->TempRefCondIn, + DataPlant::PlantLoop(this->CDLoopNum).FluidIndex, + RoutineName); + this->CondMassFlowRateMax = rho * this->CondVolFlowRate; + PlantUtilities::InitComponentNodes(0.0, + this->CondMassFlowRateMax, + this->CondInletNodeNum, + this->CondOutletNodeNum, + this->CDLoopNum, + this->CDLoopSideNum, + this->CDBranchNum, + this->CDCompNum); + DataLoopNode::Node(this->CondInletNodeNum).Temp = this->TempRefCondIn; } else { // air or evap air condenser // Initialize maximum available condenser flow rate - rho = - Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdBaroPress, ElectricEIRChiller(EIRChillNum).TempRefCondIn, 0.0, RoutineName); - ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax = rho * ElectricEIRChiller(EIRChillNum).CondVolFlowRate; - - Node(CondInletNode).MassFlowRate = ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax; - Node(CondOutletNode).MassFlowRate = Node(CondInletNode).MassFlowRate; - Node(CondInletNode).MassFlowRateMaxAvail = Node(CondInletNode).MassFlowRate; - Node(CondInletNode).MassFlowRateMax = Node(CondInletNode).MassFlowRate; - Node(CondOutletNode).MassFlowRateMax = Node(CondInletNode).MassFlowRate; - Node(CondInletNode).MassFlowRateMinAvail = 0.0; - Node(CondInletNode).MassFlowRateMin = 0.0; - Node(CondOutletNode).MassFlowRateMinAvail = 0.0; - Node(CondOutletNode).MassFlowRateMin = 0.0; - Node(CondInletNode).Temp = ElectricEIRChiller(EIRChillNum).TempRefCondIn; - } - - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - rho = GetDensityGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).FluidName, - DataGlobals::CWInitConvTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).FluidIndex, - RoutineName); - ElectricEIRChiller(EIRChillNum).DesignHeatRecMassFlowRate = rho * ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate; - - InitComponentNodes(0.0, - ElectricEIRChiller(EIRChillNum).DesignHeatRecMassFlowRate, - ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum, - ElectricEIRChiller(EIRChillNum).HeatRecOutletNodeNum, - ElectricEIRChiller(EIRChillNum).HRLoopNum, - ElectricEIRChiller(EIRChillNum).HRLoopSideNum, - ElectricEIRChiller(EIRChillNum).HRBranchNum, - ElectricEIRChiller(EIRChillNum).HRCompNum); + rho = Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdBaroPress, this->TempRefCondIn, 0.0, RoutineName); + this->CondMassFlowRateMax = rho * this->CondVolFlowRate; + + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate = this->CondMassFlowRateMax; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRate = DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRateMaxAvail = DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRateMax = DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRateMax = DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRateMinAvail = 0.0; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRateMin = 0.0; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRateMinAvail = 0.0; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRateMin = 0.0; + DataLoopNode::Node(this->CondInletNodeNum).Temp = this->TempRefCondIn; + } + + if (this->HeatRecActive) { + rho = FluidProperties::GetDensityGlycol(DataPlant::PlantLoop(this->HRLoopNum).FluidName, + DataGlobals::CWInitConvTemp, + DataPlant::PlantLoop(this->HRLoopNum).FluidIndex, + RoutineName); + this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; + + PlantUtilities::InitComponentNodes(0.0, + this->DesignHeatRecMassFlowRate, + this->HeatRecInletNodeNum, + this->HeatRecOutletNodeNum, + this->HRLoopNum, + this->HRLoopSideNum, + this->HRBranchNum, + this->HRCompNum); // overall capacity limit - ElectricEIRChiller(EIRChillNum).HeatRecMaxCapacityLimit = - ElectricEIRChiller(EIRChillNum).HeatRecCapacityFraction * - (ElectricEIRChiller(EIRChillNum).RefCap + ElectricEIRChiller(EIRChillNum).RefCap / ElectricEIRChiller(EIRChillNum).RefCOP); + this->HeatRecMaxCapacityLimit = this->HeatRecCapacityFraction * (this->RefCap + this->RefCap / this->RefCOP); - if (ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum > 0) { + if (this->HeatRecSetPointNodeNum > 0) { + Real64 THeatRecSetPoint(0.0); // tests set point node for proper set point value { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - THeatRecSetPoint = Node(ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum).TempSetPoint; - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - THeatRecSetPoint = Node(ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum).TempSetPointHi; + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->HRLoopNum).LoopDemandCalcScheme); + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + THeatRecSetPoint = DataLoopNode::Node(this->HeatRecSetPointNodeNum).TempSetPoint; + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + THeatRecSetPoint = DataLoopNode::Node(this->HeatRecSetPointNodeNum).TempSetPointHi; } else { assert(false); } } - if (THeatRecSetPoint == SensedNodeFlagValue) { - if (!AnyEnergyManagementSystemInModel) { - if (!ElectricEIRChiller(EIRChillNum).HRSPErrDone) { - ShowWarningError("Missing heat recovery temperature setpoint for chiller named " + - ElectricEIRChiller(EIRChillNum).Name); + if (THeatRecSetPoint == DataLoopNode::SensedNodeFlagValue) { + if (!DataGlobals::AnyEnergyManagementSystemInModel) { + if (!this->HRSPErrDone) { + ShowWarningError("Missing heat recovery temperature setpoint for chiller named " + this->Name); ShowContinueError(" A temperature setpoint is needed at the heat recovery leaving temperature setpoint node " "specified, use a SetpointManager"); ShowContinueError(" The overall loop setpoint will be assumed for heat recovery. The simulation continues ..."); - ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum = - PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).TempSetPointNodeNum; - ElectricEIRChiller(EIRChillNum).HRSPErrDone = true; + this->HeatRecSetPointNodeNum = DataPlant::PlantLoop(this->HRLoopNum).TempSetPointNodeNum; + this->HRSPErrDone = true; } } else { // need call to EMS to check node - FatalError = false; // but not really fatal yet, but should be. - CheckIfNodeSetPointManagedByEMS(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum, iTemperatureSetPoint, FatalError); - if (FatalError) { - if (!ElectricEIRChiller(EIRChillNum).HRSPErrDone) { - ShowWarningError("Missing heat recovery temperature setpoint for chiller named " + - ElectricEIRChiller(EIRChillNum).Name); + bool fatalError = false; // but not really fatal yet, but should be. + EMSManager::CheckIfNodeSetPointManagedByEMS(this->EvapOutletNodeNum, EMSManager::iTemperatureSetPoint, fatalError); + if (fatalError) { + if (!this->HRSPErrDone) { + ShowWarningError("Missing heat recovery temperature setpoint for chiller named " + this->Name); ShowContinueError(" A temperature setpoint is needed at the heat recovery leaving temperature setpoint node " "specified, use a SetpointManager to establish a setpoint"); ShowContinueError(" or use an EMS actuator to establish a setpoint at this node "); ShowContinueError(" The overall loop setpoint will be assumed for heat recovery. The simulation continues ..."); - ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum = - PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).TempSetPointNodeNum; - ElectricEIRChiller(EIRChillNum).HRSPErrDone = true; + this->HeatRecSetPointNodeNum = DataPlant::PlantLoop(this->HRLoopNum).TempSetPointNodeNum; + this->HRSPErrDone = true; } } } // IF (.NOT. AnyEnergyManagementSystemInModel) THEN @@ -1412,67 +1185,60 @@ namespace ChillerElectricEIR { } // IF(ElectricEIRChiller(EIRChillNum)%HeatRecSetPointNodeNum > 0)THEN } // IF (ElectricEIRChiller(EIRChillNum)%HeatRecActive) THEN - MyEnvrnFlag(EIRChillNum) = false; + this->MyEnvrnFlag = false; } - if (!BeginEnvrnFlag) { - MyEnvrnFlag(EIRChillNum) = true; + if (!DataGlobals::BeginEnvrnFlag) { + this->MyEnvrnFlag = true; } - if ((ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated) && ElectricEIRChiller(EIRChillNum).ModulatedFlowSetToLoop) { + if ((this->FlowMode == LeavingSetPointModulated) && this->ModulatedFlowSetToLoop) { // fix for clumsy old input that worked because loop setpoint was spread. // could be removed with transition, testing , model change, period of being obsolete. - Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPoint = - Node(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).TempSetPointNodeNum).TempSetPoint; - Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPointHi = - Node(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).TempSetPointNodeNum).TempSetPointHi; + DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint = + DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPoint; + DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi = + DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPointHi; } + Real64 mdot; + Real64 mdotCond; if ((std::abs(MyLoad) > 0.0) && RunFlag) { - mdot = ElectricEIRChiller(EIRChillNum).EvapMassFlowRateMax; - mdotCond = ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax; + mdot = this->EvapMassFlowRateMax; + mdotCond = this->CondMassFlowRateMax; } else { mdot = 0.0; mdotCond = 0.0; } - SetComponentFlowRate(mdot, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); - - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - SetComponentFlowRate(mdotCond, - CondInletNode, - CondOutletNode, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - ElectricEIRChiller(EIRChillNum).CDBranchNum, - ElectricEIRChiller(EIRChillNum).CDCompNum); + PlantUtilities::SetComponentFlowRate( + mdot, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWLoopNum, this->CWLoopSideNum, this->CWBranchNum, this->CWCompNum); + + if (this->CondenserType == WaterCooled) { + PlantUtilities::SetComponentFlowRate( + mdotCond, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDLoopNum, this->CDLoopSideNum, this->CDBranchNum, this->CDCompNum); } // Initialize heat recovery flow rates at node - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - LoopNum = ElectricEIRChiller(EIRChillNum).HRLoopNum; - LoopSideNum = ElectricEIRChiller(EIRChillNum).HRLoopSideNum; - BranchIndex = ElectricEIRChiller(EIRChillNum).HRBranchNum; - CompIndex = ElectricEIRChiller(EIRChillNum).HRCompNum; + if (this->HeatRecActive) { + int LoopNum = this->HRLoopNum; + int LoopSideNum = this->HRLoopSideNum; + int BranchIndex = this->HRBranchNum; + int CompIndex = this->HRCompNum; if (RunFlag) { - mdot = ElectricEIRChiller(EIRChillNum).DesignHeatRecMassFlowRate; + mdot = this->DesignHeatRecMassFlowRate; } else { mdot = 0.0; } - SetComponentFlowRate(mdot, HeatRecInNode, HeatRecOutNode, LoopNum, LoopSideNum, BranchIndex, CompIndex); + PlantUtilities::SetComponentFlowRate( + mdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, LoopNum, LoopSideNum, BranchIndex, CompIndex); } - if (ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { - BasinHeaterPower = 0.0; + if (this->CondenserType == EvapCooled) { + this->BasinHeaterPower = 0.0; } } - void SizeElectricEIRChiller(int const EIRChillNum) + void ElectricEIRChillerSpecs::size() { // SUBROUTINE INFORMATION: @@ -1490,97 +1256,56 @@ namespace ChillerElectricEIR { // the evaporator flow rate and the chilled water loop design delta T. The condenser flow rate // is calculated from the reference capacity, the COP, and the condenser loop design delta T. - // Using/Aliasing - using namespace DataSizing; - using DataPlant::PlantFinalSizesOkayToReport; - using DataPlant::PlantFirstSizesOkayToFinalize; - using DataPlant::PlantFirstSizesOkayToReport; - using DataPlant::PlantLoop; - using DataPlant::TypeOf_Chiller_ElectricEIR; - using ReportSizingManager::ReportSizingOutput; - using namespace OutputReportPredefined; - using StandardRatings::CalcChillerIPLV; - - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("SizeElectricEIRChiller"); - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PltSizNum; // Plant Sizing index corresponding to CurLoopNum - int PltSizCondNum; // Plant Sizing index for condenser loop - bool ErrorsFound; // If errors detected in input - std::string equipName; - Real64 rho; - Real64 Cp; - - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - bool bPRINT = true; // TRUE if sizing is reported to output (eio) - Real64 TempSize; // autosized value of coil input field - int SizingMethod; // Integer representation of sizing method (e.g., CoolingAirflowSizing, HeatingCapacitySizing, etc.) - - if (ChillerIPLVOneTimeFlag) { - ChillerIPLVFlagArr.dimension(NumElectricEIRChillers, true); - ChillerIPLVOneTimeFlag = false; - } + int PltSizCondNum = 0; + bool ErrorsFound = false; + Real64 tmpNomCap = this->RefCap; + Real64 tmpEvapVolFlowRate = this->EvapVolFlowRate; + Real64 tmpCondVolFlowRate = this->CondVolFlowRate; - PltSizNum = 0; - PltSizCondNum = 0; - ErrorsFound = false; - Real64 tmpNomCap = ElectricEIRChiller(EIRChillNum).RefCap; - Real64 tmpEvapVolFlowRate = ElectricEIRChiller(EIRChillNum).EvapVolFlowRate; - Real64 tmpCondVolFlowRate = ElectricEIRChiller(EIRChillNum).CondVolFlowRate; - Real64 tempHeatRecVolFlowRate = ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate; - Real64 EvapVolFlowRateUser(0.0); - Real64 RefCapUser(0.0); - Real64 CondVolFlowRateUser(0.0); - - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - PltSizCondNum = PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).PlantSizNum; + if (this->CondenserType == WaterCooled) { + PltSizCondNum = DataPlant::PlantLoop(this->CDLoopNum).PlantSizNum; } // find the appropriate Plant Sizing object - PltSizNum = PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).PlantSizNum; + int PltSizNum = DataPlant::PlantLoop(this->CWLoopNum).PlantSizNum; if (PltSizNum > 0) { - if (PlantSizData(PltSizNum).DesVolFlowRate >= SmallWaterVolFlow) { - tmpEvapVolFlowRate = PlantSizData(PltSizNum).DesVolFlowRate * ElectricEIRChiller(EIRChillNum).SizFac; + if (DataSizing::PlantSizData(PltSizNum).DesVolFlowRate >= DataHVACGlobals::SmallWaterVolFlow) { + tmpEvapVolFlowRate = DataSizing::PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; } else { - if (ElectricEIRChiller(EIRChillNum).EvapVolFlowRateWasAutoSized) tmpEvapVolFlowRate = 0.0; - } - if (PlantFirstSizesOkayToFinalize) { - if (ElectricEIRChiller(EIRChillNum).EvapVolFlowRateWasAutoSized) { - ElectricEIRChiller(EIRChillNum).EvapVolFlowRate = tmpEvapVolFlowRate; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Reference Chilled Water Flow Rate [m3/s]", - tmpEvapVolFlowRate); + if (this->EvapVolFlowRateWasAutoSized) tmpEvapVolFlowRate = 0.0; + } + if (DataPlant::PlantFirstSizesOkayToFinalize) { + if (this->EvapVolFlowRateWasAutoSized) { + this->EvapVolFlowRate = tmpEvapVolFlowRate; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Design Size Reference Chilled Water Flow Rate [m3/s]", tmpEvapVolFlowRate); } - if (PlantFirstSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Initial Design Size Reference Chilled Water Flow Rate [m3/s]", - tmpEvapVolFlowRate); + if (DataPlant::PlantFirstSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Initial Design Size Reference Chilled Water Flow Rate [m3/s]", tmpEvapVolFlowRate); } } else { // Hard-size with sizing data - if (ElectricEIRChiller(EIRChillNum).EvapVolFlowRate > 0.0 && tmpEvapVolFlowRate > 0.0) { - EvapVolFlowRateUser = ElectricEIRChiller(EIRChillNum).EvapVolFlowRate; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Reference Chilled Water Flow Rate [m3/s]", - tmpEvapVolFlowRate, - "User-Specified Reference Chilled Water Flow Rate [m3/s]", - EvapVolFlowRateUser); - if (DisplayExtraWarnings) { - if ((std::abs(tmpEvapVolFlowRate - EvapVolFlowRateUser) / EvapVolFlowRateUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + - ElectricEIRChiller(EIRChillNum).Name); + if (this->EvapVolFlowRate > 0.0 && tmpEvapVolFlowRate > 0.0) { + Real64 EvapVolFlowRateUser = this->EvapVolFlowRate; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", + this->Name, + "Design Size Reference Chilled Water Flow Rate [m3/s]", + tmpEvapVolFlowRate, + "User-Specified Reference Chilled Water Flow Rate [m3/s]", + EvapVolFlowRateUser); + if (DataGlobals::DisplayExtraWarnings) { + if ((std::abs(tmpEvapVolFlowRate - EvapVolFlowRateUser) / EvapVolFlowRateUser) > + DataSizing::AutoVsHardSizingThreshold) { + ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + this->Name); ShowContinueError("User-Specified Reference Chilled Water Flow Rate of " + - RoundSigDigits(EvapVolFlowRateUser, 5) + " [m3/s]"); + General::RoundSigDigits(EvapVolFlowRateUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Reference Chilled Water Flow Rate of " + - RoundSigDigits(tmpEvapVolFlowRate, 5) + " [m3/s]"); + General::RoundSigDigits(tmpEvapVolFlowRate, 5) + " [m3/s]"); ShowContinueError("This may, or may not, indicate mismatched component sizes."); ShowContinueError("Verify that the value entered is intended and is consistent with other components."); } @@ -1591,64 +1316,60 @@ namespace ChillerElectricEIR { } } } else { - if (ElectricEIRChiller(EIRChillNum).EvapVolFlowRateWasAutoSized && PlantFirstSizesOkayToFinalize) { + if (this->EvapVolFlowRateWasAutoSized && DataPlant::PlantFirstSizesOkayToFinalize) { ShowSevereError("Autosizing of Electric Chiller evap flow rate requires a loop Sizing:Plant object"); - ShowContinueError("Occurs in Electric Chiller object=" + ElectricEIRChiller(EIRChillNum).Name); + ShowContinueError("Occurs in Electric Chiller object=" + this->Name); ErrorsFound = true; } - if (!ElectricEIRChiller(EIRChillNum).EvapVolFlowRateWasAutoSized && PlantFinalSizesOkayToReport && - (ElectricEIRChiller(EIRChillNum).EvapVolFlowRate > 0.0)) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "User-Specified Reference Chilled Water Flow Rate [m3/s]", - ElectricEIRChiller(EIRChillNum).EvapVolFlowRate); + if (!this->EvapVolFlowRateWasAutoSized && DataPlant::PlantFinalSizesOkayToReport && (this->EvapVolFlowRate > 0.0)) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "User-Specified Reference Chilled Water Flow Rate [m3/s]", this->EvapVolFlowRate); } } - PlantUtilities::RegisterPlantCompDesignFlow(ElectricEIRChiller(EIRChillNum).EvapInletNodeNum, tmpEvapVolFlowRate); + PlantUtilities::RegisterPlantCompDesignFlow(this->EvapInletNodeNum, tmpEvapVolFlowRate); if (PltSizNum > 0) { - if (PlantSizData(PltSizNum).DesVolFlowRate >= SmallWaterVolFlow) { - Cp = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidName, - DataGlobals::CWInitConvTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidIndex, - RoutineName); - - rho = GetDensityGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidName, - DataGlobals::CWInitConvTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidIndex, - RoutineName); - tmpNomCap = Cp * rho * PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate; + if (DataSizing::PlantSizData(PltSizNum).DesVolFlowRate >= DataHVACGlobals::SmallWaterVolFlow) { + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(DataPlant::PlantLoop(this->CWLoopNum).FluidName, + DataGlobals::CWInitConvTemp, + DataPlant::PlantLoop(this->CWLoopNum).FluidIndex, + RoutineName); + + Real64 rho = FluidProperties::GetDensityGlycol(DataPlant::PlantLoop(this->CWLoopNum).FluidName, + DataGlobals::CWInitConvTemp, + DataPlant::PlantLoop(this->CWLoopNum).FluidIndex, + RoutineName); + tmpNomCap = Cp * rho * DataSizing::PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate; } else { tmpNomCap = 0.0; } - if (PlantFirstSizesOkayToFinalize) { - if (ElectricEIRChiller(EIRChillNum).RefCapWasAutoSized) { - ElectricEIRChiller(EIRChillNum).RefCap = tmpNomCap; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput( - "Chiller:Electric:EIR", ElectricEIRChiller(EIRChillNum).Name, "Design Size Reference Capacity [W]", tmpNomCap); + if (DataPlant::PlantFirstSizesOkayToFinalize) { + if (this->RefCapWasAutoSized) { + this->RefCap = tmpNomCap; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", this->Name, "Design Size Reference Capacity [W]", tmpNomCap); } - if (PlantFirstSizesOkayToReport) { - ReportSizingOutput( - "Chiller:Electric:EIR", ElectricEIRChiller(EIRChillNum).Name, "Initial Design Size Reference Capacity [W]", tmpNomCap); + if (DataPlant::PlantFirstSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Initial Design Size Reference Capacity [W]", tmpNomCap); } } else { // Hard-sized with sizing data - if (ElectricEIRChiller(EIRChillNum).RefCap > 0.0 && tmpNomCap > 0.0) { - RefCapUser = ElectricEIRChiller(EIRChillNum).RefCap; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Reference Capacity [W]", - tmpNomCap, - "User-Specified Reference Capacity [W]", - RefCapUser); - if (DisplayExtraWarnings) { - if ((std::abs(tmpNomCap - RefCapUser) / RefCapUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + - ElectricEIRChiller(EIRChillNum).Name); - ShowContinueError("User-Specified Reference Capacity of " + RoundSigDigits(RefCapUser, 2) + " [W]"); - ShowContinueError("differs from Design Size Reference Capacity of " + RoundSigDigits(tmpNomCap, 2) + " [W]"); + if (this->RefCap > 0.0 && tmpNomCap > 0.0) { + Real64 RefCapUser = this->RefCap; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", + this->Name, + "Design Size Reference Capacity [W]", + tmpNomCap, + "User-Specified Reference Capacity [W]", + RefCapUser); + if (DataGlobals::DisplayExtraWarnings) { + if ((std::abs(tmpNomCap - RefCapUser) / RefCapUser) > DataSizing::AutoVsHardSizingThreshold) { + ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + this->Name); + ShowContinueError("User-Specified Reference Capacity of " + General::RoundSigDigits(RefCapUser, 2) + " [W]"); + ShowContinueError("differs from Design Size Reference Capacity of " + General::RoundSigDigits(tmpNomCap, 2) + + " [W]"); ShowContinueError("This may, or may not, indicate mismatched component sizes."); ShowContinueError("Verify that the value entered is intended and is consistent with other components."); } @@ -1659,71 +1380,62 @@ namespace ChillerElectricEIR { } } } else { - if (ElectricEIRChiller(EIRChillNum).RefCapWasAutoSized && PlantFirstSizesOkayToFinalize) { + if (this->RefCapWasAutoSized && DataPlant::PlantFirstSizesOkayToFinalize) { ShowSevereError("Autosizing of Electric Chiller reference capacity requires a loop Sizing:Plant object"); - ShowContinueError("Occurs in Electric Chiller object=" + ElectricEIRChiller(EIRChillNum).Name); + ShowContinueError("Occurs in Electric Chiller object=" + this->Name); ErrorsFound = true; } - if (!ElectricEIRChiller(EIRChillNum).RefCapWasAutoSized && PlantFinalSizesOkayToReport && - (ElectricEIRChiller(EIRChillNum).RefCap > 0.0)) { // Hard-sized with no sizing data - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "User-Specified Reference Capacity [W]", - ElectricEIRChiller(EIRChillNum).RefCap); + if (!this->RefCapWasAutoSized && DataPlant::PlantFinalSizesOkayToReport && (this->RefCap > 0.0)) { // Hard-sized with no sizing data + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", this->Name, "User-Specified Reference Capacity [W]", this->RefCap); } } if (PltSizCondNum > 0 && PltSizNum > 0) { - if (PlantSizData(PltSizNum).DesVolFlowRate >= SmallWaterVolFlow && tmpNomCap > 0.0) { - - rho = GetDensityGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidName, - DataGlobals::CWInitConvTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidName, - ElectricEIRChiller(EIRChillNum).TempRefCondIn, - PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidIndex, - RoutineName); - tmpCondVolFlowRate = - tmpNomCap * (1.0 + (1.0 / ElectricEIRChiller(EIRChillNum).RefCOP) * ElectricEIRChiller(EIRChillNum).CompPowerToCondenserFrac) / - (PlantSizData(PltSizCondNum).DeltaT * Cp * rho); + if (DataSizing::PlantSizData(PltSizNum).DesVolFlowRate >= DataHVACGlobals::SmallWaterVolFlow && tmpNomCap > 0.0) { + + Real64 rho = FluidProperties::GetDensityGlycol(DataPlant::PlantLoop(this->CDLoopNum).FluidName, + DataGlobals::CWInitConvTemp, + DataPlant::PlantLoop(this->CDLoopNum).FluidIndex, + RoutineName); + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(DataPlant::PlantLoop(this->CDLoopNum).FluidName, + this->TempRefCondIn, + DataPlant::PlantLoop(this->CDLoopNum).FluidIndex, + RoutineName); + tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac) / + (DataSizing::PlantSizData(PltSizCondNum).DeltaT * Cp * rho); } else { - if (ElectricEIRChiller(EIRChillNum).CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; - } - if (PlantFirstSizesOkayToFinalize) { - if (ElectricEIRChiller(EIRChillNum).CondVolFlowRateWasAutoSized) { - ElectricEIRChiller(EIRChillNum).CondVolFlowRate = tmpCondVolFlowRate; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Reference Condenser Fluid Flow Rate [m3/s]", - tmpCondVolFlowRate); + if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; + } + if (DataPlant::PlantFirstSizesOkayToFinalize) { + if (this->CondVolFlowRateWasAutoSized) { + this->CondVolFlowRate = tmpCondVolFlowRate; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Design Size Reference Condenser Fluid Flow Rate [m3/s]", tmpCondVolFlowRate); } - if (PlantFirstSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Initial Design Size Reference Condenser Fluid Flow Rate [m3/s]", - tmpCondVolFlowRate); + if (DataPlant::PlantFirstSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Initial Design Size Reference Condenser Fluid Flow Rate [m3/s]", tmpCondVolFlowRate); } } else { - if (ElectricEIRChiller(EIRChillNum).CondVolFlowRate > 0.0 && tmpCondVolFlowRate > 0.0) { - CondVolFlowRateUser = ElectricEIRChiller(EIRChillNum).CondVolFlowRate; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Reference Condenser Fluid Flow Rate [m3/s]", - tmpCondVolFlowRate, - "User-Specified Reference Condenser Fluid Flow Rate [m3/s]", - CondVolFlowRateUser); - if (DisplayExtraWarnings) { - if ((std::abs(tmpCondVolFlowRate - CondVolFlowRateUser) / CondVolFlowRateUser) > AutoVsHardSizingThreshold) { - ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + - ElectricEIRChiller(EIRChillNum).Name); + if (this->CondVolFlowRate > 0.0 && tmpCondVolFlowRate > 0.0) { + Real64 CondVolFlowRateUser = this->CondVolFlowRate; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", + this->Name, + "Design Size Reference Condenser Fluid Flow Rate [m3/s]", + tmpCondVolFlowRate, + "User-Specified Reference Condenser Fluid Flow Rate [m3/s]", + CondVolFlowRateUser); + if (DataGlobals::DisplayExtraWarnings) { + if ((std::abs(tmpCondVolFlowRate - CondVolFlowRateUser) / CondVolFlowRateUser) > + DataSizing::AutoVsHardSizingThreshold) { + ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + this->Name); ShowContinueError("User-Specified Reference Condenser Fluid Flow Rate of " + - RoundSigDigits(CondVolFlowRateUser, 5) + " [m3/s]"); + General::RoundSigDigits(CondVolFlowRateUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Reference Condenser Fluid Flow Rate of " + - RoundSigDigits(tmpCondVolFlowRate, 5) + " [m3/s]"); + General::RoundSigDigits(tmpCondVolFlowRate, 5) + " [m3/s]"); ShowContinueError("This may, or may not, indicate mismatched component sizes."); ShowContinueError("Verify that the value entered is intended and is consistent with other components."); } @@ -1734,91 +1446,81 @@ namespace ChillerElectricEIR { } } } else { - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { + if (this->CondenserType == WaterCooled) { - if (ElectricEIRChiller(EIRChillNum).CondVolFlowRateWasAutoSized && PlantFirstSizesOkayToFinalize) { + if (this->CondVolFlowRateWasAutoSized && DataPlant::PlantFirstSizesOkayToFinalize) { ShowSevereError("Autosizing of Electric EIR Chiller condenser fluid flow rate requires a condenser"); ShowContinueError("loop Sizing:Plant object"); - ShowContinueError("Occurs in Electric EIR Chiller object=" + ElectricEIRChiller(EIRChillNum).Name); + ShowContinueError("Occurs in Electric EIR Chiller object=" + this->Name); ErrorsFound = true; } - if (!ElectricEIRChiller(EIRChillNum).CondVolFlowRateWasAutoSized && PlantFinalSizesOkayToReport && - (ElectricEIRChiller(EIRChillNum).CondVolFlowRate > 0.0)) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "User-Specified Reference Condenser Fluid Flow Rate [m3/s]", - ElectricEIRChiller(EIRChillNum).CondVolFlowRate); + if (!this->CondVolFlowRateWasAutoSized && DataPlant::PlantFinalSizesOkayToReport && (this->CondVolFlowRate > 0.0)) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "User-Specified Reference Condenser Fluid Flow Rate [m3/s]", this->CondVolFlowRate); } } else { // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton) - if (PlantFinalSizesOkayToReport) { - SizingMethod = DataHVACGlobals::AutoCalculateSizing; - CompType = DataPlant::ccSimPlantEquipTypes(DataPlant::TypeOf_Chiller_ElectricEIR); - CompName = ElectricEIRChiller(EIRChillNum).Name; - SizingString = "Reference Condenser Fluid Flow Rate [m3/s]"; - DataConstantUsedForSizing = ElectricEIRChiller(EIRChillNum).RefCap; - DataFractionUsedForSizing = 0.000114; - TempSize = ElectricEIRChiller(EIRChillNum).CondVolFlowRate; - ReportSizingManager::RequestSizing(CompType, CompName, SizingMethod, SizingString, TempSize, bPRINT, RoutineName); - ElectricEIRChiller(EIRChillNum).CondVolFlowRate = TempSize; - DataConstantUsedForSizing = 0.0; - DataFractionUsedForSizing = 0.0; + if (DataPlant::PlantFinalSizesOkayToReport) { + int SizingMethod = DataHVACGlobals::AutoCalculateSizing; + std::string CompType = DataPlant::ccSimPlantEquipTypes(DataPlant::TypeOf_Chiller_ElectricEIR); + std::string SizingString = "Reference Condenser Fluid Flow Rate [m3/s]"; + DataSizing::DataConstantUsedForSizing = this->RefCap; + DataSizing::DataFractionUsedForSizing = 0.000114; + Real64 TempSize = this->CondVolFlowRate; + bool bPRINT = true; // TRUE if sizing is reported to output (eio) + ReportSizingManager::RequestSizing(CompType, this->Name, SizingMethod, SizingString, TempSize, bPRINT, RoutineName); + this->CondVolFlowRate = TempSize; + DataSizing::DataConstantUsedForSizing = 0.0; + DataSizing::DataFractionUsedForSizing = 0.0; } } } // save the reference condenser water volumetric flow rate for use by the condenser water loop sizing algorithms - PlantUtilities::RegisterPlantCompDesignFlow(ElectricEIRChiller(EIRChillNum).CondInletNodeNum, tmpCondVolFlowRate); + PlantUtilities::RegisterPlantCompDesignFlow(this->CondInletNodeNum, tmpCondVolFlowRate); // now do heat recovery flow rate sizing if active - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - tempHeatRecVolFlowRate = tmpCondVolFlowRate * ElectricEIRChiller(EIRChillNum).HeatRecCapacityFraction; - if (ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRateWasAutoSized) { - - if (PlantFirstSizesOkayToFinalize) { - ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate = tempHeatRecVolFlowRate; - if (PlantFinalSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Heat Recovery Water Flow Rate [m3/s]", - tempHeatRecVolFlowRate); + if (this->HeatRecActive) { + Real64 tempHeatRecVolFlowRate = tmpCondVolFlowRate * this->HeatRecCapacityFraction; + if (this->DesignHeatRecVolFlowRateWasAutoSized) { + + if (DataPlant::PlantFirstSizesOkayToFinalize) { + this->DesignHeatRecVolFlowRate = tempHeatRecVolFlowRate; + if (DataPlant::PlantFinalSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Design Size Heat Recovery Water Flow Rate [m3/s]", tempHeatRecVolFlowRate); } - if (PlantFirstSizesOkayToReport) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Intial Design Size Heat Recovery Water Flow Rate [m3/s]", - tempHeatRecVolFlowRate); + if (DataPlant::PlantFirstSizesOkayToReport) { + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "Intial Design Size Heat Recovery Water Flow Rate [m3/s]", tempHeatRecVolFlowRate); } } } else { - if (ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate > 0.0 && tempHeatRecVolFlowRate > 0.0) { - Real64 nomHeatRecVolFlowRateUser = ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate; + if (this->DesignHeatRecVolFlowRate > 0.0 && tempHeatRecVolFlowRate > 0.0) { + Real64 nomHeatRecVolFlowRateUser = this->DesignHeatRecVolFlowRate; if (DataPlant::PlantFinalSizesOkayToReport) { if (DataGlobals::DoPlantSizing) { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "Design Size Heat Recovery Water Flow Rate [m3/s]", - tempHeatRecVolFlowRate, - "User-Specified Heat Recovery Water Flow Rate [m3/s]", - nomHeatRecVolFlowRateUser); + ReportSizingManager::ReportSizingOutput("Chiller:Electric:EIR", + this->Name, + "Design Size Heat Recovery Water Flow Rate [m3/s]", + tempHeatRecVolFlowRate, + "User-Specified Heat Recovery Water Flow Rate [m3/s]", + nomHeatRecVolFlowRateUser); } else { - ReportSizingOutput("Chiller:Electric:EIR", - ElectricEIRChiller(EIRChillNum).Name, - "User-Specified Heat Recovery Water Flow Rate [m3/s]", - nomHeatRecVolFlowRateUser); + ReportSizingManager::ReportSizingOutput( + "Chiller:Electric:EIR", this->Name, "User-Specified Heat Recovery Water Flow Rate [m3/s]", nomHeatRecVolFlowRateUser); } if (DataGlobals::DisplayExtraWarnings) { if ((std::abs(tempHeatRecVolFlowRate - nomHeatRecVolFlowRateUser) / nomHeatRecVolFlowRateUser) > DataSizing::AutoVsHardSizingThreshold) { - ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + - ElectricEIRChiller(EIRChillNum).Name); - ShowContinueError("User-Specified Heat Recovery Water Flow Rate of " + RoundSigDigits(nomHeatRecVolFlowRateUser, 5) + - " [m3/s]"); + ShowMessage("SizeChillerElectricEIR: Potential issue with equipment sizing for " + this->Name); + ShowContinueError("User-Specified Heat Recovery Water Flow Rate of " + + General::RoundSigDigits(nomHeatRecVolFlowRateUser, 5) + " [m3/s]"); ShowContinueError("differs from Design Size Heat Recovery Water Flow Rate of " + - RoundSigDigits(tempHeatRecVolFlowRate, 5) + " [m3/s]"); + General::RoundSigDigits(tempHeatRecVolFlowRate, 5) + " [m3/s]"); ShowContinueError("This may, or may not, indicate mismatched component sizes."); ShowContinueError("Verify that the value entered is intended and is consistent with other components."); } @@ -1827,31 +1529,29 @@ namespace ChillerElectricEIR { tempHeatRecVolFlowRate = nomHeatRecVolFlowRateUser; } } - if (!ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRateWasAutoSized) - tempHeatRecVolFlowRate = ElectricEIRChiller(EIRChillNum).DesignHeatRecVolFlowRate; - PlantUtilities::RegisterPlantCompDesignFlow(ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum, tempHeatRecVolFlowRate); + if (!this->DesignHeatRecVolFlowRateWasAutoSized) tempHeatRecVolFlowRate = this->DesignHeatRecVolFlowRate; + PlantUtilities::RegisterPlantCompDesignFlow(this->HeatRecInletNodeNum, tempHeatRecVolFlowRate); } // Heat recovery active - if (PlantFinalSizesOkayToReport) { - if (ChillerIPLVFlagArr(EIRChillNum)) { + if (DataPlant::PlantFinalSizesOkayToReport) { + if (this->IPLVFlag) { Real64 IPLV; - CalcChillerIPLV(ElectricEIRChiller(EIRChillNum).Name, - TypeOf_Chiller_ElectricEIR, - ElectricEIRChiller(EIRChillNum).RefCap, - ElectricEIRChiller(EIRChillNum).RefCOP, - ElectricEIRChiller(EIRChillNum).CondenserType, - ElectricEIRChiller(EIRChillNum).ChillerCapFT, - ElectricEIRChiller(EIRChillNum).ChillerEIRFT, - ElectricEIRChiller(EIRChillNum).ChillerEIRFPLR, - ElectricEIRChiller(EIRChillNum).MinUnloadRat, - IPLV); - ChillerIPLVFlagArr(EIRChillNum) = false; + StandardRatings::CalcChillerIPLV(this->Name, + DataPlant::TypeOf_Chiller_ElectricEIR, + this->RefCap, + this->RefCOP, + this->CondenserType, + this->ChillerCapFTIndex, + this->ChillerEIRFTIndex, + this->ChillerEIRFPLRIndex, + this->MinUnloadRat, + IPLV); + this->IPLVFlag = false; } // create predefined report - equipName = ElectricEIRChiller(EIRChillNum).Name; - PreDefTableEntry(pdchMechType, equipName, "Chiller:Electric:EIR"); - PreDefTableEntry(pdchMechNomEff, equipName, ElectricEIRChiller(EIRChillNum).RefCOP); - PreDefTableEntry(pdchMechNomCap, equipName, ElectricEIRChiller(EIRChillNum).RefCap); + OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchMechType, this->Name, "Chiller:Electric:EIR"); + OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchMechNomEff, this->Name, this->RefCOP); + OutputReportPredefined::PreDefTableEntry(OutputReportPredefined::pdchMechNomCap, this->Name, this->RefCap); } if (ErrorsFound) { @@ -1859,12 +1559,7 @@ namespace ChillerElectricEIR { } } - void CalcElectricEIRChillerModel(int &EIRChillNum, // Chiller number - Real64 &MyLoad, // Operating load - bool const RunFlag, // TRUE when chiller operating - bool const EP_UNUSED(FirstIteration), // TRUE when first iteration of timestep - int const EquipFlowCtrl // Flow control mode for the equipment - ) + void ElectricEIRChillerSpecs::calculate(Real64 &MyLoad, bool const RunFlag) { // SUBROUTINE INFORMATION: // AUTHOR Richard Raustad, FSEC @@ -1883,284 +1578,199 @@ namespace ChillerElectricEIR { // REFERENCES: // 1. DOE-2 Engineers Manual, Version 2.1A, November 1982, LBL-11353 - // Using/Aliasing - using CurveManager::CurveValue; - using DataBranchAirLoopPlant::ControlType_SeriesActive; - using DataBranchAirLoopPlant::MassFlowTolerance; - using DataEnvironment::CurMnDy; - using DataEnvironment::EnvironmentName; - using DataGlobals::CurrentTime; - using DataGlobals::DoingSizing; - using DataGlobals::KickOffSimulation; - using DataGlobals::WarmupFlag; - using DataHVACGlobals::SmallLoad; - using DataHVACGlobals::SysTimeElapsed; - using DataHVACGlobals::TimeStepSys; - using DataPlant::CompSetPtBasedSchemeType; - using DataPlant::CriteriaType_MassFlowRate; - using DataPlant::DeltaTempTol; - using DataPlant::DualSetPointDeadBand; - using DataPlant::PlantLoop; - using DataPlant::SimPlantEquipTypes; - using DataPlant::SingleSetPoint; - using DataPlant::TypeOf_Chiller_ElectricEIR; - using FaultsManager::FaultsChillerFouling; - using FaultsManager::FaultsChillerSWTSensor; - using General::CreateSysTimeIntervalString; - using General::RoundSigDigits; - using PlantUtilities::PullCompInterconnectTrigger; - using PlantUtilities::SetComponentFlowRate; - using Psychrometrics::PsyWFnTdbTwbPb; - - // Locals - // SUBROUTINE PARAMETER DEFINITIONS: - static ObjexxFCL::gio::Fmt OutputFormat("(F6.2)"); static std::string const RoutineName("CalcElectricEIRChillerModel"); - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 FRAC; // Chiller cycling ratio - Real64 MinPartLoadRat; // Min allowed operating fraction of full load - Real64 MinUnloadRat; // Min allowed unloading fraction of full load - Real64 MaxPartLoadRat; // Max allowed operating fraction of full load - Real64 EvapInletTemp; // Evaporator inlet temperature [C] - Real64 CondInletTemp; // Condenser inlet temperature [C] Real64 EvapOutletTempSetPoint(0.0); // Evaporator outlet temperature setpoint [C] - Real64 AvailChillerCap; // Chiller available capacity at current operating conditions [W] - Real64 ChillerRefCap; // Chiller reference capacity Real64 EvapDeltaTemp(0.0); // Evaporator temperature difference [C] - Real64 ReferenceCOP; // Reference coefficient of performance, from user input - Real64 PartLoadRat; // Operating part load ratio - Real64 TempLowLimitEout; // Evaporator low temp. limit cut off [C] - Real64 EvapMassFlowRateMax; // Max reference evaporator mass flow rate converted from volume flow rate [kg/s] - int EvapInletNode; // Evaporator inlet node number - int EvapOutletNode; // Evaporator outlet node number - int CondInletNode; // Condenser inlet node number - int CondOutletNode; // Condenser outlet node number Real64 TempLoad(0.0); // Actual load to be met by chiller. This value is compared to MyLoad // and reset when necessary since this chiller can cycle, the load passed // should be the actual load. Instead the minimum PLR * RefCap is // passed in. [W] - int PlantLoopNum; // Plant loop which contains the current chiller - int LoopSideNum; // Plant loop side which contains the current chiller (usually supply side) - int BranchNum; - int CompNum; - static Real64 TimeStepSysLast(0.0); // last system time step (used to check for downshifting) - Real64 CurrentEndTime; // end time of time step for current simulation time step - static Real64 CurrentEndTimeLast(0.0); // end time of time step for last simulation time step - static std::string OutputChar; // character string for warning messages - Real64 Cp; // local fluid specific heat - Real64 RhoAir; // air density [kg/m3] + Real64 CurrentEndTime; // end time of time step for current simulation time step + static std::string OutputChar; // character string for warning messages // Set module level inlet and outlet nodes and initialize other local variables - ChillerPartLoadRatio = 0.0; - ChillerCyclingRatio = 0.0; - ChillerFalseLoadRate = 0.0; - EvapMassFlowRate = 0.0; - CondMassFlowRate = 0.0; - Power = 0.0; - QCondenser = 0.0; - QEvaporator = 0.0; - QHeatRecovered = 0.0; - CondenserFanPower = 0.0; - EvapWaterConsumpRate = 0.0; - EvapInletNode = ElectricEIRChiller(EIRChillNum).EvapInletNodeNum; - EvapOutletNode = ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum; - CondInletNode = ElectricEIRChiller(EIRChillNum).CondInletNodeNum; - CondOutletNode = ElectricEIRChiller(EIRChillNum).CondOutletNodeNum; - PlantLoopNum = ElectricEIRChiller(EIRChillNum).CWLoopNum; - LoopSideNum = ElectricEIRChiller(EIRChillNum).CWLoopSideNum; - BranchNum = ElectricEIRChiller(EIRChillNum).CWBranchNum; - CompNum = ElectricEIRChiller(EIRChillNum).CWCompNum; - EvapInletTemp = Node(EvapInletNode).Temp; - FRAC = 1.0; + this->CondMassFlowRate = 0.0; + Real64 FRAC = 1.0; // Chiller cycling ratio // Set performance curve outputs to 0.0 when chiller is off - ChillerCapFT = 0.0; - ChillerEIRFT = 0.0; - ChillerEIRFPLR = 0.0; + this->ChillerCapFT = 0.0; + this->ChillerEIRFT = 0.0; + this->ChillerEIRFPLR = 0.0; // calculate end time of current time step - CurrentEndTime = CurrentTime + SysTimeElapsed; + CurrentEndTime = DataGlobals::CurrentTime + DataHVACGlobals::SysTimeElapsed; // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. - if (CurrentEndTime > CurrentEndTimeLast && TimeStepSys >= TimeStepSysLast) { - if (ElectricEIRChiller(EIRChillNum).PrintMessage) { - ++ElectricEIRChiller(EIRChillNum).MsgErrorCount; + if (CurrentEndTime > this->CurrentEndTimeLast && DataHVACGlobals::TimeStepSys >= this->TimeStepSysLast) { + if (this->PrintMessage) { + ++this->MsgErrorCount; // Show single warning and pass additional info to ShowRecurringWarningErrorAtEnd - if (ElectricEIRChiller(EIRChillNum).MsgErrorCount < 2) { - ShowWarningError(ElectricEIRChiller(EIRChillNum).MsgBuffer1 + '.'); - ShowContinueError(ElectricEIRChiller(EIRChillNum).MsgBuffer2); + if (this->MsgErrorCount < 2) { + ShowWarningError(this->MsgBuffer1 + '.'); + ShowContinueError(this->MsgBuffer2); } else { - ShowRecurringWarningErrorAtEnd(ElectricEIRChiller(EIRChillNum).MsgBuffer1 + " error continues.", - ElectricEIRChiller(EIRChillNum).ErrCount1, - ElectricEIRChiller(EIRChillNum).MsgDataLast, - ElectricEIRChiller(EIRChillNum).MsgDataLast, - _, - "[C]", - "[C]"); + ShowRecurringWarningErrorAtEnd( + this->MsgBuffer1 + " error continues.", this->ErrCount1, this->MsgDataLast, this->MsgDataLast, _, "[C]", "[C]"); } } } // save last system time step and last end time of current time step (used to determine if warning is valid) - TimeStepSysLast = TimeStepSys; - CurrentEndTimeLast = CurrentEndTime; + this->TimeStepSysLast = DataHVACGlobals::TimeStepSys; + this->CurrentEndTimeLast = CurrentEndTime; // If no loop demand or chiller OFF, return // If Chiller load is 0 or chiller is not running then leave the subroutine.Before leaving // if the component control is SERIESACTIVE we set the component flow to inlet flow so that // flow resolver will not shut down the branch if (MyLoad >= 0 || !RunFlag) { - if (EquipFlowCtrl == ControlType_SeriesActive || PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock == 1) { - EvapMassFlowRate = Node(EvapInletNode).MassFlowRate; - } - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - if (PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum) - .LoopSide(ElectricEIRChiller(EIRChillNum).CDLoopSideNum) - .Branch(ElectricEIRChiller(EIRChillNum).CDBranchNum) - .Comp(ElectricEIRChiller(EIRChillNum).CDCompNum) - .FlowCtrl == ControlType_SeriesActive) { - CondMassFlowRate = Node(CondInletNode).MassFlowRate; + if (this->EquipFlowCtrl == DataBranchAirLoopPlant::ControlType_SeriesActive || + DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock == 1) { + this->EvapMassFlowRate = DataLoopNode::Node(this->EvapInletNodeNum).MassFlowRate; + } + if (this->CondenserType == WaterCooled) { + if (DataPlant::PlantLoop(this->CDLoopNum).LoopSide(this->CDLoopSideNum).Branch(this->CDBranchNum).Comp(this->CDCompNum).FlowCtrl == + DataBranchAirLoopPlant::ControlType_SeriesActive) { + this->CondMassFlowRate = DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate; } } - if (ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { - CalcBasinHeaterPower(ElectricEIRChiller(EIRChillNum).BasinHeaterPowerFTempDiff, - ElectricEIRChiller(EIRChillNum).BasinHeaterSchedulePtr, - ElectricEIRChiller(EIRChillNum).BasinHeaterSetPointTemp, - BasinHeaterPower); + if (this->CondenserType == EvapCooled) { + CalcBasinHeaterPower( + this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } - ElectricEIRChiller(EIRChillNum).PrintMessage = false; + this->PrintMessage = false; return; } // initialize outlet air humidity ratio of air or evap cooled chillers - CondOutletHumRat = Node(CondInletNode).HumRat; + this->CondOutletHumRat = DataLoopNode::Node(this->CondInletNodeNum).HumRat; - if (ElectricEIRChiller(EIRChillNum).CondenserType == AirCooled) { // Condenser inlet temp = outdoor temp - // Node(CondInletNode)%Temp = OutDryBulbTemp - Node(CondInletNode).Temp = Node(CondInletNode).OutAirDryBulb; + if (this->CondenserType == AirCooled) { // Condenser inlet temp = outdoor temp + DataLoopNode::Node(this->CondInletNodeNum).Temp = DataLoopNode::Node(this->CondInletNodeNum).OutAirDryBulb; // Warn user if entering condenser dry-bulb temperature falls below 0 C - if (Node(CondInletNode).Temp < 0.0 && std::abs(MyLoad) > 0 && RunFlag && !WarmupFlag) { - ElectricEIRChiller(EIRChillNum).PrintMessage = true; - ObjexxFCL::gio::write(OutputChar, OutputFormat) << Node(CondInletNode).Temp; - ElectricEIRChiller(EIRChillNum).MsgBuffer1 = "ElectricEIRChillerModel - CHILLER:ELECTRIC:EIR \"" + - ElectricEIRChiller(EIRChillNum).Name + - "\" - Air Cooled Condenser Inlet Temperature below 0C"; - ElectricEIRChiller(EIRChillNum).MsgBuffer2 = "... Outdoor Dry-bulb Condition = " + OutputChar + - " C. Occurrence info = " + EnvironmentName + ", " + CurMnDy + ' ' + - CreateSysTimeIntervalString(); - ElectricEIRChiller(EIRChillNum).MsgDataLast = Node(CondInletNode).Temp; + if (DataLoopNode::Node(this->CondInletNodeNum).Temp < 0.0 && std::abs(MyLoad) > 0 && RunFlag && !DataGlobals::WarmupFlag) { + this->PrintMessage = true; + ObjexxFCL::gio::write(OutputChar, OutputFormat) << DataLoopNode::Node(this->CondInletNodeNum).Temp; + this->MsgBuffer1 = + "ElectricEIRChillerModel - CHILLER:ELECTRIC:EIR \"" + this->Name + "\" - Air Cooled Condenser Inlet Temperature below 0C"; + this->MsgBuffer2 = "... Outdoor Dry-bulb Condition = " + OutputChar + " C. Occurrence info = " + DataEnvironment::EnvironmentName + + ", " + DataEnvironment::CurMnDy + ' ' + General::CreateSysTimeIntervalString(); + this->MsgDataLast = DataLoopNode::Node(this->CondInletNodeNum).Temp; } else { - ElectricEIRChiller(EIRChillNum).PrintMessage = false; + this->PrintMessage = false; } - } else if (ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { // Condenser inlet temp = (outdoor wet bulb) - // Node(CondInletNode)%Temp = OutWetBulbTemp - Node(CondInletNode).Temp = Node(CondInletNode).OutAirWetBulb; + } else if (this->CondenserType == EvapCooled) { // Condenser inlet temp = (outdoor wet bulb) + DataLoopNode::Node(this->CondInletNodeNum).Temp = DataLoopNode::Node(this->CondInletNodeNum).OutAirWetBulb; // line above assumes evaporation pushes condenser inlet air humidity ratio to saturation - CondOutletHumRat = PsyWFnTdbTwbPb(Node(CondInletNode).Temp, Node(CondInletNode).Temp, Node(CondInletNode).Press); + this->CondOutletHumRat = Psychrometrics::PsyWFnTdbTwbPb(DataLoopNode::Node(this->CondInletNodeNum).Temp, + DataLoopNode::Node(this->CondInletNodeNum).Temp, + DataLoopNode::Node(this->CondInletNodeNum).Press); // Warn user if evap condenser wet-bulb temperature falls below 10 C - if (Node(CondInletNode).Temp < 10.0 && std::abs(MyLoad) > 0 && RunFlag && !WarmupFlag) { - ElectricEIRChiller(EIRChillNum).PrintMessage = true; - ObjexxFCL::gio::write(OutputChar, OutputFormat) << Node(CondInletNode).Temp; - ElectricEIRChiller(EIRChillNum).MsgBuffer1 = "ElectricEIRChillerModel - CHILLER:ELECTRIC:EIR \"" + - ElectricEIRChiller(EIRChillNum).Name + - "\" - Air Cooled Condenser Inlet Temperature below 10C"; - ElectricEIRChiller(EIRChillNum).MsgBuffer2 = "... Outdoor Wet-bulb Condition = " + OutputChar + - " C. Occurrence info = " + EnvironmentName + ", " + CurMnDy + ' ' + - CreateSysTimeIntervalString(); - ElectricEIRChiller(EIRChillNum).MsgDataLast = Node(CondInletNode).Temp; + if (DataLoopNode::Node(this->CondInletNodeNum).Temp < 10.0 && std::abs(MyLoad) > 0 && RunFlag && !DataGlobals::WarmupFlag) { + this->PrintMessage = true; + ObjexxFCL::gio::write(OutputChar, OutputFormat) << DataLoopNode::Node(this->CondInletNodeNum).Temp; + this->MsgBuffer1 = + "ElectricEIRChillerModel - CHILLER:ELECTRIC:EIR \"" + this->Name + "\" - Air Cooled Condenser Inlet Temperature below 10C"; + this->MsgBuffer2 = "... Outdoor Wet-bulb Condition = " + OutputChar + " C. Occurrence info = " + DataEnvironment::EnvironmentName + + ", " + DataEnvironment::CurMnDy + ' ' + General::CreateSysTimeIntervalString(); + this->MsgDataLast = DataLoopNode::Node(this->CondInletNodeNum).Temp; } else { - ElectricEIRChiller(EIRChillNum).PrintMessage = false; + this->PrintMessage = false; } } // End of the Air Cooled/Evap Cooled Logic block // If not air or evap cooled then set to the condenser node that is attached to a cooling tower - CondInletTemp = Node(CondInletNode).Temp; + Real64 condInletTemp = DataLoopNode::Node(this->CondInletNodeNum).Temp; // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) - MinPartLoadRat = ElectricEIRChiller(EIRChillNum).MinPartLoadRat; - MaxPartLoadRat = ElectricEIRChiller(EIRChillNum).MaxPartLoadRat; - MinUnloadRat = ElectricEIRChiller(EIRChillNum).MinUnloadRat; - ChillerRefCap = ElectricEIRChiller(EIRChillNum).RefCap; - ReferenceCOP = ElectricEIRChiller(EIRChillNum).RefCOP; - EvapOutletTemp = Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).Temp; - TempLowLimitEout = ElectricEIRChiller(EIRChillNum).TempLowLimitEvapOut; - EvapMassFlowRateMax = ElectricEIRChiller(EIRChillNum).EvapMassFlowRateMax; + Real64 ChillerRefCap = this->RefCap; + Real64 ReferenceCOP = this->RefCOP; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).Temp; + Real64 TempLowLimitEout = this->TempLowLimitEvapOut; // If there is a fault of chiller fouling (zrp_Nov2016) - if (ElectricEIRChiller(EIRChillNum).FaultyChillerFoulingFlag && (!WarmupFlag) && (!DoingSizing) && (!KickOffSimulation)) { - int FaultIndex = ElectricEIRChiller(EIRChillNum).FaultyChillerFoulingIndex; + if (this->FaultyChillerFoulingFlag && (!DataGlobals::WarmupFlag) && (!DataGlobals::DoingSizing) && (!DataGlobals::KickOffSimulation)) { + int FaultIndex = this->FaultyChillerFoulingIndex; Real64 NomCap_ff = ChillerRefCap; Real64 ReferenceCOP_ff = ReferenceCOP; // calculate the Faulty Chiller Fouling Factor using fault information - ElectricEIRChiller(EIRChillNum).FaultyChillerFoulingFactor = FaultsChillerFouling(FaultIndex).CalFoulingFactor(); + this->FaultyChillerFoulingFactor = FaultsManager::FaultsChillerFouling(FaultIndex).CalFoulingFactor(); // update the Chiller nominal capacity and COP at faulty cases - ChillerRefCap = NomCap_ff * ElectricEIRChiller(EIRChillNum).FaultyChillerFoulingFactor; - ReferenceCOP = ReferenceCOP_ff * ElectricEIRChiller(EIRChillNum).FaultyChillerFoulingFactor; + ChillerRefCap = NomCap_ff * this->FaultyChillerFoulingFactor; + ReferenceCOP = ReferenceCOP_ff * this->FaultyChillerFoulingFactor; } // Set mass flow rates - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - CondMassFlowRate = ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax; - SetComponentFlowRate(CondMassFlowRate, - CondInletNode, - CondOutletNode, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - ElectricEIRChiller(EIRChillNum).CDBranchNum, - ElectricEIRChiller(EIRChillNum).CDCompNum); - PullCompInterconnectTrigger(ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum, - ElectricEIRChiller(EIRChillNum).CondMassFlowIndex, - ElectricEIRChiller(EIRChillNum).CDLoopNum, - ElectricEIRChiller(EIRChillNum).CDLoopSideNum, - CriteriaType_MassFlowRate, - CondMassFlowRate); - - if (CondMassFlowRate < MassFlowTolerance) { - if (EvapMassFlowRate < MassFlowTolerance) { - // Use SetComponentFlowRate to decide actual flow - SetComponentFlowRate(EvapMassFlowRate, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); + if (this->CondenserType == WaterCooled) { + this->CondMassFlowRate = this->CondMassFlowRateMax; + PlantUtilities::SetComponentFlowRate(this->CondMassFlowRate, + this->CondInletNodeNum, + this->CondOutletNodeNum, + this->CDLoopNum, + this->CDLoopSideNum, + this->CDBranchNum, + this->CDCompNum); + PlantUtilities::PullCompInterconnectTrigger(this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum, + this->CondMassFlowIndex, + this->CDLoopNum, + this->CDLoopSideNum, + DataPlant::CriteriaType_MassFlowRate, + this->CondMassFlowRate); + + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + if (this->EvapMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + // Use PlantUtilities::SetComponentFlowRate to decide actual flow + PlantUtilities::SetComponentFlowRate(this->EvapMassFlowRate, + this->EvapInletNodeNum, + this->EvapOutletNodeNum, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum); } return; } } { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - if ((ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated) || - (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType == CompSetPtBasedSchemeType) || - (Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPoint != SensedNodeFlagValue)) { + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->CWLoopNum).LoopDemandCalcScheme); + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + if ((this->FlowMode == LeavingSetPointModulated) || + (DataPlant::PlantLoop(this->CWLoopNum) + .LoopSide(this->CWLoopSideNum) + .Branch(this->CWBranchNum) + .Comp(this->CWCompNum) + .CurOpSchemeType == DataPlant::CompSetPtBasedSchemeType) || + (DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint != DataLoopNode::SensedNodeFlagValue)) { // there will be a valid setpoint on outlet - EvapOutletTempSetPoint = Node(EvapOutletNode).TempSetPoint; + EvapOutletTempSetPoint = DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint; } else { // use plant loop overall setpoint - EvapOutletTempSetPoint = Node(PlantLoop(PlantLoopNum).TempSetPointNodeNum).TempSetPoint; + EvapOutletTempSetPoint = DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPoint; } - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - if ((ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated) || - (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType == CompSetPtBasedSchemeType) || - (Node(ElectricEIRChiller(EIRChillNum).EvapOutletNodeNum).TempSetPointHi != SensedNodeFlagValue)) { + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + if ((this->FlowMode == LeavingSetPointModulated) || + (DataPlant::PlantLoop(this->CWLoopNum) + .LoopSide(this->CWLoopSideNum) + .Branch(this->CWBranchNum) + .Comp(this->CWCompNum) + .CurOpSchemeType == DataPlant::CompSetPtBasedSchemeType) || + (DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi != DataLoopNode::SensedNodeFlagValue)) { // there will be a valid setpoint on outlet - EvapOutletTempSetPoint = Node(EvapOutletNode).TempSetPointHi; + EvapOutletTempSetPoint = DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi; } else { // use plant loop overall setpoint - EvapOutletTempSetPoint = Node(PlantLoop(PlantLoopNum).TempSetPointNodeNum).TempSetPointHi; + EvapOutletTempSetPoint = DataLoopNode::Node(DataPlant::PlantLoop(this->CWLoopNum).TempSetPointNodeNum).TempSetPointHi; } } else { assert(false); @@ -2168,74 +1778,78 @@ namespace ChillerElectricEIR { } // If there is a fault of Chiller SWT Sensor (zrp_Jun2016) - if (ElectricEIRChiller(EIRChillNum).FaultyChillerSWTFlag && (!WarmupFlag) && (!DoingSizing) && (!KickOffSimulation)) { - int FaultIndex = ElectricEIRChiller(EIRChillNum).FaultyChillerSWTIndex; + if (this->FaultyChillerSWTFlag && (!DataGlobals::WarmupFlag) && (!DataGlobals::DoingSizing) && (!DataGlobals::KickOffSimulation)) { + int FaultIndex = this->FaultyChillerSWTIndex; Real64 EvapOutletTempSetPoint_ff = EvapOutletTempSetPoint; // calculate the sensor offset using fault information - ElectricEIRChiller(EIRChillNum).FaultyChillerSWTOffset = FaultsChillerSWTSensor(FaultIndex).CalFaultOffsetAct(); + this->FaultyChillerSWTOffset = FaultsManager::FaultsChillerSWTSensor(FaultIndex).CalFaultOffsetAct(); // update the EvapOutletTempSetPoint EvapOutletTempSetPoint = - max(ElectricEIRChiller(EIRChillNum).TempLowLimitEvapOut, - min(Node(EvapInletNode).Temp, EvapOutletTempSetPoint_ff - ElectricEIRChiller(EIRChillNum).FaultyChillerSWTOffset)); - ElectricEIRChiller(EIRChillNum).FaultyChillerSWTOffset = EvapOutletTempSetPoint_ff - EvapOutletTempSetPoint; + max(this->TempLowLimitEvapOut, + min(DataLoopNode::Node(this->EvapInletNodeNum).Temp, EvapOutletTempSetPoint_ff - this->FaultyChillerSWTOffset)); + this->FaultyChillerSWTOffset = EvapOutletTempSetPoint_ff - EvapOutletTempSetPoint; } // correct temperature if using heat recovery // use report values for latest valid calculation, lagged somewhat - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) { - if ((ElectricEIRChillerReport(EIRChillNum).QHeatRecovery + ElectricEIRChillerReport(EIRChillNum).QCond) > 0.0) { // protect div by zero - AvgCondSinkTemp = (ElectricEIRChillerReport(EIRChillNum).QHeatRecovery * ElectricEIRChillerReport(EIRChillNum).HeatRecInletTemp + - ElectricEIRChillerReport(EIRChillNum).QCond * ElectricEIRChillerReport(EIRChillNum).CondInletTemp) / - (ElectricEIRChillerReport(EIRChillNum).QHeatRecovery + ElectricEIRChillerReport(EIRChillNum).QCond); + Real64 AvgCondSinkTemp; + if (this->HeatRecActive) { + if ((this->QHeatRecovered + this->QCondenser) > 0.0) { // protect div by zero + AvgCondSinkTemp = (this->QHeatRecovered * this->HeatRecInletTemp + this->QCondenser * this->CondInletTemp) / + (this->QHeatRecovered + this->QCondenser); } else { - AvgCondSinkTemp = CondInletTemp; + AvgCondSinkTemp = condInletTemp; } } else { - AvgCondSinkTemp = CondInletTemp; + AvgCondSinkTemp = condInletTemp; } // Get capacity curve info with respect to CW setpoint and entering condenser water temps - ChillerCapFT = CurveValue(ElectricEIRChiller(EIRChillNum).ChillerCapFT, EvapOutletTempSetPoint, AvgCondSinkTemp); - - if (ChillerCapFT < 0) { - if (ElectricEIRChiller(EIRChillNum).ChillerCapFTError < 1 && PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerCapFTError; - ShowWarningError("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + "\":"); - ShowContinueError(" Chiller Capacity as a Function of Temperature curve output is negative (" + RoundSigDigits(ChillerCapFT, 3) + - ")."); - ShowContinueError(" Negative value occurs using an Evaporator Outlet Temp of " + RoundSigDigits(EvapOutletTempSetPoint, 1) + - " and a Condenser Inlet Temp of " + RoundSigDigits(CondInletTemp, 1) + '.'); + this->ChillerCapFT = CurveManager::CurveValue(this->ChillerCapFTIndex, EvapOutletTempSetPoint, AvgCondSinkTemp); + + if (this->ChillerCapFT < 0) { + if (this->ChillerCapFTError < 1 && DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && + !DataGlobals::WarmupFlag) { + ++this->ChillerCapFTError; + ShowWarningError("CHILLER:ELECTRIC:EIR \"" + this->Name + "\":"); + ShowContinueError(" Chiller Capacity as a Function of Temperature curve output is negative (" + + General::RoundSigDigits(this->ChillerCapFT, 3) + ")."); + ShowContinueError(" Negative value occurs using an Evaporator Outlet Temp of " + General::RoundSigDigits(EvapOutletTempSetPoint, 1) + + " and a Condenser Inlet Temp of " + General::RoundSigDigits(condInletTemp, 1) + '.'); ShowContinueErrorTimeStamp(" Resetting curve output to zero and continuing simulation."); - } else if (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerCapFTError; - ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + + } else if (DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && !DataGlobals::WarmupFlag) { + ++this->ChillerCapFTError; + ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + this->Name + "\": Chiller Capacity as a Function of Temperature curve output is negative warning continues...", - ElectricEIRChiller(EIRChillNum).ChillerCapFTErrorIndex, - ChillerCapFT, - ChillerCapFT); + this->ChillerCapFTErrorIndex, + this->ChillerCapFT, + this->ChillerCapFT); } - ChillerCapFT = 0.0; + this->ChillerCapFT = 0.0; } // Available chiller capacity as a function of temperature - AvailChillerCap = ChillerRefCap * ChillerCapFT; + Real64 AvailChillerCap = ChillerRefCap * this->ChillerCapFT; // Only perform this check for temperature setpoint control - if (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType == CompSetPtBasedSchemeType) { + if (DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).CurOpSchemeType == + DataPlant::CompSetPtBasedSchemeType) { // Calculate water side load - Cp = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidName, - Node(EvapInletNode).Temp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidIndex, - RoutineName); - EvapMassFlowRate = Node(EvapInletNode).MassFlowRate; + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(DataPlant::PlantLoop(this->CWLoopNum).FluidName, + DataLoopNode::Node(this->EvapInletNodeNum).Temp, + DataPlant::PlantLoop(this->CWLoopNum).FluidIndex, + RoutineName); + this->EvapMassFlowRate = DataLoopNode::Node(this->EvapInletNodeNum).MassFlowRate; { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - TempLoad = EvapMassFlowRate * Cp * (Node(EvapInletNode).Temp - Node(EvapOutletNode).TempSetPoint); - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - TempLoad = EvapMassFlowRate * Cp * (Node(EvapInletNode).Temp - Node(EvapOutletNode).TempSetPointHi); + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->CWLoopNum).LoopDemandCalcScheme); + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + TempLoad = this->EvapMassFlowRate * Cp * + (DataLoopNode::Node(this->EvapInletNodeNum).Temp - DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint); + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + TempLoad = this->EvapMassFlowRate * Cp * + (DataLoopNode::Node(this->EvapInletNodeNum).Temp - DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi); } else { assert(false); } @@ -2249,55 +1863,57 @@ namespace ChillerElectricEIR { } // Part load ratio based on load and available chiller capacity, cap at max part load ratio + Real64 PartLoadRat; // Operating part load ratio if (AvailChillerCap > 0) { - PartLoadRat = max(0.0, min(std::abs(MyLoad) / AvailChillerCap, MaxPartLoadRat)); + PartLoadRat = max(0.0, min(std::abs(MyLoad) / AvailChillerCap, this->MaxPartLoadRat)); } else { PartLoadRat = 0.0; } - Cp = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidName, - Node(EvapInletNode).Temp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).FluidIndex, - RoutineName); + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(DataPlant::PlantLoop(this->CWLoopNum).FluidName, + DataLoopNode::Node(this->EvapInletNodeNum).Temp, + DataPlant::PlantLoop(this->CWLoopNum).FluidIndex, + RoutineName); - if (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType == CompSetPtBasedSchemeType) { - ElectricEIRChiller(EIRChillNum).PossibleSubcooling = false; + if (DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).Branch(this->CWBranchNum).Comp(this->CWCompNum).CurOpSchemeType == + DataPlant::CompSetPtBasedSchemeType) { + this->PossibleSubcooling = false; } else { - ElectricEIRChiller(EIRChillNum).PossibleSubcooling = true; + this->PossibleSubcooling = true; } // Set evaporator heat transfer rate - QEvaporator = AvailChillerCap * PartLoadRat; + this->QEvaporator = AvailChillerCap * PartLoadRat; - // Either set the flow to the Constant value or caluclate the flow for the variable volume - if ((ElectricEIRChiller(EIRChillNum).FlowMode == ConstantFlow) || (ElectricEIRChiller(EIRChillNum).FlowMode == NotModulated)) { + // Either set the flow to the Constant value or calculate the flow for the variable volume + if ((this->FlowMode == ConstantFlow) || (this->FlowMode == NotModulated)) { // Set the evaporator mass flow rate to design // Start by assuming max (design) flow - EvapMassFlowRate = EvapMassFlowRateMax; - // Use SetComponentFlowRate to decide actual flow - SetComponentFlowRate(EvapMassFlowRate, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); - if (EvapMassFlowRate != 0.0) { - EvapDeltaTemp = QEvaporator / EvapMassFlowRate / Cp; + this->EvapMassFlowRate = this->EvapMassFlowRateMax; + // Use PlantUtilities::SetComponentFlowRate to decide actual flow + PlantUtilities::SetComponentFlowRate(this->EvapMassFlowRate, + this->EvapInletNodeNum, + this->EvapOutletNodeNum, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum); + if (this->EvapMassFlowRate != 0.0) { + EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp; } else { EvapDeltaTemp = 0.0; } // Evaluate outlet temp based on delta - EvapOutletTemp = Node(EvapInletNode).Temp - EvapDeltaTemp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - EvapDeltaTemp; - } else if (ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated) { + } else if (this->FlowMode == LeavingSetPointModulated) { // Calculate the Delta Temp from the inlet temp to the chiller outlet setpoint { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - EvapDeltaTemp = Node(EvapInletNode).Temp - Node(EvapOutletNode).TempSetPoint; - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - EvapDeltaTemp = Node(EvapInletNode).Temp - Node(EvapOutletNode).TempSetPointHi; + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->CWLoopNum).LoopDemandCalcScheme); + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint; + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi; } else { assert(false); } @@ -2305,242 +1921,237 @@ namespace ChillerElectricEIR { if (EvapDeltaTemp != 0) { // Calculate desired flow to request based on load - EvapMassFlowRate = std::abs(QEvaporator / Cp / EvapDeltaTemp); - if ((EvapMassFlowRate - EvapMassFlowRateMax) > MassFlowTolerance) ElectricEIRChiller(EIRChillNum).PossibleSubcooling = true; + this->EvapMassFlowRate = std::abs(this->QEvaporator / Cp / EvapDeltaTemp); + if ((this->EvapMassFlowRate - this->EvapMassFlowRateMax) > DataBranchAirLoopPlant::MassFlowTolerance) this->PossibleSubcooling = true; // Check to see if the Maximum is exceeded, if so set to maximum - EvapMassFlowRate = min(EvapMassFlowRateMax, EvapMassFlowRate); - // Use SetComponentFlowRate to decide actual flow - SetComponentFlowRate(EvapMassFlowRate, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); + this->EvapMassFlowRate = min(this->EvapMassFlowRateMax, this->EvapMassFlowRate); + // Use PlantUtilities::SetComponentFlowRate to decide actual flow + PlantUtilities::SetComponentFlowRate(this->EvapMassFlowRate, + this->EvapInletNodeNum, + this->EvapOutletNodeNum, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum); // Should we recalculate this with the corrected setpoint? { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).CWLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - EvapOutletTemp = Node(EvapOutletNode).TempSetPoint; - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - EvapOutletTemp = Node(EvapOutletNode).TempSetPointHi; + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->CWLoopNum).LoopDemandCalcScheme); + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPoint; + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).TempSetPointHi; } } - QEvaporator = max(0.0, (EvapMassFlowRate * Cp * EvapDeltaTemp)); + this->QEvaporator = max(0.0, (this->EvapMassFlowRate * Cp * EvapDeltaTemp)); } else { // Try to request zero flow - EvapMassFlowRate = 0.0; - // Use SetComponentFlowRate to decide actual flow - SetComponentFlowRate(EvapMassFlowRate, - EvapInletNode, - EvapOutletNode, - ElectricEIRChiller(EIRChillNum).CWLoopNum, - ElectricEIRChiller(EIRChillNum).CWLoopSideNum, - ElectricEIRChiller(EIRChillNum).CWBranchNum, - ElectricEIRChiller(EIRChillNum).CWCompNum); + this->EvapMassFlowRate = 0.0; + // Use PlantUtilities::SetComponentFlowRate to decide actual flow + PlantUtilities::SetComponentFlowRate(this->EvapMassFlowRate, + this->EvapInletNodeNum, + this->EvapOutletNodeNum, + this->CWLoopNum, + this->CWLoopSideNum, + this->CWBranchNum, + this->CWCompNum); // No deltaT since component is not running - EvapOutletTemp = Node(EvapInletNode).Temp; - QEvaporator = 0.0; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + this->QEvaporator = 0.0; PartLoadRat = 0.0; - ChillerPartLoadRatio = PartLoadRat; + this->ChillerPartLoadRatio = PartLoadRat; // DSU? so what if the delta T is zero? On FlowLock==0, the inlet temp could = setpoint, right? - if (ElectricEIRChiller(EIRChillNum).DeltaTErrCount < 1 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).DeltaTErrCount; + if (this->DeltaTErrCount < 1 && !DataGlobals::WarmupFlag) { + ++this->DeltaTErrCount; ShowWarningError("Evaporator DeltaTemp = 0 in mass flow calculation (Tevapin = Tsetpoint)."); ShowContinueErrorTimeStamp(""); - } else if (!WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerCapFTError; - ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + + } else if (!DataGlobals::WarmupFlag) { + ++this->ChillerCapFTError; + ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + this->Name + "\": Evaporator DeltaTemp = 0 in mass flow calculation warning continues...", - ElectricEIRChiller(EIRChillNum).DeltaTErrCountIndex, + this->DeltaTErrCountIndex, EvapDeltaTemp, EvapDeltaTemp); } } } // End of Constant Variable Flow If Block - if (EvapMassFlowRate == 0.0) { + if (this->EvapMassFlowRate == 0.0) { MyLoad = 0.0; - if (ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { - CalcBasinHeaterPower(ElectricEIRChiller(EIRChillNum).BasinHeaterPowerFTempDiff, - ElectricEIRChiller(EIRChillNum).BasinHeaterSchedulePtr, - ElectricEIRChiller(EIRChillNum).BasinHeaterSetPointTemp, - BasinHeaterPower); + if (this->CondenserType == EvapCooled) { + CalcBasinHeaterPower( + this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } - ElectricEIRChiller(EIRChillNum).PrintMessage = false; + this->PrintMessage = false; return; } - if (ElectricEIRChiller(EIRChillNum).PossibleSubcooling) { - QEvaporator = std::abs(MyLoad); - EvapDeltaTemp = QEvaporator / EvapMassFlowRate / Cp; - EvapOutletTemp = Node(EvapInletNode).Temp - EvapDeltaTemp; + if (this->PossibleSubcooling) { + this->QEvaporator = std::abs(MyLoad); + EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - EvapDeltaTemp; } else { - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTempSetPoint; - QEvaporator = max(0.0, (EvapMassFlowRate * Cp * EvapDeltaTemp)); - EvapOutletTemp = EvapOutletTempSetPoint; + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - EvapOutletTempSetPoint; + this->QEvaporator = max(0.0, (this->EvapMassFlowRate * Cp * EvapDeltaTemp)); + this->EvapOutletTemp = EvapOutletTempSetPoint; } // Check that the Evap outlet temp honors both plant loop temp low limit and also the chiller low limit - if (EvapOutletTemp < TempLowLimitEout) { - if ((Node(EvapInletNode).Temp - TempLowLimitEout) > DeltaTempTol) { - EvapOutletTemp = TempLowLimitEout; - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTemp; - QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp; + if (this->EvapOutletTemp < TempLowLimitEout) { + if ((DataLoopNode::Node(this->EvapInletNodeNum).Temp - TempLowLimitEout) > DataPlant::DeltaTempTol) { + this->EvapOutletTemp = TempLowLimitEout; + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - this->EvapOutletTemp; + this->QEvaporator = this->EvapMassFlowRate * Cp * EvapDeltaTemp; } else { - EvapOutletTemp = Node(EvapInletNode).Temp; - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTemp; - QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - this->EvapOutletTemp; + this->QEvaporator = this->EvapMassFlowRate * Cp * EvapDeltaTemp; } } - if (EvapOutletTemp < Node(EvapOutletNode).TempMin) { - if ((Node(EvapInletNode).Temp - Node(EvapOutletNode).TempMin) > DeltaTempTol) { - EvapOutletTemp = Node(EvapOutletNode).TempMin; - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTemp; - QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp; + if (this->EvapOutletTemp < DataLoopNode::Node(this->EvapOutletNodeNum).TempMin) { + if ((DataLoopNode::Node(this->EvapInletNodeNum).Temp - DataLoopNode::Node(this->EvapOutletNodeNum).TempMin) > DataPlant::DeltaTempTol) { + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).TempMin; + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - this->EvapOutletTemp; + this->QEvaporator = this->EvapMassFlowRate * Cp * EvapDeltaTemp; } else { - EvapOutletTemp = Node(EvapInletNode).Temp; - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTemp; - QEvaporator = EvapMassFlowRate * Cp * EvapDeltaTemp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + EvapDeltaTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - this->EvapOutletTemp; + this->QEvaporator = this->EvapMassFlowRate * Cp * EvapDeltaTemp; } } // If load exceeds the distributed load set to the distributed load - if (QEvaporator > std::abs(MyLoad)) { - if (EvapMassFlowRate > MassFlowTolerance) { - QEvaporator = std::abs(MyLoad); - EvapDeltaTemp = QEvaporator / EvapMassFlowRate / Cp; - EvapOutletTemp = Node(EvapInletNode).Temp - EvapDeltaTemp; + if (this->QEvaporator > std::abs(MyLoad)) { + if (this->EvapMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { + this->QEvaporator = std::abs(MyLoad); + EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - EvapDeltaTemp; } else { - QEvaporator = 0.0; - EvapOutletTemp = Node(EvapInletNode).Temp; + this->QEvaporator = 0.0; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; } } // If there is a fault of Chiller SWT Sensor (zrp_Jun2016) - if (ElectricEIRChiller(EIRChillNum).FaultyChillerSWTFlag && (!WarmupFlag) && (!DoingSizing) && (!KickOffSimulation) && - (EvapMassFlowRate > 0)) { + if (this->FaultyChillerSWTFlag && (!DataGlobals::WarmupFlag) && (!DataGlobals::DoingSizing) && (!DataGlobals::KickOffSimulation) && + (this->EvapMassFlowRate > 0)) { // calculate directly affected variables at faulty case: EvapOutletTemp, EvapMassFlowRate, QEvaporator - int FaultIndex = ElectricEIRChiller(EIRChillNum).FaultyChillerSWTIndex; - bool VarFlowFlag = (ElectricEIRChiller(EIRChillNum).FlowMode == LeavingSetPointModulated); - FaultsChillerSWTSensor(FaultIndex) + int FaultIndex = this->FaultyChillerSWTIndex; + bool VarFlowFlag = (this->FlowMode == LeavingSetPointModulated); + FaultsManager::FaultsChillerSWTSensor(FaultIndex) .CalFaultChillerSWT(VarFlowFlag, - ElectricEIRChiller(EIRChillNum).FaultyChillerSWTOffset, + this->FaultyChillerSWTOffset, Cp, - Node(EvapInletNode).Temp, - EvapOutletTemp, - EvapMassFlowRate, - QEvaporator); + DataLoopNode::Node(this->EvapInletNodeNum).Temp, + this->EvapOutletTemp, + this->EvapMassFlowRate, + this->QEvaporator); // update corresponding variables at faulty case - PartLoadRat = (AvailChillerCap > 0.0) ? (QEvaporator / AvailChillerCap) : 0.0; - PartLoadRat = max(0.0, min(PartLoadRat, MaxPartLoadRat)); - ChillerPartLoadRatio = PartLoadRat; - EvapDeltaTemp = Node(EvapInletNode).Temp - EvapOutletTemp; + PartLoadRat = (AvailChillerCap > 0.0) ? (this->QEvaporator / AvailChillerCap) : 0.0; + PartLoadRat = max(0.0, min(PartLoadRat, this->MaxPartLoadRat)); + this->ChillerPartLoadRatio = PartLoadRat; } // Checks QEvaporator on the basis of the machine limits. - if (QEvaporator > (AvailChillerCap * MaxPartLoadRat)) { - if (EvapMassFlowRate > MassFlowTolerance) { - QEvaporator = AvailChillerCap * MaxPartLoadRat; - EvapDeltaTemp = QEvaporator / EvapMassFlowRate / Cp; + if (this->QEvaporator > (AvailChillerCap * this->MaxPartLoadRat)) { + if (this->EvapMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { + this->QEvaporator = AvailChillerCap * this->MaxPartLoadRat; + EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp; // evaporator outlet temperature is allowed to float upwards (recalculate AvailChillerCap? iterate?) - EvapOutletTemp = Node(EvapInletNode).Temp - EvapDeltaTemp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp - EvapDeltaTemp; } else { - QEvaporator = 0.0; - EvapOutletTemp = Node(EvapInletNode).Temp; + this->QEvaporator = 0.0; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; } } if (AvailChillerCap > 0.0) { - PartLoadRat = max(0.0, min((QEvaporator / AvailChillerCap), MaxPartLoadRat)); + PartLoadRat = max(0.0, min((this->QEvaporator / AvailChillerCap), this->MaxPartLoadRat)); } else { PartLoadRat = 0.0; } // Chiller cycles below minimum part load ratio, FRAC = amount of time chiller is ON during this time step - if (PartLoadRat < MinPartLoadRat) FRAC = min(1.0, (PartLoadRat / MinPartLoadRat)); + if (PartLoadRat < this->MinPartLoadRat) FRAC = min(1.0, (PartLoadRat / this->MinPartLoadRat)); // set the module level variable used for reporting FRAC - ChillerCyclingRatio = FRAC; + this->ChillerCyclingRatio = FRAC; // Chiller is false loading below PLR = minimum unloading ratio, find PLR used for energy calculation if (AvailChillerCap > 0.0) { - PartLoadRat = max(PartLoadRat, MinUnloadRat); + PartLoadRat = max(PartLoadRat, this->MinUnloadRat); } else { PartLoadRat = 0.0; } // set the module level variable used for reporting PLR - ChillerPartLoadRatio = PartLoadRat; + this->ChillerPartLoadRatio = PartLoadRat; // calculate the load due to false loading on chiller over and above water side load - ChillerFalseLoadRate = (AvailChillerCap * PartLoadRat * FRAC) - QEvaporator; - if (ChillerFalseLoadRate < SmallLoad) { - ChillerFalseLoadRate = 0.0; + this->ChillerFalseLoadRate = (AvailChillerCap * PartLoadRat * FRAC) - this->QEvaporator; + if (this->ChillerFalseLoadRate < DataHVACGlobals::SmallLoad) { + this->ChillerFalseLoadRate = 0.0; } - if (QEvaporator == 0.0 && ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { - CalcBasinHeaterPower(ElectricEIRChiller(EIRChillNum).BasinHeaterPowerFTempDiff, - ElectricEIRChiller(EIRChillNum).BasinHeaterSchedulePtr, - ElectricEIRChiller(EIRChillNum).BasinHeaterSetPointTemp, - BasinHeaterPower); + if (this->QEvaporator == 0.0 && this->CondenserType == EvapCooled) { + CalcBasinHeaterPower( + this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } - ChillerEIRFT = CurveValue(ElectricEIRChiller(EIRChillNum).ChillerEIRFT, EvapOutletTemp, AvgCondSinkTemp); - if (ChillerEIRFT < 0.0) { - if (ElectricEIRChiller(EIRChillNum).ChillerEIRFTError < 1 && PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerEIRFTError; - ShowWarningError("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + "\":"); - ShowContinueError(" Chiller EIR as a Function of Temperature curve output is negative (" + RoundSigDigits(ChillerEIRFT, 3) + ")."); - ShowContinueError(" Negative value occurs using an Evaporator Outlet Temp of " + RoundSigDigits(EvapOutletTemp, 1) + - " and a Condenser Inlet Temp of " + RoundSigDigits(CondInletTemp, 1) + '.'); + this->ChillerEIRFT = CurveManager::CurveValue(this->ChillerEIRFTIndex, this->EvapOutletTemp, AvgCondSinkTemp); + if (this->ChillerEIRFT < 0.0) { + if (this->ChillerEIRFTError < 1 && DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && + !DataGlobals::WarmupFlag) { + ++this->ChillerEIRFTError; + ShowWarningError("CHILLER:ELECTRIC:EIR \"" + this->Name + "\":"); + ShowContinueError(" Chiller EIR as a Function of Temperature curve output is negative (" + + General::RoundSigDigits(this->ChillerEIRFT, 3) + ")."); + ShowContinueError(" Negative value occurs using an Evaporator Outlet Temp of " + General::RoundSigDigits(this->EvapOutletTemp, 1) + + " and a Condenser Inlet Temp of " + General::RoundSigDigits(condInletTemp, 1) + '.'); ShowContinueErrorTimeStamp(" Resetting curve output to zero and continuing simulation."); - } else if (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerEIRFTError; - ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + + } else if (DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && !DataGlobals::WarmupFlag) { + ++this->ChillerEIRFTError; + ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + this->Name + "\": Chiller EIR as a Function of Temperature curve output is negative warning continues...", - ElectricEIRChiller(EIRChillNum).ChillerEIRFTErrorIndex, - ChillerEIRFT, - ChillerEIRFT); + this->ChillerEIRFTErrorIndex, + this->ChillerEIRFT, + this->ChillerEIRFT); } - ChillerEIRFT = 0.0; + this->ChillerEIRFT = 0.0; } - ChillerEIRFPLR = CurveValue(ElectricEIRChiller(EIRChillNum).ChillerEIRFPLR, PartLoadRat); - if (ChillerEIRFPLR < 0.0) { - if (ElectricEIRChiller(EIRChillNum).ChillerEIRFPLRError < 1 && PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && - !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerEIRFPLRError; - ShowWarningError("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + "\":"); - ShowContinueError(" Chiller EIR as a function of PLR curve output is negative (" + RoundSigDigits(ChillerEIRFPLR, 3) + ")."); - ShowContinueError(" Negative value occurs using a part-load ratio of " + RoundSigDigits(PartLoadRat, 3) + '.'); + this->ChillerEIRFPLR = CurveManager::CurveValue(this->ChillerEIRFPLRIndex, PartLoadRat); + if (this->ChillerEIRFPLR < 0.0) { + if (this->ChillerEIRFPLRError < 1 && DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && + !DataGlobals::WarmupFlag) { + ++this->ChillerEIRFPLRError; + ShowWarningError("CHILLER:ELECTRIC:EIR \"" + this->Name + "\":"); + ShowContinueError(" Chiller EIR as a function of PLR curve output is negative (" + General::RoundSigDigits(this->ChillerEIRFPLR, 3) + + ")."); + ShowContinueError(" Negative value occurs using a part-load ratio of " + General::RoundSigDigits(PartLoadRat, 3) + '.'); ShowContinueErrorTimeStamp(" Resetting curve output to zero and continuing simulation."); - } else if (PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != 0 && !WarmupFlag) { - ++ElectricEIRChiller(EIRChillNum).ChillerEIRFPLRError; - ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + ElectricEIRChiller(EIRChillNum).Name + + } else if (DataPlant::PlantLoop(this->CWLoopNum).LoopSide(this->CWLoopSideNum).FlowLock != 0 && !DataGlobals::WarmupFlag) { + ++this->ChillerEIRFPLRError; + ShowRecurringWarningErrorAtEnd("CHILLER:ELECTRIC:EIR \"" + this->Name + "\": Chiller EIR as a function of PLR curve output is negative warning continues...", - ElectricEIRChiller(EIRChillNum).ChillerEIRFPLRErrorIndex, - ChillerEIRFPLR, - ChillerEIRFPLR); + this->ChillerEIRFPLRErrorIndex, + this->ChillerEIRFPLR, + this->ChillerEIRFPLR); } - ChillerEIRFPLR = 0.0; + this->ChillerEIRFPLR = 0.0; } - Power = (AvailChillerCap / ReferenceCOP) * ChillerEIRFPLR * ChillerEIRFT * FRAC; + this->Power = (AvailChillerCap / ReferenceCOP) * this->ChillerEIRFPLR * this->ChillerEIRFT * FRAC; - QCondenser = Power * ElectricEIRChiller(EIRChillNum).CompPowerToCondenserFrac + QEvaporator + ChillerFalseLoadRate; + this->QCondenser = this->Power * this->CompPowerToCondenserFrac + this->QEvaporator + this->ChillerFalseLoadRate; - if (ElectricEIRChiller(EIRChillNum).CondenserType == WaterCooled) { - if (CondMassFlowRate > MassFlowTolerance) { + if (this->CondenserType == WaterCooled) { + if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) - EIRChillerHeatRecovery(EIRChillNum, QCondenser, CondMassFlowRate, CondInletTemp, QHeatRecovered); - Cp = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidName, - CondInletTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidIndex, - RoutineName); - - CondOutletTemp = QCondenser / CondMassFlowRate / Cp + CondInletTemp; + if (this->HeatRecActive) this->calcHeatRecovery(this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); + Cp = FluidProperties::GetSpecificHeatGlycol( + DataPlant::PlantLoop(this->CDLoopNum).FluidName, condInletTemp, DataPlant::PlantLoop(this->CDLoopNum).FluidIndex, RoutineName); + + this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / Cp + condInletTemp; } else { - ShowSevereError("CalcElectricEIRChillerModel: Condenser flow = 0, for ElectricEIRChiller=" + ElectricEIRChiller(EIRChillNum).Name); + ShowSevereError("CalcElectricEIRChillerModel: Condenser flow = 0, for ElectricEIRChiller=" + this->Name); ShowContinueErrorTimeStamp(""); // DSU? maybe this could be handled earlier, check if this component has a load and an evap flow rate // then if cond flow is zero, just make a request to the condenser, @@ -2549,43 +2160,43 @@ namespace ChillerElectricEIR { } } else { // Air Cooled or Evap Cooled - if (QCondenser > 0.0) { - CondMassFlowRate = ElectricEIRChiller(EIRChillNum).CondMassFlowRateMax * PartLoadRat; + if (this->QCondenser > 0.0) { + this->CondMassFlowRate = this->CondMassFlowRateMax * PartLoadRat; } else { - CondMassFlowRate = 0.0; + this->CondMassFlowRate = 0.0; } // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine - if (ElectricEIRChiller(EIRChillNum).HeatRecActive) - EIRChillerHeatRecovery(EIRChillNum, QCondenser, CondMassFlowRate, CondInletTemp, QHeatRecovered); + if (this->HeatRecActive) this->calcHeatRecovery(this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); - if (CondMassFlowRate > 0.0) { - Cp = Psychrometrics::PsyCpAirFnWTdb(Node(CondInletNode).HumRat, CondInletTemp); - CondOutletTemp = CondInletTemp + QCondenser / CondMassFlowRate / Cp; + if (this->CondMassFlowRate > 0.0) { + Cp = Psychrometrics::PsyCpAirFnWTdb(DataLoopNode::Node(this->CondInletNodeNum).HumRat, condInletTemp); + this->CondOutletTemp = condInletTemp + this->QCondenser / this->CondMassFlowRate / Cp; } else { - CondOutletTemp = CondInletTemp; + this->CondOutletTemp = condInletTemp; } - if (ElectricEIRChiller(EIRChillNum).CondenserType == EvapCooled) { - RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(DataEnvironment::StdBaroPress, CondInletTemp, Node(CondInletNode).HumRat, RoutineName); + if (this->CondenserType == EvapCooled) { + Real64 RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW( + DataEnvironment::StdBaroPress, condInletTemp, DataLoopNode::Node(this->CondInletNodeNum).HumRat, RoutineName); // CondMassFlowRate is already multiplied by PLR, convert to water use rate - EvapWaterConsumpRate = ((CondOutletHumRat - Node(CondInletNode).HumRat) * CondMassFlowRate) / RhoAir; + this->EvapWaterConsumpRate = + ((this->CondOutletHumRat - DataLoopNode::Node(this->CondInletNodeNum).HumRat) * this->CondMassFlowRate) / RhoAir; } } // Calculate condenser fan power - if (ChillerCapFT > 0.0) { - CondenserFanPower = ChillerRefCap * ElectricEIRChiller(EIRChillNum).CondenserFanPowerRatio * FRAC; + if (this->ChillerCapFT > 0.0) { + this->CondenserFanPower = ChillerRefCap * this->CondenserFanPowerRatio * FRAC; } else { - CondenserFanPower = 0.0; + this->CondenserFanPower = 0.0; } } - void EIRChillerHeatRecovery(int const EIRChillNum, // Number of the current electric EIR chiller being simulated - Real64 &QCond, // Current condenser load [W] - Real64 const CondMassFlow, // Current condenser mass flow [kg/s] - Real64 const CondInletTemp, // Current condenser inlet temp [C] - Real64 &QHeatRec // Amount of heat recovered [W] + void ElectricEIRChillerSpecs::calcHeatRecovery(Real64 &QCond, // Current condenser load [W] + Real64 const CondMassFlow, // Current condenser mass flow [kg/s] + Real64 const condInletTemp, // Current condenser inlet temp [C] + Real64 &QHeatRec // Amount of heat recovered [W] ) { // SUBROUTINE INFORMATION: @@ -2596,99 +2207,56 @@ namespace ChillerElectricEIR { // PURPOSE OF THIS SUBROUTINE: // Calculate the heat recovered from the chiller condenser - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using DataPlant::DualSetPointDeadBand; - using DataPlant::PlantLoop; - using DataPlant::SingleSetPoint; - using ScheduleManager::GetCurrentScheduleValue; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("EIRChillerHeatRecovery"); - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int CondInletNode; // Condenser inlet node number - int CondOutletNode; // Condenser outlet node number - int HeatRecInNode; // Node number of heat recovery water inlet node - int HeatRecOutNode; // Node number of heat recovery water outlet node - Real64 QTotal; // Total condenser heat [W] - Real64 HeatRecInletTemp; // Heat reclaim inlet temp [C] - Real64 HeatRecMassFlowRate; // Heat reclaim mass flow rate [m3/s] - Real64 TAvgIn; // Average inlet temperature of heat reclaim inlet and condenser inlet [C] - Real64 TAvgOut; // Average outlet temperature [C] - Real64 CpHeatRec; // Heat reclaim water inlet specific heat [J/kg-K] - Real64 CpCond; // Condenser water inlet specific heat [J/kg-K] - Real64 THeatRecSetPoint(0.0); // local value for heat recovery leaving setpoint [C] - Real64 QHeatRecToSetPoint; // load to heat recovery setpoint - Real64 HeatRecHighInletLimit; // local value for inlet limit for heat recovery [C] - - // Begin routine - HeatRecInNode = ElectricEIRChiller(EIRChillNum).HeatRecInletNodeNum; - HeatRecOutNode = ElectricEIRChiller(EIRChillNum).HeatRecOutletNodeNum; - CondInletNode = ElectricEIRChiller(EIRChillNum).CondInletNodeNum; - CondOutletNode = ElectricEIRChiller(EIRChillNum).CondOutletNodeNum; - // Inlet node to the heat recovery heat exchanger - HeatRecInletTemp = Node(HeatRecInNode).Temp; - HeatRecMassFlowRate = Node(HeatRecInNode).MassFlowRate; - - CpHeatRec = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).FluidName, - HeatRecInletTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).FluidIndex, - RoutineName); - CpCond = GetSpecificHeatGlycol(PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidName, - CondInletTemp, - PlantLoop(ElectricEIRChiller(EIRChillNum).CDLoopNum).FluidIndex, - RoutineName); + Real64 heatRecInletTemp = DataLoopNode::Node(this->HeatRecInletNodeNum).Temp; + Real64 HeatRecMassFlowRate = DataLoopNode::Node(this->HeatRecInletNodeNum).MassFlowRate; + + Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol( + DataPlant::PlantLoop(this->HRLoopNum).FluidName, heatRecInletTemp, DataPlant::PlantLoop(this->HRLoopNum).FluidIndex, RoutineName); + Real64 CpCond = FluidProperties::GetSpecificHeatGlycol( + DataPlant::PlantLoop(this->CDLoopNum).FluidName, condInletTemp, DataPlant::PlantLoop(this->CDLoopNum).FluidIndex, RoutineName); // Before we modify the QCondenser, the total or original value is transferred to QTot - QTotal = QCond; + Real64 QTotal = QCond; - if (ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum == 0) { // use original algorithm that blends temps - TAvgIn = (HeatRecMassFlowRate * CpHeatRec * HeatRecInletTemp + CondMassFlow * CpCond * CondInletTemp) / - (HeatRecMassFlowRate * CpHeatRec + CondMassFlow * CpCond); + if (this->HeatRecSetPointNodeNum == 0) { // use original algorithm that blends temps + Real64 TAvgIn = (HeatRecMassFlowRate * CpHeatRec * heatRecInletTemp + CondMassFlow * CpCond * condInletTemp) / + (HeatRecMassFlowRate * CpHeatRec + CondMassFlow * CpCond); - TAvgOut = QTotal / (HeatRecMassFlowRate * CpHeatRec + CondMassFlow * CpCond) + TAvgIn; + Real64 TAvgOut = QTotal / (HeatRecMassFlowRate * CpHeatRec + CondMassFlow * CpCond) + TAvgIn; - QHeatRec = HeatRecMassFlowRate * CpHeatRec * (TAvgOut - HeatRecInletTemp); + QHeatRec = HeatRecMassFlowRate * CpHeatRec * (TAvgOut - heatRecInletTemp); QHeatRec = max(QHeatRec, 0.0); // ensure non negative // check if heat flow too large for physical size of bundle - QHeatRec = min(QHeatRec, ElectricEIRChiller(EIRChillNum).HeatRecMaxCapacityLimit); - } else { // use new algorithm to meet setpoint + QHeatRec = min(QHeatRec, this->HeatRecMaxCapacityLimit); + } else { // use new algorithm to meet setpoint + Real64 THeatRecSetPoint(0.0); // local value for heat recovery leaving setpoint [C] { - auto const SELECT_CASE_var(PlantLoop(ElectricEIRChiller(EIRChillNum).HRLoopNum).LoopDemandCalcScheme); + auto const SELECT_CASE_var(DataPlant::PlantLoop(this->HRLoopNum).LoopDemandCalcScheme); - if (SELECT_CASE_var == SingleSetPoint) { - THeatRecSetPoint = Node(ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum).TempSetPoint; - } else if (SELECT_CASE_var == DualSetPointDeadBand) { - THeatRecSetPoint = Node(ElectricEIRChiller(EIRChillNum).HeatRecSetPointNodeNum).TempSetPointHi; + if (SELECT_CASE_var == DataPlant::SingleSetPoint) { + THeatRecSetPoint = DataLoopNode::Node(this->HeatRecSetPointNodeNum).TempSetPoint; + } else if (SELECT_CASE_var == DataPlant::DualSetPointDeadBand) { + THeatRecSetPoint = DataLoopNode::Node(this->HeatRecSetPointNodeNum).TempSetPointHi; } else { assert(false); } } - QHeatRecToSetPoint = HeatRecMassFlowRate * CpHeatRec * (THeatRecSetPoint - HeatRecInletTemp); + // load to heat recovery setpoint + Real64 QHeatRecToSetPoint = HeatRecMassFlowRate * CpHeatRec * (THeatRecSetPoint - heatRecInletTemp); QHeatRecToSetPoint = max(QHeatRecToSetPoint, 0.0); QHeatRec = min(QTotal, QHeatRecToSetPoint); // check if heat flow too large for physical size of bundle - QHeatRec = min(QHeatRec, ElectricEIRChiller(EIRChillNum).HeatRecMaxCapacityLimit); + QHeatRec = min(QHeatRec, this->HeatRecMaxCapacityLimit); } // check if limit on inlet is present and exceeded. - if (ElectricEIRChiller(EIRChillNum).HeatRecInletLimitSchedNum > 0) { - HeatRecHighInletLimit = GetCurrentScheduleValue(ElectricEIRChiller(EIRChillNum).HeatRecInletLimitSchedNum); - if (HeatRecInletTemp > HeatRecHighInletLimit) { // shut down heat recovery + if (this->HeatRecInletLimitSchedNum > 0) { + Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(this->HeatRecInletLimitSchedNum); + if (heatRecInletTemp > HeatRecHighInletLimit) { // shut down heat recovery QHeatRec = 0.0; } } @@ -2697,16 +2265,13 @@ namespace ChillerElectricEIR { // Calculate a new Heat Recovery Coil Outlet Temp if (HeatRecMassFlowRate > 0.0) { - HeatRecOutletTemp = QHeatRec / (HeatRecMassFlowRate * CpHeatRec) + HeatRecInletTemp; + this->HeatRecOutletTemp = QHeatRec / (HeatRecMassFlowRate * CpHeatRec) + heatRecInletTemp; } else { - HeatRecOutletTemp = HeatRecInletTemp; + this->HeatRecOutletTemp = heatRecInletTemp; } } - void UpdateElectricEIRChillerRecords(Real64 const MyLoad, // Current load [W] - bool const RunFlag, // TRUE if chiller operating - int const Num // Chiller number - ) + void ElectricEIRChillerSpecs::update(Real64 const MyLoad, bool const RunFlag) { // SUBROUTINE INFORMATION: @@ -2716,146 +2281,106 @@ namespace ChillerElectricEIR { // PURPOSE OF THIS SUBROUTINE: // Reporting - // Using/Aliasing - using DataBranchAirLoopPlant::MassFlowTolerance; - using DataGlobals::SecInHour; - using DataHVACGlobals::TimeStepSys; - using PlantUtilities::SafeCopyPlantNode; - using Psychrometrics::PsyHFnTdbW; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int EvapInletNode; // Evaporator inlet node number - int EvapOutletNode; // Evaporator outlet node number - int CondInletNode; // Condenser inlet node number - int CondOutletNode; // Condenser outlet node number - int HeatRecInNode; // Node number of heat recovery water inlet node - int HeatRecOutNode; // Node number of heat recovery water outlet node - Real64 ReportingConstant; // Number of seconds per HVAC system time step, to convert from W (J/s) to J - - ReportingConstant = TimeStepSys * SecInHour; - - EvapInletNode = ElectricEIRChiller(Num).EvapInletNodeNum; - EvapOutletNode = ElectricEIRChiller(Num).EvapOutletNodeNum; - CondInletNode = ElectricEIRChiller(Num).CondInletNodeNum; - CondOutletNode = ElectricEIRChiller(Num).CondOutletNodeNum; - HeatRecInNode = ElectricEIRChiller(Num).HeatRecInletNodeNum; - HeatRecOutNode = ElectricEIRChiller(Num).HeatRecOutletNodeNum; + // Number of seconds per HVAC system time step, to convert from W (J/s) to J + Real64 ReportingConstant = DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; if (MyLoad >= 0 || !RunFlag) { // Chiller not running so pass inlet states to outlet states // Set node conditions - Node(EvapOutletNode).Temp = Node(EvapInletNode).Temp; - Node(CondOutletNode).Temp = Node(CondInletNode).Temp; - if (ElectricEIRChiller(Num).CondenserType != WaterCooled) { - Node(CondOutletNode).HumRat = Node(CondInletNode).HumRat; - Node(CondOutletNode).Enthalpy = Node(CondInletNode).Enthalpy; - Node(CondInletNode).MassFlowRate = 0.0; - Node(CondOutletNode).MassFlowRate = 0.0; - } - - ElectricEIRChillerReport(Num).ChillerPartLoadRatio = 0.0; - ElectricEIRChillerReport(Num).ChillerCyclingRatio = 0.0; - ElectricEIRChillerReport(Num).ChillerFalseLoadRate = 0.0; - ElectricEIRChillerReport(Num).ChillerFalseLoad = 0.0; - ElectricEIRChillerReport(Num).Power = 0.0; - ElectricEIRChillerReport(Num).QEvap = 0.0; - ElectricEIRChillerReport(Num).QCond = 0.0; - ElectricEIRChillerReport(Num).Energy = 0.0; - ElectricEIRChillerReport(Num).EvapEnergy = 0.0; - ElectricEIRChillerReport(Num).CondEnergy = 0.0; - ElectricEIRChillerReport(Num).EvapInletTemp = Node(EvapInletNode).Temp; - ElectricEIRChillerReport(Num).CondInletTemp = Node(CondInletNode).Temp; - ElectricEIRChillerReport(Num).CondOutletTemp = Node(CondOutletNode).Temp; - ElectricEIRChillerReport(Num).EvapOutletTemp = Node(EvapOutletNode).Temp; - ElectricEIRChillerReport(Num).Evapmdot = EvapMassFlowRate; // could still be flow if in series - ElectricEIRChillerReport(Num).Condmdot = CondMassFlowRate; // could still be flow if in series - ElectricEIRChillerReport(Num).ActualCOP = 0.0; - ElectricEIRChillerReport(Num).CondenserFanPowerUse = 0.0; - ElectricEIRChillerReport(Num).CondenserFanEnergyConsumption = 0.0; - if (ElectricEIRChiller(Num).CondenserType == EvapCooled) { - ElectricEIRChillerReport(Num).BasinHeaterPower = BasinHeaterPower; - ElectricEIRChillerReport(Num).BasinHeaterConsumption = BasinHeaterPower * ReportingConstant; - ElectricEIRChillerReport(Num).EvapWaterConsump = 0.0; - } - - if (ElectricEIRChiller(Num).HeatRecActive) { - - SafeCopyPlantNode(HeatRecInNode, HeatRecOutNode); - - ElectricEIRChillerReport(Num).QHeatRecovery = 0.0; - ElectricEIRChillerReport(Num).EnergyHeatRecovery = 0.0; - ElectricEIRChillerReport(Num).HeatRecInletTemp = Node(HeatRecInNode).Temp; - ElectricEIRChillerReport(Num).HeatRecOutletTemp = Node(HeatRecOutNode).Temp; - ElectricEIRChillerReport(Num).HeatRecMassFlow = Node(HeatRecInNode).MassFlowRate; + DataLoopNode::Node(this->EvapOutletNodeNum).Temp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + DataLoopNode::Node(this->CondOutletNodeNum).Temp = DataLoopNode::Node(this->CondInletNodeNum).Temp; + if (this->CondenserType != WaterCooled) { + DataLoopNode::Node(this->CondOutletNodeNum).HumRat = DataLoopNode::Node(this->CondInletNodeNum).HumRat; + DataLoopNode::Node(this->CondOutletNodeNum).Enthalpy = DataLoopNode::Node(this->CondInletNodeNum).Enthalpy; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate = 0.0; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRate = 0.0; + } + + this->ChillerPartLoadRatio = 0.0; + this->ChillerCyclingRatio = 0.0; + this->ChillerFalseLoadRate = 0.0; + this->ChillerFalseLoad = 0.0; + this->Power = 0.0; + this->QEvaporator = 0.0; + this->QCondenser = 0.0; + this->Energy = 0.0; + this->EvapEnergy = 0.0; + this->CondEnergy = 0.0; + this->EvapInletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + this->CondInletTemp = DataLoopNode::Node(this->CondInletNodeNum).Temp; + this->CondOutletTemp = DataLoopNode::Node(this->CondOutletNodeNum).Temp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).Temp; + this->ActualCOP = 0.0; + this->CondenserFanPower = 0.0; + this->CondenserFanEnergyConsumption = 0.0; + if (this->CondenserType == EvapCooled) { + this->BasinHeaterConsumption = this->BasinHeaterPower * ReportingConstant; + this->EvapWaterConsump = 0.0; + } + + if (this->HeatRecActive) { + + PlantUtilities::SafeCopyPlantNode(this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum); + + this->QHeatRecovered = 0.0; + this->EnergyHeatRecovery = 0.0; + this->HeatRecInletTemp = DataLoopNode::Node(this->HeatRecInletNodeNum).Temp; + this->HeatRecOutletTemp = DataLoopNode::Node(this->HeatRecOutletNodeNum).Temp; + this->HeatRecMassFlow = DataLoopNode::Node(this->HeatRecInletNodeNum).MassFlowRate; } } else { // Chiller is running, so pass calculated values // Set node temperatures - if (CondMassFlowRate < MassFlowTolerance && EvapMassFlowRate < MassFlowTolerance) { - Node(EvapOutletNode).Temp = Node(EvapInletNode).Temp; - Node(CondOutletNode).Temp = Node(CondInletNode).Temp; - if (ElectricEIRChiller(Num).CondenserType != WaterCooled) { - Node(CondOutletNode).HumRat = Node(CondInletNode).HumRat; - Node(CondOutletNode).Enthalpy = Node(CondInletNode).Enthalpy; - Node(CondInletNode).MassFlowRate = 0.0; - Node(CondOutletNode).MassFlowRate = 0.0; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance && + this->EvapMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + DataLoopNode::Node(this->EvapOutletNodeNum).Temp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + DataLoopNode::Node(this->CondOutletNodeNum).Temp = DataLoopNode::Node(this->CondInletNodeNum).Temp; + if (this->CondenserType != WaterCooled) { + DataLoopNode::Node(this->CondOutletNodeNum).HumRat = DataLoopNode::Node(this->CondInletNodeNum).HumRat; + DataLoopNode::Node(this->CondOutletNodeNum).Enthalpy = DataLoopNode::Node(this->CondInletNodeNum).Enthalpy; + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate = 0.0; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRate = 0.0; } } else { - Node(EvapOutletNode).Temp = EvapOutletTemp; - Node(CondOutletNode).Temp = CondOutletTemp; - if (ElectricEIRChiller(Num).CondenserType != WaterCooled) { - Node(CondOutletNode).HumRat = CondOutletHumRat; - Node(CondOutletNode).Enthalpy = PsyHFnTdbW(CondOutletTemp, CondOutletHumRat); - Node(CondInletNode).MassFlowRate = CondMassFlowRate; - Node(CondOutletNode).MassFlowRate = CondMassFlowRate; + DataLoopNode::Node(this->EvapOutletNodeNum).Temp = this->EvapOutletTemp; + DataLoopNode::Node(this->CondOutletNodeNum).Temp = this->CondOutletTemp; + if (this->CondenserType != WaterCooled) { + DataLoopNode::Node(this->CondOutletNodeNum).HumRat = this->CondOutletHumRat; + DataLoopNode::Node(this->CondOutletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(this->CondOutletTemp, this->CondOutletHumRat); + DataLoopNode::Node(this->CondInletNodeNum).MassFlowRate = this->CondMassFlowRate; + DataLoopNode::Node(this->CondOutletNodeNum).MassFlowRate = this->CondMassFlowRate; } } // Set node flow rates; for these load based models // assume that sufficient evaporator flow rate is available - ElectricEIRChillerReport(Num).ChillerPartLoadRatio = ChillerPartLoadRatio; - ElectricEIRChillerReport(Num).ChillerCyclingRatio = ChillerCyclingRatio; - ElectricEIRChillerReport(Num).ChillerFalseLoadRate = ChillerFalseLoadRate; - ElectricEIRChillerReport(Num).ChillerFalseLoad = ChillerFalseLoadRate * TimeStepSys * SecInHour; - ElectricEIRChillerReport(Num).Power = Power; - ElectricEIRChillerReport(Num).QEvap = QEvaporator; - ElectricEIRChillerReport(Num).QCond = QCondenser; - ElectricEIRChillerReport(Num).Energy = Power * TimeStepSys * SecInHour; - ElectricEIRChillerReport(Num).EvapEnergy = QEvaporator * TimeStepSys * SecInHour; - ElectricEIRChillerReport(Num).CondEnergy = QCondenser * TimeStepSys * SecInHour; - ElectricEIRChillerReport(Num).EvapInletTemp = Node(EvapInletNode).Temp; - ElectricEIRChillerReport(Num).CondInletTemp = Node(CondInletNode).Temp; - ElectricEIRChillerReport(Num).CondOutletTemp = Node(CondOutletNode).Temp; - ElectricEIRChillerReport(Num).EvapOutletTemp = Node(EvapOutletNode).Temp; - ElectricEIRChillerReport(Num).Evapmdot = EvapMassFlowRate; - ElectricEIRChillerReport(Num).Condmdot = CondMassFlowRate; - ElectricEIRChillerReport(Num).CondenserFanPowerUse = CondenserFanPower; - ElectricEIRChillerReport(Num).CondenserFanEnergyConsumption = CondenserFanPower * TimeStepSys * SecInHour; - if (Power != 0.0) { - ElectricEIRChillerReport(Num).ActualCOP = (QEvaporator + ChillerFalseLoadRate) / Power; + this->ChillerFalseLoad = this->ChillerFalseLoadRate * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + this->Energy = this->Power * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + this->EvapEnergy = this->QEvaporator * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + this->CondEnergy = this->QCondenser * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + this->EvapInletTemp = DataLoopNode::Node(this->EvapInletNodeNum).Temp; + this->CondInletTemp = DataLoopNode::Node(this->CondInletNodeNum).Temp; + this->CondOutletTemp = DataLoopNode::Node(this->CondOutletNodeNum).Temp; + this->EvapOutletTemp = DataLoopNode::Node(this->EvapOutletNodeNum).Temp; + this->CondenserFanEnergyConsumption = this->CondenserFanPower * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + if (this->Power != 0.0) { + this->ActualCOP = (this->QEvaporator + this->ChillerFalseLoadRate) / this->Power; } else { - ElectricEIRChillerReport(Num).ActualCOP = 0.0; + this->ActualCOP = 0.0; } - if (ElectricEIRChiller(Num).CondenserType == EvapCooled) { - ElectricEIRChillerReport(Num).BasinHeaterPower = BasinHeaterPower; - ElectricEIRChillerReport(Num).BasinHeaterConsumption = BasinHeaterPower * ReportingConstant; - ElectricEIRChillerReport(Num).EvapWaterConsump = EvapWaterConsumpRate * ReportingConstant; + if (this->CondenserType == EvapCooled) { + this->BasinHeaterConsumption = this->BasinHeaterPower * ReportingConstant; + this->EvapWaterConsump = this->EvapWaterConsumpRate * ReportingConstant; } - if (ElectricEIRChiller(Num).HeatRecActive) { + if (this->HeatRecActive) { - SafeCopyPlantNode(HeatRecInNode, HeatRecOutNode); - ElectricEIRChillerReport(Num).QHeatRecovery = QHeatRecovered; - ElectricEIRChillerReport(Num).EnergyHeatRecovery = QHeatRecovered * TimeStepSys * SecInHour; - Node(HeatRecOutNode).Temp = HeatRecOutletTemp; - ElectricEIRChillerReport(Num).HeatRecInletTemp = Node(HeatRecInNode).Temp; - ElectricEIRChillerReport(Num).HeatRecOutletTemp = Node(HeatRecOutNode).Temp; - ElectricEIRChillerReport(Num).HeatRecMassFlow = Node(HeatRecInNode).MassFlowRate; + PlantUtilities::SafeCopyPlantNode(this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum); + this->EnergyHeatRecovery = this->QHeatRecovered * DataHVACGlobals::TimeStepSys * DataGlobals::SecInHour; + DataLoopNode::Node(this->HeatRecOutletNodeNum).Temp = this->HeatRecOutletTemp; + this->HeatRecInletTemp = DataLoopNode::Node(this->HeatRecInletNodeNum).Temp; + this->HeatRecMassFlow = DataLoopNode::Node(this->HeatRecInletNodeNum).MassFlowRate; } } - - ElectricEIRChillerReport(Num).ChillerCapFT = ChillerCapFT; - ElectricEIRChillerReport(Num).ChillerEIRFT = ChillerEIRFT; - ElectricEIRChillerReport(Num).ChillerEIRFPLR = ChillerEIRFPLR; } } // namespace ChillerElectricEIR diff --git a/src/EnergyPlus/ChillerElectricEIR.hh b/src/EnergyPlus/ChillerElectricEIR.hh index 3b56e6bdf12..2a0ac67598c 100644 --- a/src/EnergyPlus/ChillerElectricEIR.hh +++ b/src/EnergyPlus/ChillerElectricEIR.hh @@ -54,87 +54,54 @@ // EnergyPlus Headers #include #include +#include namespace EnergyPlus { namespace ChillerElectricEIR { - // Using/Aliasing - - // Data - // MODULE PARAMETER DEFINITIONS: // Chiller type parameters extern int const AirCooled; extern int const WaterCooled; - extern int const EvapCooled; // chiller flow modes extern int const FlowModeNotSet; - extern int const ConstantFlow; - extern int const NotModulated; - extern int const LeavingSetPointModulated; // MODULE VARIABLE DECLARATIONS: - extern int NumElectricEIRChillers; // Number of electric EIR chillers specified in input - extern Real64 CondMassFlowRate; // Condenser mass flow rate [kg/s] - extern Real64 EvapMassFlowRate; // Evaporator mass flow rate [kg/s] - extern Real64 CondOutletTemp; // Condenser outlet temperature [C] - extern Real64 CondOutletHumRat; // Condenser outlet humidity ratio [kg/kg] - extern Real64 EvapOutletTemp; // Evaporator outlet temperature [C] - extern Real64 Power; // Rate of chiller electric energy use [W] - extern Real64 QEvaporator; // Rate of heat transfer to the evaporator coil [W] - extern Real64 QCondenser; // Rate of heat transfer to the condenser coil [W] - extern Real64 QHeatRecovered; // Rate of heat transfer to the heat recovery coil [W] - extern Real64 HeatRecOutletTemp; // Heat recovery outlet temperature [C] - extern Real64 CondenserFanPower; // Condenser Fan Power (fan cycles with compressor) [W] - extern Real64 ChillerCapFT; // Chiller capacity fraction (evaluated as a function of temperature) - extern Real64 ChillerEIRFT; // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature - extern Real64 ChillerEIRFPLR; // Chiller EIR as a function of part-load ratio (PLR) - extern Real64 ChillerPartLoadRatio; // Chiller part-load ratio (PLR) - extern Real64 ChillerCyclingRatio; // Chiller cycling ratio - extern Real64 BasinHeaterPower; // Basin heater power (W) - extern Real64 ChillerFalseLoadRate; // Chiller false load over and above the water-side load [W] - extern Real64 AvgCondSinkTemp; // condenser temperature value for use in curves [C] - - extern Array1D_bool CheckEquipName; - - extern bool GetInputEIR; // When TRUE, calls subroutine to read input file. - extern bool ChillerIPLVOneTimeFlag; - extern Array1D_bool ChillerIPLVFlagArr; // TRUE in order to calculate IPLV - extern bool getInputAllocatedFlag; // True when arrays are allocated - extern bool InitMyOneTimeFlag; // Flag used to execute code only once - - // SUBROUTINE SPECIFICATIONS FOR MODULE ChillerElectricEIR - // PUBLIC SimEIRChillerHeatRecovery + extern int NumElectricEIRChillers; // Number of electric EIR chillers specified in input - // Types + extern bool getInputFlag; // When TRUE, calls subroutine to read input file. - struct ElectricEIRChillerSpecs + struct ElectricEIRChillerSpecs : PlantComponent { // Members std::string Name; // User identifier int TypeNum; // plant loop type identifier - std::string EIRFPLRName; // EIRPLR curve name int CondenserType; // Type of Condenser - Air Cooled, Water Cooled or Evap Cooled Real64 RefCap; // Reference capacity of chiller [W] bool RefCapWasAutoSized; // reference capacity was autosized on input Real64 RefCOP; // Reference coefficient of performance [W/W] - int FlowMode; // one of 3 modes for componet flow during operation + int FlowMode; // one of 3 modes for component flow during operation bool ModulatedFlowSetToLoop; // True if the setpoint is missing at the outlet node bool ModulatedFlowErrDone; // true if setpoint warning issued bool HRSPErrDone; // TRUE if set point warning issued for heat recovery loop Real64 EvapVolFlowRate; // Reference water volumetric flow rate through the evaporator [m3/s] bool EvapVolFlowRateWasAutoSized; // true if previous was autosize input + Real64 EvapMassFlowRate; Real64 EvapMassFlowRateMax; // Reference water mass flow rate through evaporator [kg/s] Real64 CondVolFlowRate; // Reference water volumetric flow rate through the condenser [m3/s] bool CondVolFlowRateWasAutoSized; // true if previous was set to autosize on input + Real64 CondMassFlowRate; // Condenser mass flow rate [kg/s] Real64 CondMassFlowRateMax; // Reference water mass flow rate through condenser [kg/s] Real64 CondenserFanPowerRatio; // Reference power of condenser fan to capacity ratio, W/W Real64 CompPowerToCondenserFrac; // Fraction of compressor electric power rejected by condenser [0 to 1] int EvapInletNodeNum; // Node number on the inlet side of the plant (evaporator side) int EvapOutletNodeNum; // Node number on the outlet side of the plant (evaporator side) + Real64 EvapOutletTemp; // Evaporator outlet temperature [C] int CondInletNodeNum; // Node number on the inlet side of the condenser int CondOutletNodeNum; // Node number on the outlet side of the condenser + Real64 CondOutletTemp; // Condenser outlet temperature [C] + Real64 CondOutletHumRat; // Condenser outlet humidity ratio [kg/kg] Real64 MinPartLoadRat; // Minimum allowed operating fraction of full load Real64 MaxPartLoadRat; // Maximum allowed operating fraction of full load Real64 OptPartLoadRat; // Optimal operating fraction of full load @@ -157,14 +124,13 @@ namespace ChillerElectricEIR { Real64 HeatRecMaxCapacityLimit; // Capacity limit for Heat recovery, one time calc [W] int HeatRecSetPointNodeNum; // index for system node with the heat recover leaving setpoint int HeatRecInletLimitSchedNum; // index for schedule for the inlet high limit for heat recovery operation - int ChillerCapFT; // Index for the total cooling capacity modifier curve + int ChillerCapFTIndex; // Index for the total cooling capacity modifier curve // (function of leaving chilled water temperature and // entering condenser fluid temperature) - int ChillerEIRFT; // Index for the energy input ratio modifier curve + int ChillerEIRFTIndex; // Index for the energy input ratio modifier curve // (function of leaving chilled water temperature and // entering condenser fluid temperature) - int ChillerEIRFPLR; // Index for the EIR vs part-load ratio curve - // INTEGER :: CondFanPowerFCap = 0 ! Condenser fan capacity as a function of chiller capacity + int ChillerEIRFPLRIndex; // Index for the EIR vs part-load ratio curve int ChillerCapFTError; // Used for negative capacity as a function of temp warnings int ChillerCapFTErrorIndex; // Used for negative capacity as a function of temp warnings int ChillerEIRFTError; // Used for negative EIR as a function of temp warnings @@ -204,129 +170,105 @@ namespace ChillerElectricEIR { int FaultyChillerFoulingIndex; // Index of the fault object corresponding to the chiller Real64 FaultyChillerFoulingFactor; // Chiller fouling factor std::string EndUseSubcategory; // identifier use for the end use subcategory - - // Default Constructor - ElectricEIRChillerSpecs() - : TypeNum(0), CondenserType(0), RefCap(0.0), RefCapWasAutoSized(false), RefCOP(0.0), FlowMode(FlowModeNotSet), - ModulatedFlowSetToLoop(false), ModulatedFlowErrDone(false), HRSPErrDone(false), EvapVolFlowRate(0.0), - EvapVolFlowRateWasAutoSized(false), EvapMassFlowRateMax(0.0), CondVolFlowRate(0.0), CondVolFlowRateWasAutoSized(false), - CondMassFlowRateMax(0.0), CondenserFanPowerRatio(0.0), CompPowerToCondenserFrac(0.0), EvapInletNodeNum(0), EvapOutletNodeNum(0), - CondInletNodeNum(0), CondOutletNodeNum(0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), OptPartLoadRat(0.0), MinUnloadRat(0.0), - TempRefCondIn(0.0), TempRefEvapOut(0.0), TempLowLimitEvapOut(0.0), DesignHeatRecVolFlowRate(0.0), - DesignHeatRecVolFlowRateWasAutoSized(false), DesignHeatRecMassFlowRate(0.0), SizFac(0.0), BasinHeaterPowerFTempDiff(0.0), - BasinHeaterSetPointTemp(0.0), HeatRecActive(false), HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), - HeatRecMaxCapacityLimit(0.0), HeatRecSetPointNodeNum(0), HeatRecInletLimitSchedNum(0), ChillerCapFT(0), ChillerEIRFT(0), - ChillerEIRFPLR(0), ChillerCapFTError(0), ChillerCapFTErrorIndex(0), ChillerEIRFTError(0), ChillerEIRFTErrorIndex(0), - ChillerEIRFPLRError(0), ChillerEIRFPLRErrorIndex(0), ChillerEIRFPLRMin(0.0), ChillerEIRFPLRMax(0.0), DeltaTErrCount(0), - DeltaTErrCountIndex(0), CWLoopNum(0), CWLoopSideNum(0), CWBranchNum(0), CWCompNum(0), CDLoopNum(0), CDLoopSideNum(0), CDBranchNum(0), - CDCompNum(0), HRLoopNum(0), HRLoopSideNum(0), HRBranchNum(0), HRCompNum(0), BasinHeaterSchedulePtr(0), CondMassFlowIndex(0), - MsgDataLast(0.0), PrintMessage(false), MsgErrorCount(0), ErrCount1(0), PossibleSubcooling(false), FaultyChillerSWTFlag(false), - FaultyChillerSWTIndex(0), FaultyChillerSWTOffset(0.0), FaultyChillerFoulingFlag(false), FaultyChillerFoulingIndex(0), - FaultyChillerFoulingFactor(1.0) - { - } - }; - - struct ReportEIRVars - { - // Members - Real64 ChillerPartLoadRatio; // reporting: Chiller PLR (Load/Capacity) - Real64 ChillerCyclingRatio; // reporting: Chiller cycling ratio (time on/time step) - Real64 ChillerFalseLoadRate; // reporting: Chiller false load over and above water side load [J] + Real64 TimeStepSysLast; + Real64 CurrentEndTimeLast; + bool oneTimeFlag; + bool MyEnvrnFlag; + Real64 EvapWaterConsump; // Evap cooler water consumption (m3) + Real64 EvapWaterConsumpRate; // Evap condenser water consumption rate [m3/s] + Real64 Power; // Rate of chiller electric energy use [W] + Real64 QEvaporator; // Rate of heat transfer to the evaporator coil [W] + Real64 QCondenser; // Rate of heat transfer to the condenser coil [W] + Real64 QHeatRecovered; // Rate of heat transfer to the heat recovery coil [W] + Real64 HeatRecOutletTemp; // Heat recovery outlet temperature [C] + Real64 CondenserFanPower; // Condenser Fan Power (fan cycles with compressor) [W] + Real64 ChillerCapFT; // Chiller capacity fraction (evaluated as a function of temperature) + Real64 ChillerEIRFT; // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature + Real64 ChillerEIRFPLR; // Chiller EIR as a function of part-load ratio (PLR) + Real64 ChillerPartLoadRatio; // Chiller part-load ratio (PLR) + Real64 ChillerCyclingRatio; // Chiller cycling ratio + Real64 BasinHeaterPower; // Basin heater power (W) + Real64 ChillerFalseLoadRate; // Chiller false load over and above the water-side load [W] Real64 ChillerFalseLoad; // reporting: Chiller false load over and above water side load [W] - Real64 Power; // reporting: Chiller power, W - Real64 QEvap; // reporting: Evaporator heat transfer rate [W] - Real64 QCond; // reporting: Condenser heat transfer rate [W] Real64 Energy; // reporting: Chiller electric consumption [J] Real64 EvapEnergy; // reporting: Evaporator heat transfer energy [J] Real64 CondEnergy; // reporting: Condenser heat transfer energy [J] Real64 CondInletTemp; // reporting: Condenser inlet temperature [C] Real64 EvapInletTemp; // reporting: Evaporator inlet temperature [C] - Real64 CondOutletTemp; // reporting: Condenser outlet temperature [C] - Real64 EvapOutletTemp; // reporting: Evaporator outlet temperature [C] - Real64 Evapmdot; // reporting: Evaporator mass flow rate [kg/s] - Real64 Condmdot; // reporting: Condenser mass flow rate [kg/s] Real64 ActualCOP; // reporting: Coefficient of performance - Real64 QHeatRecovery; // reporting: Heat recovered from water-cooled condenser [W] Real64 EnergyHeatRecovery; // reporting: Energy recovered from water-cooled condenser [J] Real64 HeatRecInletTemp; // reporting: Heat reclaim inlet temperature [C] - Real64 HeatRecOutletTemp; // reporting: Heat reclaim outlet temperature [C] Real64 HeatRecMassFlow; // reporting: Heat reclaim mass flow rate [kg/s] Real64 ChillerCondAvgTemp; // reporting: average condenser temp for curves with Heat recovery [C] - Real64 ChillerCapFT; // reporting: Chiller capacity curve output value - Real64 ChillerEIRFT; // reporting: Chiller EIRFT curve output value - Real64 ChillerEIRFPLR; // reporting: Chiller EIRFPLR curve output value - Real64 CondenserFanPowerUse; // reporting: Air-cooled condenser fan power [W] Real64 CondenserFanEnergyConsumption; // reporting: Air-cooled condenser fan energy [J] - Real64 BasinHeaterPower; // Basin heater power (W) Real64 BasinHeaterConsumption; // Basin heater energy consumption (J) - Real64 EvapWaterConsump; // Evap cooler water consumption (m3) + bool IPLVFlag; + bool EquipFlowCtrl; + bool oneTimeInit; // Default Constructor - ReportEIRVars() - : ChillerPartLoadRatio(0.0), ChillerCyclingRatio(0.0), ChillerFalseLoadRate(0.0), ChillerFalseLoad(0.0), Power(0.0), QEvap(0.0), - QCond(0.0), Energy(0.0), EvapEnergy(0.0), CondEnergy(0.0), CondInletTemp(0.0), EvapInletTemp(0.0), CondOutletTemp(0.0), - EvapOutletTemp(0.0), Evapmdot(0.0), Condmdot(0.0), ActualCOP(0.0), QHeatRecovery(0.0), EnergyHeatRecovery(0.0), HeatRecInletTemp(0.0), - HeatRecOutletTemp(0.0), HeatRecMassFlow(0.0), ChillerCondAvgTemp(0.0), ChillerCapFT(0.0), ChillerEIRFT(0.0), ChillerEIRFPLR(0.0), - CondenserFanPowerUse(0.0), CondenserFanEnergyConsumption(0.0), BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), EvapWaterConsump(0.0) + ElectricEIRChillerSpecs() + : TypeNum(0), CondenserType(0), RefCap(0.0), RefCapWasAutoSized(false), RefCOP(0.0), FlowMode(FlowModeNotSet), + ModulatedFlowSetToLoop(false), ModulatedFlowErrDone(false), HRSPErrDone(false), EvapVolFlowRate(0.0), + EvapVolFlowRateWasAutoSized(false), EvapMassFlowRate(0.0), EvapMassFlowRateMax(0.0), CondVolFlowRate(0.0), + CondVolFlowRateWasAutoSized(false), CondMassFlowRate(0.0), CondMassFlowRateMax(0.0), CondenserFanPowerRatio(0.0), + CompPowerToCondenserFrac(0.0), EvapInletNodeNum(0), EvapOutletNodeNum(0), EvapOutletTemp(0.0), CondInletNodeNum(0), + CondOutletNodeNum(0), CondOutletTemp(0.0), CondOutletHumRat(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), OptPartLoadRat(0.0), + MinUnloadRat(0.0), TempRefCondIn(0.0), TempRefEvapOut(0.0), TempLowLimitEvapOut(0.0), DesignHeatRecVolFlowRate(0.0), + DesignHeatRecVolFlowRateWasAutoSized(false), DesignHeatRecMassFlowRate(0.0), SizFac(0.0), BasinHeaterPowerFTempDiff(0.0), + BasinHeaterSetPointTemp(0.0), HeatRecActive(false), HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), + HeatRecMaxCapacityLimit(0.0), HeatRecSetPointNodeNum(0), HeatRecInletLimitSchedNum(0), ChillerCapFTIndex(0), ChillerEIRFTIndex(0), + ChillerEIRFPLRIndex(0), ChillerCapFTError(0), ChillerCapFTErrorIndex(0), ChillerEIRFTError(0), ChillerEIRFTErrorIndex(0), + ChillerEIRFPLRError(0), ChillerEIRFPLRErrorIndex(0), ChillerEIRFPLRMin(0.0), ChillerEIRFPLRMax(0.0), DeltaTErrCount(0), + DeltaTErrCountIndex(0), CWLoopNum(0), CWLoopSideNum(0), CWBranchNum(0), CWCompNum(0), CDLoopNum(0), CDLoopSideNum(0), CDBranchNum(0), + CDCompNum(0), HRLoopNum(0), HRLoopSideNum(0), HRBranchNum(0), HRCompNum(0), BasinHeaterSchedulePtr(0), CondMassFlowIndex(0), + MsgDataLast(0.0), PrintMessage(false), MsgErrorCount(0), ErrCount1(0), PossibleSubcooling(false), FaultyChillerSWTFlag(false), + FaultyChillerSWTIndex(0), FaultyChillerSWTOffset(0.0), FaultyChillerFoulingFlag(false), FaultyChillerFoulingIndex(0), + FaultyChillerFoulingFactor(1.0), TimeStepSysLast(0.0), CurrentEndTimeLast(0.0), oneTimeFlag(true), MyEnvrnFlag(true), EvapWaterConsump(0.0), + EvapWaterConsumpRate(0.0), Power(0.0), QEvaporator(0.0), QCondenser(0.0), QHeatRecovered(0.0), HeatRecOutletTemp(0.0), + CondenserFanPower(0.0), ChillerCapFT(0.0), ChillerEIRFT(0.0), ChillerEIRFPLR(0.0), ChillerPartLoadRatio(0.0), ChillerCyclingRatio(0.0), + BasinHeaterPower(0.0), ChillerFalseLoadRate(0.0), ChillerFalseLoad(0.0), Energy(0.0), EvapEnergy(0.0), CondEnergy(0.0), + CondInletTemp(0.0), EvapInletTemp(0.0), ActualCOP(0.0), EnergyHeatRecovery(0.0), HeatRecInletTemp(0.0), HeatRecMassFlow(0.0), + ChillerCondAvgTemp(0.0), CondenserFanEnergyConsumption(0.0), BasinHeaterConsumption(0.0), IPLVFlag(true), EquipFlowCtrl(true) { } - }; - // Object Data - extern Array1D ElectricEIRChiller; // Dimension to number of machines - extern Array1D ElectricEIRChillerReport; + static PlantComponent *factory(std::string const &objectName); - // Functions - void clear_state(); + void setupOutputVars(); - void SimElectricEIRChiller(std::string const &EIRChillerType, // Type of chiller - std::string const &EIRChillerName, // User specified name of chiller - int const EquipFlowCtrl, // Flow control mode for the equipment - int &CompIndex, // Chiller number pointer - int const LoopNum, // plant loop index pointer - bool const RunFlag, // Simulate chiller when TRUE - bool const FirstIteration, // Initialize variables when TRUE - bool &InitLoopEquip, // If not zero, calculate the max load for operating conditions - Real64 &MyLoad, // Loop demand component will meet - Real64 &MaxCap, // Maximum operating capacity of chiller [W] - Real64 &MinCap, // Minimum operating capacity of chiller [W] - Real64 &OptCap, // Optimal operating capacity of chiller [W] - bool const GetSizingFactor, // TRUE when just the sizing factor is requested - Real64 &SizingFactor, // sizing factor - Real64 &TempCondInDesign, - Real64 &TempEvapOutDesign); + void simulate(const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override; - // End Electric EIR Chiller Module Driver Subroutine - //****************************************************************************** + void getDesignCapacities(const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override; - void GetElectricEIRChillerInput(); + void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override; + + void getSizingFactor(Real64 &sizFac) override; + + void onInitLoopEquip(const PlantLocation &calledFromLocation) override; - void InitElectricEIRChiller(int const EIRChillNum, // Number of the current electric EIR chiller being simulated - bool const RunFlag, // TRUE when chiller operating - Real64 const MyLoad // current load put on chiller - ); + void initialize(bool RunFlag, Real64 MyLoad); - void SizeElectricEIRChiller(int const EIRChillNum); + void size(); - void CalcElectricEIRChillerModel(int &EIRChillNum, // Chiller number - Real64 &MyLoad, // Operating load - bool const RunFlag, // TRUE when chiller operating - bool const FirstIteration, // TRUE when first iteration of timestep - int const EquipFlowCtrl // Flow control mode for the equipment - ); + void calculate(Real64 &MyLoad, bool RunFlag); - void EIRChillerHeatRecovery(int const EIRChillNum, // Number of the current electric EIR chiller being simulated - Real64 &QCond, // Current condenser load [W] - Real64 const CondMassFlow, // Current condenser mass flow [kg/s] - Real64 const CondInletTemp, // Current condenser inlet temp [C] - Real64 &QHeatRec // Amount of heat recovered [W] - ); + void calcHeatRecovery(Real64 &QCond, // Current condenser load [W] + Real64 CondMassFlow, // Current condenser mass flow [kg/s] + Real64 condInletTemp, // Current condenser inlet temp [C] + Real64 &QHeatRec // Amount of heat recovered [W] + ); - void UpdateElectricEIRChillerRecords(Real64 const MyLoad, // Current load [W] - bool const RunFlag, // TRUE if chiller operating - int const Num // Chiller number - ); + void update(Real64 MyLoad, bool RunFlag); + }; + + // Object Data + extern Array1D ElectricEIRChiller; // Dimension to number of machines + + // Functions + void clear_state(); + + void GetElectricEIRChillerInput(); } // namespace ChillerElectricEIR diff --git a/src/EnergyPlus/FaultsManager.cc b/src/EnergyPlus/FaultsManager.cc index e970cb18845..3c22bec633c 100644 --- a/src/EnergyPlus/FaultsManager.cc +++ b/src/EnergyPlus/FaultsManager.cc @@ -580,9 +580,9 @@ namespace FaultsManager { } else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Chiller:Electric:EIR")) { // Read in chiller if not done yet - if (ChillerElectricEIR::GetInputEIR) { + if (ChillerElectricEIR::getInputFlag) { ChillerElectricEIR::GetElectricEIRChillerInput(); - ChillerElectricEIR::GetInputEIR = false; + ChillerElectricEIR::getInputFlag = false; } // Check whether the chiller name and chiller type match each other @@ -1334,9 +1334,9 @@ namespace FaultsManager { } else if (UtilityRoutines::SameString(SELECT_CASE_VAR, "Chiller:Electric:EIR")) { // Read in chiller if not done yet - if (ChillerElectricEIR::GetInputEIR) { + if (ChillerElectricEIR::getInputFlag) { ChillerElectricEIR::GetElectricEIRChillerInput(); - ChillerElectricEIR::GetInputEIR = false; + ChillerElectricEIR::getInputFlag = false; } // Check whether the chiller name and chiller type match each other ChillerNum = UtilityRoutines::FindItemInList(FaultsChillerSWTSensor(jFault_ChillerSWT).ChillerName, diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 3a2669ec660..bd777a7727c 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -4790,7 +4790,6 @@ namespace OutputReportTabular { using Boilers::Boiler; using Boilers::NumBoilers; using ChillerElectricEIR::ElectricEIRChiller; - using ChillerElectricEIR::ElectricEIRChillerReport; using ChillerElectricEIR::NumElectricEIRChillers; using ChillerReformulatedEIR::ElecReformEIRChiller; using ChillerReformulatedEIR::ElecReformEIRChillerReport; @@ -4908,7 +4907,7 @@ namespace OutputReportTabular { } for (iChiller = 1; iChiller <= NumElectricEIRChillers; ++iChiller) { if (ElectricEIRChiller(iChiller).CondenserType != WaterCooled) { - SysTotalHVACRejectHeatLoss += ElectricEIRChillerReport(iChiller).CondEnergy; + SysTotalHVACRejectHeatLoss += ElectricEIRChiller(iChiller).CondEnergy; } } for (iChiller = 1; iChiller <= NumElecReformEIRChillers; ++iChiller) { diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 3410f2ace12..fd3f8fa45f2 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -1069,6 +1070,7 @@ namespace EnergyPlus { } else if (LoopSideNum == SupplySide) { this_comp.CurOpSchemeType = UnknownStatusOpSchemeType; } + this_comp.compPtr = ChillerElectricEIR::ElectricEIRChillerSpecs::factory(CompNames(CompNum)); } else if (UtilityRoutines::SameString(this_comp_type, "Chiller:Electric:ReformulatedEIR")) { this_comp.TypeOf_Num = TypeOf_Chiller_ElectricReformEIR; diff --git a/src/EnergyPlus/PlantLoopEquip.cc b/src/EnergyPlus/PlantLoopEquip.cc index 20d33517a31..70f3b1b1e98 100644 --- a/src/EnergyPlus/PlantLoopEquip.cc +++ b/src/EnergyPlus/PlantLoopEquip.cc @@ -177,7 +177,6 @@ namespace PlantLoopEquip { // na // Using/Aliasing - using ChillerElectricEIR::SimElectricEIRChiller; using ChillerExhaustAbsorption::SimExhaustAbsorber; using ChillerGasAbsorption::SimGasAbsorber; using ChillerReformulatedEIR::SimReformulatedEIRChiller; @@ -320,33 +319,7 @@ namespace PlantLoopEquip { sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag); } else if (EquipTypeNum == TypeOf_Chiller_ElectricEIR) { - SimElectricEIRChiller(sim_component.TypeOf, - sim_component.Name, - EquipFlowCtrl, - EquipNum, - LoopNum, - RunFlag, - FirstHVACIteration, - InitLoopEquip, - CurLoad, - MaxLoad, - MinLoad, - OptLoad, - GetCompSizFac, - SizingFac, - TempCondInDesign, - TempEvapOutDesign); - if (InitLoopEquip) { - sim_component.MaxLoad = MaxLoad; - sim_component.MinLoad = MinLoad; - sim_component.OptLoad = OptLoad; - sim_component.CompNum = EquipNum; - sim_component.TempDesCondIn = TempCondInDesign; - sim_component.TempDesEvapOut = TempEvapOutDesign; - } - if (GetCompSizFac) { - sim_component.SizFac = SizingFac; - } + sim_component.compPtr->simulate(sim_component_location, FirstHVACIteration, CurLoad, RunFlag); } else if (EquipTypeNum == TypeOf_Chiller_ElectricReformEIR) { SimReformulatedEIRChiller(sim_component.TypeOf, diff --git a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc index 8e710d6bb0c..e87e30cd0c6 100644 --- a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc @@ -64,54 +64,52 @@ using namespace EnergyPlus; using namespace EnergyPlus::ChillerElectricEIR; using namespace EnergyPlus::DataLoopNode; -TEST_F(EnergyPlusFixture, ChillerElectricEIR_TestOutletNodeConditions) +class ChillerElecEIRFixture : public EnergyPlusFixture { +}; - int Num = 1; - - ElectricEIRChiller.allocate(Num); - ElectricEIRChillerReport.allocate(Num); +TEST_F(ChillerElecEIRFixture, ChillerElectricEIR_TestOutletNodeConditions) +{ + ElectricEIRChiller.allocate(1); + auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1); - ElectricEIRChiller(Num).EvapInletNodeNum = 1; - ElectricEIRChiller(Num).EvapOutletNodeNum = 2; - ElectricEIRChiller(Num).CondInletNodeNum = 3; - ElectricEIRChiller(Num).CondOutletNodeNum = 4; - ElectricEIRChiller(Num).HeatRecInletNodeNum = 5; - ElectricEIRChiller(Num).HeatRecOutletNodeNum = 6; + thisEIR.EvapInletNodeNum = 1; + thisEIR.EvapOutletNodeNum = 2; + thisEIR.CondInletNodeNum = 3; + thisEIR.CondOutletNodeNum = 4; + thisEIR.HeatRecInletNodeNum = 5; + thisEIR.HeatRecOutletNodeNum = 6; Node.allocate(6); - Node(ElectricEIRChiller(Num).EvapInletNodeNum).Temp = 18.0; - Node(ElectricEIRChiller(Num).CondInletNodeNum).Temp = 35.0; + Node(thisEIR.EvapInletNodeNum).Temp = 18.0; + Node(thisEIR.CondInletNodeNum).Temp = 35.0; - CondMassFlowRate = 0.0; - EvapMassFlowRate = 0.0; + thisEIR.update(-2000, true); - UpdateElectricEIRChillerRecords(-2000, true, 1); - - EXPECT_EQ(18, ElectricEIRChillerReport(Num).EvapOutletTemp); - EXPECT_EQ(35, ElectricEIRChillerReport(Num).CondOutletTemp); + EXPECT_EQ(18, thisEIR.EvapOutletTemp); + EXPECT_EQ(35, thisEIR.CondOutletTemp); Node.deallocate(); ElectricEIRChiller.deallocate(); - ElectricEIRChillerReport.deallocate(); } -TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) +TEST_F(ChillerElecEIRFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) { // unit test for autosizing heat recovery in Chiller:Electric:EIR ChillerElectricEIR::ElectricEIRChiller.allocate(1); - - ChillerElectricEIR::ElectricEIRChiller(1).SizFac = 1.0; - ChillerElectricEIR::ElectricEIRChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true; - ChillerElectricEIR::ElectricEIRChiller(1).HeatRecCapacityFraction = 0.5; - ChillerElectricEIR::ElectricEIRChiller(1).HeatRecActive = true; - ChillerElectricEIR::ElectricEIRChiller(1).CondenserType = ChillerElectricEIR::WaterCooled; - ChillerElectricEIR::ElectricEIRChiller(1).CWLoopNum = 1; - ChillerElectricEIR::ElectricEIRChiller(1).CDLoopNum = 2; - ChillerElectricEIR::ElectricEIRChiller(1).EvapVolFlowRate = 1.0; - ChillerElectricEIR::ElectricEIRChiller(1).CondVolFlowRate = 1.0; - ChillerElectricEIR::ElectricEIRChiller(1).RefCap = 10000; - ChillerElectricEIR::ElectricEIRChiller(1).RefCOP = 3.0; + auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1); + + thisEIR.SizFac = 1.0; + thisEIR.DesignHeatRecVolFlowRateWasAutoSized = true; + thisEIR.HeatRecCapacityFraction = 0.5; + thisEIR.HeatRecActive = true; + thisEIR.CondenserType = ChillerElectricEIR::WaterCooled; + thisEIR.CWLoopNum = 1; + thisEIR.CDLoopNum = 2; + thisEIR.EvapVolFlowRate = 1.0; + thisEIR.CondVolFlowRate = 1.0; + thisEIR.RefCap = 10000; + thisEIR.RefCOP = 3.0; DataPlant::PlantLoop.allocate(2); DataSizing::PlantSizData.allocate(2); @@ -131,16 +129,16 @@ TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) DataPlant::PlantFirstSizesOkayToFinalize = true; // now call sizing routine - ChillerElectricEIR::SizeElectricEIRChiller(1); + thisEIR.size(); // see if heat recovery flow rate is as expected - EXPECT_NEAR(ChillerElectricEIR::ElectricEIRChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001); + EXPECT_NEAR(thisEIR.DesignHeatRecVolFlowRate, 0.5, 0.00001); ChillerElectricEIR::ElectricEIRChiller.deallocate(); DataSizing::PlantSizData.deallocate(); DataPlant::PlantLoop.deallocate(); } -TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) +TEST_F(ChillerElecEIRFixture, ChillerElectricEIR_AirCooledChiller) { bool RunFlag(true); @@ -213,16 +211,17 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) } GetElectricEIRChillerInput(); + auto &thisEIR = ChillerElectricEIR::ElectricEIRChiller(1); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; DataPlant::PlantLoop(1).FluidIndex = 1; DataPlant::PlantLoop(1).PlantSizNum = 1; DataPlant::PlantLoop(1).FluidName = "WATER"; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = ElectricEIRChiller(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = thisEIR.Name; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_ElectricEIR; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = ElectricEIRChiller(1).EvapInletNodeNum; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = ElectricEIRChiller(1).EvapOutletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = thisEIR.EvapInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = thisEIR.EvapOutletNodeNum; DataSizing::PlantSizData.allocate(1); DataSizing::PlantSizData(1).DesVolFlowRate = 0.001; @@ -232,19 +231,19 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFinalSizesOkayToReport = true; - InitElectricEIRChiller(1, RunFlag, MyLoad); - SizeElectricEIRChiller(1); + thisEIR.initialize(RunFlag, MyLoad); + thisEIR.size(); // run through init again after sizing is complete to set mass flow rate DataGlobals::BeginEnvrnFlag = true; - InitElectricEIRChiller(1, RunFlag, MyLoad); + thisEIR.initialize(RunFlag, MyLoad); // check chiller water side evap flow rate is non-zero - EXPECT_NEAR(ElectricEIRChiller(1).EvapMassFlowRateMax, 0.999898, 0.0000001); + EXPECT_NEAR(thisEIR.EvapMassFlowRateMax, 0.999898, 0.0000001); // check autocalculate for air-cooled or evap-cooled chiller condenser side fluid flow rate - Real64 CalcCondVolFlow = ElectricEIRChiller(1).RefCap * 0.000114; - EXPECT_EQ(CalcCondVolFlow, ElectricEIRChiller(1).CondVolFlowRate); - EXPECT_NEAR(ElectricEIRChiller(1).CondVolFlowRate, 2.3925760323498, 0.0000001); - EXPECT_NEAR(ElectricEIRChiller(1).CondMassFlowRateMax, 2.7918772761695, 0.0000001); + Real64 CalcCondVolFlow = thisEIR.RefCap * 0.000114; + EXPECT_EQ(CalcCondVolFlow, thisEIR.CondVolFlowRate); + EXPECT_NEAR(thisEIR.CondVolFlowRate, 2.3925760323498, 0.0000001); + EXPECT_NEAR(thisEIR.CondMassFlowRateMax, 2.7918772761695, 0.0000001); } diff --git a/tst/EnergyPlus/unit/StandardRatings.unit.cc b/tst/EnergyPlus/unit/StandardRatings.unit.cc index d669cc583ce..f4e47d8148e 100644 --- a/tst/EnergyPlus/unit/StandardRatings.unit.cc +++ b/tst/EnergyPlus/unit/StandardRatings.unit.cc @@ -278,7 +278,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest) PerfCurve(CurveNum).Var1Max = 10; PerfCurve(CurveNum).Var2Min = 23.89; PerfCurve(CurveNum).Var2Max = 46.11; - ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFT = 1; + ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFTIndex = 1; // EIR=f(T) CurveNum = 2; @@ -297,7 +297,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest) PerfCurve(CurveNum).Var1Max = 10; PerfCurve(CurveNum).Var2Min = 10; PerfCurve(CurveNum).Var2Max = 46.11; - ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFT = 2; + ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFTIndex = 2; // EIR=f(PLR) CurveNum = 3; @@ -312,7 +312,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest) PerfCurve(CurveNum).Coeff4 = 0.412199944; PerfCurve(CurveNum).Var1Min = 0; PerfCurve(CurveNum).Var1Max = 1; - ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLR = 3; + ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLRIndex = 3; Real64 IPLV; CalcChillerIPLV(ChillerElectricEIR::ElectricEIRChiller(1).Name, @@ -320,9 +320,9 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest) ChillerElectricEIR::ElectricEIRChiller(1).RefCap, ChillerElectricEIR::ElectricEIRChiller(1).RefCOP, ChillerElectricEIR::ElectricEIRChiller(1).CondenserType, - ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFT, - ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFT, - ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLR, + ChillerElectricEIR::ElectricEIRChiller(1).ChillerCapFTIndex, + ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFTIndex, + ChillerElectricEIR::ElectricEIRChiller(1).ChillerEIRFPLRIndex, ChillerElectricEIR::ElectricEIRChiller(1).MinUnloadRat, IPLV);