diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 3d9352d8a1a..09daf4c34a6 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -898,6 +898,7 @@ namespace UnitVentilator { for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); + auto &coilReportObj = state.dataRptCoilSelection->coilSelectionReportObj; SetupOutputVariable(state, "Zone Unit Ventilator Heating Rate", @@ -972,12 +973,6 @@ namespace UnitVentilator { OutputProcessor::StoreType::Average, unitVent.Name); } - } - - for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { - - auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); - auto &coilReportObj = state.dataRptCoilSelection->coilSelectionReportObj; if (unitVent.HCoilPresent) { coilReportObj->setCoilSupplyFanInfo( @@ -1279,7 +1274,6 @@ namespace UnitVentilator { static constexpr std::string_view RoutineName("SizeUnitVentilator"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PltSizCoolNum = 0; // index of plant sizing object for 1st cooling loop Real64 DesCoolingLoad = 0.0; Real64 DesHeatingLoad = 0.0; Real64 TempSteamIn = 0.0; @@ -1288,7 +1282,6 @@ namespace UnitVentilator { Real64 LatentHeatSteam = 0.0; Real64 SteamDensity = 0.0; int CoilWaterOutletNode = 0; - int CoilSteamOutletNode = 0; std::string CoolingCoilName; std::string CoolingCoilType; Real64 rho = 0.0; @@ -1298,8 +1291,6 @@ namespace UnitVentilator { int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, // HeatingCapacitySizing, etc.) bool PrintFlag; // TRUE when sizing information is reported in the eio file - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and // FractionOfAutosizedHeatingCapacity ) Real64 WaterCoilSizDeltaT; // water coil deltaT for design water flow rate autosizing @@ -1336,7 +1327,7 @@ namespace UnitVentilator { if (state.dataSize->CurZoneEqNum > 0) { if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); // initialize OA flow for sizing other inputs (e.g., inlet temp, capacity, etc.) if (unitVent.OutAirVolFlow == DataSizing::AutoSize) { @@ -1354,7 +1345,7 @@ namespace UnitVentilator { if (zoneHVACSizing.CoolingSAFMethod > 0 && state.dataSize->ZoneCoolingOnlyFan && !state.dataSize->ZoneHeatingOnlyFan) { - SAFMethod = zoneHVACSizing.CoolingSAFMethod; + int SAFMethod = zoneHVACSizing.CoolingSAFMethod; SizingMethod = HVAC::CoolingAirflowSizing; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { @@ -1421,7 +1412,7 @@ namespace UnitVentilator { } else if (zoneHVACSizing.HeatingSAFMethod > 0 && state.dataSize->ZoneHeatingOnlyFan && !state.dataSize->ZoneCoolingOnlyFan) { SizingMethod = HVAC::HeatingAirflowSizing; - SAFMethod = zoneHVACSizing.HeatingSAFMethod; + int SAFMethod = zoneHVACSizing.HeatingSAFMethod; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { case DataSizing::None: @@ -1461,7 +1452,6 @@ namespace UnitVentilator { HeatingAirVolFlowScalable = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } break; case DataSizing::FlowPerHeatingCapacity: { - SizingMethod = HVAC::HeatingCapacitySizing; TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -1471,7 +1461,6 @@ namespace UnitVentilator { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataFlowPerHeatingCapacity = zoneHVACSizing.MaxHeatAirVolFlow; - SizingMethod = HVAC::HeatingAirflowSizing; PrintFlag = true; TempSize = DataSizing::AutoSize; errorsFound = false; @@ -1490,7 +1479,7 @@ namespace UnitVentilator { if (unitVent.CoilOption != CoilsUsed::None) { if (zoneHVACSizing.CoolingSAFMethod > 0) { - SAFMethod = zoneHVACSizing.CoolingSAFMethod; + int SAFMethod = zoneHVACSizing.CoolingSAFMethod; SizingMethod = HVAC::CoolingAirflowSizing; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { @@ -1555,7 +1544,7 @@ namespace UnitVentilator { } } else if (zoneHVACSizing.HeatingSAFMethod > 0) { SizingMethod = HVAC::HeatingAirflowSizing; - SAFMethod = zoneHVACSizing.HeatingSAFMethod; + int SAFMethod = zoneHVACSizing.HeatingSAFMethod; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { case DataSizing::None: @@ -1595,7 +1584,6 @@ namespace UnitVentilator { HeatingAirVolFlowScalable = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } break; case DataSizing::FlowPerHeatingCapacity: { - SizingMethod = HVAC::HeatingCapacitySizing; TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -1605,7 +1593,6 @@ namespace UnitVentilator { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataFlowPerHeatingCapacity = zoneHVACSizing.MaxHeatAirVolFlow; - SizingMethod = HVAC::HeatingAirflowSizing; PrintFlag = true; TempSize = DataSizing::AutoSize; errorsFound = false; @@ -1827,7 +1814,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::HeatingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -1897,8 +1884,6 @@ namespace UnitVentilator { MaxVolHotWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { unitVent.MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -1955,7 +1940,7 @@ namespace UnitVentilator { } else { CheckZoneSizing(state, state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name); - CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( state, "Coil:Heating:Steam", unitVent.HCoilName, unitVent.HotControlNode, CoilSteamOutletNode, ErrorsFound); @@ -1963,7 +1948,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::HeatingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -2034,8 +2019,6 @@ namespace UnitVentilator { ShowContinueError(state, format("Occurs in {} = \"{}\"", state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name)); ErrorsFound = true; } - } - if (IsAutoSize) { unitVent.MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -2102,7 +2085,7 @@ namespace UnitVentilator { } CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); if (IsAutoSize) { - PltSizCoolNum = PlantUtilities::MyPlantSizingIndex( + int PltSizCoolNum = PlantUtilities::MyPlantSizingIndex( state, CoolingCoilType, CoolingCoilName, unitVent.ColdControlNode, CoilWaterOutletNode, ErrorsFound); if (state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).DesignWaterDeltaTemp; @@ -2124,7 +2107,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::CoolingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.CoolingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -2199,8 +2182,6 @@ namespace UnitVentilator { MaxVolColdWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { unitVent.MaxVolColdWaterFlow = MaxVolColdWaterFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -2379,20 +2360,18 @@ namespace UnitVentilator { } // initialize local variables - int ControlNode = 0; Real64 QUnitOut = 0.0; Real64 ControlOffset = 0.0; Real64 MaxWaterFlow = 0.0; Real64 MinWaterFlow = 0.0; Real64 NoOutput = 0.0; Real64 FullOutput = 0.0; - int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect HVAC::FanOp fanOp = unitVent.fanOp; Real64 PartLoadFrac = 0.0; - auto &inletNode(state.dataLoopNodes->Node(unitVent.AirInNode)); - auto &outletNode(state.dataLoopNodes->Node(unitVent.AirOutNode)); - auto &outsideAirNode(state.dataLoopNodes->Node(unitVent.OutsideAirNode)); + auto const &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); + auto const &outletNode = state.dataLoopNodes->Node(unitVent.AirOutNode); + auto const &outsideAirNode = state.dataLoopNodes->Node(unitVent.OutsideAirNode); if ((std::abs(state.dataUnitVentilators->QZnReq) < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) || (ScheduleManager::GetCurrentScheduleValue(state, unitVent.SchedPtr) <= 0) || @@ -2421,11 +2400,12 @@ namespace UnitVentilator { CalcUnitVentilatorComponents(state, UnitVentNum, FirstHVACIteration, QUnitOut); } } else { // Unit is on-->this section is intended to control the outside air and the main - // result is to set the outside air flow rate variable OAMassFlowRate + // result is to set the outside air flow rate variable OAMassFlowRate + int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect unitVent.FanPartLoadRatio = 1.0; if (state.dataUnitVentilators->QZnReq > HVAC::SmallLoad) { // HEATING MODE - ControlNode = unitVent.HotControlNode; + int ControlNode = unitVent.HotControlNode; ControlOffset = unitVent.HotControlOffset; MaxWaterFlow = unitVent.MaxHotWaterFlow; MinWaterFlow = unitVent.MinHotWaterFlow; @@ -2684,7 +2664,7 @@ namespace UnitVentilator { } else { // COOLING MODE - ControlNode = unitVent.ColdControlNode; + int ControlNode = unitVent.ColdControlNode; ControlOffset = unitVent.ColdControlOffset; MaxWaterFlow = unitVent.MaxColdWaterFlow; MinWaterFlow = unitVent.MinColdWaterFlow; @@ -3201,7 +3181,7 @@ namespace UnitVentilator { auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); auto &airRelNode = state.dataLoopNodes->Node(unitVent.AirReliefNode); - auto &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); + auto const &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); auto &OAMixOutNode = state.dataLoopNodes->Node(unitVent.OAMixerOutNode); auto &outsideAirNode = state.dataLoopNodes->Node(unitVent.OutsideAirNode); Real64 OutAirMassFlowRate = state.dataUnitVentilators->OAMassFlowRate; @@ -3390,7 +3370,7 @@ namespace UnitVentilator { ) { - Real64 ActualOAMassFlowRate(0.0); // Result or return value + Real64 ActualOAMassFlowRate = 0.0; // Result or return value if (Tinlet <= Toutdoor) { diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index e68b2f8047a..ddeb892fdeb 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -102,8 +102,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function processes a string that should be numeric and @@ -184,8 +182,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -206,8 +202,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -228,8 +222,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -237,11 +229,10 @@ namespace Util { // found. This routine is case insensitive. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - int Probe(0); - int LBnd(0); - int UBnd(NumItems + 1); - bool Found(false); + int Probe = 0; + int LBnd = 0; + int UBnd = NumItems + 1; + bool Found = false; while ((!Found) || (Probe != 0)) { Probe = (UBnd - LBnd) / 2; if (Probe == 0) break; @@ -264,16 +255,12 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN April 1999 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of // items and returns the index of the item in the list, if // found. This routine is case insensitive. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int FindItem = Util::FindItemInList(String, ListOfItems, NumItems); if (FindItem != 0) return FindItem; @@ -289,8 +276,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN April 1999 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -320,20 +305,15 @@ namespace Util { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine verifys that a new name can be added to the // list of names for this item (i.e., that there isn't one of that // name already and that this name is not blank). - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Found; - ErrorFound = false; if (NumOfNames > 0) { - Found = FindItem(NameToVerify, NamesList, NumOfNames); + int Found = FindItem(NameToVerify, NamesList, NumOfNames); if (Found != 0) { ShowSevereError(state, format("{}, duplicate name={}", StringToDisplay, NameToVerify)); ErrorFound = true; @@ -361,8 +341,6 @@ namespace Util { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine verifys that a new name can be added to the @@ -460,45 +438,20 @@ int AbortEnergyPlus(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine causes the program to halt due to a fatal error. // METHODOLOGY EMPLOYED: - // Puts a message on output files. - // Closes files. - // Stops the program. - - // Using/Aliasing - using namespace DataSystemVariables; - using namespace DataErrorTracking; - using BranchInputManager::TestBranchIntegrity; - using BranchNodeConnections::CheckNodeConnections; - using BranchNodeConnections::TestCompSetInletOutletNodes; - using ExternalInterface::CloseSocket; - - using NodeInputManager::CheckMarkedNodes; - using NodeInputManager::SetupNodeVarsForReporting; - using PlantManager::CheckPlantOnAbort; - using SimulationManager::ReportLoopConnections; - using SolarShading::ReportSurfaceErrors; - using SystemReports::ReportAirLoopConnections; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: + // Puts a message on output files. Closes files. Stops the program. // SUBROUTINE PARAMETER DEFINITIONS: - std::string NumWarnings; std::string NumSevere; std::string NumWarningsDuringWarmup; std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; std::string NumSevereDuringSizing; - bool ErrFound; - bool TerminalError; if (state.dataSQLiteProcedures->sqlite) { state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(true, false); @@ -509,24 +462,24 @@ int AbortEnergyPlus(EnergyPlusData &state) state.dataErrTracking->AskForConnectionsReport = false; // Set false here in case any further fatal errors in below processing... ShowMessage(state, "Fatal error -- final processing. More error messages may appear."); - SetupNodeVarsForReporting(state); + NodeInputManager::SetupNodeVarsForReporting(state); - ErrFound = false; - TerminalError = false; - TestBranchIntegrity(state, ErrFound); + bool ErrFound = false; + bool TerminalError = false; + BranchInputManager::TestBranchIntegrity(state, ErrFound); if (ErrFound) TerminalError = true; TestAirPathIntegrity(state, ErrFound); if (ErrFound) TerminalError = true; - CheckMarkedNodes(state, ErrFound); + NodeInputManager::CheckMarkedNodes(state, ErrFound); if (ErrFound) TerminalError = true; - CheckNodeConnections(state, ErrFound); + BranchNodeConnections::CheckNodeConnections(state, ErrFound); if (ErrFound) TerminalError = true; - TestCompSetInletOutletNodes(state, ErrFound); + BranchNodeConnections::TestCompSetInletOutletNodes(state, ErrFound); if (ErrFound) TerminalError = true; if (!TerminalError) { - ReportAirLoopConnections(state); - ReportLoopConnections(state); + SystemReports::ReportAirLoopConnections(state); + SimulationManager::ReportLoopConnections(state); } } else if (!state.dataErrTracking->ExitDuringSimulations) { @@ -538,8 +491,8 @@ int AbortEnergyPlus(EnergyPlusData &state) ReportSurfaces(state); } - ReportSurfaceErrors(state); - CheckPlantOnAbort(state); + SolarShading::ReportSurfaceErrors(state); + PlantManager::CheckPlantOnAbort(state); ShowRecurringErrors(state); SummarizeErrors(state); CloseMiscOpenFiles(state); @@ -585,7 +538,7 @@ int AbortEnergyPlus(EnergyPlusData &state) << "EnergyPlus Terminated--Error(s) Detected." << std::endl; // Close the socket used by ExternalInterface. This call also sends the flag "-1" to the ExternalInterface, // indicating that E+ terminated with an error. - if (state.dataExternalInterface->NumExternalInterfaces > 0) CloseSocket(state, -1); + if (state.dataExternalInterface->NumExternalInterfaces > 0) ExternalInterface::CloseSocket(state, -1); if (state.dataGlobal->eplusRunningViaAPI) { state.files.flushAll(); @@ -604,8 +557,6 @@ void CloseMiscOpenFiles(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine scans potential unit numbers and closes @@ -614,12 +565,8 @@ void CloseMiscOpenFiles(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Use INQUIRE to determine if file is open. - // Using/Aliasing - using Dayltg::CloseDFSFile; - using Dayltg::CloseReportIllumMaps; - - CloseReportIllumMaps(state); - CloseDFSFile(state); + Dayltg::CloseReportIllumMaps(state); + Dayltg::CloseDFSFile(state); if (state.dataReportFlag->DebugOutput || (state.files.debug.good() && state.files.debug.position() > 0)) { state.files.debug.close(); @@ -634,22 +581,12 @@ int EndEnergyPlus(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine causes the program to terminate when complete (no errors). // METHODOLOGY EMPLOYED: - // Puts a message on output files. - // Closes files. - // Stops the program. - - using namespace DataSystemVariables; - using namespace DataErrorTracking; - using ExternalInterface::CloseSocket; - - using SolarShading::ReportSurfaceErrors; + // Puts a message on output files. Closes files. Stops the program. std::string NumWarnings; std::string NumSevere; @@ -662,7 +599,7 @@ int EndEnergyPlus(EnergyPlusData &state) state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(true, true); } - ReportSurfaceErrors(state); + SolarShading::ReportSurfaceErrors(state); ShowRecurringErrors(state); SummarizeErrors(state); CloseMiscOpenFiles(state); @@ -716,7 +653,8 @@ int EndEnergyPlus(EnergyPlusData &state) if (state.dataGlobal->printConsoleOutput) std::cerr << "EnergyPlus Completed Successfully." << std::endl; // Close the ExternalInterface socket. This call also sends the flag "1" to the ExternalInterface, // indicating that E+ finished its simulation - if ((state.dataExternalInterface->NumExternalInterfaces > 0) && state.dataExternalInterface->haveExternalInterfaceBCVTB) CloseSocket(state, 1); + if ((state.dataExternalInterface->NumExternalInterfaces > 0) && state.dataExternalInterface->haveExternalInterfaceBCVTB) + ExternalInterface::CloseSocket(state, 1); if (state.dataGlobal->fProgressPtr) { state.dataGlobal->fProgressPtr(100); @@ -744,8 +682,6 @@ void ConvertCaseToUpper(std::string_view InputString, // Input string // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Convert a string to upper case @@ -778,8 +714,6 @@ void ConvertCaseToLower(std::string_view InputString, // Input string // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Convert a string to lower case @@ -810,8 +744,6 @@ std::string::size_type FindNonSpace(std::string const &String) // String to be s // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function finds the first non-space character in the passed string @@ -820,28 +752,6 @@ std::string::size_type FindNonSpace(std::string const &String) // String to be s // METHODOLOGY EMPLOYED: // Scan string for character not equal to blank. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - return String.find_first_not_of(' '); } @@ -851,8 +761,6 @@ bool env_var_on(std::string const &env_var_str) // FUNCTION INFORMATION: // AUTHOR Stuart G. Mentzer // DATE WRITTEN April 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Test if a boolean environment variable value is "on" (has value starting with Y or T) @@ -920,10 +828,7 @@ void ShowFatalError(EnergyPlusData &state, std::string const &ErrorMessage, Opti // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED Kyle Benne - // August 2010 - // Added sqlite output - // RE-ENGINEERED na + // MODIFIED Kyle Benne August 2010 Added sqlite output // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Fatal designation on @@ -957,8 +862,6 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Severe designation on @@ -967,12 +870,8 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ++state.dataErrTracking->TotalSevereErrors; @@ -999,25 +898,16 @@ void ShowSevereMessage(EnergyPlusData &state, std::string const &ErrorMessage, O // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine puts ErrorMessage with a Severe designation on - // designated output files. - // But does not bump the error count so can be used in conjunction with recurring - // error calls. + // This subroutine puts ErrorMessage with a Severe designation on designated output files. + // But does not bump the error count so can be used in conjunction with recurring error calls. // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ShowErrorMessage(state, format(" ** Severe ** {}", ErrorMessage), OutUnit1, OutUnit2); @@ -1039,8 +929,6 @@ void ShowContinueError(EnergyPlusData &state, std::string const &Message, Option // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN October 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a 'continued error' message on designated output files. @@ -1063,8 +951,6 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a 'continued error' timestamp message on designated output files. @@ -1072,9 +958,6 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - // Using/Aliasing - using General::CreateSysTimeIntervalString; - std::string cEnvHeader; if (state.dataGlobal->WarmupFlag) { @@ -1097,7 +980,7 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag cEnvHeader, state.dataEnvrn->EnvironmentName, state.dataEnvrn->CurMnDy, - CreateSysTimeIntervalString(state)); + General::CreateSysTimeIntervalString(state)); ShowErrorMessage(state, format(" ** ~~~ ** {}", m), OutUnit1, OutUnit2); if (state.dataSQLiteProcedures->sqlite) { @@ -1111,7 +994,7 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag cEnvHeader, state.dataEnvrn->EnvironmentName, state.dataEnvrn->CurMnDy, - CreateSysTimeIntervalString(state)); + General::CreateSysTimeIntervalString(state)); ShowErrorMessage(state, format(" ** ~~~ ** {}", Message)); ShowErrorMessage(state, format(" ** ~~~ ** {}", postfix), OutUnit1, OutUnit2); if (state.dataSQLiteProcedures->sqlite) { @@ -1130,8 +1013,6 @@ void ShowMessage(EnergyPlusData &state, std::string const &Message, OptionalOutp // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a simple message on designated output files. @@ -1158,8 +1039,6 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Warning designation on @@ -1168,12 +1047,8 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ++state.dataErrTracking->TotalWarningErrors; @@ -1207,12 +1082,8 @@ void ShowWarningMessage(EnergyPlusData &state, std::string const &ErrorMessage, // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ShowErrorMessage(state, format(" ** Warning ** {}", ErrorMessage), OutUnit1, OutUnit2); @@ -1248,16 +1119,12 @@ void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "severe" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1299,16 +1166,12 @@ void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "severe" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1353,16 +1216,12 @@ void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "warning" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1404,16 +1263,12 @@ void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "warning" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1458,16 +1313,12 @@ void ShowRecurringContinueErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "continue" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1510,9 +1361,6 @@ void StoreRecurringErrorMessage(EnergyPlusData &state, // for output at the end of the simulation with automatic tracking of number // of occurrences and optional tracking of associated min, max, and sum values - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; // If Index is zero, then assign next available index and reallocate array if (ErrorMsgIndex == 0) { state.dataErrTracking->RecurringErrors.redimension(++state.dataErrTracking->NumRecurringErrors); @@ -1577,13 +1425,10 @@ void ShowErrorMessage(EnergyPlusData &state, std::string const &ErrorMessage, Op // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays the error messages on the indicated - // file unit numbers, in addition to the "standard error output" - // unit. + // file unit numbers, in addition to the "standard error output" unit. // METHODOLOGY EMPLOYED: // If arguments OutUnit1 and/or OutUnit2 are present the @@ -1620,15 +1465,11 @@ void SummarizeErrors(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine provides a summary of certain errors that might // otherwise get lost in the shuffle of many similar messages. - using namespace DataErrorTracking; - std::string::size_type StartC; std::string::size_type EndC; @@ -1636,10 +1477,10 @@ void SummarizeErrors(EnergyPlusData &state) ShowMessage(state, ""); ShowMessage(state, "===== Final Error Summary ====="); ShowMessage(state, "The following error categories occurred. Consider correcting or noting."); - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { if (state.dataErrTracking->MatchCounts(Loop) > 0) { - ShowMessage(state, Summaries[Loop]); - std::string thisMoreDetails = MoreDetails[Loop]; + ShowMessage(state, DataErrorTracking::Summaries[Loop]); + std::string thisMoreDetails = DataErrorTracking::MoreDetails[Loop]; if (!thisMoreDetails.empty()) { StartC = 0; EndC = len(thisMoreDetails) - 1; @@ -1663,29 +1504,18 @@ void ShowRecurringErrors(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine provides a summary of certain errors that might // otherwise get lost in the shuffle of many similar messages. - // Using/Aliasing - using namespace DataErrorTracking; - static constexpr std::string_view StatMessageStart(" ** ~~~ ** "); - int Loop; - std::string StatMessage; - std::string MaxOut; - std::string MinOut; - std::string SumOut; - if (state.dataErrTracking->NumRecurringErrors > 0) { ShowMessage(state, ""); ShowMessage(state, "===== Recurring Error Summary ====="); ShowMessage(state, "The following recurring error messages occurred."); - for (Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) { + for (int Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) { auto const &error = state.dataErrTracking->RecurringErrors(Loop); // Suppress reporting the count if it is a continue error if (has_prefix(error.Message, " ** ~~~ ** ")) { @@ -1721,19 +1551,19 @@ void ShowRecurringErrors(EnergyPlusData &state) state.dataGlobal->errorCallback(Error::Continue, ""); } } - StatMessage = ""; + std::string StatMessage = ""; if (error.ReportMax) { - MaxOut = format("{:.6f}", error.MaxValue); + std::string MaxOut = format("{:.6f}", error.MaxValue); StatMessage += " Max=" + MaxOut; if (!error.MaxUnits.empty()) StatMessage += ' ' + error.MaxUnits; } if (error.ReportMin) { - MinOut = format("{:.6f}", error.MinValue); + std::string MinOut = format("{:.6f}", error.MinValue); StatMessage += " Min=" + MinOut; if (!error.MinUnits.empty()) StatMessage += ' ' + error.MinUnits; } if (error.ReportSum) { - SumOut = format("{:.6f}", error.SumValue); + std::string SumOut = format("{:.6f}", error.SumValue); StatMessage += " Sum=" + SumOut; if (!error.SumUnits.empty()) StatMessage += ' ' + error.SumUnits; } diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index fb069db95c6..adfa4c7b3d7 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -85,14 +85,6 @@ namespace EnergyPlus { namespace VariableSpeedCoils { - // Using/Aliasing - using namespace DataLoopNode; - using namespace Psychrometrics; - using namespace DataSizing; - - using DXCoils::AdjustCBF; - using DXCoils::CalcCBF; - Real64 constexpr RatedInletAirTemp = 26.6667; // 26.6667C or 80F Real64 constexpr RatedInletWetBulbTemp = 19.4444; // 19.44 or 67F, cooling mode Real64 constexpr RatedInletAirHumRat = 0.0111847; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb @@ -133,14 +125,10 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, ORNL // DATE WRITTEN March 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine manages variable-speed Water to Air Heat Pump component simulation. - // Using/Aliasing - using General::SolveRoot; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int DXCoilNum; // The WatertoAirHP that you are currently loading input into int SpeedCal; // variable for error proof speed input @@ -217,7 +205,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen // DATE WRITTEN March, 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for HPs and stores it in HP data structures @@ -225,36 +212,15 @@ namespace VariableSpeedCoils { // METHODOLOGY EMPLOYED: // Uses "Get" routines to read in data. - // Using/Aliasing - using namespace NodeInputManager; - using BranchNodeConnections::TestCompSet; - using GlobalNames::VerifyUniqueCoilName; - using namespace OutputReportPredefined; - using Curve::CurveValue; - using Curve::GetCurveIndex; - - using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; - using WaterManager::SetupTankDemandComponent; - using WaterManager::SetupTankSupplyComponent; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetVarSpeedCoilInput: "); // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int DXCoilNum; // The Water to Air HP that you are currently loading input into - int NumCool; // Counter for cooling coil, water source - int NumCoolAS; // Counter for cooling coil, air source - int NumHeat; // Counter for heating coil, water source - int NumHeatAS; // Counter for heating coil, air source - int NumHPWHAirToWater; // counter for air source HPWH - int CoilCounter; // Counter - int I; // Loop index increment - int NumAlphas; // Number of variables in String format - int NumNums; // Number of variables in Numeric format - int NumParams; // Total number of input fields - int MaxNums(0); // Maximum number of numeric input fields - int MaxAlphas(0); // Maximum number of alpha input fields + int NumAlphas; // Number of variables in String format + int NumNums; // Number of variables in Numeric format + int NumParams; // Total number of input fields + int MaxNums(0); // Maximum number of numeric input fields + int MaxAlphas(0); // Maximum number of alpha input fields int IOStat; int AlfaFieldIncre; // increment number of Alfa field bool ErrorsFound(false); // If errors detected in input @@ -269,14 +235,16 @@ namespace VariableSpeedCoils { Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. - NumCool = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); - NumHeat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); - NumCoolAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:DX:VARIABLESPEED"); - NumHeatAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:DX:VARIABLESPEED"); - NumHPWHAirToWater = + int NumCool = + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); + int NumHeat = + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); + int NumCoolAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:DX:VARIABLESPEED"); + int NumHeatAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:DX:VARIABLESPEED"); + int NumHPWHAirToWater = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"); state.dataVariableSpeedCoils->NumVarSpeedCoils = NumCool + NumHeat + NumCoolAS + NumHeatAS + NumHPWHAirToWater; - DXCoilNum = 0; + int DXCoilNum = 0; if (state.dataVariableSpeedCoils->NumVarSpeedCoils <= 0) { ShowSevereError(state, "No Equipment found in GetVarSpeedCoilInput"); @@ -321,7 +289,7 @@ namespace VariableSpeedCoils { // Get the data for cooling coil, WATER SOURCE CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumCool; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumCool; ++CoilCounter) { ++DXCoilNum; AlfaFieldIncre = 1; @@ -340,7 +308,7 @@ namespace VariableSpeedCoils { cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -370,7 +338,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -380,7 +348,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), @@ -390,7 +358,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), @@ -400,10 +368,10 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { @@ -431,7 +399,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( @@ -446,7 +414,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -458,7 +426,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(13 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(14 + (I - 1) * 6); @@ -468,7 +436,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 7 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -497,7 +465,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -514,7 +482,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 8 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -543,7 +511,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -559,7 +527,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -588,7 +556,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -604,7 +572,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -633,7 +601,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -650,7 +618,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -679,7 +647,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -695,7 +663,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -724,7 +692,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -741,7 +709,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -770,7 +738,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), RatedInletWaterTemp, RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -786,7 +754,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -845,35 +813,15 @@ namespace VariableSpeedCoils { OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); - // for table output, being consistent with other water-to-air coils - // IF (VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal /= AutoSize) THEN - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal & - // *VarSpeedCoil(DXCoilNum)%MSRatedSHR(VarSpeedCoil(DXCoilNum)%NormSpedLevel) - // ELSE - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = AUTOSIZE - // END IF - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation - - // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine - // create predefined report entries - // PreDefTableEntry(state, pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry(state, pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry(state, pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry(state, pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - - // VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry(state, pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( - // DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry(state, pdchCoolCoilNomEff, VarSpeedCoil( - // DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //-------------------------AIR SOURCE, COOLING---BEGIN // Get the data for cooling coil, AIR SOURCE CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumCoolAS; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumCoolAS; ++CoilCounter) { ++DXCoilNum; AlfaFieldIncre = 1; @@ -891,7 +839,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -920,7 +868,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -930,9 +878,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { ShowSevereError( @@ -959,7 +907,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( @@ -974,7 +922,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -999,9 +947,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::OutsideAirReference, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { ShowWarningError(state, format("{}{}=\"{}\", may be invalid", RoutineName, @@ -1080,13 +1028,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, - ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); + WaterManager::SetupTankDemandComponent(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CurrentModuleObject, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, + ErrorsFound, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A9; \field Name of Water Storage Tank for Condensate Collection @@ -1095,13 +1043,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, - ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); + WaterManager::SetupTankSupplyComponent(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CurrentModuleObject, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, + ErrorsFound, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 @@ -1129,7 +1077,8 @@ namespace VariableSpeedCoils { } if (!lAlphaBlanks(10)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, AlphArray(10)); + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = + ScheduleManager::GetScheduleIndex(state, AlphArray(10)); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { ShowWarningError( state, @@ -1139,7 +1088,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(16 + (I - 1) * 8); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(17 + (I - 1) * 8); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(18 + (I - 1) * 8); @@ -1160,7 +1109,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1189,7 +1138,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -1206,7 +1155,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1235,7 +1184,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1251,7 +1200,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1280,7 +1229,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -1297,7 +1246,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 14 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1326,7 +1275,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1341,7 +1290,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -1398,19 +1347,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation - - // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine - // create predefined report entries - // PreDefTableEntry(state, pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry(state, pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry(state, pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry(state, pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - - // VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry(state, pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( - // DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry(state, pdchCoolCoilNomEff, VarSpeedCoil( - // DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //-------------------------AIR SOURCE COOLING---END @@ -1418,7 +1355,7 @@ namespace VariableSpeedCoils { // Get the data for heating coil, WATER SOURCE CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit"; - for (CoilCounter = 1; CoilCounter <= NumHeat; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHeat; ++CoilCounter) { ++DXCoilNum; @@ -1435,7 +1372,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -1465,7 +1402,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -1475,7 +1412,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), @@ -1485,7 +1422,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), @@ -1495,10 +1432,10 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { @@ -1526,7 +1463,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( @@ -1541,7 +1478,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1553,7 +1490,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); @@ -1562,7 +1499,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 7 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1591,10 +1528,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1610,7 +1547,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 8 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1639,7 +1576,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1655,7 +1592,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1684,7 +1621,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1700,7 +1637,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1729,10 +1666,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1748,7 +1685,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1777,7 +1714,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1793,7 +1730,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1822,7 +1759,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1839,7 +1776,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1868,10 +1805,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1886,7 +1823,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -1932,24 +1869,24 @@ namespace VariableSpeedCoils { OutputProcessor::EndUseCat::HeatingCoils); // create predefined report entries - PreDefTableEntry( + OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomCap, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomEff, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE, HEATING---BEGIN // Get the data for heating coil, AIR SOURCE CurrentModuleObject = "COIL:HEATING:DX:VARIABLESPEED"; - for (CoilCounter = 1; CoilCounter <= NumHeatAS; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHeatAS; ++CoilCounter) { ++DXCoilNum; @@ -1966,7 +1903,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -1992,7 +1929,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -2002,9 +1939,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { ShowSevereError( @@ -2031,7 +1968,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( @@ -2046,7 +1983,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2058,7 +1995,8 @@ namespace VariableSpeedCoils { } } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, AlphArray(5)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = + Curve::GetCurveIndex(state, AlphArray(5)); // convert curve name to number if (!lAlphaBlanks(6)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); @@ -2166,7 +2104,7 @@ namespace VariableSpeedCoils { ShowContinueError(state, format("...{} = 0.0 for defrost strategy = RESISTIVE.", cNumericFields(6))); } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 5); @@ -2188,7 +2126,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2217,7 +2155,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -2234,7 +2172,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2263,7 +2201,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2279,7 +2217,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2308,7 +2246,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -2325,7 +2263,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2354,7 +2292,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2371,7 +2309,7 @@ namespace VariableSpeedCoils { if (ErrorsFound) continue; - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -2411,17 +2349,17 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); // create predefined report entries - PreDefTableEntry( + OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomCap, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomEff, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE HEATING---END @@ -2429,10 +2367,9 @@ namespace VariableSpeedCoils { //------------------------VARIABLE-SPEED AIR SOURCE HPWH---BEGIN CurrentModuleObject = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumHPWHAirToWater; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHPWHAirToWater; ++CoilCounter) { ++DXCoilNum; - AlfaFieldIncre = 1; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2447,7 +2384,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::WaterHeater; @@ -2589,7 +2526,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, @@ -2600,13 +2537,13 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone = - !CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); + !OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); // Water nodes state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = @@ -2618,7 +2555,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, @@ -2629,9 +2566,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(10); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { @@ -2687,7 +2624,8 @@ namespace VariableSpeedCoils { WHInletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(11)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = + Curve::GetCurveIndex(state, AlphArray(11)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(11)) { ShowSevereError( @@ -2702,7 +2640,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2714,7 +2652,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); @@ -2724,7 +2662,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2753,8 +2691,8 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue( + state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2770,7 +2708,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2799,7 +2737,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2815,7 +2753,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 14 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2844,7 +2782,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2860,7 +2798,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 15 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2889,8 +2827,8 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue( + state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2906,7 +2844,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 16 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2935,7 +2873,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2951,7 +2889,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 17 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2980,7 +2918,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2996,7 +2934,7 @@ namespace VariableSpeedCoils { } // get scale values - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -3070,7 +3008,7 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //---------------------------VARIABLE-SPEED AIR SOURCE HPWH END -------------- @@ -3872,7 +3810,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on MODULE WaterToAirHeatPumpSimple:InitSimpleWatertoAirHP // DATE WRITTEN March, 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for initializations of the variable speed Water to Air HP Components. @@ -3880,44 +3817,23 @@ namespace VariableSpeedCoils { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - - using PlantUtilities::InitComponentNodes; - using PlantUtilities::ScanPlantLoopsForObject; - using PlantUtilities::SetComponentFlowRate; - using Psychrometrics::PsyRhoAirFnPbTdbW; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // shut off after compressor cycle off [s] - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineNameSimpleWatertoAirHP("InitSimpleWatertoAirHP"); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirInletNode; // Node Number of the air inlet int WaterInletNode; // Node Number of the Water inlet Real64 rho; // local fluid density Real64 Cp; // local fluid specific heat int SpeedCal; // calculated speed level - bool ErrorsFound(false); // TRUE when errors found, air loop initialization error + bool ErrorsFound; // TRUE when errors found, air loop initialization error Real64 RatedVolFlowPerRatedTotCap; // Rated Air Volume Flow Rate divided by Rated Total Capacity [m3/s-W) - int Mode; // Performance mode for MultiMode DX coil; Always 1 for other coil types Real64 RatedHeatPumpIndoorAirTemp; // Indoor dry-bulb temperature to heat pump evaporator at rated conditions [C] Real64 RatedHeatPumpIndoorHumRat; // Inlet humidity ratio to heat pump evaporator at rated conditions [kg/kg] Real64 WaterFlowScale; // water flow scaling factor match rated flow rate // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("InitVarSpeedCoil"); + static constexpr std::string_view RoutineName = "InitVarSpeedCoil"; + int AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; if (state.dataVariableSpeedCoils->MyOneTimeFlag) { // initialize the environment and sizing flags @@ -3961,16 +3877,16 @@ namespace VariableSpeedCoils { CoilVSWAHPType = DataPlant::PlantEquipmentType::CoilVSWAHPHeatingEquationFit; } ErrorsFound = false; - ScanPlantLoopsForObject(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CoilVSWAHPType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc, - ErrorsFound, - _, - _, - _, - _, - _); + PlantUtilities::ScanPlantLoopsForObject(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CoilVSWAHPType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc, + ErrorsFound, + _, + _, + _, + _, + _); if (ErrorsFound) { ShowFatalError(state, "InitVarSpeedCoil: Program terminated for previous conditions."); } @@ -3994,7 +3910,7 @@ namespace VariableSpeedCoils { // Multispeed Cooling if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { - for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) break; // Check for zero capacity or zero max flow rate if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { @@ -4019,27 +3935,6 @@ namespace VariableSpeedCoils { // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); - // note: variable-speed HP can exceed the flow rate restrictions at low speed levels - // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & - // ((RatedVolFlowPerRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError(state,'Sizing: '//TRIM(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType) & - // // ' "'//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & - // '": Rated air volume flow rate per watt of rated total '// & - // 'cooling capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) - // CALL ShowContinueError & - // ('Min Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(MinRatedAirVolFlowPerRatedTotCap,3))//'], '// & - // 'Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(RatedVolFlowPerRatedTotCap,3))//'], & - // Max Rated Vol Flow Per Watt=['// & - // TRIM(TrimSigDigits(MaxRatedAirVolFlowPerRatedTotCap,3))//']. See Input-Output Reference Manual for valid range.') - // END IF - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum)%MSRatedAirVolFlowRate(Mode)* & - // PsyRhoAirFnPbTdbW(state, OutBaroPress,RatedInletAirTemp,RatedInletAirHumRat,RoutineName) - // ! get high speed rated coil bypass factor - // VarSpeedCoil(DXCoilNum)%MSRatedCBF(Mode) = CalcCBF(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType, & - // VarSpeedCoil(DXCoilNum)%Name,& - // RatedInletAirTemp,RatedInletAirHumRat,VarSpeedCoil(DXCoilNum)%MSRatedTotCap(Mode),& - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode), & - // VarSpeedCoil(DXCoilNum)%MSRatedSHR(Mode)) } // call coil model with everything set at rating point state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTemp; @@ -4082,7 +3977,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTemp; // 85 F cooling mode - Real64 CpSource = GetSpecificHeatGlycol( + Real64 CpSource = FluidProperties::GetSpecificHeatGlycol( state, state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, state.dataVariableSpeedCoils->SourceSideInletTemp, @@ -4155,27 +4050,15 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); + Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); - // note: variable-speed HP can exceed the flow rate restrictions at low speed levels - // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & - // ((RatedVolFlowperRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError(state,'Coil:Heating:DX:MultiSpeed '//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & - // ': Rated air volume flow rate per watt of rated total '// & - // 'heating capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) - // CALL ShowContinueError(state, 'Min Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits & - // (MinRatedAirVolFlowPerRatedTotCap,3))//'], '// & - // 'Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(RatedVolFlowPerRatedTotCap,3))//'], & - // Max Rated Vol Flow Per Watt=['// & - // TRIM(TrimSigDigits(MaxRatedAirVolFlowPerRatedTotCap,3))//']. See Input-Output Reference & - // Manual for valid range.') - // END IF } // call coil model with everthing set at rating point state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTempHeat; @@ -4218,7 +4101,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTempHeat; // 21.11C or 70F, heating mode - Real64 CpSource = GetSpecificHeatGlycol( + Real64 CpSource = FluidProperties::GetSpecificHeatGlycol( state, state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, state.dataVariableSpeedCoils->SourceSideInletTemp, @@ -4333,8 +4216,6 @@ namespace VariableSpeedCoils { !state.dataVariableSpeedCoils->MyPlantScanFlag(DXCoilNum)) { // Do the initializations to start simulation - AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; - // Initialize all report variables to a known state at beginning of simulation state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = 0.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = 0.0; @@ -4365,12 +4246,13 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSimpleWatertoAirHP); - Cp = GetSpecificHeatGlycol( + rho = FluidProperties::GetDensityGlycol( + state, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, + Constant::CWInitConvTemp, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, + RoutineNameSimpleWatertoAirHP); + Cp = FluidProperties::GetSpecificHeatGlycol( state, state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, Constant::CWInitConvTemp, @@ -4380,11 +4262,11 @@ namespace VariableSpeedCoils { // VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate= & // rho * VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate - InitComponentNodes(state, - 0.0, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum); + PlantUtilities::InitComponentNodes(state, + 0.0, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum); state.dataLoopNodes->Node(WaterInletNode).Temp = 5.0; state.dataLoopNodes->Node(WaterInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; @@ -4417,7 +4299,6 @@ namespace VariableSpeedCoils { // Set water and air inlet nodes - AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; if ((SensLoad != 0.0 || LatentLoad != 0.0) && (state.dataLoopNodes->Node(AirInletNode).MassFlowRate > 0.0)) { @@ -4441,16 +4322,16 @@ namespace VariableSpeedCoils { // If air flow is less than 25% rated flow. Then set air flow to the 25% of rated conditions if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate < 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * - PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat)) { + Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataLoopNodes->Node(AirInletNode).Temp, + state.dataLoopNodes->Node(AirInletNode).HumRat)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * - PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat); + Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataLoopNodes->Node(AirInletNode).Temp, + state.dataLoopNodes->Node(AirInletNode).HumRat); } } else { // CYCLIC FAN, NOT CORRECTION, WILL BE PROCESSED IN THE FOLLOWING SUBROUTINES state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; @@ -4463,11 +4344,11 @@ namespace VariableSpeedCoils { if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { - SetComponentFlowRate(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc); + PlantUtilities::SetComponentFlowRate(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; @@ -4557,7 +4438,6 @@ namespace VariableSpeedCoils { static constexpr std::string_view RoutineName("SizeVarSpeedCoil"); static constexpr std::string_view RoutineNameAlt("SizeHVACWaterToAir"); - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -4671,7 +4551,7 @@ namespace VariableSpeedCoils { varSpeedCoil.plantLoc.loopNum); } - if (varSpeedCoil.RatedAirVolFlowRate == AutoSize) { + if (varSpeedCoil.RatedAirVolFlowRate == DataSizing::AutoSize) { RatedAirFlowAutoSized = true; } @@ -4688,7 +4568,7 @@ namespace VariableSpeedCoils { } else { CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { - auto &thisAirloopDOAS = + auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; RatedAirVolFlowRateDes = thisAirloopDOAS.SizingMassFlow / state.dataEnvrn->StdRhoAir; } else { @@ -4728,8 +4608,8 @@ namespace VariableSpeedCoils { // size rated total cooling capacity IsAutoSize = false; - if (varSpeedCoil.RatedCapCoolTotal == AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { + if (varSpeedCoil.RatedCapCoolTotal == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { RatedCapCoolTotalAutoSized = true; } if (SizingDesRunThisZone || SizingDesRunThisAirSys) HardSizeNoDesRun = false; @@ -4746,7 +4626,7 @@ namespace VariableSpeedCoils { } else { CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { - auto &thisAirloopDOAS = + auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; MixTemp = thisAirloopDOAS.SizingCoolOATemp; @@ -4767,7 +4647,7 @@ namespace VariableSpeedCoils { RatedCapCoolTotalDes /= TotCapTempModFac; } } else { - auto &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream @@ -4846,11 +4726,11 @@ namespace VariableSpeedCoils { } } else { CheckZoneSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); - auto &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum); + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum); VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->ZoneEqDXCoil) { - if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { + if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { MixTemp = finalZoneSizing.DesCoolCoilInTemp; MixHumRat = finalZoneSizing.DesCoolCoilInHumRat; } else { @@ -5001,8 +4881,8 @@ namespace VariableSpeedCoils { } // size rated heating capacity - if (varSpeedCoil.RatedCapHeat == AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + if (varSpeedCoil.RatedCapHeat == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { RatedCapHeatAutoSized = true; } // simply set heating capacity equal to the cooling capacity @@ -5017,7 +4897,7 @@ namespace VariableSpeedCoils { } // END IF if (RatedCapHeatAutoSized) { - if (RatedCapHeatDes == AutoSize) { + if (RatedCapHeatDes == DataSizing::AutoSize) { ShowWarningError( state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); ShowContinueError(state, @@ -5266,8 +5146,9 @@ namespace VariableSpeedCoils { } // Size water volumetric flow rate - if ((varSpeedCoil.RatedWaterVolFlowRate == AutoSize) && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { + if ((varSpeedCoil.RatedWaterVolFlowRate == DataSizing::AutoSize) && + (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { RatedWaterFlowAutoSized = true; } @@ -5344,10 +5225,8 @@ namespace VariableSpeedCoils { ShowContinueError(state, format("Occurs in COIL:{}{} Object = {}", varSpeedCoil.CoolHeatType, CurrentObjSubfix, varSpeedCoil.Name)); ErrorsFound = true; } - } - // WRITE THE WATER SIZING OUTPUT - if (RatedWaterFlowAutoSized) { + // WRITE THE WATER SIZING OUTPUT // FORCE BACK TO THE RATED WATER FLOW RATE WITH THE SAME RATIO DEFINED BY THE CATLOG DATA if (RatedCapCoolTotalAutoSized) { RatedWaterVolFlowRateDes = varSpeedCoil.RatedCapCoolTotal * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); @@ -5440,7 +5319,7 @@ namespace VariableSpeedCoils { varSpeedCoil.MSRatedWaterMassFlowRate(Mode) = varSpeedCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; } } else if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - rhoW = RhoH2O(RatedSourceTempCool); + rhoW = Psychrometrics::RhoH2O(RatedSourceTempCool); varSpeedCoil.RatedWaterMassFlowRate = varSpeedCoil.RatedWaterVolFlowRate * rhoW; for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { varSpeedCoil.MSRatedWaterVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); @@ -5485,15 +5364,15 @@ namespace VariableSpeedCoils { if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds; ++Mode) { - varSpeedCoil.MSRatedCBF(Mode) = CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, - RatedInletAirTemp, - RatedInletAirHumRat, - varSpeedCoil.MSRatedTotCap(Mode), - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), - true); + varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + varSpeedCoil.VarSpeedCoilType, + varSpeedCoil.Name, + RatedInletAirTemp, + RatedInletAirHumRat, + varSpeedCoil.MSRatedTotCap(Mode), + varSpeedCoil.MSRatedAirVolFlowRate(Mode), + varSpeedCoil.MSRatedSHR(Mode), + true); if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); } else { @@ -5517,15 +5396,15 @@ namespace VariableSpeedCoils { HPWHCoolCapacity = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; - varSpeedCoil.MSRatedCBF(Mode) = CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, - state.dataHVACGlobal->HPWHInletDBTemp, - HPInletAirHumRat, - HPWHCoolCapacity, - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), - true); + varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + varSpeedCoil.VarSpeedCoilType, + varSpeedCoil.Name, + state.dataHVACGlobal->HPWHInletDBTemp, + HPInletAirHumRat, + HPWHCoolCapacity, + varSpeedCoil.MSRatedAirVolFlowRate(Mode), + varSpeedCoil.MSRatedSHR(Mode), + true); if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); } else { @@ -5554,7 +5433,7 @@ namespace VariableSpeedCoils { varSpeedCoil.RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); RatedInletEnth = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat); - CBFRated = AdjustCBF(varSpeedCoil.MSRatedCBF(NormSpeed), varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); + CBFRated = DXCoils::AdjustCBF(varSpeedCoil.MSRatedCBF(NormSpeed), varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); if (CBFRated > 0.999) CBFRated = 0.999; if (varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed) > 1.0e-10) { AirMassFlowRatio = RatedAirMassFlowRate / varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed); @@ -5657,7 +5536,7 @@ namespace VariableSpeedCoils { // START SIZING EVAP PRECOOLING PUMP POWER IsAutoSize = false; if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (varSpeedCoil.EvapCondPumpElecNomPower == AutoSize) { + if (varSpeedCoil.EvapCondPumpElecNomPower == DataSizing::AutoSize) { IsAutoSize = true; } // Auto size high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) @@ -5707,7 +5586,7 @@ namespace VariableSpeedCoils { // Resistive Defrost Heater Capacity = capacity at the first stage IsAutoSize = false; if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - if (varSpeedCoil.DefrostCapacity == AutoSize) { + if (varSpeedCoil.DefrostCapacity == DataSizing::AutoSize) { IsAutoSize = true; } if (varSpeedCoil.DefrostStrategy == Resistive) { @@ -5859,8 +5738,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:CalcHPCoolingSimple // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for simulating the cooling mode of the Variable-Speed Water to Air HP Simple @@ -5876,33 +5753,12 @@ namespace VariableSpeedCoils { // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio // and RuntimeFrac. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using Psychrometrics::PsyTdbFnHW; - using Psychrometrics::PsyTwbFnTdbWPb; - using Psychrometrics::PsyWFnTdbH; - using Psychrometrics::PsyWFnTdbTwbPb; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedCoilCooling"); static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcVarSpeedCoilCooling:SourceSideInletTemp"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Twet_Rated; // Twet at rated conditions (coil air flow rate and air temperatures), sec Real64 Gamma_Rated; // Gamma at rated conditions (coil air flow rate and air temperatures) @@ -5958,17 +5814,18 @@ namespace VariableSpeedCoils { // Set indoor air conditions to the rated condition state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init = 26.7; state.dataVariableSpeedCoils->LoadSideInletHumRat_Init = 0.0111; - state.dataVariableSpeedCoils->LoadSideInletEnth_Init = - PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); - state.dataVariableSpeedCoils->CpAir_Init = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); + state.dataVariableSpeedCoils->LoadSideInletEnth_Init = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, + state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); + state.dataVariableSpeedCoils->CpAir_Init = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); state.dataVariableSpeedCoils->firstTime = false; } - state.dataVariableSpeedCoils->LoadSideInletWBTemp_Init = PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, - state.dataVariableSpeedCoils->LoadSideInletHumRat_Init, - state.dataEnvrn->OutBaroPress, - RoutineName); + state.dataVariableSpeedCoils->LoadSideInletWBTemp_Init = + Psychrometrics::PsyTwbFnTdbWPb(state, + state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, + state.dataVariableSpeedCoils->LoadSideInletHumRat_Init, + state.dataEnvrn->OutBaroPress, + RoutineName); MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; @@ -6008,10 +5865,10 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling = state.dataEnvrn->OutWetBulbTemp; } - RhoSourceAir = PsyRhoAirFnPbTdbW(state, - state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling); + RhoSourceAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling); if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { CondAirMassFlow = RhoSourceAir * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal); @@ -6034,10 +5891,10 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling - state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling) * (1.0 - EvapCondEffectSped); - CondInletHumRat = PsyWFnTdbTwbPb(state, - CondInletTemp, - state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling); + CondInletHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, + CondInletTemp, + state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling); state.dataVariableSpeedCoils->CompAmbTemp_CalcVarSpeedCoilCooling = CondInletTemp; } else { // AIR COOLED CONDENSER CondInletTemp = state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling; // Outdoor dry-bulb temp @@ -6048,8 +5905,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = CondAirMassFlow; state.dataVariableSpeedCoils->SourceSideInletTemp = CondInletTemp; - state.dataVariableSpeedCoils->SourceSideInletEnth = PsyHFnTdbW(CondInletTemp, CondInletHumRat); - CpSource = PsyCpAirFnW(CondInletHumRat); + state.dataVariableSpeedCoils->SourceSideInletEnth = Psychrometrics::PsyHFnTdbW(CondInletTemp, CondInletHumRat); + CpSource = Psychrometrics::PsyCpAirFnW(CondInletHumRat); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp = CondInletTemp; // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) @@ -6071,12 +5928,12 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = - GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpSource = FluidProperties::GetSpecificHeatGlycol( + state, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, + RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. @@ -6123,14 +5980,14 @@ namespace VariableSpeedCoils { LoadSideInletDBTemp_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; LoadSideInletHumRat_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; LoadSideInletWBTemp_Unit = - PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName); + Psychrometrics::PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName); LoadSideInletEnth_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - CpAir_Unit = PsyCpAirFnW(LoadSideInletHumRat_Unit); + CpAir_Unit = Psychrometrics::PsyCpAirFnW(LoadSideInletHumRat_Unit); state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -6184,9 +6041,9 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6217,25 +6074,26 @@ namespace VariableSpeedCoils { 1, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6273,10 +6131,10 @@ namespace VariableSpeedCoils { } else { QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { AirMassFlowRatio = @@ -6324,17 +6182,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); SpeedCal = SpeedNum - 1; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -6345,24 +6204,25 @@ namespace VariableSpeedCoils { QWasteHeat1 = 0.0; } else { QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat1 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -6373,10 +6233,10 @@ namespace VariableSpeedCoils { QWasteHeat2 = 0.0; } else { QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat2 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; @@ -6442,7 +6302,7 @@ namespace VariableSpeedCoils { // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** - RhoEvapCondWater = RhoH2O(state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling); + RhoEvapCondWater = Psychrometrics::RhoH2O(state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling) * CondAirMassFlow / RhoEvapCondWater * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; @@ -6480,18 +6340,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(state, - state.dataVariableSpeedCoils->LoadSideOutletDBTemp, - 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, - RoutineName); - MaxOutletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, + state.dataVariableSpeedCoils->LoadSideOutletDBTemp, + 0.9999, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + RoutineName); + MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; // QLoadTotal = LoadSideMassFlowRate * (LoadSideInletEnth - LoadSideOutletEnth) } - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); if (state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } @@ -6507,8 +6367,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor @@ -6555,11 +6415,11 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); // This seems wrong, initializing mass flow rate to StdRhoAir or actual air density, // then using that mass flow rate, then back calculating volume using inlet conditions. // Volume should be constant through a fan and air mass flow rate should vary based on inlet conditions. @@ -6586,9 +6446,9 @@ namespace VariableSpeedCoils { if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions - RhoWater = RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / - 2.0); + RhoWater = Psychrometrics::RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / + 2.0); // CR9155 Remove specific humidity calculations SpecHumIn = state.dataVariableSpeedCoils->LoadSideInletHumRat; SpecHumOut = state.dataVariableSpeedCoils->LoadSideOutletHumRat; @@ -6625,18 +6485,9 @@ namespace VariableSpeedCoils { // water temperature. In addition, knowledge of the fan heat is required to back into // a compressor COP. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedHPWH"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 OperatingHeatingCapacity; // Water heating operating capacity including the impact of capacity and COP curves (W) @@ -6671,7 +6522,6 @@ namespace VariableSpeedCoils { Real64 Winput1; // power consumption at low speed Real64 Winput2; // power consumption at high speed Real64 LoadPressure; // evaporator inlet pressure - Real64 CrankcaseHeatingPower; // power due to crankcase heater Real64 hDelta; // Change in air enthalpy across the cooling coil [J/kg] Real64 hADP; // Apparatus dew point enthalpy [J/kg] Real64 tADP; // Apparatus dew point temperature [C] @@ -6683,29 +6533,24 @@ namespace VariableSpeedCoils { Real64 MaxHumRat; // max possible humidity Real64 MaxOutletEnth; // max possible outlet enthalpy int EvapInletNode; // Evaporator air inlet node number - int EvapOutletNode; // Evaporator air outlet node number - int CondInletNode; // Condenser water inlet node number - int CondOutletNode; // Condenser water outlet node number - int MaxSpeed; // maximum speed level int SpeedCal; // calculated speed level - Real64 rhoair(0.0); // entering air density - Real64 RhoWater(0.0); // water density + Real64 rhoair = 0.0; // entering air density + Real64 RhoWater = 0.0; // water density // note: load side is the evaporator side, and source side is the condenser side - CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; + int CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + int CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; // If heat pump water heater is OFF, set outlet to inlet and RETURN if (PartLoadRatio == 0.0) { state.dataLoopNodes->Node(CondOutletNode) = state.dataLoopNodes->Node(CondInletNode); return; } else { EvapInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; - EvapOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum; InletWaterTemp = state.dataLoopNodes->Node(CondInletNode).Temp; CondInletMassFlowRate = state.dataLoopNodes->Node(CondInletNode).MassFlowRate; EvapInletMassFlowRate = state.dataLoopNodes->Node(EvapInletNode).MassFlowRate; - CpWater = CPHW(InletWaterTemp); + CpWater = Psychrometrics::CPHW(InletWaterTemp); CompressorPower = 0.0; OperatingHeatingPower = 0.0; TankHeatingCOP = 0.0; @@ -6728,7 +6573,7 @@ namespace VariableSpeedCoils { } // check if indoor evaporator or outdoor evaporator - CrankcaseHeatingPower = 0.0; + Real64 CrankcaseHeatingPower = 0.0; if (EvapInletNode != 0) { state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataLoopNodes->Node(EvapInletNode).Temp; state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataLoopNodes->Node(EvapInletNode).HumRat; @@ -6771,20 +6616,11 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } - MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; - - // must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places - if (SpeedNum > MaxSpeed) { - SpeedCal = MaxSpeed; - } else { - SpeedCal = SpeedNum; - } - // part-load calculation state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -6802,6 +6638,8 @@ namespace VariableSpeedCoils { } } + int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + // interpolate between speeds // must be placed inside the loop, otherwise cause bug in release mode if (SpeedNum > MaxSpeed) { @@ -6822,24 +6660,27 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; @@ -6895,9 +6736,9 @@ namespace VariableSpeedCoils { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; } - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); } else { AirMassFlowRatio = @@ -6913,30 +6754,32 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; Winput1 = state.dataVariableSpeedCoils->Winput; WHCAP1 = OperatingHeatingCapacity; @@ -6945,32 +6788,32 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; - state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; - - Winput2 = state.dataVariableSpeedCoils->Winput; + Winput2 = OperatingHeatingCapacity / COP; WHCAP2 = OperatingHeatingCapacity; // interpolation @@ -7043,9 +6886,9 @@ namespace VariableSpeedCoils { } else { hDelta = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; hADP = state.dataVariableSpeedCoils->LoadSideInletEnth - hDelta / (1.0 - CBFSpeed); - tADP = PsyTsatFnHPb(state, hADP, LoadPressure, RoutineName); - wADP = PsyWFnTdbH(state, tADP, hADP, RoutineName); - hTinwADP = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp, wADP); + tADP = Psychrometrics::PsyTsatFnHPb(state, hADP, LoadPressure, RoutineName); + wADP = Psychrometrics::PsyWFnTdbH(state, tADP, hADP, RoutineName); + hTinwADP = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp, wADP); if ((state.dataVariableSpeedCoils->LoadSideInletEnth - hADP) > 1.e-10) { SHR = min((hTinwADP - hADP) / (state.dataVariableSpeedCoils->LoadSideInletEnth - hADP), 1.0); } else { @@ -7088,22 +6931,22 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideOutletEnth = state.dataVariableSpeedCoils->LoadSideInletEnth - state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; - CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); + CpAir = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(state, - state.dataVariableSpeedCoils->LoadSideOutletDBTemp, - 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, - RoutineName); - MaxOutletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, + state.dataVariableSpeedCoils->LoadSideOutletDBTemp, + 0.9999, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + RoutineName); + MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; } - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); if (state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } @@ -7118,8 +6961,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; @@ -7168,15 +7011,15 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; - RhoWater = RhoH2O(InletWaterTemp); // initialize + RhoWater = Psychrometrics::RhoH2O(InletWaterTemp); // initialize state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate / RhoWater; @@ -7227,8 +7070,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:CalcHPHeatingSimple // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for simulating the heating mode of the Variable Speed Water to Air HP Simple @@ -7238,34 +7079,13 @@ namespace VariableSpeedCoils { // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio // and RuntimeFrac. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using Psychrometrics::PsyTdbFnHW; - using Psychrometrics::PsyTwbFnTdbWPb; - using Psychrometrics::PsyWFnTdbH; - using Psychrometrics::PsyWFnTdbTwbPb; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedCoilHeating"); static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcVarSpeedCoilHeating:SourceSideInletTemp"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CpSource; // Specific heat of water [J/kg_C] - Real64 CpAir; // Specific heat of air [J/kg_C] Real64 AirMassFlowRatio; // airflow ratio at low speed Real64 WaterMassFlowRatio; // airflow ratio at high speed Real64 TotCapAirFFModFac; // air flow fraction modification @@ -7275,7 +7095,6 @@ namespace VariableSpeedCoils { Real64 EIRWaterFFModFac; // water flow fraction modification Real64 EIRTempModFac; // total capacity temperature correction fraction Real64 EIR; // total capacity temperature correction fraction - int MaxSpeed; // maximum speed level int SpeedCal; // calculated speed level Real64 QLoadTotal1; // heating capacity at low speed Real64 QLoadTotal2; // heating capacity at high speed @@ -7288,7 +7107,7 @@ namespace VariableSpeedCoils { Real64 rhoair(0.0); // entering air density // ADDED VARIABLES FOR air source coil - MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(fanOp == HVAC::FanOp::Continuous) && PartLoadRatio > 0.0) { @@ -7300,13 +7119,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; - state.dataVariableSpeedCoils->LoadSideInletWBTemp = PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - state.dataEnvrn->OutBaroPress, - RoutineName); + state.dataVariableSpeedCoils->LoadSideInletWBTemp = Psychrometrics::PsyTwbFnTdbWPb(state, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + state.dataEnvrn->OutBaroPress, + RoutineName); state.dataVariableSpeedCoils->LoadSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); // Specific heat of air [J/kg_C] if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX Heating Coil @@ -7328,8 +7147,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = 1.0; // not used and avoid divided by zero state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->OutdoorDryBulb; state.dataVariableSpeedCoils->SourceSideInletEnth = - PsyHFnTdbW(state.dataVariableSpeedCoils->OutdoorDryBulb, state.dataVariableSpeedCoils->OutdoorHumRat); - CpSource = PsyCpAirFnW(state.dataEnvrn->OutHumRat); + Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->OutdoorDryBulb, state.dataVariableSpeedCoils->OutdoorHumRat); + CpSource = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil if (state.dataVariableSpeedCoils->OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { @@ -7347,12 +7166,12 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = - GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpSource = FluidProperties::GetSpecificHeatGlycol( + state, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, + state.dataVariableSpeedCoils->SourceSideInletTemp, + state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, + RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. @@ -7383,7 +7202,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -7412,17 +7231,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } state.dataVariableSpeedCoils->QLoadTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * @@ -7431,17 +7251,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->TotRatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal); // for defrosting power cal - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7452,10 +7273,10 @@ namespace VariableSpeedCoils { QWasteHeat = 0.0; } else { QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { @@ -7470,33 +7291,35 @@ namespace VariableSpeedCoils { } SpeedCal = SpeedNum - 1; - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } QLoadTotal1 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7507,40 +7330,42 @@ namespace VariableSpeedCoils { QWasteHeat1 = 0.0; } else { QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat1 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } QLoadTotal2 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7551,10 +7376,10 @@ namespace VariableSpeedCoils { QWasteHeat2 = 0.0; } else { QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat2 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } state.dataVariableSpeedCoils->QLoadTotal = QLoadTotal2 * SpeedRatio + (1.0 - SpeedRatio) * QLoadTotal1; @@ -7574,7 +7399,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->OutdoorCoildw = max(1.0e-6, (state.dataVariableSpeedCoils->OutdoorHumRat - - PsyWFnTdpPb(state, state.dataVariableSpeedCoils->OutdoorCoilT, state.dataVariableSpeedCoils->OutdoorPressure))); + Psychrometrics::PsyWFnTdpPb(state, state.dataVariableSpeedCoils->OutdoorCoilT, state.dataVariableSpeedCoils->OutdoorPressure))); // Initializing defrost adjustment factors state.dataVariableSpeedCoils->LoadDueToDefrost = 0.0; @@ -7605,10 +7430,10 @@ namespace VariableSpeedCoils { (7.222 - state.dataVariableSpeedCoils->OutdoorDryBulb) * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667); state.dataVariableSpeedCoils->DefrostEIRTempModFac = - CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, - max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), - max(15.555, state.dataVariableSpeedCoils->OutdoorDryBulb)); + Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, + max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), + max(15.555, state.dataVariableSpeedCoils->OutdoorDryBulb)); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = state.dataVariableSpeedCoils->DefrostEIRTempModFac * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667) * state.dataVariableSpeedCoils->FractionalDefrostTime; @@ -7653,8 +7478,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp + state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); // Actual outlet conditions are "average" for time step if (fanOp == HVAC::FanOp::Continuous) { @@ -7666,8 +7491,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor @@ -7708,11 +7533,11 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; @@ -7743,16 +7568,12 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilCapacity // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the rated coil capacity at the nominal speed level for the given coil and returns it. If // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned // as negative. - // Using/Aliasing - // Return value Real64 CoilCapacity; // returned capacity of matched coil @@ -7804,13 +7625,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilIndex // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the coil index for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned - // as zero. + // This function looks up the coil index for the given coil and returns it. If incorrect + // coil type or name is given, ErrorsFound is returned as true and index is returned as zero. // Return value int IndexNum; // returned index of matched coil @@ -7842,13 +7660,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilAirFlowRate // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the max coil air flow rate for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. + // This function looks up the max coil air flow rate for the given coil and returns it. If incorrect + // coil type or name is given, ErrorsFound is returned as true and capacity is returned as negative. // Return value Real64 CoilAirFlowRate; // returned air volume flow rate of matched coil @@ -7869,8 +7684,7 @@ namespace VariableSpeedCoils { Util::SameString(CoilType, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED")) { WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - // CoilAirFlowRate=VarSpeedCoil(WhichCoil)%RatedAirVolFlowRate - if (state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == AutoSize) { // means autosize + if (state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == DataSizing::AutoSize) { // means autosize CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; } else { CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate( @@ -7903,13 +7717,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen // DATE WRITTEN 12/2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns PLR curve index. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns PLR curve index. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int PLRNumber; // returned outlet node of matched coil @@ -7949,9 +7760,8 @@ namespace VariableSpeedCoils { // DATE WRITTEN 7/2017 // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns CapFT curve index. If - // incorrect coil index is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns CapFT curve index. If incorrect + // coil index is given, ErrorsFound is returned as true and value is returned as zero. // Return value int CapFTIndex; // returned CapFT curve index of matched coil @@ -7984,13 +7794,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilInletNode // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the inlet node. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns the inlet node. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int NodeNumber; // returned outlet node of matched coil @@ -8029,13 +7836,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilOutletNode // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the outlet node. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns the outlet node. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int NodeNumber; // returned outlet node of matched coil @@ -8073,8 +7877,6 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on DXCoil:GetCoilCondenserInletNode // DATE WRITTEN July 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given coil and returns the condenser inlet node. If @@ -8135,8 +7937,6 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Richard Raustad, FSEC // DATE WRITTEN March 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given coil and returns number of speeds. If @@ -8145,16 +7945,13 @@ namespace VariableSpeedCoils { // Return value int Speeds; // returned number of speeds - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int WhichCoil; - // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); + int WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { Speeds = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).NumOfSpeeds; } else { @@ -8204,12 +8001,9 @@ namespace VariableSpeedCoils { // SUBROUTINE INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:SetWSHPData // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This routine was designed to "push" information from a parent object to - // this WSHP coil object. + // This routine was designed to "push" information from a parent object to this WSHP coil object. // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered @@ -8248,8 +8042,6 @@ namespace VariableSpeedCoils { // SUBROUTINE INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:UpdateSimpleWSHP // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the Water to Air Heat Pump outlet nodes. @@ -8259,13 +8051,6 @@ namespace VariableSpeedCoils { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using PlantUtilities::SafeCopyPlantNode; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirInletNode; - int WaterInletNode; - int AirOutletNode; - int WaterOutletNode; auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); @@ -8293,10 +8078,10 @@ namespace VariableSpeedCoils { varSpeedCoil.OutletWaterEnthalpy = varSpeedCoil.InletWaterEnthalpy; } - AirInletNode = varSpeedCoil.AirInletNodeNum; - WaterInletNode = varSpeedCoil.WaterInletNodeNum; - AirOutletNode = varSpeedCoil.AirOutletNodeNum; - WaterOutletNode = varSpeedCoil.WaterOutletNodeNum; + int AirInletNode = varSpeedCoil.AirInletNodeNum; + int WaterInletNode = varSpeedCoil.WaterInletNodeNum; + int AirOutletNode = varSpeedCoil.AirOutletNodeNum; + int WaterOutletNode = varSpeedCoil.WaterOutletNodeNum; // Set the air outlet nodes of the WatertoAirHPSimple state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; // LoadSideMassFlowRate @@ -8316,7 +8101,7 @@ namespace VariableSpeedCoils { // Set the water outlet node of the WatertoAirHPSimple // Set the water outlet nodes for properties that just pass through & not used if (WaterInletNode != 0 && WaterOutletNode != 0) { - SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); + PlantUtilities::SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); state.dataLoopNodes->Node(WaterOutletNode).Temp = varSpeedCoil.OutletWaterTemp; state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = varSpeedCoil.OutletWaterEnthalpy; } @@ -8406,9 +8191,6 @@ namespace VariableSpeedCoils { // model is used by ultilizing the fan delay time as the time-off (or time duration // for the re-evaporation of moisture from time coil). Refer to Tang, C.C. (2005) - // REFERENCES: - // na - // Return value Real64 SHReff; // Effective sensible heat ratio, includes degradation due to cycling effects @@ -8417,27 +8199,21 @@ namespace VariableSpeedCoils { // at the current operating conditions (sec) Real64 Gamma; // Initial moisture evaporation rate divided by steady-state AC latent capacity // at the current operating conditions - Real64 Twet_Rated; // Twet at rated conditions (coil air flow rate and air temperatures), sec - Real64 Gamma_Rated; // Gamma at rated conditions (coil air flow rate and air temperatures) - Real64 Twet_max; // Maximum allowed value for Twet - Real64 MaxONOFFCyclesperHour; // Maximum cycling rate of heat pump [cycles/hr] - Real64 LatentCapacityTimeConstant; // Latent capacity time constant [s] - Real64 FanDelayTime; // Fan delay time, time delay for the HP's fan to - // shut off after compressor cycle off [s] - Real64 Ton; // Coil on time (sec) - Real64 Toff; // Coil off time (sec) - Real64 Toffa; // Actual coil off time (sec). Equations valid for Toff <= (2.0 * Twet/Gamma) - Real64 aa; // Intermediate variable - Real64 To1; // Intermediate variable (first guess at To). To = time to the start of moisture removal - Real64 To2; // Intermediate variable (second guess at To). To = time to the start of moisture removal - Real64 Error; // Error for iteration (DO) loop - Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult - - Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; - Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; - MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; - LatentCapacityTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant; - FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; + Real64 Twet_max; // Maximum allowed value for Twet + Real64 Ton; // Coil on time (sec) + Real64 Toff; // Coil off time (sec) + Real64 Toffa; // Actual coil off time (sec). Equations valid for Toff <= (2.0 * Twet/Gamma) + Real64 aa; // Intermediate variable + Real64 To1; // Intermediate variable (first guess at To). To = time to the start of moisture removal + Real64 To2; // Intermediate variable (second guess at To). To = time to the start of moisture removal + Real64 Error; // Error for iteration (DO) loop + Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult + + Real64 Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; // [s] + Real64 Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; + Real64 MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; // [cycles/hr] + Real64 LatentCapacityTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant; // [s] + Real64 FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; // [s] // No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0 // All latent degradation model parameters cause divide by 0.0 if not greater than 0.0 @@ -8544,8 +8320,7 @@ namespace VariableSpeedCoils { // does NOT employ the exact same methodology to calculate performance as DOE-2, although // some of the DOE-2 curve fits are employed by this model. - // The model checks for coil dryout conditions, and adjusts the calculated performance - // appropriately. + // The model checks for coil dryout conditions, and adjusts the calculated performance appropriately. // REFERENCES: // ASHRAE HVAC 2 Toolkit page 4-81. @@ -8556,13 +8331,10 @@ namespace VariableSpeedCoils { // User Defined Functions to Provide More Accurate Part Load Energy Use and Humidity // Predictions. Proceedings of ACEEE Conference. - // Using/Aliasing - using Curve::CurveValue; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcTotCapSHR_VSWSHP"); - constexpr int MaxIter(30); // Maximum number of iterations for dry evaporator calculations - constexpr Real64 Tolerance(0.01); // Error tolerance for dry evaporator iterations + constexpr int MaxIter = 30; // Maximum number of iterations for dry evaporator calculations + constexpr Real64 Tolerance = 0.01; // Error tolerance for dry evaporator iterations // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 TotCapWaterFlowModFac1; // Total capacity modifier (function of actual supply water flow vs nominal flow) at low speed @@ -8584,14 +8356,14 @@ namespace VariableSpeedCoils { // LOOP WHILE (ABS(werror) .gt. Tolerance .OR. Counter == 0) while (LoopOn) { // Get capacity modifying factor (function of inlet wetbulb & condenser inlet temp) for off-rated conditions - Real64 TotCapTempModFac1 = CurveValue(state, CCapFTemp1, InletWetBulbCalc, CondInletTemp); + Real64 TotCapTempModFac1 = Curve::CurveValue(state, CCapFTemp1, InletWetBulbCalc, CondInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - Real64 TotCapAirFlowModFac1 = CurveValue(state, CCapAirFFlow1, AirMassFlowRatio); + Real64 TotCapAirFlowModFac1 = Curve::CurveValue(state, CCapAirFFlow1, AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions if (CCapWaterFFlow1 == 0) { TotCapWaterFlowModFac1 = 1.0; } else { - TotCapWaterFlowModFac1 = CurveValue(state, CCapWaterFFlow1, WaterMassFlowRatio); + TotCapWaterFlowModFac1 = Curve::CurveValue(state, CCapWaterFFlow1, WaterMassFlowRatio); } // Get total capacity @@ -8601,13 +8373,13 @@ namespace VariableSpeedCoils { TotCapCalc2 = 0.0; TotCapModFac = TotCapAirFlowModFac1 * TotCapWaterFlowModFac1 * TotCapTempModFac1; } else { - TotCapTempModFac2 = CurveValue(state, CCapFTemp2, InletWetBulbCalc, CondInletTemp); - TotCapAirFlowModFac2 = CurveValue(state, CCapAirFFlow2, AirMassFlowRatio); + TotCapTempModFac2 = Curve::CurveValue(state, CCapFTemp2, InletWetBulbCalc, CondInletTemp); + TotCapAirFlowModFac2 = Curve::CurveValue(state, CCapAirFFlow2, AirMassFlowRatio); if (CCapWaterFFlow2 == 0) { TotCapWaterFlowModFac2 = 1.0; } else { - TotCapWaterFlowModFac2 = CurveValue(state, CCapWaterFFlow2, WaterMassFlowRatio); + TotCapWaterFlowModFac2 = Curve::CurveValue(state, CCapWaterFFlow2, WaterMassFlowRatio); } TotCapCalc1 = TotCapNom1 * TotCapAirFlowModFac1 * TotCapWaterFlowModFac1 * TotCapTempModFac1; @@ -8621,11 +8393,11 @@ namespace VariableSpeedCoils { Real64 localCBF = max(0.0, CBF); // negative coil bypass factor is physically impossible // Calculate apparatus dew point conditions using TotCap and CBF - Real64 hDelta = TotCapCalc / AirMassFlow; // Change in air enthalpy across the cooling coil [J/kg] - Real64 hADP = InletEnthalpy - hDelta / (1.0 - localCBF); // Apparatus dew point enthalpy [J/kg] - Real64 tADP = PsyTsatFnHPb(state, hADP, Pressure, RoutineName); // Apparatus dew point temperature [C] - Real64 wADP = PsyWFnTdbH(state, tADP, hADP, RoutineName); // Apparatus dew point humidity ratio [kg/kg] - Real64 hTinwADP = PsyHFnTdbW(InletDryBulb, wADP); // Enthalpy at inlet dry-bulb and wADP [J/kg] + Real64 hDelta = TotCapCalc / AirMassFlow; // Change in air enthalpy across the cooling coil [J/kg] + Real64 hADP = InletEnthalpy - hDelta / (1.0 - localCBF); // Apparatus dew point enthalpy [J/kg] + Real64 tADP = Psychrometrics::PsyTsatFnHPb(state, hADP, Pressure, RoutineName); // Apparatus dew point temperature [C] + Real64 wADP = Psychrometrics::PsyWFnTdbH(state, tADP, hADP, RoutineName); // Apparatus dew point humidity ratio [kg/kg] + Real64 hTinwADP = Psychrometrics::PsyHFnTdbW(InletDryBulb, wADP); // Enthalpy at inlet dry-bulb and wADP [J/kg] if (TotCapCalc > 1.0e-10) { SHRCalc = min((hTinwADP - hADP) / (InletEnthalpy - hADP), 1.0); // temporary calculated value of SHR } else { @@ -8640,7 +8412,7 @@ namespace VariableSpeedCoils { // capacity at the dry-out point to determine exiting conditions from coil. This is required // since the TotCapTempModFac doesn't work properly with dry-coil conditions. InletHumRatCalc = RF * wADP + (1.0 - RF) * InletHumRatCalc; - InletWetBulbCalc = PsyTwbFnTdbWPb(state, InletDryBulb, InletHumRatCalc, Pressure); + InletWetBulbCalc = Psychrometrics::PsyTwbFnTdbWPb(state, InletDryBulb, InletHumRatCalc, Pressure); ++Counter; if (std::abs(werror) > Tolerance) { LoopOn = true; // Recalculate with modified inlet conditions