diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index 2494162ba8b..ce942997160 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -76,9 +76,7 @@ #include #include -namespace EnergyPlus { - -namespace FluidCoolers { +namespace EnergyPlus::FluidCoolers { // Module containing the routines dealing with the objects FluidCooler:SingleSpeed and // FluidCooler:TwoSpeed @@ -99,21 +97,14 @@ namespace FluidCoolers { std::string const cFluidCooler_SingleSpeed("FluidCooler:SingleSpeed"); std::string const cFluidCooler_TwoSpeed("FluidCooler:TwoSpeed"); - bool GetFluidCoolerInputFlag(true); - int NumSimpleFluidCoolers(0); // Number of similar fluid coolers - - // Object Data - Array1D SimpleFluidCooler; // dimension to number of machines - std::unordered_map UniqueSimpleFluidCoolerNames; - - PlantComponent *FluidCoolerspecs::factory(EnergyPlusData &state, int objectType, std::string objectName) + PlantComponent *FluidCoolerspecs::factory(EnergyPlusData &state, int objectType, std::string const &objectName) { - if (GetFluidCoolerInputFlag) { + if (state.dataFluidCoolers->GetFluidCoolerInputFlag) { GetFluidCoolerInput(state); - GetFluidCoolerInputFlag = false; + state.dataFluidCoolers->GetFluidCoolerInputFlag = false; } // Now look for this particular fluid cooler in the list - for (auto &fc : SimpleFluidCooler) { + for (auto &fc : state.dataFluidCoolers->SimpleFluidCooler) { if (fc.FluidCoolerType_Num == objectType && fc.Name == objectName) { return &fc; } @@ -189,19 +180,19 @@ namespace FluidCoolers { // Get number of all Fluid Coolers specified in the input data file (idf) int const NumSingleSpeedFluidCoolers = inputProcessor->getNumObjectsFound(state, "FluidCooler:SingleSpeed"); int const NumTwoSpeedFluidCoolers = inputProcessor->getNumObjectsFound(state, "FluidCooler:TwoSpeed"); - NumSimpleFluidCoolers = NumSingleSpeedFluidCoolers + NumTwoSpeedFluidCoolers; + state.dataFluidCoolers->NumSimpleFluidCoolers = NumSingleSpeedFluidCoolers + NumTwoSpeedFluidCoolers; - if (NumSimpleFluidCoolers <= 0) + if (state.dataFluidCoolers->NumSimpleFluidCoolers <= 0) ShowFatalError(state, "No fluid cooler objects found in input, however, a branch object has specified a fluid cooler. Search the input for " "fluid cooler to determine the cause for this error."); // See if load distribution manager has already gotten the input - if (allocated(SimpleFluidCooler)) return; - GetFluidCoolerInputFlag = false; + if (allocated(state.dataFluidCoolers->SimpleFluidCooler)) return; + state.dataFluidCoolers->GetFluidCoolerInputFlag = false; // Allocate data structures to hold fluid cooler input data, report data and fluid cooler inlet conditions - SimpleFluidCooler.allocate(NumSimpleFluidCoolers); - UniqueSimpleFluidCoolerNames.reserve(NumSimpleFluidCoolers); + state.dataFluidCoolers->SimpleFluidCooler.allocate(state.dataFluidCoolers->NumSimpleFluidCoolers); + state.dataFluidCoolers->UniqueSimpleFluidCoolerNames.reserve(state.dataFluidCoolers->NumSimpleFluidCoolers); int FluidCoolerNum; @@ -222,14 +213,14 @@ namespace FluidCoolers { cAlphaFieldNames, cNumericFieldNames); GlobalNames::VerifyUniqueInterObjectName(state, - UniqueSimpleFluidCoolerNames, AlphArray(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); - - SimpleFluidCooler(FluidCoolerNum).Name = AlphArray(1); - SimpleFluidCooler(FluidCoolerNum).FluidCoolerType = cCurrentModuleObject; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerType_Num = DataPlant::TypeOf_FluidCooler_SingleSpd; - SimpleFluidCooler(FluidCoolerNum).indexInArray = FluidCoolerNum; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; - SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), + state.dataFluidCoolers->UniqueSimpleFluidCoolerNames, AlphArray(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name = AlphArray(1); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerType = cCurrentModuleObject; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerType_Num = DataPlant::TypeOf_FluidCooler_SingleSpd; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).indexInArray = FluidCoolerNum; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), ErrorsFound, cCurrentModuleObject, AlphArray(1), @@ -237,7 +228,7 @@ namespace FluidCoolers { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), ErrorsFound, cCurrentModuleObject, AlphArray(1), @@ -246,42 +237,42 @@ namespace FluidCoolers { 1, DataLoopNode::ObjectIsNotParent); BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = NumArray(1); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = NumArray(1); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = NumArray(2); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = NumArray(3); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = NumArray(4); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = NumArray(5); - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = NumArray(6); - if (SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = NumArray(2); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = NumArray(3); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = NumArray(4); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = NumArray(5); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = NumArray(6); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = NumArray(7); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = NumArray(7); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = NumArray(8); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = NumArray(8); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; } // outdoor air inlet node if (AlphArray(5).empty()) { - SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = 0; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = 0; } else { - SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), ErrorsFound, cCurrentModuleObject, - SimpleFluidCooler(FluidCoolerNum).Name, + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name, DataLoopNode::NodeType_Air, DataLoopNode::NodeConnectionType_OutsideAirReference, 1, DataLoopNode::ObjectIsNotParent); - if (!OutAirNodeManager::CheckOutAirNodeNumber(state, SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum)) { - ShowSevereError(state, cCurrentModuleObject + "= \"" + SimpleFluidCooler(FluidCoolerNum).Name + "\" " + cAlphaFieldNames(5) + "= \"" + + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum)) { + ShowSevereError(state, cCurrentModuleObject + "= \"" + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name + "\" " + cAlphaFieldNames(5) + "= \"" + AlphArray(5) + "\" not valid."); ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ErrorsFound = true; @@ -289,7 +280,7 @@ namespace FluidCoolers { } ErrorsFound |= - SimpleFluidCooler(FluidCoolerNum).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); } // End Single-Speed fluid cooler Loop @@ -309,14 +300,14 @@ namespace FluidCoolers { cAlphaFieldNames, cNumericFieldNames); GlobalNames::VerifyUniqueInterObjectName(state, - UniqueSimpleFluidCoolerNames, AlphArray(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); - - SimpleFluidCooler(FluidCoolerNum).Name = AlphArray(1); - SimpleFluidCooler(FluidCoolerNum).FluidCoolerType = cCurrentModuleObject; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerType_Num = DataPlant::TypeOf_FluidCooler_TwoSpd; - SimpleFluidCooler(FluidCoolerNum).indexInArray = FluidCoolerNum; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; - SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), + state.dataFluidCoolers->UniqueSimpleFluidCoolerNames, AlphArray(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); + + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name = AlphArray(1); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerType = cCurrentModuleObject; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerType_Num = DataPlant::TypeOf_FluidCooler_TwoSpd; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).indexInArray = FluidCoolerNum; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), ErrorsFound, cCurrentModuleObject, AlphArray(1), @@ -324,7 +315,7 @@ namespace FluidCoolers { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), ErrorsFound, cCurrentModuleObject, AlphArray(1), @@ -334,62 +325,62 @@ namespace FluidCoolers { DataLoopNode::ObjectIsNotParent); BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = NumArray(1); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = NumArray(1); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = NumArray(2); - if (SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUAWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = NumArray(2); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUAWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUASizingFactor = NumArray(3); - SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = NumArray(4); - SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = NumArray(5); - if (SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCapWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUASizingFactor = NumArray(3); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = NumArray(4); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = NumArray(5); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCapWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCapSizingFactor = NumArray(6); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = NumArray(7); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = NumArray(8); - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = NumArray(9); - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = NumArray(10); - if (SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCapSizingFactor = NumArray(6); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = NumArray(7); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = NumArray(8); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = NumArray(9); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = NumArray(10); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = NumArray(11); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = NumArray(11); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = NumArray(12); - if (SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = NumArray(12); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = NumArray(13); - if (SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = NumArray(13); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateSizingFactor = NumArray(14); - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = NumArray(15); - if (SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower == DataSizing::AutoSize) { - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateSizingFactor = NumArray(14); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = NumArray(15); + if (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower == DataSizing::AutoSize) { + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; } - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerSizingFactor = NumArray(16); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerSizingFactor = NumArray(16); // outdoor air inlet node if (AlphArray(5).empty()) { - SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = 0; + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = 0; } else { - SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), ErrorsFound, cCurrentModuleObject, - SimpleFluidCooler(FluidCoolerNum).Name, + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name, DataLoopNode::NodeType_Air, DataLoopNode::NodeConnectionType_OutsideAirReference, 1, DataLoopNode::ObjectIsNotParent); - if (!OutAirNodeManager::CheckOutAirNodeNumber(state, SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum)) { - ShowSevereError(state, cCurrentModuleObject + "= \"" + SimpleFluidCooler(FluidCoolerNum).Name + "\" " + cAlphaFieldNames(5) + "= \"" + + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).OutdoorAirInletNodeNum)) { + ShowSevereError(state, cCurrentModuleObject + "= \"" + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name + "\" " + cAlphaFieldNames(5) + "= \"" + AlphArray(5) + "\" not valid."); ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); ErrorsFound = true; @@ -397,7 +388,7 @@ namespace FluidCoolers { } ErrorsFound |= - SimpleFluidCooler(FluidCoolerNum).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); } if (ErrorsFound) { @@ -1674,19 +1665,19 @@ namespace FluidCoolers { if (UAdesign == 0.0) return; // set local fluid cooler inlet and outlet temperature variables - _InletWaterTemp = SimpleFluidCooler(FluidCoolerNum).WaterTemp; + _InletWaterTemp = state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterTemp; _OutletWaterTemp = _InletWaterTemp; - Real64 InletAirTemp = SimpleFluidCooler(FluidCoolerNum).AirTemp; + Real64 InletAirTemp = state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirTemp; // set water and air properties Real64 AirDensity = - Psychrometrics::PsyRhoAirFnPbTdbW(state, SimpleFluidCooler(FluidCoolerNum).AirPress, InletAirTemp, SimpleFluidCooler(FluidCoolerNum).AirHumRat); + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirPress, InletAirTemp, state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirHumRat); Real64 AirMassFlowRate = AirFlowRate * AirDensity; - Real64 CpAir = Psychrometrics::PsyCpAirFnW(SimpleFluidCooler(FluidCoolerNum).AirHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirHumRat); Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(SimpleFluidCooler(FluidCoolerNum).LoopNum).FluidName, + state.dataPlnt->PlantLoop(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LoopNum).FluidName, _InletWaterTemp, - state.dataPlnt->PlantLoop(SimpleFluidCooler(FluidCoolerNum).LoopNum).FluidIndex, + state.dataPlnt->PlantLoop(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LoopNum).FluidIndex, RoutineName); // Calculate mass flow rates @@ -1747,7 +1738,7 @@ namespace FluidCoolers { int FluidCoolerIndex = int(Par(2)); CalcFluidCoolerOutlet(state, FluidCoolerIndex, Par(3), Par(4), UA, OutWaterTemp); - Real64 const Output = Par(5) * Par(3) * (SimpleFluidCooler(FluidCoolerIndex).WaterTemp - OutWaterTemp); + Real64 const Output = Par(5) * Par(3) * (state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerIndex).WaterTemp - OutWaterTemp); Real64 Residuum = (Par(1) - Output) / Par(1); return Residuum; } @@ -1861,14 +1852,4 @@ namespace FluidCoolers { } } - void clear_state() - { - NumSimpleFluidCoolers = 0; - SimpleFluidCooler.clear(); - UniqueSimpleFluidCoolerNames.clear(); - GetFluidCoolerInputFlag = true; - } - -} // namespace FluidCoolers - } // namespace EnergyPlus diff --git a/src/EnergyPlus/FluidCoolers.hh b/src/EnergyPlus/FluidCoolers.hh index 5f6fb631bbc..1b2489cc086 100644 --- a/src/EnergyPlus/FluidCoolers.hh +++ b/src/EnergyPlus/FluidCoolers.hh @@ -61,18 +61,12 @@ namespace EnergyPlus { namespace FluidCoolers { - // MODULE PARAMETER DEFINITIONS: - extern std::string const cFluidCooler_SingleSpeed; - extern std::string const cFluidCooler_TwoSpeed; - enum class PerfInputMethod { NOMINAL_CAPACITY, U_FACTOR }; - extern int NumSimpleFluidCoolers; // Number of similar fluid coolers - struct FluidCoolerspecs : PlantComponent { // Members @@ -204,11 +198,9 @@ namespace FluidCoolers { void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override; - static PlantComponent *factory(EnergyPlusData &state, int typeOf, std::string objectName); + static PlantComponent *factory(EnergyPlusData &state, int typeOf, std::string const &objectName); }; - extern Array1D SimpleFluidCooler; // dimension to number of machines - void GetFluidCoolerInput(EnergyPlusData &state); void CalcFluidCoolerOutlet(EnergyPlusData &state, int FluidCoolerNum, Real64 _WaterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign, Real64 &_OutletWaterTemp); @@ -218,15 +210,21 @@ namespace FluidCoolers { Array1D const &Par // par(1) = design fluid cooler load [W] ); - void clear_state(); - } // namespace FluidCoolers struct FluidCoolersData : BaseGlobalStruct { + bool GetFluidCoolerInputFlag = true; + int NumSimpleFluidCoolers = 0; + Array1D SimpleFluidCooler; + std::unordered_map UniqueSimpleFluidCoolerNames; + void clear_state() override { - + this->GetFluidCoolerInputFlag = true; + this->NumSimpleFluidCoolers = 0; + this->SimpleFluidCooler.deallocate(); + this->UniqueSimpleFluidCoolerNames.clear(); } }; diff --git a/src/EnergyPlus/FuelCellElectricGenerator.cc b/src/EnergyPlus/FuelCellElectricGenerator.cc index 10fa4b993f8..9673f210689 100644 --- a/src/EnergyPlus/FuelCellElectricGenerator.cc +++ b/src/EnergyPlus/FuelCellElectricGenerator.cc @@ -100,31 +100,16 @@ namespace FuelCellElectricGenerator { // REFERENCES: // IEA/ECBCS Annex 42 model specification for Solid oxide and proton exchange membrane fuel cells - int NumFuelCellGenerators(0); - bool getFuelCellInputFlag(true); - Array1D_bool CheckEquipName; - Array1D FuelCell; // dimension to number of machines - bool MyEnvrnFlag(true); - - void clear_state() - { - NumFuelCellGenerators = 0; - getFuelCellInputFlag = true; - CheckEquipName.deallocate(); - FuelCell.deallocate(); - MyEnvrnFlag = true; - } - PlantComponent *FCDataStruct::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data - if (getFuelCellInputFlag) { + if (state.dataFuelCellElectGen->getFuelCellInputFlag) { getFuelCellInput(state); - getFuelCellInputFlag = false; + state.dataFuelCellElectGen->getFuelCellInputFlag = false; } // Now look for this object - for (auto &thisFC : FuelCell) { + for (auto &thisFC : state.dataFuelCellElectGen->FuelCell) { if (thisFC.Name == objectName) { return &thisFC; } @@ -138,13 +123,13 @@ namespace FuelCellElectricGenerator { PlantComponent *FCDataStruct::factory_exhaust(EnergyPlusData &state, std::string const &objectName) { // Process the input data - if (getFuelCellInputFlag) { + if (state.dataFuelCellElectGen->getFuelCellInputFlag) { getFuelCellInput(state); - getFuelCellInputFlag = false; + state.dataFuelCellElectGen->getFuelCellInputFlag = false; } // Now look for this object - for (auto &thisFC : FuelCell) { + for (auto &thisFC : state.dataFuelCellElectGen->FuelCell) { if (UtilityRoutines::MakeUPPERCase(thisFC.NameExhaustHX) == UtilityRoutines::MakeUPPERCase(objectName)) { return &thisFC; } @@ -197,19 +182,18 @@ namespace FuelCellElectricGenerator { bool ErrorsFound(false); // error flag DataIPShortCuts::cCurrentModuleObject = "Generator:FuelCell"; - NumFuelCellGenerators = inputProcessor->getNumObjectsFound(state, DataIPShortCuts::cCurrentModuleObject); + state.dataFuelCellElectGen->NumFuelCellGenerators = inputProcessor->getNumObjectsFound(state, DataIPShortCuts::cCurrentModuleObject); - if (NumFuelCellGenerators <= 0) { + if (state.dataFuelCellElectGen->NumFuelCellGenerators <= 0) { ShowSevereError(state, "No " + DataIPShortCuts::cCurrentModuleObject + " equipment specified in input file"); ErrorsFound = true; } // ALLOCATE ARRAYS - FuelCell.allocate(NumFuelCellGenerators); // inits handled in derived type definitions - CheckEquipName.dimension(NumFuelCellGenerators, true); + state.dataFuelCellElectGen->FuelCell.allocate(state.dataFuelCellElectGen->NumFuelCellGenerators); // inits handled in derived type definitions // first load in FuelCell names - for (int GeneratorNum = 1; GeneratorNum <= NumFuelCellGenerators; ++GeneratorNum) { + for (int GeneratorNum = 1; GeneratorNum <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++GeneratorNum) { inputProcessor->getObjectItem(state, DataIPShortCuts::cCurrentModuleObject, GeneratorNum, @@ -224,17 +208,17 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - FuelCell(GeneratorNum).Name = AlphArray(1); - FuelCell(GeneratorNum).NameFCPM = AlphArray(2); - FuelCell(GeneratorNum).NameFCAirSup = AlphArray(3); - FuelCell(GeneratorNum).NameFCFuelSup = AlphArray(4); - FuelCell(GeneratorNum).NameFCWaterSup = AlphArray(5); - FuelCell(GeneratorNum).NameFCAuxilHeat = AlphArray(6); - FuelCell(GeneratorNum).NameExhaustHX = AlphArray(7); - FuelCell(GeneratorNum).NameElecStorage = AlphArray(8); - FuelCell(GeneratorNum).NameInverter = AlphArray(9); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCPM = AlphArray(2); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCAirSup = AlphArray(3); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCFuelSup = AlphArray(4); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCWaterSup = AlphArray(5); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCAuxilHeat = AlphArray(6); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameExhaustHX = AlphArray(7); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameElecStorage = AlphArray(8); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameInverter = AlphArray(9); if (NumAlphas == 10) { - FuelCell(GeneratorNum).NameStackCooler = AlphArray(10); + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameStackCooler = AlphArray(10); } } @@ -261,81 +245,81 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameFCPM); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameFCPM); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).FCPM.Name = AlphArray(1); - if (UtilityRoutines::SameString(AlphArray(2), "ANNEX42")) FuelCell(thisFuelCell).FCPM.EffMode = DataGenerators::CurveMode::Direct; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.Name = AlphArray(1); + if (UtilityRoutines::SameString(AlphArray(2), "ANNEX42")) state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.EffMode = DataGenerators::CurveMode::Direct; if (UtilityRoutines::SameString(AlphArray(2), "NORMALIZED")) - FuelCell(thisFuelCell).FCPM.EffMode = DataGenerators::CurveMode::Normalized; - if (FuelCell(thisFuelCell).FCPM.EffMode == DataGenerators::CurveMode::Unassigned) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.EffMode = DataGenerators::CurveMode::Normalized; + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.EffMode == DataGenerators::CurveMode::Unassigned) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(2) + " = " + AlphArray(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).FCPM.EffCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); - if (FuelCell(thisFuelCell).FCPM.EffCurveID == 0) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.EffCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.EffCurveID == 0) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(3) + " = " + AlphArray(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).FCPM.NomEff = NumArray(1); - FuelCell(thisFuelCell).FCPM.NomPel = NumArray(2); - FuelCell(thisFuelCell).FCPM.NumCycles = NumArray(3); - FuelCell(thisFuelCell).FCPM.CyclingDegradRat = NumArray(4); - FuelCell(thisFuelCell).FCPM.NumRunHours = NumArray(5); - FuelCell(thisFuelCell).FCPM.OperateDegradRat = NumArray(6); - FuelCell(thisFuelCell).FCPM.ThreshRunHours = NumArray(7); - FuelCell(thisFuelCell).FCPM.UpTranLimit = NumArray(8); - FuelCell(thisFuelCell).FCPM.DownTranLimit = NumArray(9); - FuelCell(thisFuelCell).FCPM.StartUpTime = NumArray(10) / DataGlobalConstants::SecInHour; // convert to hours from seconds - FuelCell(thisFuelCell).FCPM.StartUpFuel = NumArray(11); - FuelCell(thisFuelCell).FCPM.StartUpElectConsum = NumArray(12); - FuelCell(thisFuelCell).FCPM.StartUpElectProd = NumArray(13); - FuelCell(thisFuelCell).FCPM.ShutDownTime = NumArray(14) / DataGlobalConstants::SecInHour; // convert to hours from seconds - FuelCell(thisFuelCell).FCPM.ShutDownFuel = NumArray(15); - FuelCell(thisFuelCell).FCPM.ShutDownElectConsum = NumArray(16); - FuelCell(thisFuelCell).FCPM.ANC0 = NumArray(17); - FuelCell(thisFuelCell).FCPM.ANC1 = NumArray(18); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.NomEff = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.NomPel = NumArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.NumCycles = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.CyclingDegradRat = NumArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.NumRunHours = NumArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.OperateDegradRat = NumArray(6); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ThreshRunHours = NumArray(7); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.UpTranLimit = NumArray(8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DownTranLimit = NumArray(9); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpTime = NumArray(10) / DataGlobalConstants::SecInHour; // convert to hours from seconds + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpFuel = NumArray(11); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpElectConsum = NumArray(12); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpElectProd = NumArray(13); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownTime = NumArray(14) / DataGlobalConstants::SecInHour; // convert to hours from seconds + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownFuel = NumArray(15); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownElectConsum = NumArray(16); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ANC0 = NumArray(17); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ANC1 = NumArray(18); if (UtilityRoutines::SameString(AlphArray(4), "ConstantRate")) - FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::ConstantRate; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::ConstantRate; if (UtilityRoutines::SameString(AlphArray(4), "UAForProcessGasTemperature")) - FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::UADT; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::UADT; if (UtilityRoutines::SameString(AlphArray(4), "QUADRATIC FUNCTION OF FUEL RATE")) - FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::QuadraticFuelNdot; - if (FuelCell(thisFuelCell).FCPM.SkinLossMode == DataGenerators::SkinLoss::Unassigned) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossMode = DataGenerators::SkinLoss::QuadraticFuelNdot; + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossMode == DataGenerators::SkinLoss::Unassigned) { // throw error ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(4) + " = " + AlphArray(4)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).FCPM.ZoneName = AlphArray(5); - FuelCell(thisFuelCell).FCPM.ZoneID = UtilityRoutines::FindItemInList(FuelCell(thisFuelCell).FCPM.ZoneName, DataHeatBalance::Zone); - if (FuelCell(thisFuelCell).FCPM.ZoneID == 0 && !lAlphaBlanks(5)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ZoneName = AlphArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ZoneID = UtilityRoutines::FindItemInList(state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ZoneName, DataHeatBalance::Zone); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ZoneID == 0 && !lAlphaBlanks(5)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(5) + " = " + AlphArray(5)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Zone Name was not found "); ErrorsFound = true; } - FuelCell(thisFuelCell).FCPM.RadiativeFract = NumArray(19); - FuelCell(thisFuelCell).FCPM.QdotSkin = NumArray(20); - FuelCell(thisFuelCell).FCPM.UAskin = NumArray(21); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.RadiativeFract = NumArray(19); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.QdotSkin = NumArray(20); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.UAskin = NumArray(21); - FuelCell(thisFuelCell).FCPM.SkinLossCurveID = CurveManager::GetCurveIndex(state, AlphArray(6)); - if (FuelCell(thisFuelCell).FCPM.SkinLossCurveID == 0) { - if (FuelCell(thisFuelCell).FCPM.SkinLossMode == DataGenerators::SkinLoss::QuadraticFuelNdot) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossCurveID = CurveManager::GetCurveIndex(state, AlphArray(6)); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossCurveID == 0) { + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.SkinLossMode == DataGenerators::SkinLoss::QuadraticFuelNdot) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(6) + " = " + AlphArray(6)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } } - FuelCell(thisFuelCell).FCPM.NdotDilutionAir = NumArray(22); - FuelCell(thisFuelCell).FCPM.StackHeatLossToDilution = NumArray(23); - FuelCell(thisFuelCell).FCPM.DilutionInletNodeName = AlphArray(7); - FuelCell(thisFuelCell).FCPM.DilutionInletNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(7), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.NdotDilutionAir = NumArray(22); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StackHeatLossToDilution = NumArray(23); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DilutionInletNodeName = AlphArray(7); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DilutionInletNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(7), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -343,8 +327,8 @@ namespace FuelCellElectricGenerator { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - FuelCell(thisFuelCell).FCPM.DilutionExhaustNodeName = AlphArray(8); - FuelCell(thisFuelCell).FCPM.DilutionExhaustNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(8), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DilutionExhaustNodeName = AlphArray(8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DilutionExhaustNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(8), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -353,13 +337,13 @@ namespace FuelCellElectricGenerator { 1, DataLoopNode::ObjectIsNotParent); - FuelCell(thisFuelCell).FCPM.PelMin = NumArray(24); - FuelCell(thisFuelCell).FCPM.PelMax = NumArray(25); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.PelMin = NumArray(24); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.PelMax = NumArray(25); // check for other FuelCell using the same power module and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).FCPM.Name, FuelCell(thisFuelCell).FCPM.Name)) { - FuelCell(otherFuelCell).FCPM = FuelCell(thisFuelCell).FCPM; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).FCPM.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).FCPM = state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM; } } } else { // throw warning, did not find power module input @@ -376,11 +360,11 @@ namespace FuelCellElectricGenerator { } // set fuel supply ID in Fuel cell structure - for (int GeneratorNum = 1; GeneratorNum <= NumFuelCellGenerators; ++GeneratorNum) { - FuelCell(GeneratorNum).FuelSupNum = - UtilityRoutines::FindItemInList(FuelCell(GeneratorNum).NameFCFuelSup, state.dataGenerator->FuelSupply); // Fuel Supply ID - if (FuelCell(GeneratorNum).FuelSupNum == 0) { - ShowSevereError(state, "Fuel Supply Name: " + FuelCell(GeneratorNum).NameFCFuelSup + " not found in " + FuelCell(GeneratorNum).Name); + for (int GeneratorNum = 1; GeneratorNum <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++GeneratorNum) { + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FuelSupNum = + UtilityRoutines::FindItemInList(state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCFuelSup, state.dataGenerator->FuelSupply); // Fuel Supply ID + if (state.dataFuelCellElectGen->FuelCell(GeneratorNum).FuelSupNum == 0) { + ShowSevereError(state, "Fuel Supply Name: " + state.dataFuelCellElectGen->FuelCell(GeneratorNum).NameFCFuelSup + " not found in " + state.dataFuelCellElectGen->FuelCell(GeneratorNum).Name); ErrorsFound = true; } } @@ -408,15 +392,15 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameFCAirSup); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameFCAirSup); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).AirSup.Name = AlphArray(1); - FuelCell(thisFuelCell).AirSup.NodeName = AlphArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.NodeName = AlphArray(2); // check the node connections - FuelCell(thisFuelCell).AirSup.SupNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.SupNodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -425,43 +409,43 @@ namespace FuelCellElectricGenerator { 1, DataLoopNode::ObjectIsNotParent); - FuelCell(thisFuelCell).AirSup.BlowerPowerCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); - if (FuelCell(thisFuelCell).AirSup.BlowerPowerCurveID == 0) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.BlowerPowerCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.BlowerPowerCurveID == 0) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(3) + " = " + AlphArray(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Curve name was not found "); ErrorsFound = true; } - FuelCell(thisFuelCell).AirSup.BlowerHeatLossFactor = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.BlowerHeatLossFactor = NumArray(1); if (UtilityRoutines::SameString(AlphArray(4), "AirRatiobyStoics")) { - FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::ConstantStoicsAirRat; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::ConstantStoicsAirRat; } else if (UtilityRoutines::SameString(AlphArray(4), "QuadraticFunctionofElectricPower")) { - FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::QuadraticFuncofPel; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::QuadraticFuncofPel; } else if (UtilityRoutines::SameString(AlphArray(4), "QUADRATIC FUNCTION OF FUEL RATE")) { - FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::QuadraticFuncofNdot; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirSupRateMode = DataGenerators::AirSupRateMode::QuadraticFuncofNdot; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(4) + " = " + AlphArray(4)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).AirSup.Stoics = NumArray(2) + 1.0; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.Stoics = NumArray(2) + 1.0; - FuelCell(thisFuelCell).AirSup.AirFuncPelCurveID = CurveManager::GetCurveIndex(state, AlphArray(5)); - if ((FuelCell(thisFuelCell).AirSup.AirFuncPelCurveID == 0) && - (FuelCell(thisFuelCell).AirSup.AirSupRateMode == DataGenerators::AirSupRateMode::QuadraticFuncofPel)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirFuncPelCurveID = CurveManager::GetCurveIndex(state, AlphArray(5)); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirFuncPelCurveID == 0) && + (state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirSupRateMode == DataGenerators::AirSupRateMode::QuadraticFuncofPel)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(5) + " = " + AlphArray(5)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowSevereError(state, "Curve name was not found"); ErrorsFound = true; } - FuelCell(thisFuelCell).AirSup.AirTempCoeff = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirTempCoeff = NumArray(3); - FuelCell(thisFuelCell).AirSup.AirFuncNdotCurveID = CurveManager::GetCurveIndex(state, AlphArray(6)); - if ((FuelCell(thisFuelCell).AirSup.AirFuncNdotCurveID == 0) && - (FuelCell(thisFuelCell).AirSup.AirSupRateMode == DataGenerators::AirSupRateMode::QuadraticFuncofNdot)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirFuncNdotCurveID = CurveManager::GetCurveIndex(state, AlphArray(6)); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirFuncNdotCurveID == 0) && + (state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.AirSupRateMode == DataGenerators::AirSupRateMode::QuadraticFuncofNdot)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(6) + " = " + AlphArray(6)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowSevereError(state, "Curve name was not found"); @@ -469,17 +453,17 @@ namespace FuelCellElectricGenerator { } if (UtilityRoutines::SameString("RecoverBurnerInverterStorage", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverBurnInvertBatt; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverBurnInvertBatt; } else if (UtilityRoutines::SameString("RecoverAuxiliaryBurner", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverAuxiliaryBurner; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverAuxiliaryBurner; } else if (UtilityRoutines::SameString("RecoverInverterandStorage", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverInverterBatt; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverInverterBatt; } else if (UtilityRoutines::SameString("RecoverInverter", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverInverter; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverInverter; } else if (UtilityRoutines::SameString("RecoverElectricalStorage", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverBattery; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::RecoverBattery; } else if (UtilityRoutines::SameString("NoRecovery", AlphArray(7))) { - FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::NoRecoveryOnAirIntake; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.IntakeRecoveryMode = DataGenerators::RecoverMode::NoRecoveryOnAirIntake; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(7) + " = " + AlphArray(7)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); @@ -487,9 +471,9 @@ namespace FuelCellElectricGenerator { } if (UtilityRoutines::SameString("AmbientAir", AlphArray(8))) { - FuelCell(thisFuelCell).AirSup.ConstituentMode = DataGenerators::ConstituentMode::RegularAir; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstituentMode = DataGenerators::ConstituentMode::RegularAir; } else if (UtilityRoutines::SameString("UserDefinedConstituents", AlphArray(8))) { - FuelCell(thisFuelCell).AirSup.ConstituentMode = DataGenerators::ConstituentMode::UserDefinedConstituents; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstituentMode = DataGenerators::ConstituentMode::UserDefinedConstituents; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(8) + " = " + AlphArray(8)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); @@ -498,9 +482,9 @@ namespace FuelCellElectricGenerator { int NumAirConstit; - if (FuelCell(thisFuelCell).AirSup.ConstituentMode == DataGenerators::ConstituentMode::UserDefinedConstituents) { + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstituentMode == DataGenerators::ConstituentMode::UserDefinedConstituents) { NumAirConstit = NumArray(4); - FuelCell(thisFuelCell).AirSup.NumConstituents = NumAirConstit; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.NumConstituents = NumAirConstit; if (NumAirConstit > 5) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(4), NumArray(4))); @@ -510,44 +494,44 @@ namespace FuelCellElectricGenerator { } for (int ConstitNum = 1; ConstitNum <= NumAirConstit; ++ConstitNum) { - FuelCell(thisFuelCell).AirSup.ConstitName(ConstitNum) = AlphArray(ConstitNum + 8); - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(ConstitNum) = NumArray(ConstitNum + 4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(ConstitNum) = AlphArray(ConstitNum + 8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(ConstitNum) = NumArray(ConstitNum + 4); } } else { // regular air NumAirConstit = 5; - FuelCell(thisFuelCell).AirSup.NumConstituents = NumAirConstit; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.NumConstituents = NumAirConstit; - FuelCell(thisFuelCell).AirSup.ConstitName(1) = "Nitrogen"; - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(1) = 0.7728; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(1) = "Nitrogen"; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(1) = 0.7728; - FuelCell(thisFuelCell).AirSup.ConstitName(2) = "Oxygen"; - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(2) = 0.2073; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(2) = "Oxygen"; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(2) = 0.2073; - FuelCell(thisFuelCell).AirSup.ConstitName(3) = "Water"; - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(3) = 0.0104; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(3) = "Water"; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(3) = 0.0104; - FuelCell(thisFuelCell).AirSup.ConstitName(4) = "Argon"; - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(4) = 0.0092; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(4) = "Argon"; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(4) = 0.0092; - FuelCell(thisFuelCell).AirSup.ConstitName(5) = "CarbonDioxide"; - FuelCell(thisFuelCell).AirSup.ConstitMolalFract(5) = 0.0003; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitName(5) = "CarbonDioxide"; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract(5) = 0.0003; } // check for molar fractions summing to 1.0. - if (std::abs(sum(FuelCell(thisFuelCell).AirSup.ConstitMolalFract) - 1.0) > 0.0001) { + if (std::abs(sum(state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract) - 1.0) > 0.0001) { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + " molar fractions do not sum to 1.0"); - ShowContinueError(state, format("..Sum was={:.1R}", sum(FuelCell(thisFuelCell).AirSup.ConstitMolalFract))); + ShowContinueError(state, format("..Sum was={:.1R}", sum(state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.ConstitMolalFract))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + " = " + AlphArray(1)); ErrorsFound = true; } // check for other FuelCell using the same Air Supply module and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).AirSup.Name, FuelCell(thisFuelCell).AirSup.Name)) { - FuelCell(otherFuelCell).AirSup = FuelCell(thisFuelCell).AirSup; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).AirSup.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).AirSup = state.dataFuelCellElectGen->FuelCell(thisFuelCell).AirSup; } } } else { @@ -557,29 +541,29 @@ namespace FuelCellElectricGenerator { } } - for (int GeneratorNum = 1; GeneratorNum <= NumFuelCellGenerators; ++GeneratorNum) { + for (int GeneratorNum = 1; GeneratorNum <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++GeneratorNum) { // find molar fraction of oxygen in air supply int thisConstituent = - UtilityRoutines::FindItem("Oxygen", FuelCell(GeneratorNum).AirSup.ConstitName, FuelCell(GeneratorNum).AirSup.NumConstituents); - if (thisConstituent > 0) FuelCell(GeneratorNum).AirSup.O2fraction = FuelCell(GeneratorNum).AirSup.ConstitMolalFract(thisConstituent); + UtilityRoutines::FindItem("Oxygen", state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.ConstitName, state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.NumConstituents); + if (thisConstituent > 0) state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.O2fraction = state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.ConstitMolalFract(thisConstituent); // Loop over air constituents and do one-time setup - for (int i = 1; i <= FuelCell(GeneratorNum).AirSup.NumConstituents; ++i) { + for (int i = 1; i <= state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.NumConstituents; ++i) { - std::string thisName = FuelCell(GeneratorNum).AirSup.ConstitName(i); + std::string thisName = state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.ConstitName(i); int thisGasID = UtilityRoutines::FindItem( thisName, state.dataGenerator->GasPhaseThermoChemistryData, &DataGenerators::GasPropertyDataStruct::ConstituentName); - FuelCell(GeneratorNum).AirSup.GasLibID(i) = thisGasID; + state.dataFuelCellElectGen->FuelCell(GeneratorNum).AirSup.GasLibID(i) = thisGasID; } // set up gas constituents for product gases - FuelCell(GeneratorNum).FCPM.GasLibID(1) = 1; // Carbon Dioxide - FuelCell(GeneratorNum).FCPM.GasLibID(2) = 2; // Nitrogen - FuelCell(GeneratorNum).FCPM.GasLibID(3) = 3; // Oxygen - FuelCell(GeneratorNum).FCPM.GasLibID(4) = 4; // Water - FuelCell(GeneratorNum).FCPM.GasLibID(5) = 5; // Argon + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FCPM.GasLibID(1) = 1; // Carbon Dioxide + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FCPM.GasLibID(2) = 2; // Nitrogen + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FCPM.GasLibID(3) = 3; // Oxygen + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FCPM.GasLibID(4) = 4; // Water + state.dataFuelCellElectGen->FuelCell(GeneratorNum).FCPM.GasLibID(5) = 5; // Argon } DataIPShortCuts::cCurrentModuleObject = "Generator:FuelCell:WaterSupply"; @@ -605,32 +589,32 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameFCWaterSup); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameFCWaterSup); if (thisFuelCell > 0) { // this is only the first instance of a FuelCell generator using this type of Water supply module - FuelCell(thisFuelCell).WaterSup.Name = AlphArray(1); - FuelCell(thisFuelCell).WaterSup.WaterSupRateCurveID = CurveManager::GetCurveIndex(state, AlphArray(2)); - if (FuelCell(thisFuelCell).WaterSup.WaterSupRateCurveID == 0) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterSupRateCurveID = CurveManager::GetCurveIndex(state, AlphArray(2)); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterSupRateCurveID == 0) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(2) + " = " + AlphArray(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Curve name was not found "); ErrorsFound = true; } - FuelCell(thisFuelCell).WaterSup.PmpPowerCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); - if (FuelCell(thisFuelCell).WaterSup.PmpPowerCurveID == 0) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.PmpPowerCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.PmpPowerCurveID == 0) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(3) + " = " + AlphArray(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Curve name was not found "); ErrorsFound = true; } - FuelCell(thisFuelCell).WaterSup.PmpPowerLossFactor = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.PmpPowerLossFactor = NumArray(1); if (UtilityRoutines::SameString("TemperatureFromAirNode", AlphArray(4))) { - FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformAirNode; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformAirNode; - FuelCell(thisFuelCell).WaterSup.NodeName = AlphArray(5); - FuelCell(thisFuelCell).WaterSup.NodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.NodeName = AlphArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.NodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -640,10 +624,10 @@ namespace FuelCellElectricGenerator { DataLoopNode::ObjectIsNotParent); } else if (UtilityRoutines::SameString("TemperatureFromWaterNode", AlphArray(4))) { - FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformWaterNode; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformWaterNode; - FuelCell(thisFuelCell).WaterSup.NodeName = AlphArray(5); - FuelCell(thisFuelCell).WaterSup.NodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.NodeName = AlphArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.NodeNum = NodeInputManager::GetOnlySingleNode(state, AlphArray(5), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -653,19 +637,19 @@ namespace FuelCellElectricGenerator { DataLoopNode::ObjectIsNotParent); } else if (UtilityRoutines::SameString("MainsWaterTemperature", AlphArray(4))) { - FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformMains; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformMains; } else if (UtilityRoutines::SameString("TemperatureFromSchedule", AlphArray(4))) { - FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformSchedule; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode = DataGenerators::WaterTemperatureMode::WaterInReformSchedule; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(4) + " = " + AlphArray(4)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).WaterSup.SchedNum = ScheduleManager::GetScheduleIndex(state, AlphArray(6)); - if ((FuelCell(thisFuelCell).WaterSup.SchedNum == 0) && - (FuelCell(thisFuelCell).WaterSup.WaterTempMode == DataGenerators::WaterTemperatureMode::WaterInReformSchedule)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.SchedNum = ScheduleManager::GetScheduleIndex(state, AlphArray(6)); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.SchedNum == 0) && + (state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode == DataGenerators::WaterTemperatureMode::WaterInReformSchedule)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(6) + " = " + AlphArray(6)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Schedule was not found"); @@ -673,9 +657,9 @@ namespace FuelCellElectricGenerator { } // check for other FuelCell using the same Water Supply module and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).WaterSup.Name, FuelCell(thisFuelCell).WaterSup.Name)) { - FuelCell(otherFuelCell).WaterSup = FuelCell(thisFuelCell).WaterSup; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).WaterSup.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).WaterSup = state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup; } } } else { @@ -708,46 +692,46 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameFCAuxilHeat); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameFCAuxilHeat); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).AuxilHeat.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.Name = AlphArray(1); - FuelCell(thisFuelCell).AuxilHeat.ExcessAirRAT = NumArray(1); - FuelCell(thisFuelCell).AuxilHeat.ANC0 = NumArray(2); - FuelCell(thisFuelCell).AuxilHeat.ANC1 = NumArray(3); - FuelCell(thisFuelCell).AuxilHeat.UASkin = NumArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ExcessAirRAT = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ANC0 = NumArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ANC1 = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.UASkin = NumArray(4); if (UtilityRoutines::SameString("SurroundingZone", AlphArray(2))) { - FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination = DataGenerators::LossDestination::SurroundingZone; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination = DataGenerators::LossDestination::SurroundingZone; } else if (UtilityRoutines::SameString("AirInletForFuelCell", AlphArray(2))) { - FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination = DataGenerators::LossDestination::AirInletForFC; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination = DataGenerators::LossDestination::AirInletForFC; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(2) + " = " + AlphArray(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).AuxilHeat.ZoneName = AlphArray(3); - FuelCell(thisFuelCell).AuxilHeat.ZoneID = UtilityRoutines::FindItemInList(AlphArray(3), DataHeatBalance::Zone); - if ((FuelCell(thisFuelCell).AuxilHeat.ZoneID == 0) && - (FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination == DataGenerators::LossDestination::SurroundingZone)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ZoneName = AlphArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ZoneID = UtilityRoutines::FindItemInList(AlphArray(3), DataHeatBalance::Zone); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.ZoneID == 0) && + (state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.SkinLossDestination == DataGenerators::LossDestination::SurroundingZone)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(3) + " = " + AlphArray(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Zone name was not found "); ErrorsFound = true; } - FuelCell(thisFuelCell).AuxilHeat.MaxPowerW = NumArray(5); - FuelCell(thisFuelCell).AuxilHeat.MinPowerW = NumArray(6); - FuelCell(thisFuelCell).AuxilHeat.MaxPowerkmolperSec = NumArray(7); - FuelCell(thisFuelCell).AuxilHeat.MinPowerkmolperSec = NumArray(8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.MaxPowerW = NumArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.MinPowerW = NumArray(6); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.MaxPowerkmolperSec = NumArray(7); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.MinPowerkmolperSec = NumArray(8); // TODO finish Auxiliary heater // check for other FuelCell using the same Auxiliary Heating module and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).AuxilHeat.Name, FuelCell(thisFuelCell).AuxilHeat.Name)) { - FuelCell(otherFuelCell).AuxilHeat = FuelCell(thisFuelCell).AuxilHeat; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).AuxilHeat.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).AuxilHeat = state.dataFuelCellElectGen->FuelCell(thisFuelCell).AuxilHeat; } } } else { @@ -781,15 +765,15 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameExhaustHX); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameExhaustHX); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCExhaust; - FuelCell(thisFuelCell).ExhaustHX.Name = AlphArray(1); - FuelCell(thisFuelCell).ExhaustHX.WaterInNodeName = AlphArray(2); - FuelCell(thisFuelCell).ExhaustHX.WaterOutNodeName = AlphArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCExhaust; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterInNodeName = AlphArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterOutNodeName = AlphArray(3); // find node ids for water path - FuelCell(thisFuelCell).ExhaustHX.WaterInNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterInNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -797,7 +781,7 @@ namespace FuelCellElectricGenerator { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - FuelCell(thisFuelCell).ExhaustHX.WaterOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -808,8 +792,8 @@ namespace FuelCellElectricGenerator { BranchNodeConnections::TestCompSet(state, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Heat Recovery Nodes"); - FuelCell(thisFuelCell).ExhaustHX.ExhaustOutNodeName = AlphArray(4); - FuelCell(thisFuelCell).ExhaustHX.ExhaustOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(4), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.ExhaustOutNodeName = AlphArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.ExhaustOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(4), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -819,41 +803,41 @@ namespace FuelCellElectricGenerator { DataLoopNode::ObjectIsNotParent); if (UtilityRoutines::SameString("FixedEffectiveness", AlphArray(5))) { - FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::FixedEffectiveness; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::FixedEffectiveness; } else if (UtilityRoutines::SameString("EmpiricalUAeff", AlphArray(5))) { - FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::LMTDempiricalUAeff; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::LMTDempiricalUAeff; } else if (UtilityRoutines::SameString("FundementalUAeff", AlphArray(5))) { - FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::LMTDfundementalUAeff; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::LMTDfundementalUAeff; } else if (UtilityRoutines::SameString("CONDENSING", AlphArray(5))) { - FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::Condensing; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.HXmodelMode = DataGenerators::ExhaustGasHX::Condensing; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(5) + " = " + AlphArray(5)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).ExhaustHX.WaterVolumeFlowMax = NumArray(1); - FuelCell(thisFuelCell).ExhaustHX.HXEffect = NumArray(2); - FuelCell(thisFuelCell).ExhaustHX.hxs0 = NumArray(3); - FuelCell(thisFuelCell).ExhaustHX.hxs1 = NumArray(4); - FuelCell(thisFuelCell).ExhaustHX.hxs2 = NumArray(5); - FuelCell(thisFuelCell).ExhaustHX.hxs3 = NumArray(6); - FuelCell(thisFuelCell).ExhaustHX.hxs4 = NumArray(7); - FuelCell(thisFuelCell).ExhaustHX.h0gas = NumArray(8); - FuelCell(thisFuelCell).ExhaustHX.NdotGasRef = NumArray(9); - FuelCell(thisFuelCell).ExhaustHX.nCoeff = NumArray(10); - FuelCell(thisFuelCell).ExhaustHX.AreaGas = NumArray(11); - FuelCell(thisFuelCell).ExhaustHX.h0Water = NumArray(12); - FuelCell(thisFuelCell).ExhaustHX.NdotWaterRef = NumArray(13); - FuelCell(thisFuelCell).ExhaustHX.mCoeff = NumArray(14); - FuelCell(thisFuelCell).ExhaustHX.AreaWater = NumArray(15); - FuelCell(thisFuelCell).ExhaustHX.Fadjust = NumArray(16); - FuelCell(thisFuelCell).ExhaustHX.l1Coeff = NumArray(17); - FuelCell(thisFuelCell).ExhaustHX.l2Coeff = NumArray(18); - FuelCell(thisFuelCell).ExhaustHX.CondensationThresholdTemp = NumArray(19); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterVolumeFlowMax = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.HXEffect = NumArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.hxs0 = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.hxs1 = NumArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.hxs2 = NumArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.hxs3 = NumArray(6); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.hxs4 = NumArray(7); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.h0gas = NumArray(8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.NdotGasRef = NumArray(9); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.nCoeff = NumArray(10); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.AreaGas = NumArray(11); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.h0Water = NumArray(12); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.NdotWaterRef = NumArray(13); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.mCoeff = NumArray(14); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.AreaWater = NumArray(15); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.Fadjust = NumArray(16); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.l1Coeff = NumArray(17); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.l2Coeff = NumArray(18); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.CondensationThresholdTemp = NumArray(19); // store cooling water volume flow rate for autosizing system - PlantUtilities::RegisterPlantCompDesignFlow(FuelCell(thisFuelCell).ExhaustHX.WaterInNode, - FuelCell(thisFuelCell).ExhaustHX.WaterVolumeFlowMax); + PlantUtilities::RegisterPlantCompDesignFlow(state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterInNode, + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ExhaustHX.WaterVolumeFlowMax); } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(1) + " = " + AlphArray(1)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); @@ -885,29 +869,29 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameElecStorage); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameElecStorage); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).ElecStorage.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.Name = AlphArray(1); if (UtilityRoutines::SameString(AlphArray(2), "SimpleEfficiencyWithConstraints")) { - FuelCell(thisFuelCell).ElecStorage.StorageModelMode = DataGenerators::ElectricalStorage::SimpleEffConstraints; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.StorageModelMode = DataGenerators::ElectricalStorage::SimpleEffConstraints; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(2) + " = " + AlphArray(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).ElecStorage.EnergeticEfficCharge = NumArray(1); - FuelCell(thisFuelCell).ElecStorage.EnergeticEfficDischarge = NumArray(2); - FuelCell(thisFuelCell).ElecStorage.NominalEnergyCapacity = NumArray(3); - FuelCell(thisFuelCell).ElecStorage.MaxPowerDraw = NumArray(4); - FuelCell(thisFuelCell).ElecStorage.MaxPowerStore = NumArray(5); - FuelCell(thisFuelCell).ElecStorage.StartingEnergyStored = NumArray(6); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.EnergeticEfficCharge = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.EnergeticEfficDischarge = NumArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.NominalEnergyCapacity = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.MaxPowerDraw = NumArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.MaxPowerStore = NumArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.StartingEnergyStored = NumArray(6); // check for other FuelCell using the same Electrical Storage and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).ElecStorage.Name, FuelCell(thisFuelCell).ElecStorage.Name)) { - FuelCell(otherFuelCell).ElecStorage = FuelCell(thisFuelCell).ElecStorage; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).ElecStorage.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).ElecStorage = state.dataFuelCellElectGen->FuelCell(thisFuelCell).ElecStorage; } } } else { @@ -942,26 +926,26 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameInverter); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameInverter); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).Inverter.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.Name = AlphArray(1); if (UtilityRoutines::SameString(AlphArray(2), "QUADRATIC")) - FuelCell(thisFuelCell).Inverter.EffMode = DataGenerators::InverterEfficiencyMode::Quadratic; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffMode = DataGenerators::InverterEfficiencyMode::Quadratic; if (UtilityRoutines::SameString(AlphArray(2), "Constant")) - FuelCell(thisFuelCell).Inverter.EffMode = DataGenerators::InverterEfficiencyMode::Constant; - if (FuelCell(thisFuelCell).Inverter.EffMode == DataGenerators::InverterEfficiencyMode::Unassigned) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffMode = DataGenerators::InverterEfficiencyMode::Constant; + if (state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffMode == DataGenerators::InverterEfficiencyMode::Unassigned) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(2) + " = " + AlphArray(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ErrorsFound = true; } - FuelCell(thisFuelCell).Inverter.ConstEff = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.ConstEff = NumArray(1); - FuelCell(thisFuelCell).Inverter.EffQuadraticCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); - if ((FuelCell(thisFuelCell).Inverter.EffQuadraticCurveID == 0) && - (FuelCell(thisFuelCell).Inverter.EffMode == DataGenerators::InverterEfficiencyMode::Quadratic)) { + state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffQuadraticCurveID = CurveManager::GetCurveIndex(state, AlphArray(3)); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffQuadraticCurveID == 0) && + (state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.EffMode == DataGenerators::InverterEfficiencyMode::Quadratic)) { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(3) + " = " + AlphArray(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + AlphArray(1)); ShowContinueError(state, "Curve was not found "); @@ -969,9 +953,9 @@ namespace FuelCellElectricGenerator { } // check for other FuelCell using the same Inverter and fill - for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= NumFuelCellGenerators; ++otherFuelCell) { - if (UtilityRoutines::SameString(FuelCell(otherFuelCell).Inverter.Name, FuelCell(thisFuelCell).Inverter.Name)) { - FuelCell(otherFuelCell).Inverter = FuelCell(thisFuelCell).Inverter; + for (int otherFuelCell = thisFuelCell + 1; otherFuelCell <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++otherFuelCell) { + if (UtilityRoutines::SameString(state.dataFuelCellElectGen->FuelCell(otherFuelCell).Inverter.Name, state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter.Name)) { + state.dataFuelCellElectGen->FuelCell(otherFuelCell).Inverter = state.dataFuelCellElectGen->FuelCell(thisFuelCell).Inverter; } } } else { @@ -1000,16 +984,16 @@ namespace FuelCellElectricGenerator { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, AlphArray(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), FuelCell, &FCDataStruct::NameStackCooler); + int thisFuelCell = UtilityRoutines::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameStackCooler); if (thisFuelCell > 0) { - FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCStackCooler; - FuelCell(thisFuelCell).StackCooler.Name = AlphArray(1); - FuelCell(thisFuelCell).StackCooler.WaterInNodeName = AlphArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).TypeOf = DataPlant::TypeOf_Generator_FCStackCooler; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.Name = AlphArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.WaterInNodeName = AlphArray(2); - FuelCell(thisFuelCell).StackCooler.WaterOutNodeName = AlphArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.WaterOutNodeName = AlphArray(3); - FuelCell(thisFuelCell).StackCooler.WaterInNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.WaterInNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(2), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -1017,7 +1001,7 @@ namespace FuelCellElectricGenerator { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - FuelCell(thisFuelCell).StackCooler.WaterOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.WaterOutNode = NodeInputManager::GetOnlySingleNode(state, AlphArray(3), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), @@ -1028,26 +1012,26 @@ namespace FuelCellElectricGenerator { BranchNodeConnections::TestCompSet(state, DataIPShortCuts::cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Heat Recovery Nodes"); - FuelCell(thisFuelCell).StackCooler.TstackNom = NumArray(1); - FuelCell(thisFuelCell).StackCooler.TstackActual = NumArray(2); - FuelCell(thisFuelCell).StackCooler.r0 = NumArray(3); - FuelCell(thisFuelCell).StackCooler.r1 = NumArray(4); - FuelCell(thisFuelCell).StackCooler.r2 = NumArray(5); - FuelCell(thisFuelCell).StackCooler.r3 = NumArray(6); - FuelCell(thisFuelCell).StackCooler.MdotStackCoolant = NumArray(7); - FuelCell(thisFuelCell).StackCooler.UAs_cool = NumArray(8); - FuelCell(thisFuelCell).StackCooler.Fs_cogen = NumArray(9); - FuelCell(thisFuelCell).StackCooler.As_cogen = NumArray(10); - FuelCell(thisFuelCell).StackCooler.MdotCogenNom = NumArray(11); - FuelCell(thisFuelCell).StackCooler.hCogenNom = NumArray(12); - FuelCell(thisFuelCell).StackCooler.ns = NumArray(13); - FuelCell(thisFuelCell).StackCooler.PstackPumpEl = NumArray(14); - FuelCell(thisFuelCell).StackCooler.PmpPowerLossFactor = NumArray(15); - FuelCell(thisFuelCell).StackCooler.f0 = NumArray(16); - FuelCell(thisFuelCell).StackCooler.f1 = NumArray(17); - FuelCell(thisFuelCell).StackCooler.f1 = NumArray(18); - - FuelCell(thisFuelCell).StackCooler.StackCoolerPresent = true; + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.TstackNom = NumArray(1); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.TstackActual = NumArray(2); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.r0 = NumArray(3); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.r1 = NumArray(4); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.r2 = NumArray(5); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.r3 = NumArray(6); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.MdotStackCoolant = NumArray(7); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.UAs_cool = NumArray(8); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.Fs_cogen = NumArray(9); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.As_cogen = NumArray(10); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.MdotCogenNom = NumArray(11); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.hCogenNom = NumArray(12); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.ns = NumArray(13); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.PstackPumpEl = NumArray(14); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.PmpPowerLossFactor = NumArray(15); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.f0 = NumArray(16); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.f1 = NumArray(17); + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.f1 = NumArray(18); + + state.dataFuelCellElectGen->FuelCell(thisFuelCell).StackCooler.StackCoolerPresent = true; } else { ShowSevereError(state, "Invalid, " + DataIPShortCuts::cAlphaFieldNames(1) + " = " + AlphArray(1)); @@ -1061,8 +1045,8 @@ namespace FuelCellElectricGenerator { ShowFatalError(state, "Errors found in getting input for fuel cell model "); } - for (int genNum = 1; genNum <= NumFuelCellGenerators; ++genNum) { - auto &thisGen = FuelCell(genNum); + for (int genNum = 1; genNum <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++genNum) { + auto &thisGen = state.dataFuelCellElectGen->FuelCell(genNum); thisGen.setupOutputVars(state); } } @@ -3341,14 +3325,14 @@ namespace FuelCellElectricGenerator { // This routine adds up the various skin losses and then // sets the values in the ZoneIntGain structure - if (NumFuelCellGenerators == 0) return; + if (state.dataFuelCellElectGen->NumFuelCellGenerators == 0) return; - if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag) { + if (state.dataGlobal->BeginEnvrnFlag && state.dataFuelCellElectGen->MyEnvrnFlag) { for (auto &e : state.dataGenerator->FuelSupply) e.QskinLoss = 0.0; - MyEnvrnFlag = false; - for (int i = FuelCell.l(), e = FuelCell.u(); i <= e; ++i) { - auto &cell(FuelCell(i)); + state.dataFuelCellElectGen->MyEnvrnFlag = false; + for (int i = state.dataFuelCellElectGen->FuelCell.l(), e = state.dataFuelCellElectGen->FuelCell.u(); i <= e; ++i) { + auto &cell(state.dataFuelCellElectGen->FuelCell(i)); cell.FCPM.HasBeenOn = false; cell.AirSup.PairCompEl = 0.0; cell.QconvZone = 0.0; @@ -3365,13 +3349,13 @@ namespace FuelCellElectricGenerator { } } - if (!state.dataGlobal->BeginEnvrnFlag) MyEnvrnFlag = true; + if (!state.dataGlobal->BeginEnvrnFlag) state.dataFuelCellElectGen->MyEnvrnFlag = true; // this routine needs to do something for zone gains during sizing // first collect skin losses from different subsystems - for (int FCnum = 1; FCnum <= NumFuelCellGenerators; ++FCnum) { - auto &thisFC = FuelCell(FCnum); + for (int FCnum = 1; FCnum <= state.dataFuelCellElectGen->NumFuelCellGenerators; ++FCnum) { + auto &thisFC = state.dataFuelCellElectGen->FuelCell(FCnum); Real64 TotalZoneHeatGain = thisFC.AirSup.QskinLoss + state.dataGenerator->FuelSupply(thisFC.FuelSupNum).QskinLoss + thisFC.WaterSup.QskinLoss + thisFC.AuxilHeat.QskinLoss + thisFC.FCPM.QdotSkin; // intake Blower losses to zone | fuel compressor losses to // zone | water pump losses to zone | auxil burner losses to diff --git a/src/EnergyPlus/FuelCellElectricGenerator.hh b/src/EnergyPlus/FuelCellElectricGenerator.hh index c5bb2d781f2..534393b49d9 100644 --- a/src/EnergyPlus/FuelCellElectricGenerator.hh +++ b/src/EnergyPlus/FuelCellElectricGenerator.hh @@ -608,24 +608,25 @@ namespace FuelCellElectricGenerator { void UpdateFuelCellGeneratorRecords(EnergyPlusData &state); }; - void clear_state(); - void getFuelCellInput(EnergyPlusData &state); void FigureFuelCellZoneGains(EnergyPlusData &state); - extern bool getFuelCellInputFlag; - extern int NumFuelCellGenerators; - extern Array1D_bool CheckEquipName; - extern Array1D FuelCell; - } // namespace FuelCellElectricGenerator struct FuelCellElectricGeneratorData : BaseGlobalStruct { + int NumFuelCellGenerators = 0; + bool getFuelCellInputFlag = true; + bool MyEnvrnFlag = true; + Array1D FuelCell; + void clear_state() override { - + this->NumFuelCellGenerators = 0; + this->getFuelCellInputFlag = true; + this->MyEnvrnFlag = true; + this->FuelCell.deallocate(); } }; diff --git a/src/EnergyPlus/GeneratorFuelSupply.cc b/src/EnergyPlus/GeneratorFuelSupply.cc index fb7a7108451..f78aa302728 100644 --- a/src/EnergyPlus/GeneratorFuelSupply.cc +++ b/src/EnergyPlus/GeneratorFuelSupply.cc @@ -96,12 +96,6 @@ namespace GeneratorFuelSupply { // Using/Aliasing using namespace DataGenerators; - static bool MyOneTimeFlag(true); - - void clear_state() { - MyOneTimeFlag = true; - } - void GetGeneratorFuelSupplyInput(EnergyPlusData &state) { @@ -134,7 +128,7 @@ namespace GeneratorFuelSupply { std::string ObjMSGName; int ConstitNum; - if (MyOneTimeFlag) { + if (state.dataGeneratorFuelSupply->MyOneTimeFlag) { cCurrentModuleObject = "Generator:FuelSupply"; state.dataGenerator->NumGeneratorFuelSups = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); @@ -238,7 +232,7 @@ namespace GeneratorFuelSupply { ShowFatalError(state, "Problem found processing input for " + cCurrentModuleObject); } - MyOneTimeFlag = false; + state.dataGeneratorFuelSupply->MyOneTimeFlag = false; } // MyOneTimeFlag } diff --git a/src/EnergyPlus/GeneratorFuelSupply.hh b/src/EnergyPlus/GeneratorFuelSupply.hh index 0f4f268fc3a..ff8bd35108e 100644 --- a/src/EnergyPlus/GeneratorFuelSupply.hh +++ b/src/EnergyPlus/GeneratorFuelSupply.hh @@ -59,37 +59,19 @@ struct EnergyPlusData; namespace GeneratorFuelSupply { - // Data - // MODULE PARAMETER DEFINITIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // MODULE VARIABLE DECLARATIONS: - // na - - // SUBROUTINE SPECIFICATIONS FOR MODULE - - // - - // Functions - - void clear_state(); - void GetGeneratorFuelSupplyInput(EnergyPlusData &state); - //****************************************************************************** - - void SetupFuelConstituentData(EnergyPlusData &state, int const FuelSupplyNum, bool &ErrorsFound); + void SetupFuelConstituentData(EnergyPlusData &state, int FuelSupplyNum, bool &ErrorsFound); } // namespace GeneratorFuelSupply struct GeneratorFuelSupplyData : BaseGlobalStruct { + bool MyOneTimeFlag = true; + void clear_state() override { - + this->MyOneTimeFlag = true; } }; diff --git a/src/EnergyPlus/GlobalNames.cc b/src/EnergyPlus/GlobalNames.cc index 59e6a101cd4..a56002ad5e7 100644 --- a/src/EnergyPlus/GlobalNames.cc +++ b/src/EnergyPlus/GlobalNames.cc @@ -46,12 +46,11 @@ // POSSIBILITY OF SUCH DAMAGE. // EnergyPlus Headers +#include #include #include -namespace EnergyPlus { - -namespace GlobalNames { +namespace EnergyPlus::GlobalNames { // Module containing the routines dealing with matching and assuring that // various component types are unique by name (e.g. Chillers). @@ -66,44 +65,6 @@ namespace GlobalNames { // This module allows for verification of uniqueness (by name) across // certain component names (esp. Chillers, Boilers) - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // Using/Aliasing - // Data - // MODULE PARAMETER DEFINITIONS: - // na - - // DERIVED TYPE DEFINITIONS: - - // MODULE VARIABLE DECLARATIONS: - int NumChillers(0); - int NumBoilers(0); - int NumBaseboards(0); - int NumCoils(0); - int numAirDistUnits(0); - int CurMaxChillers(0); - int CurMaxBoilers(0); - int CurMaxBaseboards(0); - int CurMaxCoils(0); - - // SUBROUTINE SPECIFICATIONS FOR MODULE GlobalNames: - - // Object Data - std::unordered_map ChillerNames; - std::unordered_map BoilerNames; - std::unordered_map BaseboardNames; - std::unordered_map CoilNames; - std::unordered_map aDUNames; - - // Functions - void IntraObjUniquenessCheck(EnergyPlusData &state, std::string &NameToVerify, std::string const &CurrentModuleObject, @@ -185,17 +146,17 @@ namespace GlobalNames { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine verifys that a new name will be unique in the list of + // This subroutine verifies that a new name will be unique in the list of // chillers. If not found in the list, it is added before returning. - auto const iter = ChillerNames.find(NameToVerify); - if (iter != ChillerNames.end()) { + auto const iter = state.dataGlobalNames->ChillerNames.find(NameToVerify); + if (iter != state.dataGlobalNames->ChillerNames.end()) { ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Chiller Type=\"" + iter->second + "\"."); ShowContinueError(state, "...Current entry is Chiller Type=\"" + TypeToVerify + "\"."); ErrorsFound = true; } else { - ChillerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); - NumChillers = static_cast(ChillerNames.size()); + state.dataGlobalNames->ChillerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->NumChillers = static_cast(state.dataGlobalNames->ChillerNames.size()); } } @@ -210,17 +171,17 @@ namespace GlobalNames { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine verifys that a new name will be unique in the list of + // This subroutine verifies that a new name will be unique in the list of // Baseboards. If not found in the list, it is added before returning. - auto const iter = BaseboardNames.find(NameToVerify); - if (iter != BaseboardNames.end()) { + auto const iter = state.dataGlobalNames->BaseboardNames.find(NameToVerify); + if (iter != state.dataGlobalNames->BaseboardNames.end()) { ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Baseboard Type=\"" + iter->second + "\"."); ShowContinueError(state, "...Current entry is Baseboard Type=\"" + TypeToVerify + "\"."); ErrorsFound = true; } else { - BaseboardNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); - NumBaseboards = static_cast(BaseboardNames.size()); + state.dataGlobalNames->BaseboardNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->NumBaseboards = static_cast(state.dataGlobalNames->BaseboardNames.size()); } } @@ -235,17 +196,17 @@ namespace GlobalNames { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine verifys that a new name will be unique in the list of + // This subroutine verifies that a new name will be unique in the list of // Boilers. If not found in the list, it is added before returning. - auto const iter = BoilerNames.find(NameToVerify); - if (iter != BoilerNames.end()) { + auto const iter = state.dataGlobalNames->BoilerNames.find(NameToVerify); + if (iter != state.dataGlobalNames->BoilerNames.end()) { ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Boiler Type=\"" + iter->second + "\"."); ShowContinueError(state, "...Current entry is Boiler Type=\"" + TypeToVerify + "\"."); ErrorsFound = true; } else { - BoilerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); - NumBoilers = static_cast(BoilerNames.size()); + state.dataGlobalNames->BoilerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->NumBoilers = static_cast(state.dataGlobalNames->BoilerNames.size()); } } @@ -259,7 +220,7 @@ namespace GlobalNames { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine verifys that a new name will be unique in the list of + // This subroutine verifies that a new name will be unique in the list of // Coils. If not found in the list, it is added before returning. if (NameToVerify.empty()) { @@ -269,51 +230,28 @@ namespace GlobalNames { return; } - auto const iter = CoilNames.find(NameToVerify); - if (iter != CoilNames.end()) { + auto const iter = state.dataGlobalNames->CoilNames.find(NameToVerify); + if (iter != state.dataGlobalNames->CoilNames.end()) { ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Coil Type=\"" + iter->second + "\"."); ShowContinueError(state, "...Current entry is Coil Type=\"" + TypeToVerify + "\"."); ErrorsFound = true; } else { - CoilNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); - NumCoils = static_cast(CoilNames.size()); + state.dataGlobalNames->CoilNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->NumCoils = static_cast(state.dataGlobalNames->CoilNames.size()); } } void VerifyUniqueADUName(EnergyPlusData &state, std::string const &TypeToVerify, std::string const &NameToVerify, bool &ErrorsFound, std::string const &StringToDisplay) { - auto const iter = aDUNames.find(NameToVerify); - if (iter != aDUNames.end()) { + auto const iter = state.dataGlobalNames->aDUNames.find(NameToVerify); + if (iter != state.dataGlobalNames->aDUNames.end()) { ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", ADU Type=\"" + iter->second + "\"."); ShowContinueError(state, "...Current entry is Air Distribution Unit Type=\"" + TypeToVerify + "\"."); ErrorsFound = true; } else { - aDUNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); - numAirDistUnits = static_cast(aDUNames.size()); + state.dataGlobalNames->aDUNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->numAirDistUnits = static_cast(state.dataGlobalNames->aDUNames.size()); } } - // Clears the global data in GlobalNames. - // Needed for unit tests, should not be normally called. - void clear_state() - { - NumChillers = 0; - NumBoilers = 0; - NumBaseboards = 0; - NumCoils = 0; - numAirDistUnits = 0; - CurMaxChillers = 0; - CurMaxBoilers = 0; - CurMaxBaseboards = 0; - CurMaxCoils = 0; - - ChillerNames.clear(); - BoilerNames.clear(); - BaseboardNames.clear(); - CoilNames.clear(); - aDUNames.clear(); - } - -} // namespace GlobalNames - } // namespace EnergyPlus diff --git a/src/EnergyPlus/GlobalNames.hh b/src/EnergyPlus/GlobalNames.hh index 2ac0470ef51..6464b8e1c60 100644 --- a/src/EnergyPlus/GlobalNames.hh +++ b/src/EnergyPlus/GlobalNames.hh @@ -62,30 +62,10 @@ namespace EnergyPlus { -namespace GlobalNames { - - // Using/Aliasing - - // Data - // MODULE PARAMETER DEFINITIONS: - // na - - // DERIVED TYPE DEFINITIONS: +// Forward declarations +struct EnergyPlusData; - // MODULE VARIABLE DECLARATIONS: - extern int NumChillers; - extern int NumBoilers; - extern int NumBaseboards; - extern int NumCoils; - extern int CurMaxChillers; - extern int CurMaxBoilers; - extern int CurMaxBaseboards; - extern int CurMaxCoils; - extern int numAirDistUnits; // count of air distribution units - - // SUBROUTINE SPECIFICATIONS FOR MODULE GlobalNames: - - // Types +namespace GlobalNames { struct ComponentNameData { @@ -94,23 +74,9 @@ namespace GlobalNames { std::string CompName; // Component Name (user supplied) // Default Constructor - ComponentNameData() - { - } + ComponentNameData() = default; }; - // Object Data - extern std::unordered_map ChillerNames; - extern std::unordered_map BoilerNames; - extern std::unordered_map BaseboardNames; - extern std::unordered_map CoilNames; - extern std::unordered_map aDUNames; - - // Functions - - // for unit tests - void clear_state(); - void IntraObjUniquenessCheck(EnergyPlusData &state, std::string &NameToVerify, std::string const &CurrentModuleObject, @@ -169,17 +135,37 @@ namespace GlobalNames { bool &ErrorsFound, // returns true if duplicate name found, unchanged otherwise std::string const &StringToDisplay); - // Clears the global data in GlobalNames. - // Needed for unit tests, should not be normally called. - void clear_state(); - } // namespace GlobalNames struct GlobalNamesData : BaseGlobalStruct { + int NumChillers = 0; + int NumBoilers = 0; + int NumBaseboards = 0; + int NumCoils = 0; + int CurMaxChillers = 0; + int CurMaxCoils = 0; + int numAirDistUnits = 0; + std::unordered_map ChillerNames; + std::unordered_map BoilerNames; + std::unordered_map BaseboardNames; + std::unordered_map CoilNames; + std::unordered_map aDUNames; + void clear_state() override { - + this->NumChillers = 0; + this->NumBoilers = 0; + this->NumBaseboards = 0; + this->NumCoils = 0; + this->CurMaxChillers = 0; + this->CurMaxCoils = 0; + this->numAirDistUnits = 0; + this->ChillerNames.clear(); + this->BoilerNames.clear(); + this->BaseboardNames.clear(); + this->CoilNames.clear(); + this->aDUNames.clear(); } }; diff --git a/src/EnergyPlus/HVACControllers.cc b/src/EnergyPlus/HVACControllers.cc index c5f9514335e..22083215a16 100644 --- a/src/EnergyPlus/HVACControllers.cc +++ b/src/EnergyPlus/HVACControllers.cc @@ -847,9 +847,6 @@ namespace HVACControllers { ActuatedNode = ControllerProps(ControlNum).ActuatedNode; SensedNode = ControllerProps(ControlNum).SensedNode; - // Set again in ReportController() to ControllerProps(ControlNum)%NextActuatedValue - // IF (FirstHVACIteration) THEN - // DSU3 Node(ActuatedNode)%MassFlowRate = 0.0d0 NoFlowResetValue = 0.0; SetActuatedBranchFlowRate(state, NoFlowResetValue, ControllerProps(ControlNum).ActuatedNode, diff --git a/src/EnergyPlus/HVACControllers.hh b/src/EnergyPlus/HVACControllers.hh index fb070f33e86..1419b2fbb8b 100644 --- a/src/EnergyPlus/HVACControllers.hh +++ b/src/EnergyPlus/HVACControllers.hh @@ -205,9 +205,9 @@ namespace HVACControllers { int ActuatedNode; // The node that is acted upon by the controller Real64 ActuatedValue; // Value of actuated variable before change by the controller Real64 NextActuatedValue; // The new control actuated value - int ActuatedNodePlantLoopNum; // the plant loop index for the actuated node DSU3 - int ActuatedNodePlantLoopSide; // the plant loop side for the actuated node DSU3 - int ActuatedNodePlantLoopBranchNum; // the plant loop branch num for actuated node DSU3 + int ActuatedNodePlantLoopNum; // the plant loop index for the actuated node + int ActuatedNodePlantLoopSide; // the plant loop side for the actuated node + int ActuatedNodePlantLoopBranchNum; // the plant loop branch num for actuated node // -------------------- // Sensed variable // -------------------- diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 675bb144034..1e248b252e3 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -227,7 +227,6 @@ namespace HVACManager { using DemandManager::ManageDemand; using DemandManager::UpdateDemandManagers; using EMSManager::ManageEMS; - using IceThermalStorage::UpdateIceFractions; using InternalHeatGains::UpdateInternalGainValues; using NodeInputManager::CalcMoreNodeInfo; using OutAirNodeManager::SetOutAirNodes; @@ -452,7 +451,7 @@ namespace HVACManager { DetectOscillatingZoneTemp(state); UpdateZoneListAndGroupLoads(); // Must be called before UpdateDataandReport(OutputProcessor::TimeStepType::TimeStepSystem) - UpdateIceFractions(); // Update fraction of ice stored in TES + IceThermalStorage::UpdateIceFractions(state); // Update fraction of ice stored in TES ManageWater(state); // update electricity data for net, purchased, sold etc. DummyLogical = false; diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.cc b/src/EnergyPlus/HeatBalFiniteDiffManager.cc index 05a9a32db26..aabf20c5f61 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.cc +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.cc @@ -927,6 +927,8 @@ namespace HeatBalFiniteDiffManager { SurfaceFD(Surf).PhaseChangeStateOld = 0; SurfaceFD(Surf).PhaseChangeStateOldOld = 0; SurfaceFD(Surf).PhaseChangeTemperatureReverse = 50; + SurfaceFD(Surf).condNodeReport = 0.0; + SurfaceFD(Surf).specHeatNodeReport = 0.0; // Setup EMS data for (int lay = 1; lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++lay) { diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc index c06479916b1..8b1677592f1 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc @@ -68,9 +68,7 @@ #include #include -namespace EnergyPlus { - -namespace HeatPumpWaterToWaterCOOLING { +namespace EnergyPlus::HeatPumpWaterToWaterCOOLING { // Module containing the routines dealing with the Water to Water Heat Pump (Cooling) // MODULE INFORMATION: @@ -95,26 +93,14 @@ namespace HeatPumpWaterToWaterCOOLING { // MODULE PARAMETER DEFINITIONS std::string const ModuleCompName("HeatPump:WaterToWater:ParameterEstimation:Cooling"); std::string const ModuleCompNameUC("HEATPUMP:WATERTOWATER:PARAMETERESTIMATION:COOLING"); - - // MODULE VARIABLE DECLARATIONS: - std::string GSHPRefrigerant("R22"); // refrigerant name and index - int GSHPRefrigIndex(0); - int NumGSHPs(0); // number of Gshps specified in input - bool GetWWHPCoolingInput = true; - Array1D GSHP; // dimension to number of machines - - void clear_state() { - NumGSHPs = 0; - GetWWHPCoolingInput = true; - GSHP.deallocate(); - } + std::string const GSHPRefrigerant("R22"); // refrigerant name and index PlantComponent *GshpPeCoolingSpecs::factory(EnergyPlusData &state, const std::string& objectName) { - if (GetWWHPCoolingInput) { + if (state.dataHPWaterToWaterClg->GetWWHPCoolingInput) { GetGshpInput(state); - GetWWHPCoolingInput = false; + state.dataHPWaterToWaterClg->GetWWHPCoolingInput = false; } - for (auto &wwhp : GSHP) { + for (auto &wwhp : state.dataHPWaterToWaterClg->GSHP) { if (wwhp.Name == objectName) { return &wwhp; } @@ -236,27 +222,27 @@ namespace HeatPumpWaterToWaterCOOLING { Array1D_string AlphArray(5); // character string data Array1D NumArray(23); // numeric data - static bool ErrorsFound(false); + bool ErrorsFound(false); - NumGSHPs = inputProcessor->getNumObjectsFound(state, ModuleCompNameUC); + state.dataHPWaterToWaterClg->NumGSHPs = inputProcessor->getNumObjectsFound(state, ModuleCompNameUC); - if (NumGSHPs <= 0) { + if (state.dataHPWaterToWaterClg->NumGSHPs <= 0) { ShowSevereError(state, "No Equipment found in SimGshp"); ErrorsFound = true; } // Allocate Arrays - GSHP.allocate(NumGSHPs); + state.dataHPWaterToWaterClg->GSHP.allocate(state.dataHPWaterToWaterClg->NumGSHPs); - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterClg->NumGSHPs; ++GSHPNum) { inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat); UtilityRoutines::IsNameEmpty(state, AlphArray(1), ModuleCompNameUC, ErrorsFound); - GSHP(GSHPNum).Name = AlphArray(1); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name = AlphArray(1); - GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterPECooling; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterPECooling; - GSHP(GSHPNum).COP = NumArray(1); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).COP = NumArray(1); if (NumArray(1) == 0.0) { ShowSevereError(state, ModuleCompName + ":COP = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; @@ -264,86 +250,86 @@ namespace HeatPumpWaterToWaterCOOLING { // zero values for NumArray 3 - 6 checked in input - idd - GSHP(GSHPNum).NomCap = NumArray(2); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).NomCap = NumArray(2); - GSHP(GSHPNum).MinPartLoadRat = NumArray(3); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).MinPartLoadRat = NumArray(3); - GSHP(GSHPNum).MaxPartLoadRat = NumArray(4); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).MaxPartLoadRat = NumArray(4); - GSHP(GSHPNum).OptPartLoadRat = NumArray(5); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).OptPartLoadRat = NumArray(5); - GSHP(GSHPNum).LoadSideVolFlowRate = NumArray(6); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideVolFlowRate = NumArray(6); if (NumArray(6) == 0.0) { ShowSevereError(state, ModuleCompName + ":Load Side Vol Flow Rate = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SourceSideVolFlowRate = NumArray(7); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideVolFlowRate = NumArray(7); if (NumArray(7) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side Vol Flow Rate = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).LoadSideUACoeff = NumArray(8); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideUACoeff = NumArray(8); if (NumArray(9) == 0.0) { ShowSevereError(state, ModuleCompName + ":Load Side Heat Transfer Coefficient = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SourceSideUACoeff = NumArray(9); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideUACoeff = NumArray(9); if (NumArray(8) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side Heat Transfer Coefficient = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompPistonDisp = NumArray(10); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompPistonDisp = NumArray(10); if (NumArray(10) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Piston displacement/Stroke = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompClearanceFactor = NumArray(11); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompClearanceFactor = NumArray(11); if (NumArray(11) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Clearance Factor = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompSucPressDrop = NumArray(12); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).CompSucPressDrop = NumArray(12); if (NumArray(12) == 0.0) { ShowSevereError(state, ModuleCompName + ": Pressure Drop = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SuperheatTemp = NumArray(13); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SuperheatTemp = NumArray(13); if (NumArray(13) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side SuperHeat = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).PowerLosses = NumArray(14); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).PowerLosses = NumArray(14); if (NumArray(14) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Power Loss = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).LossFactor = NumArray(15); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LossFactor = NumArray(15); if (NumArray(15) == 0.0) { ShowSevereError(state, ModuleCompName + ":Efficiency = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).HighPressCutoff = NumArray(16); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).HighPressCutoff = NumArray(16); if (NumArray(16) == 0.0) { - GSHP(GSHPNum).HighPressCutoff = 500000000.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).HighPressCutoff = 500000000.0; // CALL ShowWarningError(ModuleCompName//': High Pressure Cut Off= 0.0 Heat Pump'//TRIM(AlphArray(1))) } - GSHP(GSHPNum).LowPressCutoff = NumArray(17); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LowPressCutoff = NumArray(17); if (NumArray(17) == 0.0) { - GSHP(GSHPNum).LowPressCutoff = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LowPressCutoff = 0.0; // CALL ShowWarningError(ModuleCompName//': Low Pressure Cut Off= 0.0 Heat Pump'//TRIM(AlphArray(1))) } - GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, AlphArray(2), + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, "HeatPump:WaterToWater Cooling", AlphArray(1), @@ -352,7 +338,7 @@ namespace HeatPumpWaterToWaterCOOLING { 1, ObjectIsNotParent); - GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, "HeatPump:WaterToWater Cooling", AlphArray(1), @@ -361,7 +347,7 @@ namespace HeatPumpWaterToWaterCOOLING { 1, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, AlphArray(4), + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, "HeatPump:WaterToWater Cooling", AlphArray(1), @@ -370,7 +356,7 @@ namespace HeatPumpWaterToWaterCOOLING { 2, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, "HeatPump:WaterToWater Cooling", AlphArray(1), @@ -384,45 +370,45 @@ namespace HeatPumpWaterToWaterCOOLING { TestCompSet(state, ModuleCompNameUC, AlphArray(1), AlphArray(4), AlphArray(5), "Chilled Water Nodes"); // save the design source side flow rate for use by plant loop sizing algorithms - RegisterPlantCompDesignFlow(GSHP(GSHPNum).SourceSideInletNodeNum, 0.5 * GSHP(GSHPNum).SourceSideVolFlowRate); - - GSHP(GSHPNum).QLoad = 0.0; - GSHP(GSHPNum).QSource = 0.0; - GSHP(GSHPNum).Power = 0.0; - GSHP(GSHPNum).LoadSideWaterInletTemp = 0.0; - GSHP(GSHPNum).SourceSideWaterInletTemp = 0.0; - GSHP(GSHPNum).LoadSideWaterOutletTemp = 0.0; - GSHP(GSHPNum).SourceSideWaterOutletTemp = 0.0; - GSHP(GSHPNum).SourceSideWaterMassFlowRate = 0.0; - GSHP(GSHPNum).LoadSideWaterMassFlowRate = 0.0; - GSHP(GSHPNum).IsOn = false; - GSHP(GSHPNum).MustRun = true; + RegisterPlantCompDesignFlow(state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideInletNodeNum, 0.5 * state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideVolFlowRate); + + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoad = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSource = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Power = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterInletTemp = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterInletTemp = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterOutletTemp = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterOutletTemp = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterMassFlowRate = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterMassFlowRate = 0.0; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).IsOn = false; + state.dataHPWaterToWaterClg->GSHP(GSHPNum).MustRun = true; } if (ErrorsFound) { ShowFatalError(state, "Errors Found in getting Gshp input"); } - GSHPRefrigIndex = FindRefrigerant(state, GSHPRefrigerant); - if (GSHPRefrigIndex == 0) { + state.dataHPWaterToWaterClg->GSHPRefrigIndex = FindRefrigerant(state, GSHPRefrigerant); + if (state.dataHPWaterToWaterClg->GSHPRefrigIndex == 0) { ShowFatalError(state, "Refrigerant for HeatPump:WaterToWater Heating not found, should have been=" + GSHPRefrigerant); ShowFatalError(state, "FluidProperties:* objects for " + GSHPRefrigerant + " must be included in the idf file."); } // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Cooling' - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterClg->NumGSHPs; ++GSHPNum) { SetupOutputVariable(state, "Heat Pump Electricity Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).Power, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Power, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Electricity Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).Energy, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Energy, "System", "Sum", - GSHP(GSHPNum).Name, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name, _, "Electricity", "Cooling", @@ -431,66 +417,66 @@ namespace HeatPumpWaterToWaterCOOLING { SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).QLoad, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoad, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).QLoadEnergy, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QLoadEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).QSource, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSource, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).QSourceEnergy, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).QSourceEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).LoadSideWaterOutletTemp, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).LoadSideWaterInletTemp, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).SourceSideWaterOutletTemp, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).SourceSideWaterInletTemp, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).LoadSideWaterMassFlowRate, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).LoadSideWaterMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).SourceSideWaterMassFlowRate, + state.dataHPWaterToWaterClg->GSHP(GSHPNum).SourceSideWaterMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterClg->GSHP(GSHPNum).Name); } } @@ -785,8 +771,8 @@ namespace HeatPumpWaterToWaterCOOLING { SourceSideRefridgTemp = this->SourceSideWaterInletTemp + initialQSource / (SourceSideEffect * CpSourceSide * this->SourceSideWaterMassFlowRate); // Determine the evaporating and condensing pressures - SourceSidePressure = FluidProperties::GetSatPressureRefrig(state, GSHPRefrigerant, SourceSideRefridgTemp, GSHPRefrigIndex, RoutineName); - LoadSidePressure = FluidProperties::GetSatPressureRefrig(state, GSHPRefrigerant, LoadSideRefridgTemp, GSHPRefrigIndex, RoutineName); + SourceSidePressure = FluidProperties::GetSatPressureRefrig(state, GSHPRefrigerant, SourceSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName); + LoadSidePressure = FluidProperties::GetSatPressureRefrig(state, GSHPRefrigerant, LoadSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName); if (SourceSidePressure < this->LowPressCutoff) { ShowSevereError(state, ModuleCompName + "=\"" + this->Name + "\" Cooling Source Side Pressure Less than the Design Minimum"); @@ -834,11 +820,11 @@ namespace HeatPumpWaterToWaterCOOLING { // Determine the Source Side Outlet Enthalpy qual = 1.0; - LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig(state, GSHPRefrigerant, LoadSideRefridgTemp, qual, GSHPRefrigIndex, RoutineNameLoadSideRefridgTemp); + LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig(state, GSHPRefrigerant, LoadSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameLoadSideRefridgTemp); qual = 0.0; SourceSideOutletEnth = - FluidProperties::GetSatEnthalpyRefrig(state, GSHPRefrigerant, SourceSideRefridgTemp, qual, GSHPRefrigIndex, RoutineNameSourceSideRefridgTemp); + FluidProperties::GetSatEnthalpyRefrig(state, GSHPRefrigerant, SourceSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSourceSideRefridgTemp); // Determine Load Side Outlet Enthalpy // Determine superheated temperature of the LoadSide outlet/compressor inlet @@ -846,7 +832,7 @@ namespace HeatPumpWaterToWaterCOOLING { // Determine the enathalpy of the super heated fluid at Source Side outlet SuperHeatEnth = - FluidProperties::GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompressInletTemp, LoadSidePressure, GSHPRefrigIndex, RoutineNameCompressInletTemp); + FluidProperties::GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompressInletTemp, LoadSidePressure, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... @@ -854,7 +840,7 @@ namespace HeatPumpWaterToWaterCOOLING { // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached // this routine was reenginerred from HVACsim + takes pressure in Pascals, tolrance, refrgerant # R22 =6 - CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig(state, GSHPRefrigerant, SuctionPr, GSHPRefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig(state, GSHPRefrigerant, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSuctionPr); T110 = CompSuctionSatTemp; // Shoot into the super heated region @@ -863,7 +849,7 @@ namespace HeatPumpWaterToWaterCOOLING { while (true) { CompSuctionTemp = 0.5 * (T110 + T111); - CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) { goto LOOP_exit; @@ -878,7 +864,7 @@ namespace HeatPumpWaterToWaterCOOLING { LOOP_exit:; // Determine the Mass flow rate of refrigerant - CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); MassRef = this->CompPistonDisp * CompSuctionDensity * (1 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1 / gamma)); // Find the Source Side Heat Transfer @@ -971,6 +957,4 @@ namespace HeatPumpWaterToWaterCOOLING { } -} // namespace HeatPumpWaterToWaterCOOLING - } // namespace EnergyPlus diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh index 90d3735d831..54054490906 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh @@ -64,15 +64,6 @@ struct EnergyPlusData; namespace HeatPumpWaterToWaterCOOLING { - // MODULE PARAMETER DEFINITIONS - extern std::string const ModuleCompName; - extern std::string const ModuleCompNameUC; - - extern std::string GSHPRefrigerant; // refrigerent name and index - extern int GSHPRefrigIndex; - - extern int NumGSHPs; // number of Gshps specified in input - struct GshpPeCoolingSpecs : PlantComponent // Needs Some Modifications talk with Dr.Fisher and decide.... { // Members @@ -80,8 +71,8 @@ namespace HeatPumpWaterToWaterCOOLING { int WWHPPlantTypeOfNum; bool Available; // need an array of logicals--load identifiers of available equipment bool ON; // simulate the machine at it's operating part load ratio - Real64 COP; // Coefficeint of Performance of the machine - Real64 NomCap; // Nomial Capcity of the HeatPump + Real64 COP; // Coefficient of Performance of the machine + Real64 NomCap; // Nominal Capacity of the HeatPump Real64 MinPartLoadRat; // Minimum operating Part Load Ratio Real64 MaxPartLoadRat; // Maximum operating Part Load Ratio Real64 OptPartLoadRat; // Optimal operating Part Load Ratio @@ -138,30 +129,30 @@ namespace HeatPumpWaterToWaterCOOLING { // Default Constructor GshpPeCoolingSpecs() - : WWHPPlantTypeOfNum(0), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), OptPartLoadRat(0.0), - LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), + : WWHPPlantTypeOfNum(0), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), + OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourceLoopNum(0), SourceLoopSideNum(0), SourceBranchNum(0), SourceCompNum(0), LoadLoopNum(0), LoadLoopSideNum(0), LoadBranchNum(0), LoadCompNum(0), CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), - SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), - Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), beginEnvironFlag(true) + SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), + SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), beginEnvironFlag(true) { } virtual ~GshpPeCoolingSpecs() = default; - static PlantComponent *factory(EnergyPlusData &state, const std::string& objectName); + static PlantComponent *factory(EnergyPlusData &state, const std::string &objectName); - void simulate([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, + void simulate([[maybe_unused]] EnergyPlusData &state, + const PlantLocation &calledFromLocation, + bool FirstHVACIteration, + Real64 &CurLoad, bool RunFlag) override; - void getDesignCapacities(EnergyPlusData &state, - const PlantLocation &calledFromLocation, - Real64 &MaxLoad, - Real64 &MinLoad, - Real64 &OptLoad) override; + void getDesignCapacities( + EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override; void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override; @@ -172,20 +163,24 @@ namespace HeatPumpWaterToWaterCOOLING { void update(); }; - // Object Data - extern Array1D GSHP; // dimension to number of machines - - void clear_state(); - void GetGshpInput(EnergyPlusData &state); } // namespace HeatPumpWaterToWaterCOOLING -struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct { +struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct +{ + + int NumGSHPs = 0; + int GSHPRefrigIndex = 0; + bool GetWWHPCoolingInput = true; + Array1D GSHP; void clear_state() override { - + this->NumGSHPs = 0; + this->GSHPRefrigIndex = 0; + this->GetWWHPCoolingInput = true; + this->GSHP.deallocate(); } }; diff --git a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc index 57aebeac867..c56df753dec 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc @@ -68,9 +68,8 @@ #include #include -namespace EnergyPlus { +namespace EnergyPlus::HeatPumpWaterToWaterHEATING { -namespace HeatPumpWaterToWaterHEATING { // Module containing the routines dealing with the Water to Water Heat Pump (Heating) // MODULE INFORMATION: @@ -95,28 +94,14 @@ namespace HeatPumpWaterToWaterHEATING { // MODULE PARAMETER DEFINITIONS std::string const ModuleCompName("HeatPump:WaterToWater:ParameterEstimation:Heating"); std::string const ModuleCompNameUC("HEATPUMP:WATERTOWATER:PARAMETERESTIMATION:HEATING"); - - std::string GSHPRefrigerant("R22"); // Refrigerent name and index - int GSHPRefrigIndex(0); - - int NumGSHPs(0); // number of Gshps specified in input - - // Object Data - bool GetWWHPHeatingInput = true; - Array1D GSHP; // dimension to number of machines - - void clear_state() { - NumGSHPs = 0; - GetWWHPHeatingInput = true; - GSHP.deallocate(); - } + std::string const GSHPRefrigerant("R22"); PlantComponent *GshpPeHeatingSpecs::factory(EnergyPlusData &state, const std::string& objectName) { - if (GetWWHPHeatingInput) { + if (state.dataHPWaterToWaterHtg->GetWWHPHeatingInput) { GetGshpInput(state); - GetWWHPHeatingInput = false; + state.dataHPWaterToWaterHtg->GetWWHPHeatingInput = false; } - for (auto &wwhp : GSHP) { + for (auto &wwhp : state.dataHPWaterToWaterHtg->GSHP) { if (wwhp.Name == objectName) { return &wwhp; } @@ -244,120 +229,120 @@ namespace HeatPumpWaterToWaterHEATING { static bool ErrorsFound(false); - NumGSHPs = inputProcessor->getNumObjectsFound(state, ModuleCompName); + state.dataHPWaterToWaterHtg->NumGSHPs = inputProcessor->getNumObjectsFound(state, ModuleCompName); - if (NumGSHPs <= 0) { + if (state.dataHPWaterToWaterHtg->NumGSHPs <= 0) { ShowSevereError(state, ModuleCompName + ": No Equipment found"); ErrorsFound = true; } // Allocate Arrays - GSHP.allocate(NumGSHPs); + state.dataHPWaterToWaterHtg->GSHP.allocate(state.dataHPWaterToWaterHtg->NumGSHPs); - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterHtg->NumGSHPs; ++GSHPNum) { inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat); UtilityRoutines::IsNameEmpty(state, AlphArray(1), ModuleCompNameUC, ErrorsFound); - GSHP(GSHPNum).Name = AlphArray(1); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name = AlphArray(1); - GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterPEHeating; + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterPEHeating; - GSHP(GSHPNum).COP = NumArray(1); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).COP = NumArray(1); if (NumArray(1) == 0.0) { ShowSevereError(state, ModuleCompName + ":COP = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } // zero values for NumArray 3 - 6 checked in input - idd - GSHP(GSHPNum).NomCap = NumArray(2); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).NomCap = NumArray(2); - GSHP(GSHPNum).MinPartLoadRat = NumArray(3); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).MinPartLoadRat = NumArray(3); - GSHP(GSHPNum).MaxPartLoadRat = NumArray(4); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).MaxPartLoadRat = NumArray(4); - GSHP(GSHPNum).OptPartLoadRat = NumArray(5); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).OptPartLoadRat = NumArray(5); - GSHP(GSHPNum).LoadSideVolFlowRate = NumArray(6); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideVolFlowRate = NumArray(6); if (NumArray(6) == 0.0) { ShowSevereError(state, ModuleCompName + ":Load Side Flow Rate = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SourceSideVolFlowRate = NumArray(7); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideVolFlowRate = NumArray(7); if (NumArray(7) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side Flow Rate = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).LoadSideUACoeff = NumArray(8); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideUACoeff = NumArray(8); if (NumArray(8) == 0.0) { ShowSevereError(state, ModuleCompName + ":Load Side Heat Transfer Coeffcient = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SourceSideUACoeff = NumArray(9); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideUACoeff = NumArray(9); if (NumArray(9) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side Heat Transfer Coeffcient = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompPistonDisp = NumArray(10); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).CompPistonDisp = NumArray(10); if (NumArray(10) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Piston displacement/Storke = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompClearanceFactor = NumArray(11); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).CompClearanceFactor = NumArray(11); if (NumArray(11) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Clearance Factor = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).CompSucPressDrop = NumArray(12); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).CompSucPressDrop = NumArray(12); if (NumArray(12) == 0.0) { ShowSevereError(state, ModuleCompName + ": Pressure Drop = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).SuperheatTemp = NumArray(13); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SuperheatTemp = NumArray(13); if (NumArray(13) == 0.0) { ShowSevereError(state, ModuleCompName + ":Source Side SuperHeat = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).PowerLosses = NumArray(14); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).PowerLosses = NumArray(14); if (NumArray(14) == 0.0) { ShowSevereError(state, ModuleCompName + ":Compressor Power Loss = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).LossFactor = NumArray(15); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LossFactor = NumArray(15); if (NumArray(15) == 0.0) { ShowSevereError(state, ModuleCompName + ":Efficiency = 0.0, Heatpump=" + AlphArray(1)); ErrorsFound = true; } - GSHP(GSHPNum).HighPressCutoff = NumArray(16); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).HighPressCutoff = NumArray(16); if (NumArray(16) == 0.0) { - GSHP(GSHPNum).HighPressCutoff = 500000000.0; + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).HighPressCutoff = 500000000.0; // CALL ShowWarningError(ModuleCompName//': High Pressure Cut Off= 0.0 Heat Pump'//TRIM(AlphArray(1))) } - GSHP(GSHPNum).LowPressCutoff = NumArray(17); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LowPressCutoff = NumArray(17); if (NumArray(17) == 0.0) { - GSHP(GSHPNum).LowPressCutoff = 0.0; + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LowPressCutoff = 0.0; // CALL ShowWarningError(ModuleCompName//': Low Pressure Cut Off= 0.0 Heat Pump'//TRIM(AlphArray(1))) } - GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, AlphArray(2), ErrorsFound, ModuleCompName, AlphArray(1), NodeType_Water, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), ErrorsFound, ModuleCompName, AlphArray(1), NodeType_Water, NodeConnectionType_Outlet, 1, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, AlphArray(4), ErrorsFound, ModuleCompName, AlphArray(1), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), ErrorsFound, ModuleCompName, AlphArray(1), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent); // Test node sets @@ -365,7 +350,7 @@ namespace HeatPumpWaterToWaterHEATING { TestCompSet(state, ModuleCompNameUC, AlphArray(1), AlphArray(4), AlphArray(5), "Hot Water Nodes"); // save the design source side flow rate for use by plant loop sizing algorithms - RegisterPlantCompDesignFlow(GSHP(GSHPNum).SourceSideInletNodeNum, 0.5 * GSHP(GSHPNum).SourceSideVolFlowRate); + RegisterPlantCompDesignFlow(state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideInletNodeNum, 0.5 * state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideVolFlowRate); } @@ -373,25 +358,25 @@ namespace HeatPumpWaterToWaterHEATING { ShowFatalError(state, "Errors Found in getting " + ModuleCompNameUC + " Input"); } - GSHPRefrigIndex = FindRefrigerant(state, GSHPRefrigerant); - if (GSHPRefrigIndex == 0) { + state.dataHPWaterToWaterHtg->GSHPRefrigIndex = FindRefrigerant(state, GSHPRefrigerant); + if (state.dataHPWaterToWaterHtg->GSHPRefrigIndex == 0) { ShowFatalError(state, "Refrigerant for HeatPump:WaterToWater Heating not found, should have been=" + GSHPRefrigerant); } // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Heating' - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterHtg->NumGSHPs; ++GSHPNum) { SetupOutputVariable(state, "Heat Pump Electricity Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).Power, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Power, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Electricity Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).Energy, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Energy, "System", "Sum", - GSHP(GSHPNum).Name, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name, _, "Electricity", "Heating", @@ -400,66 +385,66 @@ namespace HeatPumpWaterToWaterHEATING { SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).QLoad, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).QLoad, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).QLoadEnergy, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).QLoadEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).QSource, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).QSource, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).QSourceEnergy, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).QSourceEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).LoadSideWaterOutletTemp, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideWaterOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).LoadSideWaterInletTemp, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideWaterInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).SourceSideWaterOutletTemp, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideWaterOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).SourceSideWaterInletTemp, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideWaterInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).LoadSideWaterMassFlowRate, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).LoadSideWaterMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).SourceSideWaterMassFlowRate, + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).SourceSideWaterMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterHtg->GSHP(GSHPNum).Name); } } #pragma clang diagnostic pop @@ -559,17 +544,17 @@ namespace HeatPumpWaterToWaterHEATING { using PlantUtilities::SetComponentFlowRate; // SUBROUTINE PARAMETER DEFINITIONS: - Real64 const gamma(1.114); // Expnasion Coefficient - Real64 const HeatBalTol(0.0005); - Real64 const RelaxParam(0.6); - Real64 const SmallNum(1.0e-20); - int const IterationLimit(500); - static std::string const RoutineName("CalcGshpModel"); - static std::string const RoutineNameLoadSideTemp("CalcGSHPModel:LoadSideTemp"); - static std::string const RoutineNameSourceSideTemp("CalcGSHPModel:SourceSideTemp"); - static std::string const RoutineNameCompressInletTemp("CalcGSHPModel:CompressInletTemp"); - static std::string const RoutineNameSuctionPr("CalcGSHPModel:SuctionPr"); - static std::string const RoutineNameCompSuctionTemp("CalcGSHPModel:CompSuctionTemp"); + constexpr Real64 gamma(1.114); // Expansion Coefficient + constexpr Real64 HeatBalTol(0.0005); + constexpr Real64 RelaxParam(0.6); + constexpr Real64 SmallNum(1.0e-20); + constexpr int IterationLimit(500); + constexpr const char * RoutineName("CalcGshpModel"); + constexpr const char * RoutineNameLoadSideTemp("CalcGSHPModel:LoadSideTemp"); + constexpr const char * RoutineNameSourceSideTemp("CalcGSHPModel:SourceSideTemp"); + constexpr const char * RoutineNameCompressInletTemp("CalcGSHPModel:CompressInletTemp"); + constexpr const char * RoutineNameSuctionPr("CalcGSHPModel:SuctionPr"); + constexpr const char * RoutineNameCompSuctionTemp("CalcGSHPModel:CompSuctionTemp"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CompSuctionTemp; @@ -723,8 +708,8 @@ namespace HeatPumpWaterToWaterHEATING { Real64 LoadSideTemp = this->LoadSideWaterInletTemp + initialQLoad / (LoadSideEffect * CpLoadSide * this->LoadSideWaterMassFlowRate); // Determine the evaporating and condensing pressures - Real64 SourceSidePressure = GetSatPressureRefrig(state, GSHPRefrigerant, SourceSideTemp, GSHPRefrigIndex, RoutineNameSourceSideTemp); - Real64 LoadSidePressure = GetSatPressureRefrig(state, GSHPRefrigerant, LoadSideTemp, GSHPRefrigIndex, RoutineNameLoadSideTemp); + Real64 SourceSidePressure = GetSatPressureRefrig(state, GSHPRefrigerant, SourceSideTemp, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSourceSideTemp); + Real64 LoadSidePressure = GetSatPressureRefrig(state, GSHPRefrigerant, LoadSideTemp, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameLoadSideTemp); // check cutoff pressures if (SourceSidePressure < this->LowPressCutoff) { @@ -766,24 +751,24 @@ namespace HeatPumpWaterToWaterHEATING { // Determine the Source Side Outlet Enthalpy Real64 qualOne = 1.0; - Real64 SourceSideOutletEnth = GetSatEnthalpyRefrig(state, GSHPRefrigerant, SourceSideTemp, qualOne, GSHPRefrigIndex, RoutineNameSourceSideTemp); + Real64 SourceSideOutletEnth = GetSatEnthalpyRefrig(state, GSHPRefrigerant, SourceSideTemp, qualOne, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSourceSideTemp); // Determine Load Side Outlet Enthalpy Real64 qualZero = 0.0; - Real64 LoadSideOutletEnth = GetSatEnthalpyRefrig(state, GSHPRefrigerant, LoadSideTemp, qualZero, GSHPRefrigIndex, RoutineNameLoadSideTemp); + Real64 LoadSideOutletEnth = GetSatEnthalpyRefrig(state, GSHPRefrigerant, LoadSideTemp, qualZero, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameLoadSideTemp); // Determine superheated temperature of the Source Side outlet/compressor inlet Real64 CompressInletTemp = SourceSideTemp + this->SuperheatTemp; // Determine the enathalpy of the super heated fluid at Source Side outlet Real64 SuperHeatEnth = - GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompressInletTemp, SourceSidePressure, GSHPRefrigIndex, RoutineNameCompressInletTemp); + GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompressInletTemp, SourceSidePressure, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... // Determine the saturated temp at suction pressure, shoot out into the superheated region find the enthalpy // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached - CompSuctionSatTemp = GetSatTemperatureRefrig(state, GSHPRefrigerant, SuctionPr, GSHPRefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = GetSatTemperatureRefrig(state, GSHPRefrigerant, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSuctionPr); Real64 T110 = CompSuctionSatTemp; // Shoot into the super heated region @@ -793,7 +778,7 @@ namespace HeatPumpWaterToWaterHEATING { while (true) { CompSuctionTemp = 0.5 * (T110 + T111); - CompSuctionEnth = GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionEnth = GetSupHeatEnthalpyRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) { goto LOOP_exit; } @@ -807,7 +792,7 @@ namespace HeatPumpWaterToWaterHEATING { LOOP_exit:; // Determine the Mass flow rate of refrigerant - CompSuctionDensity = GetSupHeatDensityRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionDensity = GetSupHeatDensityRefrig(state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); Real64 MassRef = this->CompPistonDisp * CompSuctionDensity * (1.0 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1.0 / gamma)); // Find the Source Side Heat Transfer @@ -901,6 +886,4 @@ namespace HeatPumpWaterToWaterHEATING { } -} // namespace HeatPumpWaterToWaterHEATING - } // namespace EnergyPlus diff --git a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh index 42d7dcc14ce..686820ed0f4 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh @@ -64,15 +64,6 @@ struct EnergyPlusData; namespace HeatPumpWaterToWaterHEATING { - // MODULE PARAMETER DEFINITIONS - extern std::string const ModuleCompName; - extern std::string const ModuleCompNameUC; - - extern std::string GSHPRefrigerant; // Refrigerent name and index - extern int GSHPRefrigIndex; - - extern int NumGSHPs; // number of Gshps specified in input - struct GshpPeHeatingSpecs : PlantComponent { // Members @@ -81,7 +72,7 @@ namespace HeatPumpWaterToWaterHEATING { bool Available; // need an array of logicals--load identifiers of available equipment bool ON; // simulate the machine at it's operating part load ratio Real64 COP; // Coefficient of Performance of the machine - Real64 NomCap; // Nominal Capcity of the HeatPump + Real64 NomCap; // Nominal Capacity of the HeatPump Real64 MinPartLoadRat; // Minimum operating Part Load Ratio Real64 MaxPartLoadRat; // Maximum operating Part Load Ratio Real64 OptPartLoadRat; // Optimal operating Part Load Ratio @@ -104,8 +95,6 @@ namespace HeatPumpWaterToWaterHEATING { // loss that is supposed to be proportional to the theoretical power Real64 HighPressCutoff; // Maximum Design Pressure on the Load Side Pascals Real64 LowPressCutoff; // Minimum Design Pressure on the Source Side Pascals - // Added by Arun 6-27-02 - // to implement cycletime - removed 9/10/2013 LKL bool IsOn; bool MustRun; // loop topology variables @@ -120,48 +109,48 @@ namespace HeatPumpWaterToWaterHEATING { int CondMassFlowIndex; // index for criteria in PullCompInterconnectTrigger // Members - Real64 Power; // Power Consumption Watts - Real64 Energy; // Energy Consumption Joules - Real64 QLoad; // Load Side heat transfer rate Watts - Real64 QLoadEnergy; // Load Side heat transfer Joules - Real64 QSource; // Source Side heat transfer rate Watts - Real64 QSourceEnergy; // Source Side heat transfer Joules - Real64 LoadSideWaterInletTemp; // Load Side outlet temperature °C - Real64 SourceSideWaterInletTemp; // Source Side outlet temperature °C - Real64 LoadSideWaterOutletTemp; // Load Side outlet temperature °C - Real64 SourceSideWaterOutletTemp; // Source Side outlet temperature °C - Real64 LoadSideWaterMassFlowRate; // Mass flow rate of the cooling water in Load Side Kg/s + Real64 Power; // Power Consumption Watts + Real64 Energy; // Energy Consumption Joules + Real64 QLoad; // Load Side heat transfer rate Watts + Real64 QLoadEnergy; // Load Side heat transfer Joules + Real64 QSource; // Source Side heat transfer rate Watts + Real64 QSourceEnergy; // Source Side heat transfer Joules + Real64 LoadSideWaterInletTemp; // Load Side outlet temperature °C + Real64 SourceSideWaterInletTemp; // Source Side outlet temperature °C + Real64 LoadSideWaterOutletTemp; // Load Side outlet temperature °C + Real64 SourceSideWaterOutletTemp; // Source Side outlet temperature °C + Real64 LoadSideWaterMassFlowRate; // Mass flow rate of the cooling water in Load Side Kg/s Real64 SourceSideWaterMassFlowRate; // Mass flow rate of chilled water in Eavporator Kg/s - int Running; // On reporting Flag + int Running; // On reporting Flag bool plantScanFlag; bool beginEnvironFlag; // Default Constructor GshpPeHeatingSpecs() - : WWHPPlantTypeOfNum(0), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), - OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), - SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideUACoeff(0.0), - LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), PowerLosses(0.0), - LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourceLoopNum(0), SourceLoopSideNum(0), - SourceBranchNum(0), SourceCompNum(0), LoadLoopNum(0), LoadLoopSideNum(0), LoadBranchNum(0), LoadCompNum(0), CondMassFlowIndex(0), - Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), - SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), LoadSideWaterMassFlowRate(0.0), - SourceSideWaterMassFlowRate(0.0), Running(0), plantScanFlag(true), beginEnvironFlag(true) + : WWHPPlantTypeOfNum(0), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), + OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), + SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideUACoeff(0.0), + LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), PowerLosses(0.0), + LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourceLoopNum(0), SourceLoopSideNum(0), + SourceBranchNum(0), SourceCompNum(0), LoadLoopNum(0), LoadLoopSideNum(0), LoadBranchNum(0), LoadCompNum(0), CondMassFlowIndex(0), + Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), + SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), LoadSideWaterMassFlowRate(0.0), + SourceSideWaterMassFlowRate(0.0), Running(0), plantScanFlag(true), beginEnvironFlag(true) { } virtual ~GshpPeHeatingSpecs() = default; - static PlantComponent *factory(EnergyPlusData &state, const std::string& objectName); + static PlantComponent *factory(EnergyPlusData &state, const std::string &objectName); - void simulate([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, + void simulate([[maybe_unused]] EnergyPlusData &state, + const PlantLocation &calledFromLocation, + bool FirstHVACIteration, + Real64 &CurLoad, bool RunFlag) override; - void getDesignCapacities(EnergyPlusData &state, - const PlantLocation &calledFromLocation, - Real64 &MaxLoad, - Real64 &MinLoad, - Real64 &OptLoad) override; + void getDesignCapacities( + EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override; void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override; @@ -172,20 +161,24 @@ namespace HeatPumpWaterToWaterHEATING { void update(); }; - // Object Data - extern Array1D GSHP; // dimension to number of machines - void GetGshpInput(EnergyPlusData &state); - void clear_state(); - } // namespace HeatPumpWaterToWaterHEATING -struct HeatPumpWaterToWaterHEATINGData : BaseGlobalStruct { +struct HeatPumpWaterToWaterHEATINGData : BaseGlobalStruct +{ + + int GSHPRefrigIndex = 0; + int NumGSHPs = 0; + bool GetWWHPHeatingInput = true; + Array1D GSHP; void clear_state() override { - + this->GSHPRefrigIndex = 0; + this->NumGSHPs = 0; + this->GetWWHPHeatingInput = true; + this->GSHP.deallocate(); } }; diff --git a/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc b/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc index b41c58ce152..c83cb000b99 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc @@ -71,9 +71,7 @@ #include #include -namespace EnergyPlus { - -namespace HeatPumpWaterToWaterSimple { +namespace EnergyPlus::HeatPumpWaterToWaterSimple { // MODULE INFORMATION: // AUTHOR Kenneth Tang @@ -110,32 +108,14 @@ namespace HeatPumpWaterToWaterSimple { std::string const HPEqFitCooling("HeatPump:WatertoWater:EquationFit:Cooling"); std::string const HPEqFitCoolingUC("HEATPUMP:WATERTOWATER:EQUATIONFIT:COOLING"); - // MODULE VARIABLE DECLARATIONS: - int NumGSHPs(0); // Number of GSHPs specified in input - namespace { - bool GetInputFlag(true); // then TRUE, calls subroutine to read input file. - } // namespace - - // Object Data - Array1D GSHP; - std::unordered_map HeatPumpWaterUniqueNames; - - void GshpSpecs::clear_state() - { - NumGSHPs = 0; - GetInputFlag = true; - HeatPumpWaterUniqueNames.clear(); - GSHP.deallocate(); - } - PlantComponent *GshpSpecs::factory(EnergyPlusData &state, int wwhp_type, std::string eir_wwhp_name) { - if (GetInputFlag) { + if (state.dataHPWaterToWaterSimple->GetInputFlag) { GshpSpecs::GetWatertoWaterHPInput(state); - GetInputFlag = false; + state.dataHPWaterToWaterSimple->GetInputFlag = false; } - for (auto &wwhp : GSHP) { + for (auto &wwhp : state.dataHPWaterToWaterSimple->GSHP) { if (wwhp.Name == eir_wwhp_name && wwhp.WWHPPlantTypeOfNum == wwhp_type) { return &wwhp; } @@ -265,16 +245,16 @@ namespace HeatPumpWaterToWaterSimple { NumCoolCoil = inputProcessor->getNumObjectsFound(state, HPEqFitCoolingUC); NumHeatCoil = inputProcessor->getNumObjectsFound(state, HPEqFitHeatingUC); - NumGSHPs = NumCoolCoil + NumHeatCoil; + state.dataHPWaterToWaterSimple->NumGSHPs = NumCoolCoil + NumHeatCoil; - if (NumGSHPs <= 0) { + if (state.dataHPWaterToWaterSimple->NumGSHPs <= 0) { ShowSevereError(state, "GetEquationFitWaterToWater Input: No Equipment found"); ErrorsFound = true; } - if (NumGSHPs > 0) { - GSHP.allocate(NumGSHPs); - HeatPumpWaterUniqueNames.reserve(NumGSHPs); + if (state.dataHPWaterToWaterSimple->NumGSHPs > 0) { + state.dataHPWaterToWaterSimple->GSHP.allocate(state.dataHPWaterToWaterSimple->NumGSHPs); + state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames.reserve(state.dataHPWaterToWaterSimple->NumGSHPs); } // Load data structure for cooling coil @@ -292,63 +272,63 @@ namespace HeatPumpWaterToWaterSimple { IOStat, DataIPShortCuts::lNumericFieldBlanks, DataIPShortCuts::lAlphaFieldBlanks); - GlobalNames::VerifyUniqueInterObjectName(state, HeatPumpWaterUniqueNames, DataIPShortCuts::cAlphaArgs(1), HPEqFitCoolingUC, ErrorsFound); - GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterEFCooling; - GSHP(GSHPNum).Name = DataIPShortCuts::cAlphaArgs(1); - GSHP(GSHPNum).RatedLoadVolFlowCool = DataIPShortCuts::rNumericArgs(1); - if (GSHP(GSHPNum).RatedLoadVolFlowCool == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedLoadVolFlowCoolWasAutoSized = true; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames, DataIPShortCuts::cAlphaArgs(1), HPEqFitCoolingUC, ErrorsFound); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterEFCooling; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name = DataIPShortCuts::cAlphaArgs(1); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowCool = DataIPShortCuts::rNumericArgs(1); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowCool == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedLoadVolFlowCoolWasAutoSized = true; } - GSHP(GSHPNum).RatedSourceVolFlowCool = DataIPShortCuts::rNumericArgs(2); - if (GSHP(GSHPNum).RatedSourceVolFlowCool == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedSourceVolFlowCoolWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowCool = DataIPShortCuts::rNumericArgs(2); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowCool == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedSourceVolFlowCoolWasAutoSized = true; } - GSHP(GSHPNum).RatedCapCool = DataIPShortCuts::rNumericArgs(3); - if (GSHP(GSHPNum).RatedCapCool == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedCapCoolWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool = DataIPShortCuts::rNumericArgs(3); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapCoolWasAutoSized = true; } - GSHP(GSHPNum).RatedPowerCool = DataIPShortCuts::rNumericArgs(4); - if (GSHP(GSHPNum).RatedPowerCool == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedPowerCoolWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool = DataIPShortCuts::rNumericArgs(4); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerCoolWasAutoSized = true; } - GSHP(GSHPNum).CoolCap1 = DataIPShortCuts::rNumericArgs(5); - GSHP(GSHPNum).CoolCap2 = DataIPShortCuts::rNumericArgs(6); - GSHP(GSHPNum).CoolCap3 = DataIPShortCuts::rNumericArgs(7); - GSHP(GSHPNum).CoolCap4 = DataIPShortCuts::rNumericArgs(8); - GSHP(GSHPNum).CoolCap5 = DataIPShortCuts::rNumericArgs(9); - GSHP(GSHPNum).CoolPower1 = DataIPShortCuts::rNumericArgs(10); - GSHP(GSHPNum).CoolPower2 = DataIPShortCuts::rNumericArgs(11); - GSHP(GSHPNum).CoolPower3 = DataIPShortCuts::rNumericArgs(12); - GSHP(GSHPNum).CoolPower4 = DataIPShortCuts::rNumericArgs(13); - GSHP(GSHPNum).CoolPower5 = DataIPShortCuts::rNumericArgs(14); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCap1 = DataIPShortCuts::rNumericArgs(5); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCap2 = DataIPShortCuts::rNumericArgs(6); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCap3 = DataIPShortCuts::rNumericArgs(7); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCap4 = DataIPShortCuts::rNumericArgs(8); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolCap5 = DataIPShortCuts::rNumericArgs(9); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPower1 = DataIPShortCuts::rNumericArgs(10); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPower2 = DataIPShortCuts::rNumericArgs(11); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPower3 = DataIPShortCuts::rNumericArgs(12); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPower4 = DataIPShortCuts::rNumericArgs(13); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).CoolPower5 = DataIPShortCuts::rNumericArgs(14); if (NumNums > 14) { if (!DataIPShortCuts::lNumericFieldBlanks(15)) { - GSHP(GSHPNum).refCOP = DataIPShortCuts::rNumericArgs(15); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = DataIPShortCuts::rNumericArgs(15); } else { - GSHP(GSHPNum).refCOP = 8.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 8.0; } } else { - GSHP(GSHPNum).refCOP = 8.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 8.0; } // calculate reference COP if hard sized - if (!GSHP(GSHPNum).ratedPowerCoolWasAutoSized && !GSHP(GSHPNum).ratedCapCoolWasAutoSized && GSHP(GSHPNum).RatedPowerCool > 0.0) { - GSHP(GSHPNum).refCOP = GSHP(GSHPNum).RatedCapCool / GSHP(GSHPNum).RatedPowerCool; + if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerCoolWasAutoSized && !state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapCoolWasAutoSized && state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool > 0.0) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapCool / state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerCool; } if (NumNums > 15) { if (!DataIPShortCuts::lNumericFieldBlanks(16)) { - GSHP(GSHPNum).sizFac = DataIPShortCuts::rNumericArgs(16); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = DataIPShortCuts::rNumericArgs(16); } else { - GSHP(GSHPNum).sizFac = 1.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0; } } else { - GSHP(GSHPNum).sizFac = 1.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0; } - GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(2), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(2), ErrorsFound, HPEqFitCoolingUC, DataIPShortCuts::cAlphaArgs(1), @@ -357,7 +337,7 @@ namespace HeatPumpWaterToWaterSimple { 1, ObjectIsNotParent); - GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), ErrorsFound, HPEqFitCoolingUC, DataIPShortCuts::cAlphaArgs(1), @@ -366,7 +346,7 @@ namespace HeatPumpWaterToWaterSimple { 1, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), ErrorsFound, HPEqFitCoolingUC, DataIPShortCuts::cAlphaArgs(1), @@ -375,7 +355,7 @@ namespace HeatPumpWaterToWaterSimple { 2, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(5), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(5), ErrorsFound, HPEqFitCoolingUC, DataIPShortCuts::cAlphaArgs(1), @@ -397,16 +377,16 @@ namespace HeatPumpWaterToWaterSimple { "Chilled Water Nodes"); if (NumAlphas > 5 && !DataIPShortCuts::lAlphaFieldBlanks(6)) { - GSHP(GSHPNum).companionName = DataIPShortCuts::cAlphaArgs(6); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName = DataIPShortCuts::cAlphaArgs(6); } // CurrentModuleObject='HeatPump:WatertoWater:EquationFit:Cooling' SetupOutputVariable(state, "Heat Pump Electricity Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportEnergy, "System", "Sum", - GSHP(GSHPNum).Name, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name, _, "Electricity", "Cooling", @@ -414,16 +394,16 @@ namespace HeatPumpWaterToWaterSimple { "Plant"); SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportQLoadEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoadEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportQSourceEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSourceEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); } // Load data structure for heating coil @@ -441,64 +421,64 @@ namespace HeatPumpWaterToWaterSimple { IOStat, DataIPShortCuts::lNumericFieldBlanks, DataIPShortCuts::lAlphaFieldBlanks); - GlobalNames::VerifyUniqueInterObjectName(state, HeatPumpWaterUniqueNames, DataIPShortCuts::cAlphaArgs(1), HPEqFitHeatingUC, ErrorsFound); - GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterEFHeating; - GSHP(GSHPNum).Name = DataIPShortCuts::cAlphaArgs(1); - GSHP(GSHPNum).RatedLoadVolFlowHeat = DataIPShortCuts::rNumericArgs(1); - if (GSHP(GSHPNum).RatedLoadVolFlowHeat == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedLoadVolFlowHeatWasAutoSized = true; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataHPWaterToWaterSimple->HeatPumpWaterUniqueNames, DataIPShortCuts::cAlphaArgs(1), HPEqFitHeatingUC, ErrorsFound); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).WWHPPlantTypeOfNum = TypeOf_HPWaterEFHeating; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name = DataIPShortCuts::cAlphaArgs(1); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowHeat = DataIPShortCuts::rNumericArgs(1); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedLoadVolFlowHeat == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedLoadVolFlowHeatWasAutoSized = true; } - GSHP(GSHPNum).RatedSourceVolFlowHeat = DataIPShortCuts::rNumericArgs(2); - if (GSHP(GSHPNum).RatedSourceVolFlowHeat == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedSourceVolFlowHeatWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowHeat = DataIPShortCuts::rNumericArgs(2); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedSourceVolFlowHeat == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedSourceVolFlowHeatWasAutoSized = true; } - GSHP(GSHPNum).RatedCapHeat = DataIPShortCuts::rNumericArgs(3); - if (GSHP(GSHPNum).RatedCapHeat == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedCapHeatWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat = DataIPShortCuts::rNumericArgs(3); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapHeatWasAutoSized = true; } - GSHP(GSHPNum).RatedPowerHeat = DataIPShortCuts::rNumericArgs(4); - if (GSHP(GSHPNum).RatedPowerHeat == DataSizing::AutoSize) { - GSHP(GSHPNum).ratedPowerHeatWasAutoSized = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat = DataIPShortCuts::rNumericArgs(4); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat == DataSizing::AutoSize) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerHeatWasAutoSized = true; } - GSHP(GSHPNum).HeatCap1 = DataIPShortCuts::rNumericArgs(5); - GSHP(GSHPNum).HeatCap2 = DataIPShortCuts::rNumericArgs(6); - GSHP(GSHPNum).HeatCap3 = DataIPShortCuts::rNumericArgs(7); - GSHP(GSHPNum).HeatCap4 = DataIPShortCuts::rNumericArgs(8); - GSHP(GSHPNum).HeatCap5 = DataIPShortCuts::rNumericArgs(9); - GSHP(GSHPNum).HeatPower1 = DataIPShortCuts::rNumericArgs(10); - GSHP(GSHPNum).HeatPower2 = DataIPShortCuts::rNumericArgs(11); - GSHP(GSHPNum).HeatPower3 = DataIPShortCuts::rNumericArgs(12); - GSHP(GSHPNum).HeatPower4 = DataIPShortCuts::rNumericArgs(13); - GSHP(GSHPNum).HeatPower5 = DataIPShortCuts::rNumericArgs(14); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCap1 = DataIPShortCuts::rNumericArgs(5); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCap2 = DataIPShortCuts::rNumericArgs(6); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCap3 = DataIPShortCuts::rNumericArgs(7); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCap4 = DataIPShortCuts::rNumericArgs(8); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatCap5 = DataIPShortCuts::rNumericArgs(9); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPower1 = DataIPShortCuts::rNumericArgs(10); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPower2 = DataIPShortCuts::rNumericArgs(11); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPower3 = DataIPShortCuts::rNumericArgs(12); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPower4 = DataIPShortCuts::rNumericArgs(13); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).HeatPower5 = DataIPShortCuts::rNumericArgs(14); if (NumNums > 14) { if (!DataIPShortCuts::lNumericFieldBlanks(15)) { - GSHP(GSHPNum).refCOP = DataIPShortCuts::rNumericArgs(15); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = DataIPShortCuts::rNumericArgs(15); } else { - GSHP(GSHPNum).refCOP = 7.5; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 7.5; } } else { - GSHP(GSHPNum).refCOP = 7.5; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = 7.5; } // calculate reference COP if hard sized - if (!GSHP(GSHPNum).ratedPowerHeatWasAutoSized && !GSHP(GSHPNum).ratedCapHeatWasAutoSized && GSHP(GSHPNum).RatedPowerHeat > 0.0) { - GSHP(GSHPNum).refCOP = GSHP(GSHPNum).RatedCapHeat / GSHP(GSHPNum).RatedPowerHeat; + if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedPowerHeatWasAutoSized && !state.dataHPWaterToWaterSimple->GSHP(GSHPNum).ratedCapHeatWasAutoSized && state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat > 0.0) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).refCOP = state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedCapHeat / state.dataHPWaterToWaterSimple->GSHP(GSHPNum).RatedPowerHeat; } if (NumNums > 15) { if (!DataIPShortCuts::lNumericFieldBlanks(16)) { - GSHP(GSHPNum).sizFac = DataIPShortCuts::rNumericArgs(16); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = DataIPShortCuts::rNumericArgs(16); } else { - GSHP(GSHPNum).sizFac = 1.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0; } } else { - GSHP(GSHPNum).sizFac = 1.0; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).sizFac = 1.0; } - GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(2), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(2), ErrorsFound, HPEqFitHeatingUC, DataIPShortCuts::cAlphaArgs(1), @@ -507,7 +487,7 @@ namespace HeatPumpWaterToWaterSimple { 1, ObjectIsNotParent); - GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).SourceSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), ErrorsFound, HPEqFitHeatingUC, DataIPShortCuts::cAlphaArgs(1), @@ -516,7 +496,7 @@ namespace HeatPumpWaterToWaterSimple { 1, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideInletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), ErrorsFound, HPEqFitHeatingUC, DataIPShortCuts::cAlphaArgs(1), @@ -525,7 +505,7 @@ namespace HeatPumpWaterToWaterSimple { 2, ObjectIsNotParent); - GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(5), + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).LoadSideOutletNodeNum = GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(5), ErrorsFound, HPEqFitHeatingUC, DataIPShortCuts::cAlphaArgs(1), @@ -535,7 +515,7 @@ namespace HeatPumpWaterToWaterSimple { ObjectIsNotParent); if (NumAlphas > 5 && !DataIPShortCuts::lAlphaFieldBlanks(6)) { - GSHP(GSHPNum).companionName = DataIPShortCuts::cAlphaArgs(6); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName = DataIPShortCuts::cAlphaArgs(6); } // Test node sets @@ -550,10 +530,10 @@ namespace HeatPumpWaterToWaterSimple { // CurrentModuleObject='HeatPump:WatertoWater:EquationFit:Heating' SetupOutputVariable(state, "Heat Pump Electricity Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportEnergy, "System", "Sum", - GSHP(GSHPNum).Name, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name, _, "Electricity", "Heating", @@ -561,28 +541,28 @@ namespace HeatPumpWaterToWaterSimple { "Plant"); SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportQLoadEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoadEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Energy", OutputProcessor::Unit::J, - GSHP(GSHPNum).reportQSourceEnergy, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSourceEnergy, "System", "Sum", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); } // now process companion coils, if any - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { - if (!GSHP(GSHPNum).companionName.empty()) { - GSHP(GSHPNum).companionIndex = UtilityRoutines::FindItemInList(GSHP(GSHPNum).companionName, GSHP); - if (GSHP(GSHPNum).companionIndex == 0) { - ShowSevereError(state, "GetEquationFitWaterToWater Input: did not find companion heat pump named '" + GSHP(GSHPNum).companionName + - "' in heat pump called " + GSHP(GSHPNum).Name); + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterSimple->NumGSHPs; ++GSHPNum) { + if (!state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName.empty()) { + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIndex = UtilityRoutines::FindItemInList(state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName, state.dataHPWaterToWaterSimple->GSHP); + if (state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIndex == 0) { + ShowSevereError(state, "GetEquationFitWaterToWater Input: did not find companion heat pump named '" + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionName + + "' in heat pump called " + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); ErrorsFound = true; } else { - GSHP(GSHPNum).companionIdentified = true; + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).companionIdentified = true; } } } @@ -591,58 +571,58 @@ namespace HeatPumpWaterToWaterSimple { ShowFatalError(state, "Errors found in processing input for Water to Water Heat Pumps"); } - for (GSHPNum = 1; GSHPNum <= NumGSHPs; ++GSHPNum) { + for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterSimple->NumGSHPs; ++GSHPNum) { // setup output variables SetupOutputVariable(state, - "Heat Pump Electricity Rate", OutputProcessor::Unit::W, GSHP(GSHPNum).reportPower, "System", "Average", GSHP(GSHPNum).Name); + "Heat Pump Electricity Rate", OutputProcessor::Unit::W, state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportPower, "System", "Average", state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).reportQLoad, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQLoad, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Heat Transfer Rate", OutputProcessor::Unit::W, - GSHP(GSHPNum).reportQSource, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportQSource, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).reportLoadSideOutletTemp, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).reportLoadSideInletTemp, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Outlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).reportSourceSideOutletTemp, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideOutletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Inlet Temperature", OutputProcessor::Unit::C, - GSHP(GSHPNum).reportSourceSideInletTemp, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideInletTemp, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Load Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).reportLoadSideMassFlowRate, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportLoadSideMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); SetupOutputVariable(state, "Heat Pump Source Side Mass Flow Rate", OutputProcessor::Unit::kg_s, - GSHP(GSHPNum).reportSourceSideMassFlowRate, + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).reportSourceSideMassFlowRate, "System", "Average", - GSHP(GSHPNum).Name); + state.dataHPWaterToWaterSimple->GSHP(GSHPNum).Name); } } @@ -945,14 +925,14 @@ namespace HeatPumpWaterToWaterSimple { // if companion heating coil known, update info from that if (this->companionIdentified) { - this->RatedLoadVolFlowHeat = GSHP(this->companionIndex).RatedLoadVolFlowHeat; - this->ratedLoadVolFlowHeatWasAutoSized = GSHP(this->companionIndex).ratedLoadVolFlowHeatWasAutoSized; - this->RatedSourceVolFlowHeat = GSHP(this->companionIndex).RatedSourceVolFlowHeat; - this->ratedSourceVolFlowHeatWasAutoSized = GSHP(this->companionIndex).ratedSourceVolFlowHeatWasAutoSized; - this->RatedCapHeat = GSHP(this->companionIndex).RatedCapHeat; - this->ratedCapHeatWasAutoSized = GSHP(this->companionIndex).ratedCapHeatWasAutoSized; - this->RatedPowerHeat = GSHP(this->companionIndex).RatedPowerHeat; - this->ratedPowerHeatWasAutoSized = GSHP(this->companionIndex).ratedPowerHeatWasAutoSized; + this->RatedLoadVolFlowHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedLoadVolFlowHeat; + this->ratedLoadVolFlowHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedLoadVolFlowHeatWasAutoSized; + this->RatedSourceVolFlowHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedSourceVolFlowHeat; + this->ratedSourceVolFlowHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedSourceVolFlowHeatWasAutoSized; + this->RatedCapHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedCapHeat; + this->ratedCapHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedCapHeatWasAutoSized; + this->RatedPowerHeat = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedPowerHeat; + this->ratedPowerHeatWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedPowerHeatWasAutoSized; } int pltLoadSizNum = state.dataPlnt->PlantLoop(this->LoadLoopNum).PlantSizNum; @@ -1281,14 +1261,14 @@ namespace HeatPumpWaterToWaterSimple { // if companion cooling coil known, update info from that if (this->companionIdentified) { - this->RatedLoadVolFlowCool = GSHP(this->companionIndex).RatedLoadVolFlowCool; - this->ratedLoadVolFlowCoolWasAutoSized = GSHP(this->companionIndex).ratedLoadVolFlowCoolWasAutoSized; - this->RatedSourceVolFlowCool = GSHP(this->companionIndex).RatedSourceVolFlowCool; - this->ratedSourceVolFlowCoolWasAutoSized = GSHP(this->companionIndex).ratedSourceVolFlowCoolWasAutoSized; - this->RatedCapCool = GSHP(this->companionIndex).RatedCapCool; - this->ratedCapCoolWasAutoSized = GSHP(this->companionIndex).ratedCapCoolWasAutoSized; - this->RatedPowerCool = GSHP(this->companionIndex).RatedPowerCool; - this->ratedPowerCoolWasAutoSized = GSHP(this->companionIndex).ratedPowerCoolWasAutoSized; + this->RatedLoadVolFlowCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedLoadVolFlowCool; + this->ratedLoadVolFlowCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedLoadVolFlowCoolWasAutoSized; + this->RatedSourceVolFlowCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedSourceVolFlowCool; + this->ratedSourceVolFlowCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedSourceVolFlowCoolWasAutoSized; + this->RatedCapCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedCapCool; + this->ratedCapCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedCapCoolWasAutoSized; + this->RatedPowerCool = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).RatedPowerCool; + this->ratedPowerCoolWasAutoSized = state.dataHPWaterToWaterSimple->GSHP(this->companionIndex).ratedPowerCoolWasAutoSized; } int pltLoadSizNum = state.dataPlnt->PlantLoop(this->LoadLoopNum).PlantSizNum; @@ -1986,6 +1966,4 @@ namespace HeatPumpWaterToWaterSimple { Node(LoadSideOutletNode).Temp = this->reportLoadSideOutletTemp; } -} // namespace HeatPumpWaterToWaterSimple - } // namespace EnergyPlus diff --git a/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh b/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh index 50f55d111e6..13ef6672876 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh @@ -64,15 +64,6 @@ struct EnergyPlusData; namespace HeatPumpWaterToWaterSimple { - // MODULE PARAMETER DEFINITIONS - extern std::string const HPEqFitHeating; - extern std::string const HPEqFitHeatingUC; - extern std::string const HPEqFitCooling; - extern std::string const HPEqFitCoolingUC; - - // MODULE VARIABLE DECLARATIONS: - extern int NumGSHPs; // Number of GSHPs specified in input - struct GshpSpecs : public PlantComponent { // Members @@ -198,46 +189,55 @@ namespace HeatPumpWaterToWaterSimple { static PlantComponent *factory(EnergyPlusData &state, int wwhp_type, std::string eir_wwhp_name); - static void clear_state(); - static void GetWatertoWaterHPInput(EnergyPlusData &state); - void simulate([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation, bool const FirstHVACIteration, Real64 &CurLoad, bool const RunFlag) override; + void simulate([[maybe_unused]] EnergyPlusData &state, + const PlantLocation &calledFromLocation, + bool FirstHVACIteration, + Real64 &CurLoad, + bool RunFlag) override; - void getDesignCapacities(EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override; + void getDesignCapacities( + EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override; void getSizingFactor(Real64 &sizingFactor) override; void InitWatertoWaterHP(EnergyPlusData &state, - int const GSHPTypeNum, // Type of GSHP + int GSHPTypeNum, // Type of GSHP std::string const &GSHPName, // User Specified Name of GSHP - bool const FirstHVACIteration, - Real64 const MyLoad // Demand Load + bool FirstHVACIteration, + Real64 MyLoad // Demand Load ); void sizeCoolingWaterToWaterHP(EnergyPlusData &state); void sizeHeatingWaterToWaterHP(EnergyPlusData &state); - void CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 const MyLoad); // Operating Load + void CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 MyLoad); // Operating Load - void CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 const MyLoad); // Operating Load + void CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 MyLoad); // Operating Load void UpdateGSHPRecords(); void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override; }; - // Object Data - extern Array1D GSHP; - } // namespace HeatPumpWaterToWaterSimple -struct HeatPumpWaterToWaterSimpleData : BaseGlobalStruct { +struct HeatPumpWaterToWaterSimpleData : BaseGlobalStruct +{ + + int NumGSHPs = 0; + bool GetInputFlag = true; + Array1D GSHP; + std::unordered_map HeatPumpWaterUniqueNames; void clear_state() override { - + this->NumGSHPs = 0; + this->GetInputFlag = true; + this->GSHP.deallocate(); + this->HeatPumpWaterUniqueNames.clear(); } }; diff --git a/src/EnergyPlus/HybridEvapCoolingModel.cc b/src/EnergyPlus/HybridEvapCoolingModel.cc index caef8159c80..74b02fb2df1 100644 --- a/src/EnergyPlus/HybridEvapCoolingModel.cc +++ b/src/EnergyPlus/HybridEvapCoolingModel.cc @@ -1270,11 +1270,6 @@ namespace HybridEvapCoolingModel { Real64 PreviousMaxiumConditioningOutput = 0; Real64 PreviousMaxiumHumidOrDehumidOutput = 0; std::string ObjectID = Name.c_str(); - int size = CurrentOperatingSettings.size(); - CSetting empty_setting; - for (int i = 0; i < size; i++) { - CurrentOperatingSettings[i] = empty_setting; - } if (StepIns.RHosa > 1) { ShowSevereError(state, "Unitary hybrid system error, required relative humidity value 0-1, called in object" + ObjectID + ".Check inputs"); assert(true); @@ -1853,6 +1848,14 @@ namespace HybridEvapCoolingModel { UnitOn = 0; ForceOff = true; } + + // Initialize all settings for all operating modes + int size = CurrentOperatingSettings.size(); + CSetting empty_setting; + for (int i = 1; i < size; i++) { + CurrentOperatingSettings[i] = empty_setting; + } + // Go into standby if unit is off or not needed if ((!CoolingRequested && !HeatingRequested && !VentilationRequested && !HumidificationRequested && !DehumidificationRequested) || ForceOff) diff --git a/src/EnergyPlus/IceThermalStorage.cc b/src/EnergyPlus/IceThermalStorage.cc index 0cc2b8d482c..862557133f1 100644 --- a/src/EnergyPlus/IceThermalStorage.cc +++ b/src/EnergyPlus/IceThermalStorage.cc @@ -101,54 +101,31 @@ namespace IceThermalStorage { std::string const cIceStorageDetailed("ThermalStorage:Ice:Detailed"); // ITS parameter - Real64 const FreezTemp(0.0); // Water freezing Temperature, 0[C] - Real64 const FreezTempIP(32.0); // Water freezing Temperature, 32[F] - Real64 const TimeInterval(3600.0); // Time Interval (1 hr) [s] + constexpr Real64 FreezTemp(0.0); // Water freezing Temperature, 0[C] + constexpr Real64 FreezTempIP(32.0); // Water freezing Temperature, 32[F] + constexpr Real64 TimeInterval(3600.0); // Time Interval (1 hr) [s] // Conversion parameter - Real64 const EpsLimitForX(0.0); // 0.02 ! See Dion's code as eps1 - Real64 const EpsLimitForDisCharge(0.0); // 0.20 ! See Dion's code as eps2 - Real64 const EpsLimitForCharge(0.0); // 0.20 ! See Dion's code as eps3 + constexpr Real64 EpsLimitForX(0.0); // 0.02 ! See Dion's code as eps1 + constexpr Real64 EpsLimitForDisCharge(0.0); // 0.20 ! See Dion's code as eps2 + constexpr Real64 EpsLimitForCharge(0.0); // 0.20 ! See Dion's code as eps3 // Parameter used by the Detailed Ice Storage Model - Real64 const DeltaTofMin(0.5); // Minimum allowed outlet side temperature difference [C] + constexpr Real64 DeltaTofMin(0.5); // Minimum allowed outlet side temperature difference [C] // This is (Tout - Tfreezing) - Real64 const DeltaTifMin(1.0); // Minimum allowed inlet side temperature difference [C] + constexpr Real64 DeltaTifMin(1.0); // Minimum allowed inlet side temperature difference [C] // This is (Tin - Tfreezing) - int NumSimpleIceStorage(0); - int NumDetailedIceStorage(0); - int TotalNumIceStorage(0); - - bool getITSInput = true; - - // Object Data - Array1D SimpleIceStorage; // dimension to number of machines - Array1D DetailedIceStorage; // Derived type for detailed ice storage model - - //************************************************************************* - - // Functions - void clear_state() - { - getITSInput = true; - NumSimpleIceStorage = 0; - NumDetailedIceStorage = 0; - TotalNumIceStorage = 0; - SimpleIceStorage.deallocate(); - DetailedIceStorage.deallocate(); - } - PlantComponent *SimpleIceStorageData::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data for boilers if it hasn't been done already - if (getITSInput) { + if (state.dataIceThermalStorage->getITSInput) { GetIceStorageInput(state); - getITSInput = false; + state.dataIceThermalStorage->getITSInput = false; } // Now look for this particular pipe in the list - for (auto &ITS : SimpleIceStorage) { + for (auto &ITS : state.dataIceThermalStorage->SimpleIceStorage) { if (ITS.Name == objectName) { return &ITS; } @@ -162,13 +139,13 @@ namespace IceThermalStorage { PlantComponent *DetailedIceStorageData::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data for boilers if it hasn't been done already - if (getITSInput) { + if (state.dataIceThermalStorage->getITSInput) { GetIceStorageInput(state); - getITSInput = false; + state.dataIceThermalStorage->getITSInput = false; } // Now look for this particular pipe in the list - for (auto &ITS : DetailedIceStorage) { + for (auto &ITS : state.dataIceThermalStorage->DetailedIceStorage) { if (ITS.Name == objectName) { return &ITS; } @@ -720,14 +697,14 @@ namespace IceThermalStorage { ErrorsFound = false; // Always need to reset this since there are multiple types of ice storage systems // LOAD ARRAYS WITH SimpleIceStorage DATA - NumSimpleIceStorage = inputProcessor->getNumObjectsFound(state, cIceStorageSimple); // by ZG - NumDetailedIceStorage = inputProcessor->getNumObjectsFound(state, cIceStorageDetailed); + state.dataIceThermalStorage->NumSimpleIceStorage = inputProcessor->getNumObjectsFound(state, cIceStorageSimple); // by ZG + state.dataIceThermalStorage->NumDetailedIceStorage = inputProcessor->getNumObjectsFound(state, cIceStorageDetailed); // Allocate SimpleIceStorage based on NumOfIceStorage - SimpleIceStorage.allocate(NumSimpleIceStorage); + state.dataIceThermalStorage->SimpleIceStorage.allocate(state.dataIceThermalStorage->NumSimpleIceStorage); DataIPShortCuts::cCurrentModuleObject = cIceStorageSimple; - for (int iceNum = 1; iceNum <= NumSimpleIceStorage; ++iceNum) { + for (int iceNum = 1; iceNum <= state.dataIceThermalStorage->NumSimpleIceStorage; ++iceNum) { int NumAlphas; int NumNums; @@ -746,18 +723,18 @@ namespace IceThermalStorage { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, DataIPShortCuts::cAlphaArgs(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - ++TotalNumIceStorage; - SimpleIceStorage(iceNum).MapNum = TotalNumIceStorage; + ++state.dataIceThermalStorage->TotalNumIceStorage; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).MapNum = state.dataIceThermalStorage->TotalNumIceStorage; // ITS name - SimpleIceStorage(iceNum).Name = DataIPShortCuts::cAlphaArgs(1); + state.dataIceThermalStorage->SimpleIceStorage(iceNum).Name = DataIPShortCuts::cAlphaArgs(1); // Get Ice Thermal Storage Type - SimpleIceStorage(iceNum).ITSType = DataIPShortCuts::cAlphaArgs(2); - if (UtilityRoutines::SameString(SimpleIceStorage(iceNum).ITSType, "IceOnCoilInternal")) { - SimpleIceStorage(iceNum).ITSType_Num = ITSType::IceOnCoilInternal; - } else if (UtilityRoutines::SameString(SimpleIceStorage(iceNum).ITSType, "IceOnCoilExternal")) { - SimpleIceStorage(iceNum).ITSType_Num = ITSType::IceOnCoilExternal; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSType = DataIPShortCuts::cAlphaArgs(2); + if (UtilityRoutines::SameString(state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSType, "IceOnCoilInternal")) { + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSType_Num = ITSType::IceOnCoilInternal; + } else if (UtilityRoutines::SameString(state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSType, "IceOnCoilExternal")) { + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSType_Num = ITSType::IceOnCoilExternal; } else { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(2) + '=' + DataIPShortCuts::cAlphaArgs(2)); @@ -765,7 +742,7 @@ namespace IceThermalStorage { } // Get and Verify ITS nominal Capacity (user input is in GJ, internal value in in J) - SimpleIceStorage(iceNum).ITSNomCap = DataIPShortCuts::rNumericArgs(1) * 1.e+09; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSNomCap = DataIPShortCuts::rNumericArgs(1) * 1.e+09; if (DataIPShortCuts::rNumericArgs(1) == 0.0) { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(1), DataIPShortCuts::rNumericArgs(1))); @@ -773,7 +750,7 @@ namespace IceThermalStorage { } // Get Plant Inlet Node Num - SimpleIceStorage(iceNum).PltInletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), + state.dataIceThermalStorage->SimpleIceStorage(iceNum).PltInletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), @@ -783,7 +760,7 @@ namespace IceThermalStorage { DataLoopNode::ObjectIsNotParent); // Get Plant Outlet Node Num - SimpleIceStorage(iceNum).PltOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), + state.dataIceThermalStorage->SimpleIceStorage(iceNum).PltOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), @@ -800,16 +777,16 @@ namespace IceThermalStorage { "Chilled Water Nodes"); // Initialize Report Variables - SimpleIceStorage(iceNum).MyLoad = 0.0; - SimpleIceStorage(iceNum).Urate = 0.0; - SimpleIceStorage(iceNum).IceFracRemain = 1.0; - SimpleIceStorage(iceNum).ITSCoolingRate_rep = 0.0; - SimpleIceStorage(iceNum).ITSCoolingEnergy_rep = 0.0; - SimpleIceStorage(iceNum).ITSChargingRate = 0.0; - SimpleIceStorage(iceNum).ITSChargingEnergy = 0.0; - SimpleIceStorage(iceNum).ITSmdot = 0.0; - SimpleIceStorage(iceNum).ITSInletTemp = 0.0; - SimpleIceStorage(iceNum).ITSOutletTemp = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).MyLoad = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).Urate = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).IceFracRemain = 1.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSCoolingRate_rep = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSCoolingEnergy_rep = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSChargingRate = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSChargingEnergy = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSmdot = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSInletTemp = 0.0; + state.dataIceThermalStorage->SimpleIceStorage(iceNum).ITSOutletTemp = 0.0; } // IceNum @@ -822,9 +799,9 @@ namespace IceThermalStorage { // Determine the number of detailed ice storage devices are in the input file and allocate appropriately DataIPShortCuts::cCurrentModuleObject = cIceStorageDetailed; - DetailedIceStorage.allocate(NumDetailedIceStorage); // Allocate DetIceStorage based on NumDetIceStorages + state.dataIceThermalStorage->DetailedIceStorage.allocate(state.dataIceThermalStorage->NumDetailedIceStorage); // Allocate DetIceStorage based on NumDetIceStorages - for (int iceNum = 1; iceNum <= NumDetailedIceStorage; ++iceNum) { + for (int iceNum = 1; iceNum <= state.dataIceThermalStorage->NumDetailedIceStorage; ++iceNum) { int NumAlphas; int NumNums; @@ -843,18 +820,18 @@ namespace IceThermalStorage { DataIPShortCuts::cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, DataIPShortCuts::cAlphaArgs(1), DataIPShortCuts::cCurrentModuleObject, ErrorsFound); - ++TotalNumIceStorage; + ++state.dataIceThermalStorage->TotalNumIceStorage; - DetailedIceStorage(iceNum).MapNum = TotalNumIceStorage; - DetailedIceStorage(iceNum).Name = DataIPShortCuts::cAlphaArgs(1); // Detailed ice storage name + state.dataIceThermalStorage->DetailedIceStorage(iceNum).MapNum = state.dataIceThermalStorage->TotalNumIceStorage; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).Name = DataIPShortCuts::cAlphaArgs(1); // Detailed ice storage name // Get and verify availability schedule - DetailedIceStorage(iceNum).ScheduleName = DataIPShortCuts::cAlphaArgs(2); // Detailed ice storage availability schedule name + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleName = DataIPShortCuts::cAlphaArgs(2); // Detailed ice storage availability schedule name if (DataIPShortCuts::lAlphaFieldBlanks(2)) { - DetailedIceStorage(iceNum).ScheduleIndex = DataGlobalConstants::ScheduleAlwaysOn; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex = DataGlobalConstants::ScheduleAlwaysOn; } else { - DetailedIceStorage(iceNum).ScheduleIndex = ScheduleManager::GetScheduleIndex(state, DetailedIceStorage(iceNum).ScheduleName); - if (DetailedIceStorage(iceNum).ScheduleIndex == 0) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex = ScheduleManager::GetScheduleIndex(state, state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleName); + if (state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex == 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(2) + '=' + DataIPShortCuts::cAlphaArgs(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; @@ -864,7 +841,7 @@ namespace IceThermalStorage { // Get and Verify ITS nominal Capacity (user input is in GJ, internal value is in W-hr) // Convert GJ to J by multiplying by 10^9 // Convert J to W-hr by dividing by number of seconds in an hour (3600) - DetailedIceStorage(iceNum).NomCapacity = DataIPShortCuts::rNumericArgs(1) * (1.e+09) / (DataGlobalConstants::SecInHour); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).NomCapacity = DataIPShortCuts::rNumericArgs(1) * (1.e+09) / (DataGlobalConstants::SecInHour); if (DataIPShortCuts::rNumericArgs(1) <= 0.0) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(1), DataIPShortCuts::rNumericArgs(1))); @@ -873,7 +850,7 @@ namespace IceThermalStorage { } // Get Plant Inlet Node Num - DetailedIceStorage(iceNum).PlantInNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), + state.dataIceThermalStorage->DetailedIceStorage(iceNum).PlantInNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), @@ -883,7 +860,7 @@ namespace IceThermalStorage { DataLoopNode::ObjectIsNotParent); // Get Plant Outlet Node Num - DetailedIceStorage(iceNum).PlantOutNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), + state.dataIceThermalStorage->DetailedIceStorage(iceNum).PlantOutNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(4), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), @@ -900,15 +877,15 @@ namespace IceThermalStorage { "Chilled Water Nodes"); // Obtain the Charging and Discharging Curve types and names - DetailedIceStorage(iceNum).DischargeCurveName = DataIPShortCuts::cAlphaArgs(6); - DetailedIceStorage(iceNum).DischargeCurveNum = CurveManager::GetCurveIndex(state, DataIPShortCuts::cAlphaArgs(6)); - if (DetailedIceStorage(iceNum).DischargeCurveNum <= 0) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveName = DataIPShortCuts::cAlphaArgs(6); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveNum = CurveManager::GetCurveIndex(state, DataIPShortCuts::cAlphaArgs(6)); + if (state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveNum <= 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(6) + '=' + DataIPShortCuts::cAlphaArgs(6)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; } - int dischargeCurveDim = state.dataCurveManager->PerfCurve(DetailedIceStorage(iceNum).DischargeCurveNum).NumDims; + int dischargeCurveDim = state.dataCurveManager->PerfCurve(state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveNum).NumDims; if (dischargeCurveDim != 2) { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + ": Discharge curve must have 2 independent variables"); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); @@ -917,13 +894,13 @@ namespace IceThermalStorage { ErrorsFound = true; } else { if (DataIPShortCuts::cAlphaArgs(5) == "FRACTIONCHARGEDLMTD") { - DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::FracChargedLMTD; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::FracChargedLMTD; } else if (DataIPShortCuts::cAlphaArgs(5) == "FRACTIONDISCHARGEDLMTD") { - DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::FracDischargedLMTD; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::FracDischargedLMTD; } else if (DataIPShortCuts::cAlphaArgs(5) == "LMTDMASSFLOW") { - DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::LMTDMassFlow; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::LMTDMassFlow; } else if (DataIPShortCuts::cAlphaArgs(5) == "LMTDFRACTIONCHARGED") { - DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::LMTDFracCharged; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveTypeNum = CurveVars::LMTDFracCharged; } else { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + ": Discharge curve independent variable options not valid, option=" + DataIPShortCuts::cAlphaArgs(5)); @@ -933,22 +910,22 @@ namespace IceThermalStorage { } } - ErrorsFound |= CurveManager::CheckCurveDims(state, DetailedIceStorage(iceNum).DischargeCurveNum, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeCurveNum, // Curve index {2}, // Valid dimensions "GetIceStorageInput: ", // Routine name DataIPShortCuts::cCurrentModuleObject, // Object Type - DetailedIceStorage(iceNum).Name, // Object Name + state.dataIceThermalStorage->DetailedIceStorage(iceNum).Name, // Object Name DataIPShortCuts::cAlphaFieldNames(6)); // Field Name - DetailedIceStorage(iceNum).ChargeCurveName = DataIPShortCuts::cAlphaArgs(8); - DetailedIceStorage(iceNum).ChargeCurveNum = CurveManager::GetCurveIndex(state, DataIPShortCuts::cAlphaArgs(8)); - if (DetailedIceStorage(iceNum).ChargeCurveNum <= 0) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveName = DataIPShortCuts::cAlphaArgs(8); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveNum = CurveManager::GetCurveIndex(state, DataIPShortCuts::cAlphaArgs(8)); + if (state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveNum <= 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(8) + '=' + DataIPShortCuts::cAlphaArgs(8)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; } - int chargeCurveDim = state.dataCurveManager->PerfCurve(DetailedIceStorage(iceNum).ChargeCurveNum).NumDims; + int chargeCurveDim = state.dataCurveManager->PerfCurve(state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveNum).NumDims; if (chargeCurveDim != 2) { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + ": Charge curve must have 2 independent variables"); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); @@ -957,13 +934,13 @@ namespace IceThermalStorage { ErrorsFound = true; } else { if (DataIPShortCuts::cAlphaArgs(7) == "FRACTIONCHARGEDLMTD") { - DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::FracChargedLMTD; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::FracChargedLMTD; } else if (DataIPShortCuts::cAlphaArgs(7) == "FRACTIONDISCHARGEDLMTD") { - DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::FracDischargedLMTD; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::FracDischargedLMTD; } else if (DataIPShortCuts::cAlphaArgs(7) == "LMTDMASSFLOW") { - DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::LMTDMassFlow; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::LMTDMassFlow; } else if (DataIPShortCuts::cAlphaArgs(7) == "LMTDFRACTIONCHARGED") { - DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::LMTDFracCharged; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveTypeNum = CurveVars::LMTDFracCharged; } else { ShowSevereError(state, DataIPShortCuts::cCurrentModuleObject + ": Charge curve independent variable options not valid, option=" + DataIPShortCuts::cAlphaArgs(7)); @@ -973,63 +950,63 @@ namespace IceThermalStorage { } } - ErrorsFound |= CurveManager::CheckCurveDims(state, DetailedIceStorage(iceNum).ChargeCurveNum, // Curve index + ErrorsFound |= CurveManager::CheckCurveDims(state, state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeCurveNum, // Curve index {2}, // Valid dimensions "GetIceStorageInput: ", // Routine name DataIPShortCuts::cCurrentModuleObject, // Object Type - DetailedIceStorage(iceNum).Name, // Object Name + state.dataIceThermalStorage->DetailedIceStorage(iceNum).Name, // Object Name DataIPShortCuts::cAlphaFieldNames(8)); // Field Name - DetailedIceStorage(iceNum).CurveFitTimeStep = DataIPShortCuts::rNumericArgs(2); - if ((DetailedIceStorage(iceNum).CurveFitTimeStep <= 0.0) || (DetailedIceStorage(iceNum).CurveFitTimeStep > 1.0)) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).CurveFitTimeStep = DataIPShortCuts::rNumericArgs(2); + if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).CurveFitTimeStep <= 0.0) || (state.dataIceThermalStorage->DetailedIceStorage(iceNum).CurveFitTimeStep > 1.0)) { ShowSevereError(state, format("Invalid {}={:.3R}", DataIPShortCuts::cNumericFieldNames(2), DataIPShortCuts::rNumericArgs(2))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, "Curve fit time step invalid, less than zero or greater than 1 for " + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; } - DetailedIceStorage(iceNum).ThawProcessIndicator = DataIPShortCuts::cAlphaArgs(9); - if (UtilityRoutines::SameString(DetailedIceStorage(iceNum).ThawProcessIndicator, "INSIDEMELT")) { - DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::InsideMelt; - } else if ((UtilityRoutines::SameString(DetailedIceStorage(iceNum).ThawProcessIndicator, "OUTSIDEMELT")) || - (DetailedIceStorage(iceNum).ThawProcessIndicator.empty())) { - DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::OutsideMelt; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndicator = DataIPShortCuts::cAlphaArgs(9); + if (UtilityRoutines::SameString(state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndicator, "INSIDEMELT")) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::InsideMelt; + } else if ((UtilityRoutines::SameString(state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndicator, "OUTSIDEMELT")) || + (state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndicator.empty())) { + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::OutsideMelt; } else { ShowSevereError(state, "Invalid thaw process indicator of " + DataIPShortCuts::cAlphaArgs(9) + " was entered"); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, R"(Value should either be "InsideMelt" or "OutsideMelt")"); - DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::InsideMelt; // Severe error will end simulation, but just in case... + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ThawProcessIndex = DetIce::InsideMelt; // Severe error will end simulation, but just in case... ErrorsFound = true; } // Get the other ice storage parameters (electric, heat loss, freezing temperature) and stupidity check each one - DetailedIceStorage(iceNum).DischargeParaElecLoad = DataIPShortCuts::rNumericArgs(3); - DetailedIceStorage(iceNum).ChargeParaElecLoad = DataIPShortCuts::rNumericArgs(4); - DetailedIceStorage(iceNum).TankLossCoeff = DataIPShortCuts::rNumericArgs(5); - DetailedIceStorage(iceNum).FreezingTemp = DataIPShortCuts::rNumericArgs(6); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeParaElecLoad = DataIPShortCuts::rNumericArgs(3); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeParaElecLoad = DataIPShortCuts::rNumericArgs(4); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).TankLossCoeff = DataIPShortCuts::rNumericArgs(5); + state.dataIceThermalStorage->DetailedIceStorage(iceNum).FreezingTemp = DataIPShortCuts::rNumericArgs(6); - if ((DetailedIceStorage(iceNum).DischargeParaElecLoad < 0.0) || (DetailedIceStorage(iceNum).DischargeParaElecLoad > 1.0)) { + if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeParaElecLoad < 0.0) || (state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargeParaElecLoad > 1.0)) { ShowSevereError(state, format("Invalid {}={:.3R}", DataIPShortCuts::cNumericFieldNames(3), DataIPShortCuts::rNumericArgs(3))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, "Value is either less than/equal to zero or greater than 1"); ErrorsFound = true; } - if ((DetailedIceStorage(iceNum).ChargeParaElecLoad < 0.0) || (DetailedIceStorage(iceNum).ChargeParaElecLoad > 1.0)) { + if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeParaElecLoad < 0.0) || (state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargeParaElecLoad > 1.0)) { ShowSevereError(state, format("Invalid {}={:.3R}", DataIPShortCuts::cNumericFieldNames(4), DataIPShortCuts::rNumericArgs(4))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, "Value is either less than/equal to zero or greater than 1"); ErrorsFound = true; } - if ((DetailedIceStorage(iceNum).TankLossCoeff < 0.0) || (DetailedIceStorage(iceNum).TankLossCoeff > 0.1)) { + if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).TankLossCoeff < 0.0) || (state.dataIceThermalStorage->DetailedIceStorage(iceNum).TankLossCoeff > 0.1)) { ShowSevereError(state, format("Invalid {}={:.3R}", DataIPShortCuts::cNumericFieldNames(5), DataIPShortCuts::rNumericArgs(5))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ShowContinueError(state, "Value is either less than/equal to zero or greater than 0.1 (10%)"); ErrorsFound = true; } - if ((DetailedIceStorage(iceNum).FreezingTemp < -10.0) || (DetailedIceStorage(iceNum).FreezingTemp > 10.0)) { + if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).FreezingTemp < -10.0) || (state.dataIceThermalStorage->DetailedIceStorage(iceNum).FreezingTemp > 10.0)) { ShowWarningError(state, format("Potentially invalid {}={:.3R}", DataIPShortCuts::cNumericFieldNames(6), DataIPShortCuts::rNumericArgs(6))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); @@ -1038,26 +1015,26 @@ namespace IceThermalStorage { } // Initialize Report Variables - DetailedIceStorage(iceNum).CompLoad = 0.0; - DetailedIceStorage(iceNum).IceFracChange = 0.0; - DetailedIceStorage(iceNum).IceFracRemaining = 1.0; - DetailedIceStorage(iceNum).IceFracOnCoil = 1.0; - DetailedIceStorage(iceNum).DischargingRate = 0.0; - DetailedIceStorage(iceNum).DischargingEnergy = 0.0; - DetailedIceStorage(iceNum).ChargingRate = 0.0; - DetailedIceStorage(iceNum).ChargingEnergy = 0.0; - DetailedIceStorage(iceNum).MassFlowRate = 0.0; - DetailedIceStorage(iceNum).BypassMassFlowRate = 0.0; - DetailedIceStorage(iceNum).TankMassFlowRate = 0.0; - DetailedIceStorage(iceNum).InletTemp = 0.0; - DetailedIceStorage(iceNum).OutletTemp = 0.0; - DetailedIceStorage(iceNum).TankOutletTemp = 0.0; - DetailedIceStorage(iceNum).ParasiticElecRate = 0.0; - DetailedIceStorage(iceNum).ParasiticElecEnergy = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).CompLoad = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).IceFracChange = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).IceFracRemaining = 1.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).IceFracOnCoil = 1.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargingRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).DischargingEnergy = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargingRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ChargingEnergy = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).MassFlowRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).BypassMassFlowRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).TankMassFlowRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).InletTemp = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).OutletTemp = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).TankOutletTemp = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ParasiticElecRate = 0.0; + state.dataIceThermalStorage->DetailedIceStorage(iceNum).ParasiticElecEnergy = 0.0; } // ...over detailed ice storage units - if ((NumSimpleIceStorage + NumDetailedIceStorage) <= 0) { + if ((state.dataIceThermalStorage->NumSimpleIceStorage + state.dataIceThermalStorage->NumDetailedIceStorage) <= 0) { ShowSevereError(state, "No Ice Storage Equipment found in GetIceStorage"); ErrorsFound = true; } @@ -1794,7 +1771,7 @@ namespace IceThermalStorage { } } - void UpdateIceFractions() + void UpdateIceFractions(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1810,13 +1787,13 @@ namespace IceThermalStorage { // This is called from HVACManager once we have actually stepped forward // a system time step. - for (auto &thisITS : SimpleIceStorage) { + for (auto &thisITS : state.dataIceThermalStorage->SimpleIceStorage) { thisITS.IceFracRemain += thisITS.Urate * DataHVACGlobals::TimeStepSys; if (thisITS.IceFracRemain <= 0.001) thisITS.IceFracRemain = 0.0; if (thisITS.IceFracRemain > 1.0) thisITS.IceFracRemain = 1.0; } - for (auto &thisITS : DetailedIceStorage) { + for (auto &thisITS : state.dataIceThermalStorage->DetailedIceStorage) { thisITS.IceFracRemaining += thisITS.IceFracChange - (thisITS.TankLossCoeff * DataHVACGlobals::TimeStepSys); if (thisITS.IceFracRemaining < 0.001) thisITS.IceFracRemaining = 0.0; if (thisITS.IceFracRemaining > 1.000) thisITS.IceFracRemaining = 1.0; diff --git a/src/EnergyPlus/IceThermalStorage.hh b/src/EnergyPlus/IceThermalStorage.hh index d2a9a69811c..245c7854325 100644 --- a/src/EnergyPlus/IceThermalStorage.hh +++ b/src/EnergyPlus/IceThermalStorage.hh @@ -64,15 +64,6 @@ struct EnergyPlusData; namespace IceThermalStorage { - // MODULE PARAMETER DEFINITIONS - extern std::string const cIceStorageSimple; - extern std::string const cIceStorageDetailed; - - // ITS numbers and FoundOrNot - extern int NumSimpleIceStorage; - extern int NumDetailedIceStorage; - extern int TotalNumIceStorage; - enum class IceStorageType { Simple, @@ -268,13 +259,6 @@ namespace IceThermalStorage { void setupOutputVars(EnergyPlusData &state); }; - // Object Data - extern Array1D SimpleIceStorage; // dimension to number of machines - extern Array1D DetailedIceStorage; // Derived type for detailed ice storage model - - // Static Functions - void clear_state(); - void GetIceStorageInput(EnergyPlusData &state); Real64 CalcDetIceStorLMTDstar(Real64 Tin, // ice storage unit inlet temperature @@ -294,15 +278,27 @@ namespace IceThermalStorage { Real64 TempIPtoSI(Real64 Temp); - void UpdateIceFractions(); + void UpdateIceFractions(EnergyPlusData &state); } // namespace IceThermalStorage struct IceThermalStorageData : BaseGlobalStruct { + bool getITSInput = true; + int NumSimpleIceStorage = 0; + int NumDetailedIceStorage = 0; + int TotalNumIceStorage = 0; + Array1D SimpleIceStorage; + Array1D DetailedIceStorage; + void clear_state() override { - + this->getITSInput = true; + this->NumSimpleIceStorage = 0; + this->NumDetailedIceStorage = 0; + this->TotalNumIceStorage = 0; + this->SimpleIceStorage.deallocate(); + this->DetailedIceStorage.deallocate(); } }; diff --git a/src/EnergyPlus/MicroCHPElectricGenerator.hh b/src/EnergyPlus/MicroCHPElectricGenerator.hh index 464fd353dae..f25073218aa 100644 --- a/src/EnergyPlus/MicroCHPElectricGenerator.hh +++ b/src/EnergyPlus/MicroCHPElectricGenerator.hh @@ -53,6 +53,7 @@ // EnergyPlus Headers #include +#include #include #include diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index da78bd27bf5..c694468d9f0 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -4318,7 +4318,6 @@ namespace EnergyPlus::OutputReportTabular { using EvaporativeCoolers::NumEvapCool; using EvaporativeFluidCoolers::NumSimpleEvapFluidCoolers; using EvaporativeFluidCoolers::SimpleEvapFluidCooler; - using FluidCoolers::SimpleFluidCooler; using HeatingCoils::HeatingCoil; using HeatingCoils::NumHeatingCoils; using PackagedThermalStorageCoil::NumTESCoils; @@ -4351,7 +4350,7 @@ namespace EnergyPlus::OutputReportTabular { for (iCooler = 1; iCooler <= NumSimpleEvapFluidCoolers; ++iCooler) { SysTotalHVACRejectHeatLoss += SimpleEvapFluidCooler(iCooler).Qactual * TimeStepSysSec + SimpleEvapFluidCooler(iCooler).FanEnergy; } - for (auto &cooler : SimpleFluidCooler) { + for (auto &cooler : state.dataFluidCoolers->SimpleFluidCooler) { SysTotalHVACRejectHeatLoss += cooler.Qactual * TimeStepSysSec + cooler.FanEnergy; } diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 46ffa4172c5..e88cc0533b3 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -143,25 +143,8 @@ namespace EnergyPlus::PlantManager { using namespace DataLoopNode; using namespace FluidProperties; - // MODULE PARAMETER DEFINITIONS - int const TempSetPt(1001); - bool InitLoopEquip(true); - bool GetCompSizFac(true); - static std::string const fluidNameSteam("STEAM"); - Array1D_int SupplySideInletNode; // Node number for the supply side inlet - Array1D_int SupplySideOutletNode; // Node number for the supply side outlet - Array1D_int DemandSideInletNode; // Inlet node on the demand side - - void clear_state() { - InitLoopEquip = true; - GetCompSizFac = true; - SupplySideInletNode.deallocate(); - SupplySideOutletNode.deallocate(); - DemandSideInletNode.deallocate(); - } - void ManagePlantLoops(EnergyPlusData &state, bool const FirstHVACIteration, bool &SimAirLoops, // True when the air loops need to be (re)simulated @@ -326,7 +309,7 @@ namespace EnergyPlus::PlantManager { int CondLoopNum; Array1D_string Alpha(18); // dimension to num of alpha fields in input Array1D Num(30); // dimension to num of numeric data fields in input - static bool ErrorsFound(false); + bool ErrorsFound(false); std::string LoadingScheme; bool ErrFound; std::string CurrentModuleObject; // for ease in renaming. @@ -774,7 +757,7 @@ namespace EnergyPlus::PlantManager { bool SplitInBranch; bool MixerOutBranch; - static bool ErrorsFound(false); + bool ErrorsFound(false); bool ASeriesBranchHasPump; bool AParallelBranchHasPump; @@ -2099,7 +2082,7 @@ namespace EnergyPlus::PlantManager { int CompNum; // plant side component counter int SensedNode; - static bool ErrorsFound(false); + bool ErrorsFound(false); bool FinishSizingFlag; static bool SupplyEnvrnFlag(true); @@ -2181,10 +2164,10 @@ namespace EnergyPlus::PlantManager { state.dataPlnt->PlantFirstSizesOkayToFinalize = false; // set global flag for when it ready to store final sizes state.dataPlnt->PlantFirstSizesOkayToReport = false; state.dataPlnt->PlantFinalSizesOkayToReport = false; - GetCompSizFac = true; + state.dataPlantMgr->GetCompSizFac = true; for (passNum = 1; passNum <= 4; ++passNum) { // begin while loop to iterate over the next calls sequentially - InitLoopEquip = true; + state.dataPlantMgr->InitLoopEquip = true; // Step 2, call component models it using PlantCallingOrderInfo for sizing for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { @@ -2196,7 +2179,7 @@ namespace EnergyPlus::PlantManager { BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch( BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, state.dataPlantMgr->InitLoopEquip, state.dataPlantMgr->GetCompSizFac); } //-CompNum } //-BranchNum } @@ -2217,7 +2200,7 @@ namespace EnergyPlus::PlantManager { SizePlantLoop(state, LoopNum, FinishSizingFlag); } } - GetCompSizFac = false; + state.dataPlantMgr->GetCompSizFac = false; } // iterative passes thru sizing related routines. end while? // Step 5 now one more time for the final @@ -2245,7 +2228,7 @@ namespace EnergyPlus::PlantManager { BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch( BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, state.dataPlantMgr->InitLoopEquip, state.dataPlantMgr->GetCompSizFac); } //-CompNum } //-BranchNum // if ( PlantLoop( LoopNum ).PlantSizNum > 0 ) PlantSizData( PlantLoop( LoopNum ).PlantSizNum @@ -2264,8 +2247,8 @@ namespace EnergyPlus::PlantManager { if (state.dataGlobal->RedoSizesHVACSimulation && !state.dataPlnt->PlantReSizingCompleted) { // cycle through plant equipment calling with InitLoopEquip true - InitLoopEquip = true; - GetCompSizFac = false; + state.dataPlantMgr->InitLoopEquip = true; + state.dataPlantMgr->GetCompSizFac = false; for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex; LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide; @@ -2275,7 +2258,7 @@ namespace EnergyPlus::PlantManager { BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch( BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, state.dataPlantMgr->InitLoopEquip, state.dataPlantMgr->GetCompSizFac); } //-CompNum } //-BranchNum } @@ -2286,7 +2269,7 @@ namespace EnergyPlus::PlantManager { ResizePlantLoopLevelSizes(state, LoopNum); } - InitLoopEquip = true; + state.dataPlantMgr->InitLoopEquip = true; // now call everything again to reporting turned on for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) { @@ -2298,7 +2281,7 @@ namespace EnergyPlus::PlantManager { BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch( BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration, state.dataPlantMgr->InitLoopEquip, state.dataPlantMgr->GetCompSizFac); } //-CompNum } //-BranchNum // pumps are special so call them directly @@ -2309,7 +2292,7 @@ namespace EnergyPlus::PlantManager { state.dataPlnt->PlantFinalSizesOkayToReport = false; } //***************************************************************** - // END Resizing Pass for HVAC Sizing Simultion Adjustments + // END Resizing Pass for HVAC Sizing Simulation Adjustments //***************************************************************** //***************************************************************** // BEGIN ONE TIME ENVIRONMENT INITS @@ -3022,7 +3005,7 @@ namespace EnergyPlus::PlantManager { // calculate a loop sizing factor and a branch sizing factor. Note that components without a sizing factor // are assigned sizing factors of zero in this calculation if (PlantSizNum > 0) { - if (GetCompSizFac) { + if (state.dataPlantMgr->GetCompSizFac) { for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SupplySide).TotalBranches; ++BranchNum) { BranchSizFac = 0.0; @@ -3035,7 +3018,7 @@ namespace EnergyPlus::PlantManager { continue; for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SupplySide).Branch( BranchNum).TotalComponents; ++CompNum) { - state.dataPlnt->PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).simulate(state, true, localInitLoopEquip, GetCompSizFac); + state.dataPlnt->PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).simulate(state, true, localInitLoopEquip, state.dataPlantMgr->GetCompSizFac); BranchSizFac = max(BranchSizFac, state.dataPlnt->PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp( CompNum).SizFac); @@ -3355,24 +3338,6 @@ namespace EnergyPlus::PlantManager { // 3. third call all condenser demand sides // 4. fourth call all condenser supply sides - // REFERENCES: - // na - - // USE STATEMENTS: - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int OrderIndex; // local int I; // local loop @@ -3429,25 +3394,9 @@ namespace EnergyPlus::PlantManager { // simple rule-based allocation of which order to call the half loops // Examine for interconnected components and rearrange to impose the following rules - // REFERENCES: - // na - // Using/Aliasing using PlantUtilities::ShiftPlantLoopSideCallingOrder; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int HalfLoopNum; int LoopNum; @@ -4241,7 +4190,7 @@ namespace EnergyPlus::PlantManager { BranchCtr).Name); ShowContinueError(state, "Occurs in Plant Loop=" + state.dataPlnt->PlantLoop(LoopCtr).Name); ShowContinueError(state, "SetupBranchControlTypes: and the simulation continues"); - // DSU3 note not sure why this is so bad. heat transfer pipe might be a good reason to allow this? + // note not sure why this is so bad. heat transfer pipe might be a good reason to allow this? // this used to fatal in older PlantFlowResolver. } diff --git a/src/EnergyPlus/Plant/PlantManager.hh b/src/EnergyPlus/Plant/PlantManager.hh index aa20982091a..c818cad391e 100644 --- a/src/EnergyPlus/Plant/PlantManager.hh +++ b/src/EnergyPlus/Plant/PlantManager.hh @@ -64,19 +64,6 @@ struct EnergyPlusData; namespace PlantManager { - // MODULE PARAMETER DEFINITIONS - extern int const TempSetPt; - extern int const FlowSetPt; - - extern bool InitLoopEquip; - extern bool GetCompSizFac; - - extern Array1D_int SupplySideInletNode; // Node number for the supply side inlet - extern Array1D_int SupplySideOutletNode; // Node number for the supply side outlet - extern Array1D_int DemandSideInletNode; // Inlet node on the demand side - - void clear_state(); - void ManagePlantLoops(EnergyPlusData &state, bool FirstHVACIteration, bool &SimAirLoops, // True when the air loops need to be (re)simulated bool &SimZoneEquipment, // True when zone equipment components need to be (re)simulated @@ -122,9 +109,13 @@ namespace PlantManager { struct PlantMgrData : BaseGlobalStruct { + bool InitLoopEquip = true; + bool GetCompSizFac = true; + void clear_state() override { - + this->InitLoopEquip = true; + this->GetCompSizFac = true; } }; diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc index 5faf5ca01b6..6144ad2ab4e 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc @@ -76,9 +76,7 @@ #include #include -namespace EnergyPlus { - -namespace PlantHeatExchangerFluidToFluid { +namespace EnergyPlus::PlantHeatExchangerFluidToFluid { // Module containing the routines dealing with the HeatExchanger:FluidToFluid @@ -91,58 +89,17 @@ namespace PlantHeatExchangerFluidToFluid { // PURPOSE OF THIS MODULE: // Simulate a generic plant heat exchanger with a variety of control options - int const CrossFlowBothUnMixed(1); - int const CrossFlowBothMixed(2); - int const CrossFlowSupplyLoopMixedDemandLoopUnMixed(3); - int const CrossFlowSupplyLoopUnMixedDemandLoopMixed(4); - int const CounterFlow(5); - int const ParallelFlow(6); - int const Ideal(7); - - int const UncontrolledOn(1001); - int const OperationSchemeModulated(1002); - int const OperationSchemeOnOff(1003); - int const HeatingSetPointModulated(1004); - int const HeatingSetPointOnOff(1005); - int const CoolingSetPointModulated(1006); - int const CoolingSetPointOnOff(1007); - int const DualDeadBandSetPointModulated(1008); - int const DualDeadBandSetPointOnOff(1009); - int const CoolingDifferentialOnOff(1010); - int const CoolingSetPointOnOffWithComponentOverride(1011); - int const TrackComponentOnOff(1012); - - int const WetBulbTemperature(10); - int const DryBulbTemperature(11); - int const LoopTemperature(12); - - int const HeatingSupplySideLoop(501); - int const CoolingSupplySideLoop(502); - std::string const ComponentClassName("HeatExchanger:FluidToFluid"); - int NumberOfPlantFluidHXs(0); - bool GetInput(true); - Array1D FluidHX; - Array1D_bool CheckFluidHXs; - - void clear_state() - { - NumberOfPlantFluidHXs = 0; - GetInput = true; - FluidHX.deallocate(); - CheckFluidHXs.deallocate(); - } - PlantComponent *HeatExchangerStruct::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data for heat exchangers if it hasn't been done already - if (GetInput) { + if (state.dataPlantHXFluidToFluid->GetInput) { GetFluidHeatExchangerInput(state); - GetInput = false; + state.dataPlantHXFluidToFluid->GetInput = false; } // Now look for this particular object - for (auto &obj : FluidHX) { + for (auto &obj : state.dataPlantHXFluidToFluid->FluidHX) { if (obj.Name == objectName) { return &obj; } @@ -191,7 +148,7 @@ namespace PlantHeatExchangerFluidToFluid { this->initialize(state); // for op scheme led HXs, only call controls if called from Loop Supply Side - if ((this->ControlMode == OperationSchemeModulated) || (this->ControlMode == OperationSchemeOnOff)) { + if ((this->ControlMode == iCtrlType::OperationSchemeModulated) || (this->ControlMode == iCtrlType::OperationSchemeOnOff)) { if (calledFromLocation.loopNum == this->SupplySideLoop.loopNum) { this->control(state, calledFromLocation.loopNum, CurLoad, FirstHVACIteration); } @@ -235,8 +192,8 @@ namespace PlantHeatExchangerFluidToFluid { cCurrentModuleObject = "HeatExchanger:FluidToFluid"; - NumberOfPlantFluidHXs = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (NumberOfPlantFluidHXs == 0) return; + state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + if (state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs == 0) return; inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNums); MaxNumNumbers = NumNums; @@ -249,10 +206,9 @@ namespace PlantHeatExchangerFluidToFluid { rNumericArgs.dimension(MaxNumNumbers, 0.0); lNumericFieldBlanks.dimension(MaxNumNumbers, false); - if (NumberOfPlantFluidHXs > 0) { - FluidHX.allocate(NumberOfPlantFluidHXs); - CheckFluidHXs.dimension(NumberOfPlantFluidHXs, true); - for (int CompLoop = 1; CompLoop <= NumberOfPlantFluidHXs; ++CompLoop) { + if (state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs > 0) { + state.dataPlantHXFluidToFluid->FluidHX.allocate(state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs); + for (int CompLoop = 1; CompLoop <= state.dataPlantHXFluidToFluid->NumberOfPlantFluidHXs; ++CompLoop) { inputProcessor->getObjectItem(state, cCurrentModuleObject, CompLoop, @@ -267,13 +223,13 @@ namespace PlantHeatExchangerFluidToFluid { cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - FluidHX(CompLoop).Name = cAlphaArgs(1); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).Name = cAlphaArgs(1); if (lAlphaFieldBlanks(2)) { - FluidHX(CompLoop).AvailSchedNum = DataGlobalConstants::ScheduleAlwaysOn; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum = DataGlobalConstants::ScheduleAlwaysOn; } else { - FluidHX(CompLoop).AvailSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2)); - if (FluidHX(CompLoop).AvailSchedNum <= 0) { + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2)); + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum <= 0) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Invalid " + cAlphaFieldNames(2) + " = " + cAlphaArgs(2)); ShowContinueError(state, "Schedule was not found "); @@ -281,7 +237,7 @@ namespace PlantHeatExchangerFluidToFluid { } } - FluidHX(CompLoop).DemandSideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(3), + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), @@ -289,7 +245,7 @@ namespace PlantHeatExchangerFluidToFluid { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - FluidHX(CompLoop).DemandSideLoop.outletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(4), + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.outletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), @@ -298,12 +254,12 @@ namespace PlantHeatExchangerFluidToFluid { 1, DataLoopNode::ObjectIsNotParent); BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(3), cAlphaArgs(4), "Loop Demand Side Plant Nodes"); - FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRate = rNumericArgs(1); - if (FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRate == DataSizing::AutoSize) { - FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRateWasAutoSized = true; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRate = rNumericArgs(1); + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRate == DataSizing::AutoSize) { + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.DesignVolumeFlowRateWasAutoSized = true; } - FluidHX(CompLoop).SupplySideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(5), + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SupplySideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), @@ -311,7 +267,7 @@ namespace PlantHeatExchangerFluidToFluid { DataLoopNode::NodeConnectionType_Inlet, 2, DataLoopNode::ObjectIsNotParent); - FluidHX(CompLoop).SupplySideLoop.outletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(6), + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SupplySideLoop.outletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(6), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), @@ -320,25 +276,25 @@ namespace PlantHeatExchangerFluidToFluid { 2, DataLoopNode::ObjectIsNotParent); BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(5), cAlphaArgs(6), "Loop Supply Side Plant Nodes"); - FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRate = rNumericArgs(2); - if (FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRate == DataSizing::AutoSize) { - FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRateWasAutoSized = true; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRate = rNumericArgs(2); + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRate == DataSizing::AutoSize) { + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SupplySideLoop.DesignVolumeFlowRateWasAutoSized = true; } if (UtilityRoutines::SameString(cAlphaArgs(7), "CrossFlowBothUnMixed")) { - FluidHX(CompLoop).HeatExchangeModelType = CrossFlowBothUnMixed; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::CrossFlowBothUnMixed; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "CrossFlowBothMixed")) { - FluidHX(CompLoop).HeatExchangeModelType = CrossFlowBothMixed; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::CrossFlowBothMixed; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "CrossFlowSupplyMixedDemandUnMixed")) { - FluidHX(CompLoop).HeatExchangeModelType = CrossFlowSupplyLoopMixedDemandLoopUnMixed; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::CrossFlowSupplyLoopMixedDemandLoopUnMixed; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "CrossFlowSupplyUnMixedDemandMixed")) { - FluidHX(CompLoop).HeatExchangeModelType = CrossFlowSupplyLoopUnMixedDemandLoopMixed; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::CrossFlowSupplyLoopUnMixedDemandLoopMixed; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "CounterFlow")) { - FluidHX(CompLoop).HeatExchangeModelType = CounterFlow; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::CounterFlow; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "ParallelFlow")) { - FluidHX(CompLoop).HeatExchangeModelType = ParallelFlow; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::ParallelFlow; } else if (UtilityRoutines::SameString(cAlphaArgs(7), "Ideal")) { - FluidHX(CompLoop).HeatExchangeModelType = Ideal; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType = iFluidHXType::Ideal; } else { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Invalid " + cAlphaFieldNames(7) + " = " + cAlphaArgs(7)); @@ -346,12 +302,12 @@ namespace PlantHeatExchangerFluidToFluid { } if (!lNumericFieldBlanks(3)) { - FluidHX(CompLoop).UA = rNumericArgs(3); - if (FluidHX(CompLoop).UA == DataSizing::AutoSize) { - FluidHX(CompLoop).UAWasAutoSized = true; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).UA = rNumericArgs(3); + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).UA == DataSizing::AutoSize) { + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).UAWasAutoSized = true; } } else { - if (FluidHX(CompLoop).HeatExchangeModelType != Ideal) { + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatExchangeModelType != iFluidHXType::Ideal) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Missing entry for " + cNumericFieldNames(3)); ErrorsFound = true; @@ -359,29 +315,29 @@ namespace PlantHeatExchangerFluidToFluid { } if (UtilityRoutines::SameString(cAlphaArgs(8), "UncontrolledOn")) { - FluidHX(CompLoop).ControlMode = UncontrolledOn; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::UncontrolledOn; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "OperationSchemeModulated")) { - FluidHX(CompLoop).ControlMode = OperationSchemeModulated; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::OperationSchemeModulated; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "OperationSchemeOnOff")) { - FluidHX(CompLoop).ControlMode = OperationSchemeOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::OperationSchemeOnOff; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "HeatingSetpointModulated")) { - FluidHX(CompLoop).ControlMode = HeatingSetPointModulated; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::HeatingSetPointModulated; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "HeatingSetpointOnOff")) { - FluidHX(CompLoop).ControlMode = HeatingSetPointOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::HeatingSetPointOnOff; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "CoolingSetpointModulated")) { - FluidHX(CompLoop).ControlMode = CoolingSetPointModulated; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::CoolingSetPointModulated; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "CoolingSetpointOnOff")) { - FluidHX(CompLoop).ControlMode = CoolingSetPointOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::CoolingSetPointOnOff; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "DualDeadbandSetpointModulated")) { - FluidHX(CompLoop).ControlMode = DualDeadBandSetPointModulated; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::DualDeadBandSetPointModulated; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "DualDeadbandSetpointOnOff")) { - FluidHX(CompLoop).ControlMode = DualDeadBandSetPointOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::DualDeadBandSetPointOnOff; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "CoolingDifferentialOnOff")) { - FluidHX(CompLoop).ControlMode = CoolingDifferentialOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::CoolingDifferentialOnOff; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "CoolingSetpointOnOffWithComponentOverride")) { - FluidHX(CompLoop).ControlMode = CoolingSetPointOnOffWithComponentOverride; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::CoolingSetPointOnOffWithComponentOverride; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "TrackComponentOnOff")) { - FluidHX(CompLoop).ControlMode = TrackComponentOnOff; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode = iCtrlType::TrackComponentOnOff; } else { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Invalid " + cAlphaFieldNames(8) + " = " + cAlphaArgs(8)); @@ -389,7 +345,7 @@ namespace PlantHeatExchangerFluidToFluid { } if (!lAlphaFieldBlanks(9)) { - FluidHX(CompLoop).SetPointNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(9), + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(9), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), @@ -398,10 +354,10 @@ namespace PlantHeatExchangerFluidToFluid { 1, DataLoopNode::ObjectIsNotParent); // check that node actually has setpoints on it - if ((FluidHX(CompLoop).ControlMode == HeatingSetPointModulated) || (FluidHX(CompLoop).ControlMode == HeatingSetPointOnOff) || - (FluidHX(CompLoop).ControlMode == CoolingSetPointModulated) || (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOff) || - (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOffWithComponentOverride)) { - if (DataLoopNode::Node(FluidHX(CompLoop).SetPointNodeNum).TempSetPoint == DataLoopNode::SensedNodeFlagValue) { + if ((state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::HeatingSetPointModulated) || (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::HeatingSetPointOnOff) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointModulated) || (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOff) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride)) { + if (DataLoopNode::Node(state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum).TempSetPoint == DataLoopNode::SensedNodeFlagValue) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, RoutineName + " Missing temperature setpoint for DataLoopNode::Node = " + cAlphaArgs(9)); ShowContinueError(state, "Occurs for " + cCurrentModuleObject + "=\"" + cAlphaArgs(1)); @@ -411,7 +367,7 @@ namespace PlantHeatExchangerFluidToFluid { // need call to EMS to check node bool NodeEMSSetPointMissing = false; EMSManager::CheckIfNodeSetPointManagedByEMS(state, - FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, NodeEMSSetPointMissing); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureSetPoint, NodeEMSSetPointMissing); if (NodeEMSSetPointMissing) { ShowSevereError(state, RoutineName + " Missing temperature setpoint for node = " + cAlphaArgs(9)); ShowContinueError(state, "Occurs for " + cCurrentModuleObject + "=\"" + cAlphaArgs(1)); @@ -420,10 +376,10 @@ namespace PlantHeatExchangerFluidToFluid { } } } - } else if ((FluidHX(CompLoop).ControlMode == DualDeadBandSetPointModulated) || - (FluidHX(CompLoop).ControlMode == DualDeadBandSetPointOnOff)) { - if ((DataLoopNode::Node(FluidHX(CompLoop).SetPointNodeNum).TempSetPointHi == DataLoopNode::SensedNodeFlagValue) || - (DataLoopNode::Node(FluidHX(CompLoop).SetPointNodeNum).TempSetPointLo == DataLoopNode::SensedNodeFlagValue)) { + } else if ((state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::DualDeadBandSetPointModulated) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::DualDeadBandSetPointOnOff)) { + if ((DataLoopNode::Node(state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum).TempSetPointHi == DataLoopNode::SensedNodeFlagValue) || + (DataLoopNode::Node(state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum).TempSetPointLo == DataLoopNode::SensedNodeFlagValue)) { if (!state.dataGlobal->AnyEnergyManagementSystemInModel) { ShowSevereError(state, RoutineName + " Missing dual temperature setpoints for node = " + cAlphaArgs(9)); ShowContinueError(state, "Occurs for " + cCurrentModuleObject + "=\"" + cAlphaArgs(1)); @@ -433,9 +389,9 @@ namespace PlantHeatExchangerFluidToFluid { // need call to EMS to check node bool NodeEMSSetPointMissing = false; EMSManager::CheckIfNodeSetPointManagedByEMS(state, - FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureMinSetPoint, NodeEMSSetPointMissing); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureMinSetPoint, NodeEMSSetPointMissing); EMSManager::CheckIfNodeSetPointManagedByEMS(state, - FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureMaxSetPoint, NodeEMSSetPointMissing); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SetPointNodeNum, EMSManager::SPControlType::iTemperatureMaxSetPoint, NodeEMSSetPointMissing); if (NodeEMSSetPointMissing) { ShowSevereError(state, RoutineName + " Missing temperature setpoint for node = " + cAlphaArgs(9)); ShowContinueError(state, "Occurs for " + cCurrentModuleObject + "=\"" + cAlphaArgs(1)); @@ -448,11 +404,11 @@ namespace PlantHeatExchangerFluidToFluid { } else { // need to name a setpoint node if using a setpoint type control mode - if ((FluidHX(CompLoop).ControlMode == HeatingSetPointModulated) || (FluidHX(CompLoop).ControlMode == HeatingSetPointOnOff) || - (FluidHX(CompLoop).ControlMode == CoolingSetPointModulated) || (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOff) || - (FluidHX(CompLoop).ControlMode == DualDeadBandSetPointModulated) || - (FluidHX(CompLoop).ControlMode == DualDeadBandSetPointOnOff) || - (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOffWithComponentOverride)) { + if ((state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::HeatingSetPointModulated) || (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::HeatingSetPointOnOff) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointModulated) || (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOff) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::DualDeadBandSetPointModulated) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::DualDeadBandSetPointOnOff) || + (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride)) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Missing entry for " + cAlphaFieldNames(9)); ErrorsFound = true; @@ -460,15 +416,15 @@ namespace PlantHeatExchangerFluidToFluid { } if (!lNumericFieldBlanks(4)) { - FluidHX(CompLoop).TempControlTol = rNumericArgs(4); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).TempControlTol = rNumericArgs(4); } else { - FluidHX(CompLoop).TempControlTol = 0.01; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).TempControlTol = 0.01; } - FluidHX(CompLoop).HeatTransferMeteringEndUse = cAlphaArgs(10); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).HeatTransferMeteringEndUse = cAlphaArgs(10); if (!lAlphaFieldBlanks(11)) { - FluidHX(CompLoop).OtherCompSupplySideLoop.inletNodeNum = + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).OtherCompSupplySideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(11), ErrorsFound, cCurrentModuleObject, @@ -478,7 +434,7 @@ namespace PlantHeatExchangerFluidToFluid { 1, DataLoopNode::ObjectIsNotParent); } else { - if (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOffWithComponentOverride) { + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Missing entry for " + cAlphaFieldNames(11)); ErrorsFound = true; @@ -486,7 +442,7 @@ namespace PlantHeatExchangerFluidToFluid { } if (!lAlphaFieldBlanks(12)) { - FluidHX(CompLoop).OtherCompDemandSideLoop.inletNodeNum = + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).OtherCompDemandSideLoop.inletNodeNum = NodeInputManager::GetOnlySingleNode(state, cAlphaArgs(12), ErrorsFound, cCurrentModuleObject, @@ -496,7 +452,7 @@ namespace PlantHeatExchangerFluidToFluid { 1, DataLoopNode::ObjectIsNotParent); } else { - if (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOffWithComponentOverride) { + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Missing entry for " + cAlphaFieldNames(12)); ErrorsFound = true; @@ -505,14 +461,14 @@ namespace PlantHeatExchangerFluidToFluid { if (!lAlphaFieldBlanks(13)) { if (UtilityRoutines::SameString(cAlphaArgs(13), "WetBulbTemperature")) { - FluidHX(CompLoop).ControlSignalTemp = WetBulbTemperature; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlSignalTemp = iCtrlTemp::WetBulbTemperature; } else if (UtilityRoutines::SameString(cAlphaArgs(13), "DryBulbTemperature")) { - FluidHX(CompLoop).ControlSignalTemp = DryBulbTemperature; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlSignalTemp = iCtrlTemp::DryBulbTemperature; } else if (UtilityRoutines::SameString(cAlphaArgs(13), "Loop")) { - FluidHX(CompLoop).ControlSignalTemp = LoopTemperature; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlSignalTemp = iCtrlTemp::LoopTemperature; } } else { - if (FluidHX(CompLoop).ControlMode == CoolingSetPointOnOffWithComponentOverride) { + if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { ShowSevereError(state, RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid entry."); ShowContinueError(state, "Missing entry for " + cAlphaFieldNames(13)); ErrorsFound = true; @@ -520,21 +476,21 @@ namespace PlantHeatExchangerFluidToFluid { } if (!lNumericFieldBlanks(5)) { - FluidHX(CompLoop).SizingFactor = rNumericArgs(5); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SizingFactor = rNumericArgs(5); } else { - FluidHX(CompLoop).SizingFactor = 1.0; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).SizingFactor = 1.0; } if (!lNumericFieldBlanks(6)) { - FluidHX(CompLoop).MinOperationTemp = rNumericArgs(6); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).MinOperationTemp = rNumericArgs(6); } else { - FluidHX(CompLoop).MinOperationTemp = -9999.0; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).MinOperationTemp = -9999.0; } if (!lNumericFieldBlanks(7)) { - FluidHX(CompLoop).MaxOperationTemp = rNumericArgs(7); + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).MaxOperationTemp = rNumericArgs(7); } else { - FluidHX(CompLoop).MaxOperationTemp = 9999.0; + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).MaxOperationTemp = 9999.0; } } } @@ -693,7 +649,7 @@ namespace PlantHeatExchangerFluidToFluid { } // find remote component if control mode is of that type. - if (this->ControlMode == CoolingSetPointOnOffWithComponentOverride) { + if (this->ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { PlantUtilities::ScanPlantLoopsForNodeNum(state, RoutineName, this->OtherCompSupplySideLoop.inletNodeNum, @@ -730,13 +686,13 @@ namespace PlantHeatExchangerFluidToFluid { { auto const SELECT_CASE_var(this->ControlSignalTemp); - if (SELECT_CASE_var == WetBulbTemperature) { + if (SELECT_CASE_var == iCtrlTemp::WetBulbTemperature) { state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideNum).Branch(BranchNum).Comp(LoopCompNum).FreeCoolCntrlMode = DataPlant::iFreeCoolControlMode::WetBulb; - } else if (SELECT_CASE_var == DryBulbTemperature) { + } else if (SELECT_CASE_var == iCtrlTemp::DryBulbTemperature) { state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideNum).Branch(BranchNum).Comp(LoopCompNum).FreeCoolCntrlMode = DataPlant::iFreeCoolControlMode::DryBulb; - } else if (SELECT_CASE_var == LoopTemperature) { + } else if (SELECT_CASE_var == iCtrlTemp::LoopTemperature) { state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideNum).Branch(BranchNum).Comp(LoopCompNum).FreeCoolCntrlMode = DataPlant::iFreeCoolControlMode::Loop; state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideNum).Branch(BranchNum).Comp(LoopCompNum).FreeCoolCntrlNodeNum = @@ -744,7 +700,7 @@ namespace PlantHeatExchangerFluidToFluid { } } } - if (this->ControlMode == TrackComponentOnOff) { + if (this->ControlMode == iCtrlType::TrackComponentOnOff) { if (this->OtherCompSupplySideLoop.inletNodeNum > 0) { PlantUtilities::ScanPlantLoopsForObject(state, this->ComponentUserName, @@ -823,7 +779,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.InletTemp = DataLoopNode::Node(this->DemandSideLoop.inletNodeNum).Temp; this->SupplySideLoop.InletTemp = DataLoopNode::Node(this->SupplySideLoop.inletNodeNum).Temp; - if (this->ControlMode == CoolingSetPointOnOffWithComponentOverride) { + if (this->ControlMode == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { // store current value for setpoint in central plant loop data structure int LoopNum2 = this->OtherCompSupplySideLoop.loopNum; int LoopSideNum = this->OtherCompSupplySideLoop.loopSideNum; @@ -1094,7 +1050,7 @@ namespace PlantHeatExchangerFluidToFluid { { auto const SELECT_CASE_var(this->ControlMode); - if (SELECT_CASE_var == UncontrolledOn) { + if (SELECT_CASE_var == iCtrlType::UncontrolledOn) { // make passive request for supply side loop flow mdotSupSide = this->SupplySideLoop.MassFlowRateMax; @@ -1119,7 +1075,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.branchNum, this->DemandSideLoop.compNum); - } else if (SELECT_CASE_var == OperationSchemeModulated) { + } else if (SELECT_CASE_var == iCtrlType::OperationSchemeModulated) { if (std::abs(MyLoad) > DataHVACGlobals::SmallLoad) { if (MyLoad < -1.0 * DataHVACGlobals::SmallLoad) { // requesting cooling @@ -1142,7 +1098,7 @@ namespace PlantHeatExchangerFluidToFluid { RoutineName); Real64 TargetLeavingTemp = this->SupplySideLoop.InletTemp - std::abs(MyLoad) / (cp * mdotSupSide); - this->findDemandSideLoopFlow(state, TargetLeavingTemp, CoolingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::CoolingSupplySideLoop); } else { // no flow on supply side so do not request flow on demand side mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1197,7 +1153,7 @@ namespace PlantHeatExchangerFluidToFluid { RoutineName); Real64 TargetLeavingTemp = this->SupplySideLoop.InletTemp + std::abs(MyLoad) / (cp * mdotSupSide); - this->findDemandSideLoopFlow(state, TargetLeavingTemp, HeatingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::HeatingSupplySideLoop); } else { // no flow on supply side so do not request flow on demand side mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1253,7 +1209,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == OperationSchemeOnOff) { + } else if (SELECT_CASE_var == iCtrlType::OperationSchemeOnOff) { if (std::abs(MyLoad) > DataHVACGlobals::SmallLoad) { if (MyLoad < DataHVACGlobals::SmallLoad) { // requesting cooling Real64 DeltaTCooling = this->SupplySideLoop.InletTemp - this->DemandSideLoop.InletTemp; @@ -1372,7 +1328,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == HeatingSetPointModulated) { + } else if (SELECT_CASE_var == iCtrlType::HeatingSetPointModulated) { Real64 SetPointTemp = DataLoopNode::Node(this->SetPointNodeNum).TempSetPoint; Real64 DeltaTHeating = this->DemandSideLoop.InletTemp - this->SupplySideLoop.InletTemp; @@ -1389,7 +1345,7 @@ namespace PlantHeatExchangerFluidToFluid { if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { Real64 TargetLeavingTemp = SetPointTemp; - this->findDemandSideLoopFlow(state, TargetLeavingTemp, HeatingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::HeatingSupplySideLoop); } else { mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1425,7 +1381,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == HeatingSetPointOnOff) { + } else if (SELECT_CASE_var == iCtrlType::HeatingSetPointOnOff) { Real64 SetPointTemp = DataLoopNode::Node(this->SetPointNodeNum).TempSetPoint; Real64 DeltaTHeating = this->DemandSideLoop.InletTemp - this->SupplySideLoop.InletTemp; @@ -1476,7 +1432,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == CoolingSetPointModulated) { + } else if (SELECT_CASE_var == iCtrlType::CoolingSetPointModulated) { Real64 SetPointTemp = DataLoopNode::Node(this->SetPointNodeNum).TempSetPoint; Real64 DeltaTCooling = this->SupplySideLoop.InletTemp - this->DemandSideLoop.InletTemp; @@ -1492,7 +1448,7 @@ namespace PlantHeatExchangerFluidToFluid { this->SupplySideLoop.compNum); if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { Real64 TargetLeavingTemp = SetPointTemp; - this->findDemandSideLoopFlow(state, TargetLeavingTemp, CoolingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::CoolingSupplySideLoop); } else { mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1528,7 +1484,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == CoolingSetPointOnOff) { + } else if (SELECT_CASE_var == iCtrlType::CoolingSetPointOnOff) { Real64 SetPointTemp = DataLoopNode::Node(this->SetPointNodeNum).TempSetPoint; Real64 DeltaTCooling = this->SupplySideLoop.InletTemp - this->DemandSideLoop.InletTemp; @@ -1579,7 +1535,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == DualDeadBandSetPointModulated) { + } else if (SELECT_CASE_var == iCtrlType::DualDeadBandSetPointModulated) { Real64 SetPointTempLo = DataLoopNode::Node(this->SetPointNodeNum).TempSetPointLo; Real64 SetPointTempHi = DataLoopNode::Node(this->SetPointNodeNum).TempSetPointHi; @@ -1598,7 +1554,7 @@ namespace PlantHeatExchangerFluidToFluid { this->SupplySideLoop.compNum); if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { Real64 TargetLeavingTemp = SetPointTempHi; - this->findDemandSideLoopFlow(state, TargetLeavingTemp, CoolingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::CoolingSupplySideLoop); } else { mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1621,7 +1577,7 @@ namespace PlantHeatExchangerFluidToFluid { this->SupplySideLoop.compNum); if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { Real64 TargetLeavingTemp = SetPointTempLo; - this->findDemandSideLoopFlow(state, TargetLeavingTemp, HeatingSupplySideLoop); + this->findDemandSideLoopFlow(state, TargetLeavingTemp, iHXAction::HeatingSupplySideLoop); } else { mdotDmdSide = 0.0; PlantUtilities::SetComponentFlowRate(state, mdotDmdSide, @@ -1657,7 +1613,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == DualDeadBandSetPointOnOff) { + } else if (SELECT_CASE_var == iCtrlType::DualDeadBandSetPointOnOff) { Real64 SetPointTempLo = DataLoopNode::Node(this->SetPointNodeNum).TempSetPointLo; Real64 SetPointTempHi = DataLoopNode::Node(this->SetPointNodeNum).TempSetPointHi; @@ -1732,7 +1688,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == CoolingDifferentialOnOff) { + } else if (SELECT_CASE_var == iCtrlType::CoolingDifferentialOnOff) { Real64 DeltaTCooling = this->SupplySideLoop.InletTemp - this->DemandSideLoop.InletTemp; if (DeltaTCooling > this->TempControlTol) { @@ -1782,17 +1738,17 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == CoolingSetPointOnOffWithComponentOverride) { + } else if (SELECT_CASE_var == iCtrlType::CoolingSetPointOnOffWithComponentOverride) { Real64 ControlSignalValue(0.0); { auto const SELECT_CASE_var1(this->ControlSignalTemp); - if (SELECT_CASE_var1 == WetBulbTemperature) { + if (SELECT_CASE_var1 == iCtrlTemp::WetBulbTemperature) { ControlSignalValue = state.dataEnvrn->OutWetBulbTemp; - } else if (SELECT_CASE_var1 == DryBulbTemperature) { + } else if (SELECT_CASE_var1 == iCtrlTemp::DryBulbTemperature) { ControlSignalValue = state.dataEnvrn->OutDryBulbTemp; - } else if (SELECT_CASE_var1 == LoopTemperature) { + } else if (SELECT_CASE_var1 == iCtrlTemp::LoopTemperature) { ControlSignalValue = DataLoopNode::Node(this->OtherCompDemandSideLoop.inletNodeNum).TempLastTimestep; } else { assert(false); @@ -1924,7 +1880,7 @@ namespace PlantHeatExchangerFluidToFluid { { auto const SELECT_CASE_var(this->HeatExchangeModelType); - if (SELECT_CASE_var == CrossFlowBothUnMixed) { + if (SELECT_CASE_var == iFluidHXType::CrossFlowBothUnMixed) { Real64 NTU = this->UA / MinCapRate; Real64 CapRatio = MinCapRate / MaxCapRate; Real64 ExpCheckValue1 = std::pow(NTU, 0.22) / CapRatio; @@ -1941,7 +1897,7 @@ namespace PlantHeatExchangerFluidToFluid { this->Effectiveness = min(1.0, this->Effectiveness); } - } else if (SELECT_CASE_var == CrossFlowBothMixed) { + } else if (SELECT_CASE_var == iFluidHXType::CrossFlowBothMixed) { Real64 NTU = this->UA / MinCapRate; Real64 CapRatio = MinCapRate / MaxCapRate; Real64 ExpCheckValue1 = -CapRatio * NTU; @@ -1963,17 +1919,17 @@ namespace PlantHeatExchangerFluidToFluid { this->Effectiveness = min(1.0, this->Effectiveness); } - } else if ((SELECT_CASE_var == CrossFlowSupplyLoopMixedDemandLoopUnMixed) || - (SELECT_CASE_var == CrossFlowSupplyLoopUnMixedDemandLoopMixed)) { + } else if ((SELECT_CASE_var == iFluidHXType::CrossFlowSupplyLoopMixedDemandLoopUnMixed) || + (SELECT_CASE_var == iFluidHXType::CrossFlowSupplyLoopUnMixedDemandLoopMixed)) { int CrossFlowEquation; - if (SupSideCapRate == MaxCapRate && this->HeatExchangeModelType == CrossFlowSupplyLoopMixedDemandLoopUnMixed) { + if (SupSideCapRate == MaxCapRate && this->HeatExchangeModelType == iFluidHXType::CrossFlowSupplyLoopMixedDemandLoopUnMixed) { CrossFlowEquation = CmaxMixedCminUnmixed; - } else if (SupSideCapRate == MinCapRate && this->HeatExchangeModelType == CrossFlowSupplyLoopMixedDemandLoopUnMixed) { + } else if (SupSideCapRate == MinCapRate && this->HeatExchangeModelType == iFluidHXType::CrossFlowSupplyLoopMixedDemandLoopUnMixed) { CrossFlowEquation = CmaxUnMixedCminMixed; - } else if (DmdSideCapRate == MaxCapRate && this->HeatExchangeModelType == CrossFlowSupplyLoopUnMixedDemandLoopMixed) { + } else if (DmdSideCapRate == MaxCapRate && this->HeatExchangeModelType == iFluidHXType::CrossFlowSupplyLoopUnMixedDemandLoopMixed) { CrossFlowEquation = CmaxMixedCminUnmixed; - } else if (DmdSideCapRate == MinCapRate && this->HeatExchangeModelType == CrossFlowSupplyLoopUnMixedDemandLoopMixed) { + } else if (DmdSideCapRate == MinCapRate && this->HeatExchangeModelType == iFluidHXType::CrossFlowSupplyLoopUnMixedDemandLoopMixed) { CrossFlowEquation = CmaxUnMixedCminMixed; } else { CrossFlowEquation = CmaxMixedCminUnmixed; @@ -2023,7 +1979,7 @@ namespace PlantHeatExchangerFluidToFluid { assert(false); } - } else if (SELECT_CASE_var == CounterFlow) { + } else if (SELECT_CASE_var == iFluidHXType::CounterFlow) { Real64 NTU = this->UA / MinCapRate; Real64 CapRatio = MinCapRate / MaxCapRate; Real64 ExpCheckValue1 = -NTU * (1.0 - CapRatio); @@ -2046,7 +2002,7 @@ namespace PlantHeatExchangerFluidToFluid { this->Effectiveness = min(1.0, this->Effectiveness); } - } else if (SELECT_CASE_var == ParallelFlow) { + } else if (SELECT_CASE_var == iFluidHXType::ParallelFlow) { Real64 NTU = this->UA / MinCapRate; Real64 CapRatio = MinCapRate / MaxCapRate; Real64 ExpCheckValue1 = -NTU * (1.0 + CapRatio); @@ -2062,7 +2018,7 @@ namespace PlantHeatExchangerFluidToFluid { this->Effectiveness = min(1.0, this->Effectiveness); } - } else if (SELECT_CASE_var == Ideal) { + } else if (SELECT_CASE_var == iFluidHXType::Ideal) { this->Effectiveness = 1.0; } else { assert(false); @@ -2105,7 +2061,7 @@ namespace PlantHeatExchangerFluidToFluid { } } - void HeatExchangerStruct::findDemandSideLoopFlow(EnergyPlusData &state, Real64 const TargetSupplySideLoopLeavingTemp, int const HXActionMode) + void HeatExchangerStruct::findDemandSideLoopFlow(EnergyPlusData &state, Real64 const TargetSupplySideLoopLeavingTemp, iHXAction const HXActionMode) { // SUBROUTINE INFORMATION: @@ -2144,7 +2100,7 @@ namespace PlantHeatExchangerFluidToFluid { { auto const SELECT_CASE_var(HXActionMode); - if (SELECT_CASE_var == HeatingSupplySideLoop) { + if (SELECT_CASE_var == iHXAction::HeatingSupplySideLoop) { if ((LeavingTempFullFlow > TargetSupplySideLoopLeavingTemp) && (TargetSupplySideLoopLeavingTemp > LeavingTempMinFlow)) { // need to solve Par(2) = TargetSupplySideLoopLeavingTemp; @@ -2217,7 +2173,7 @@ namespace PlantHeatExchangerFluidToFluid { this->DemandSideLoop.branchNum, this->DemandSideLoop.compNum); } - } else if (SELECT_CASE_var == CoolingSupplySideLoop) { + } else if (SELECT_CASE_var == iHXAction::CoolingSupplySideLoop) { if ((LeavingTempFullFlow < TargetSupplySideLoopLeavingTemp) && (TargetSupplySideLoopLeavingTemp < LeavingTempMinFlow)) { // need to solve Par(2) = TargetSupplySideLoopLeavingTemp; @@ -2321,6 +2277,4 @@ namespace PlantHeatExchangerFluidToFluid { return Residuum; } -} // namespace PlantHeatExchangerFluidToFluid - } // namespace EnergyPlus diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh index 81548bbd878..4ae7a8c64c9 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh @@ -65,11 +65,48 @@ struct EnergyPlusData; namespace PlantHeatExchangerFluidToFluid { - extern int const CoolingDifferentialOnOff; - extern int const CoolingSetPointOnOffWithComponentOverride; - extern int const DryBulbTemperature; + enum class iFluidHXType + { + Unassigned, + CrossFlowBothUnMixed, + CrossFlowBothMixed, + CrossFlowSupplyLoopMixedDemandLoopUnMixed, + CrossFlowSupplyLoopUnMixedDemandLoopMixed, + CounterFlow, + ParallelFlow, + Ideal, + }; + + enum class iCtrlType + { + Unassigned, + UncontrolledOn, + OperationSchemeModulated, + OperationSchemeOnOff, + HeatingSetPointModulated, + HeatingSetPointOnOff, + CoolingSetPointModulated, + CoolingSetPointOnOff, + DualDeadBandSetPointModulated, + DualDeadBandSetPointOnOff, + CoolingDifferentialOnOff, + CoolingSetPointOnOffWithComponentOverride, + TrackComponentOnOff, + }; + + enum class iCtrlTemp + { + Unassigned, + WetBulbTemperature, + DryBulbTemperature, + LoopTemperature, + }; - extern int NumberOfPlantFluidHXs; + enum class iHXAction + { + HeatingSupplySideLoop, + CoolingSupplySideLoop, + }; struct PlantConnectionStruct : PlantLocation { @@ -113,13 +150,13 @@ namespace PlantHeatExchangerFluidToFluid { // Members std::string Name; int AvailSchedNum; - int HeatExchangeModelType; + iFluidHXType HeatExchangeModelType; Real64 UA; bool UAWasAutoSized; // true is UA was autosized on input - int ControlMode; + iCtrlType ControlMode; int SetPointNodeNum; Real64 TempControlTol; - int ControlSignalTemp; + iCtrlTemp ControlSignalTemp; Real64 MinOperationTemp; Real64 MaxOperationTemp; PlantConnectionStruct DemandSideLoop; // plant connections and data for the side of HX connected to demand side @@ -144,11 +181,11 @@ namespace PlantHeatExchangerFluidToFluid { // Default Constructor HeatExchangerStruct() - : AvailSchedNum(0), HeatExchangeModelType(0), UA(0.0), UAWasAutoSized(false), ControlMode(0), SetPointNodeNum(0), TempControlTol(0.0), - ControlSignalTemp(0), MinOperationTemp(-99999.0), MaxOperationTemp(99999.0), ComponentTypeOfNum(0), SizingFactor(1.0), - HeatTransferRate(0.0), HeatTransferEnergy(0.0), Effectiveness(0.0), OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0), - DmdSideModulatSolvNoConvergeErrorIndex(0), DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0), - MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true) + : AvailSchedNum(0), HeatExchangeModelType(iFluidHXType::Unassigned), UA(0.0), UAWasAutoSized(false), ControlMode(iCtrlType::Unassigned), + SetPointNodeNum(0), TempControlTol(0.0), ControlSignalTemp(iCtrlTemp::Unassigned), MinOperationTemp(-99999.0), + MaxOperationTemp(99999.0), ComponentTypeOfNum(0), SizingFactor(1.0), HeatTransferRate(0.0), HeatTransferEnergy(0.0), Effectiveness(0.0), + OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0), DmdSideModulatSolvNoConvergeErrorIndex(0), + DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0), MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true) { } @@ -170,7 +207,7 @@ namespace PlantHeatExchangerFluidToFluid { void control(EnergyPlusData &state, int LoopNum, Real64 MyLoad, bool FirstHVACIteration); - void findDemandSideLoopFlow(EnergyPlusData &state, Real64 TargetSupplySideLoopLeavingTemp, int HXActionMode); + void findDemandSideLoopFlow(EnergyPlusData &state, Real64 TargetSupplySideLoopLeavingTemp, iHXAction HXActionMode); Real64 demandSideFlowResidual(EnergyPlusData &state, Real64 DmdSideMassFlowRate, @@ -178,20 +215,21 @@ namespace PlantHeatExchangerFluidToFluid { ); }; - // Object Data - extern Array1D FluidHX; - void GetFluidHeatExchangerInput(EnergyPlusData &state); - void clear_state(); - } // namespace PlantHeatExchangerFluidToFluid struct PlantHeatExchangerFluidToFluidData : BaseGlobalStruct { + int NumberOfPlantFluidHXs = 0; + bool GetInput = true; + Array1D FluidHX; + void clear_state() override { - + this->NumberOfPlantFluidHXs = 0; + this->GetInput = true; + this->FluidHX.deallocate(); } }; diff --git a/src/EnergyPlus/PlantLoadProfile.cc b/src/EnergyPlus/PlantLoadProfile.cc index 36d89edf4e6..67be7ea6427 100644 --- a/src/EnergyPlus/PlantLoadProfile.cc +++ b/src/EnergyPlus/PlantLoadProfile.cc @@ -68,9 +68,8 @@ #include #include -namespace EnergyPlus { +namespace EnergyPlus::PlantLoadProfile { -namespace PlantLoadProfile { // MODULE INFORMATION: // AUTHOR Peter Graham Ellis // DATE WRITTEN January 2004 @@ -93,21 +92,14 @@ namespace PlantLoadProfile { using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; - // MODULE VARIABLE DECLARATIONS: - bool GetPlantLoadProfileInputFlag(true); - int NumOfPlantProfile; - - // Object Data - Array1D PlantProfile; - - PlantComponent *PlantProfileData::factory(EnergyPlusData &state, std::string objectName) + PlantComponent *PlantProfileData::factory(EnergyPlusData &state, std::string const &objectName) { - if (GetPlantLoadProfileInputFlag) { + if (state.dataPlantLoadProfile->GetPlantLoadProfileInputFlag) { GetPlantProfileInput(state); - GetPlantLoadProfileInputFlag = false; + state.dataPlantLoadProfile->GetPlantLoadProfileInputFlag = false; } // Now look for this particular pipe in the list - for (auto &plp : PlantProfile) { + for (auto &plp : state.dataPlantLoadProfile->PlantProfile) { if (plp.Name == objectName) { return &plp; } @@ -143,14 +135,9 @@ namespace PlantLoadProfile { // This is a very simple simulation. InitPlantProfile does the work of getting the scheduled load and flow rate. // Flow is requested and the actual available flow is set. The outlet temperature is calculated. - // USE STATEMENTS: - // Using/Aliasing using FluidProperties::GetSpecificHeatGlycol; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static std::string const RoutineName("SimulatePlantProfile"); Real64 DeltaTemp; @@ -196,16 +183,11 @@ namespace PlantLoadProfile { using ScheduleManager::GetCurrentScheduleValue; using ScheduleManager::GetScheduleMaxValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static std::string const RoutineName("InitPlantProfile"); Real64 FluidDensityInit; bool errFlag; - // FLOW: - // Do the one time initializations if (this->SetLoopIndexFlag) { if (allocated(state.dataPlnt->PlantLoop)) { @@ -273,7 +255,7 @@ namespace PlantLoadProfile { } // InitPlantProfile() - void PlantProfileData::UpdatePlantProfile() + void PlantProfileData::UpdatePlantProfile() const { // SUBROUTINE INFORMATION: @@ -285,24 +267,8 @@ namespace PlantLoadProfile { // PURPOSE OF THIS SUBROUTINE: // Updates the node variables with local variables. - // METHODOLOGY EMPLOYED: - // Standard EnergyPlus methodology. - - // Using/Aliasing - using DataLoopNode::Node; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutletNode; - - // FLOW: - - OutletNode = this->OutletNode; - // Set outlet node variables that are possibly changed - Node(OutletNode).Temp = this->OutletTemp; + DataLoopNode::Node(this->OutletNode).Temp = this->OutletTemp; } void PlantProfileData::ReportPlantProfile() @@ -317,15 +283,9 @@ namespace PlantLoadProfile { // PURPOSE OF THIS SUBROUTINE: // Calculates report variables. - // METHODOLOGY EMPLOYED: - // Standard EnergyPlus methodology. - // Using/Aliasing using DataHVACGlobals::TimeStepSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // FLOW: this->Energy = this->Power * TimeStepSys * DataGlobalConstants::SecInHour; @@ -351,9 +311,6 @@ namespace PlantLoadProfile { // PURPOSE OF THIS SUBROUTINE: // Gets the plant load profile input from the input file and sets up the objects. - // METHODOLOGY EMPLOYED: - // Standard EnergyPlus methodology. - // Using/Aliasing using BranchNodeConnections::TestCompSet; using NodeInputManager::GetOnlySingleNode; @@ -361,7 +318,6 @@ namespace PlantLoadProfile { using namespace DataLoopNode; using namespace DataIPShortCuts; // Data for field names, blank numerics - // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine int IOStatus; // Used in GetObjectItem @@ -371,12 +327,12 @@ namespace PlantLoadProfile { // FLOW: cCurrentModuleObject = "LoadProfile:Plant"; - NumOfPlantProfile = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + state.dataPlantLoadProfile->NumOfPlantProfile = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (NumOfPlantProfile > 0) { - PlantProfile.allocate(NumOfPlantProfile); + if (state.dataPlantLoadProfile->NumOfPlantProfile > 0) { + state.dataPlantLoadProfile->PlantProfile.allocate(state.dataPlantLoadProfile->NumOfPlantProfile); - for (ProfileNum = 1; ProfileNum <= NumOfPlantProfile; ++ProfileNum) { + for (ProfileNum = 1; ProfileNum <= state.dataPlantLoadProfile->NumOfPlantProfile; ++ProfileNum) { inputProcessor->getObjectItem(state, cCurrentModuleObject, ProfileNum, @@ -391,27 +347,27 @@ namespace PlantLoadProfile { cNumericFieldNames); UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - PlantProfile(ProfileNum).Name = cAlphaArgs(1); - PlantProfile(ProfileNum).TypeNum = TypeOf_PlantLoadProfile; // parameter assigned in DataPlant + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name = cAlphaArgs(1); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).TypeNum = TypeOf_PlantLoadProfile; // parameter assigned in DataPlant - PlantProfile(ProfileNum).InletNode = GetOnlySingleNode(state, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).InletNode = GetOnlySingleNode(state, cAlphaArgs(2), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Inlet, 1, ObjectIsNotParent); - PlantProfile(ProfileNum).OutletNode = GetOnlySingleNode(state, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).OutletNode = GetOnlySingleNode(state, cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Water, NodeConnectionType_Outlet, 1, ObjectIsNotParent); - PlantProfile(ProfileNum).LoadSchedule = GetScheduleIndex(state, cAlphaArgs(4)); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).LoadSchedule = GetScheduleIndex(state, cAlphaArgs(4)); - if (PlantProfile(ProfileNum).LoadSchedule == 0) { + if (state.dataPlantLoadProfile->PlantProfile(ProfileNum).LoadSchedule == 0) { ShowSevereError(state, cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" The Schedule for " + cAlphaFieldNames(4) + " called " + cAlphaArgs(4) + " was not found."); ErrorsFound = true; } - PlantProfile(ProfileNum).PeakVolFlowRate = rNumericArgs(1); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).PeakVolFlowRate = rNumericArgs(1); - PlantProfile(ProfileNum).FlowRateFracSchedule = GetScheduleIndex(state, cAlphaArgs(5)); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).FlowRateFracSchedule = GetScheduleIndex(state, cAlphaArgs(5)); - if (PlantProfile(ProfileNum).FlowRateFracSchedule == 0) { + if (state.dataPlantLoadProfile->PlantProfile(ProfileNum).FlowRateFracSchedule == 0) { ShowSevereError(state, cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" The Schedule for " + cAlphaFieldNames(5) + " called " + cAlphaArgs(5) + " was not found."); @@ -424,24 +380,24 @@ namespace PlantLoadProfile { // Setup report variables SetupOutputVariable(state, "Plant Load Profile Mass Flow Rate", OutputProcessor::Unit::kg_s, - PlantProfile(ProfileNum).MassFlowRate, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).MassFlowRate, "System", "Average", - PlantProfile(ProfileNum).Name); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name); SetupOutputVariable(state, "Plant Load Profile Heat Transfer Rate", OutputProcessor::Unit::W, - PlantProfile(ProfileNum).Power, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Power, "System", "Average", - PlantProfile(ProfileNum).Name); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name); SetupOutputVariable(state, "Plant Load Profile Heat Transfer Energy", OutputProcessor::Unit::J, - PlantProfile(ProfileNum).Energy, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Energy, "System", "Sum", - PlantProfile(ProfileNum).Name, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name, _, "ENERGYTRANSFER", "Heating", @@ -450,10 +406,10 @@ namespace PlantLoadProfile { SetupOutputVariable(state, "Plant Load Profile Heating Energy", OutputProcessor::Unit::J, - PlantProfile(ProfileNum).HeatingEnergy, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).HeatingEnergy, "System", "Sum", - PlantProfile(ProfileNum).Name, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name, _, "PLANTLOOPHEATINGDEMAND", "Heating", @@ -462,10 +418,10 @@ namespace PlantLoadProfile { SetupOutputVariable(state, "Plant Load Profile Cooling Energy", OutputProcessor::Unit::J, - PlantProfile(ProfileNum).CoolingEnergy, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).CoolingEnergy, "System", "Sum", - PlantProfile(ProfileNum).Name, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name, _, "PLANTLOOPCOOLINGDEMAND", "Cooling", @@ -474,17 +430,17 @@ namespace PlantLoadProfile { if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "Plant Load Profile", - PlantProfile(ProfileNum).Name, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name, "Mass Flow Rate", "[kg/s]", - PlantProfile(ProfileNum).EMSOverrideMassFlow, - PlantProfile(ProfileNum).EMSMassFlowValue); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).EMSOverrideMassFlow, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).EMSMassFlowValue); SetupEMSActuator(state, "Plant Load Profile", - PlantProfile(ProfileNum).Name, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name, "Power", "[W]", - PlantProfile(ProfileNum).EMSOverridePower, - PlantProfile(ProfileNum).EMSPowerValue); + state.dataPlantLoadProfile->PlantProfile(ProfileNum).EMSOverridePower, + state.dataPlantLoadProfile->PlantProfile(ProfileNum).EMSPowerValue); } if (ErrorsFound) ShowFatalError(state, "Errors in " + cCurrentModuleObject + " input."); @@ -493,13 +449,4 @@ namespace PlantLoadProfile { } } - void clear_state() - { - NumOfPlantProfile = 0; - GetPlantLoadProfileInputFlag = true; - PlantProfile.deallocate(); - } - -} // namespace PlantLoadProfile - } // namespace EnergyPlus diff --git a/src/EnergyPlus/PlantLoadProfile.hh b/src/EnergyPlus/PlantLoadProfile.hh index 348067e0b9f..78c9ac8a616 100644 --- a/src/EnergyPlus/PlantLoadProfile.hh +++ b/src/EnergyPlus/PlantLoadProfile.hh @@ -63,25 +63,10 @@ namespace EnergyPlus { struct EnergyPlusData; namespace PlantLoadProfile { - // Using/Aliasing - - // Data - // DERIVED TYPE DEFINITIONS: - - // MODULE VARIABLE TYPE DECLARATIONS: - - // MODULE VARIABLE DECLARATIONS: - extern int NumOfPlantProfile; - - // SUBROUTINE SPECIFICATIONS: - - // Types struct PlantProfileData : public PlantComponent { - virtual ~PlantProfileData() - { - } + virtual ~PlantProfileData() = default; // Members std::string Name; // Name of Plant Load Profile object @@ -114,43 +99,47 @@ namespace PlantLoadProfile { // Default Constructor PlantProfileData() - : WLoopNum(0), WLoopSideNum(0), WLoopBranchNum(0), WLoopCompNum(0), Init(true), InitSizing(true), InletNode(0), InletTemp(0.0), - OutletNode(0), OutletTemp(0.0), LoadSchedule(0), EMSOverridePower(false), EMSPowerValue(0.0), PeakVolFlowRate(0.0), + : TypeNum(0), WLoopNum(0), WLoopSideNum(0), WLoopBranchNum(0), WLoopCompNum(0), Init(true), InitSizing(true), InletNode(0), + InletTemp(0.0), OutletNode(0), OutletTemp(0.0), LoadSchedule(0), EMSOverridePower(false), EMSPowerValue(0.0), PeakVolFlowRate(0.0), FlowRateFracSchedule(0), VolFlowRate(0.0), MassFlowRate(0.0), EMSOverrideMassFlow(false), EMSMassFlowValue(0.0), Power(0.0), Energy(0.0), HeatingEnergy(0.0), CoolingEnergy(0.0), SetLoopIndexFlag(true) { } // Functions - static PlantComponent *factory(EnergyPlusData &state, std::string objectName); + static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName); - void simulate([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation, bool const FirstHVACIteration, Real64 &CurLoad, bool const RunFlag) override; + void simulate([[maybe_unused]] EnergyPlusData &state, + const PlantLocation &calledFromLocation, + bool FirstHVACIteration, + Real64 &CurLoad, + bool RunFlag) override; void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override; void InitPlantProfile(EnergyPlusData &state); - void UpdatePlantProfile(); + void UpdatePlantProfile() const; void ReportPlantProfile(); }; - // Object Data - extern Array1D PlantProfile; - // This could be static inside the class void GetPlantProfileInput(EnergyPlusData &state); - // As could this - void clear_state(); - } // namespace PlantLoadProfile struct PlantLoadProfileData : BaseGlobalStruct { + bool GetPlantLoadProfileInputFlag = true; + int NumOfPlantProfile = 0; + Array1D PlantProfile; + void clear_state() override { - + this->GetPlantLoadProfileInputFlag = true; + this->NumOfPlantProfile = 0; + this->PlantProfile.deallocate(); } }; diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index 5b90b5ba8bb..88fef376c9c 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -114,28 +114,8 @@ namespace EnergyPlus { std::string const ObjName_ZoneCoupled_Slab("Site:GroundDomain:Slab"); std::string const ObjName_ZoneCoupled_Basement("Site:GroundDomain:Basement"); - // MODULE VARIABLE DECLARATIONS: - std::vector domains; - std::vector circuits; - std::vector segments; - std::unordered_map GroundDomainUniqueNames; - bool GetInputFlag(true); // First time, input is "gotten" - bool GetSegmentInputFlag(true); - bool GetCircuitInputFlag(true); - bool WriteEIOFlag(true); // False after EIO is written #pragma clang diagnostic pop - void clear_state() { - GetInputFlag = true; - GetSegmentInputFlag = true; - GetCircuitInputFlag = true; - WriteEIOFlag = true; - domains.clear(); - circuits.clear(); - segments.clear(); - GroundDomainUniqueNames.clear(); - } - void CheckIfAnySlabs(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Matt Mitchell @@ -159,12 +139,12 @@ namespace EnergyPlus { PlantComponent *Circuit::factory(EnergyPlusData &state, [[maybe_unused]] int objectType, std::string objectName) { // Process the input data for circuits if it hasn't been done already - if (GetInputFlag) { + if (state.dataPlantPipingSysMgr->GetInputFlag) { GetPipingSystemsAndGroundDomainsInput(state); - GetInputFlag = false; + state.dataPlantPipingSysMgr->GetInputFlag = false; } // Now look for this particular pipe in the list - for (auto &circuit : circuits) { + for (auto &circuit : state.dataPlantPipingSysMgr->circuits) { if (circuit.Name == objectName) { return &circuit; } @@ -183,7 +163,7 @@ namespace EnergyPlus { [[maybe_unused]] bool const RunFlag) { // Retrieve the parent domain index for this pipe circuit - auto &thisDomain(domains[this->ParentDomainIndex]); + auto &thisDomain(state.dataPlantPipingSysMgr->domains[this->ParentDomainIndex]); // Do any initialization here thisDomain.InitPipingSystems(state, this); @@ -208,12 +188,12 @@ namespace EnergyPlus { // Read input if necessary - if (GetInputFlag) { + if (state.dataPlantPipingSysMgr->GetInputFlag) { GetPipingSystemsAndGroundDomainsInput(state); - GetInputFlag = false; + state.dataPlantPipingSysMgr->GetInputFlag = false; } - for (auto &thisDomain : domains) { + for (auto &thisDomain : state.dataPlantPipingSysMgr->domains) { // if the domain contains a pipe circuit, it shouldn't be initialized here, it has its own entry point if (thisDomain.HasAPipeCircuit) continue; @@ -390,14 +370,14 @@ namespace EnergyPlus { } } - if (WriteEIOFlag) { + if (state.dataPlantPipingSysMgr->WriteEIOFlag) { // Write eio header static constexpr auto DomainCellsToEIOHeader( "! , Total Number of Domain Cells, Total Number of Ground Surface Cells, Total Number of Insulation Cells\n"); print(state.files.eio, DomainCellsToEIOHeader); // Write eio data - for (auto &thisDomain : domains) { + for (auto &thisDomain : state.dataPlantPipingSysMgr->domains) { static constexpr auto DomainCellsToEIO("{},{:5},{:5},{:5}\n"); print(state.files.eio, DomainCellsToEIO, @@ -406,7 +386,7 @@ namespace EnergyPlus { thisDomain.NumGroundSurfCells, thisDomain.NumInsulationCells); } - WriteEIOFlag = false; + state.dataPlantPipingSysMgr->WriteEIOFlag = false; } } @@ -429,7 +409,7 @@ namespace EnergyPlus { int NumZoneCoupledDomains = inputProcessor->getNumObjectsFound(state, ObjName_ZoneCoupled_Slab); int NumBasements = inputProcessor->getNumObjectsFound(state, ObjName_ZoneCoupled_Basement); int TotalNumDomains = NumGeneralizedDomains + NumHorizontalTrenches + NumZoneCoupledDomains + NumBasements; - domains.resize(TotalNumDomains); + state.dataPlantPipingSysMgr->domains.resize(TotalNumDomains); // then circuits int NumPipeCircuits = inputProcessor->getNumObjectsFound(state, ObjName_Circuit); @@ -457,7 +437,7 @@ namespace EnergyPlus { for (int DomainNum = 0; DomainNum < TotalNumDomains; ++DomainNum) { // Convenience - auto & thisDomain = domains[DomainNum]; + auto & thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum]; // validate pipe domain-circuit name-to-index references for (auto & thisCircuit : thisDomain.circuits) { @@ -539,7 +519,7 @@ namespace EnergyPlus { DataIPShortCuts::cAlphaFieldNames, DataIPShortCuts::cNumericFieldNames); - auto &thisDomain = domains[DomainNum - 1]; + auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum - 1]; // Get the name, validate thisDomain.Name = DataIPShortCuts::cAlphaArgs(1); @@ -865,14 +845,14 @@ namespace EnergyPlus { DataIPShortCuts::cAlphaFieldNames, DataIPShortCuts::cNumericFieldNames); - auto &thisDomain = domains[DomainCtr - 1]; + auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainCtr - 1]; // Get the name, validate // Domain name thisDomain.Name = DataIPShortCuts::cAlphaArgs(1); GlobalNames::VerifyUniqueInterObjectName(state, - GroundDomainUniqueNames, DataIPShortCuts::cAlphaArgs(1), ObjName_ZoneCoupled_Slab, + state.dataPlantPipingSysMgr->GroundDomainUniqueNames, DataIPShortCuts::cAlphaArgs(1), ObjName_ZoneCoupled_Slab, DataIPShortCuts::cAlphaFieldNames(1), ErrorsFound); // Read in the rest of the inputs into the local type for clarity during transition @@ -1181,12 +1161,12 @@ namespace EnergyPlus { DataIPShortCuts::cAlphaFieldNames, DataIPShortCuts::cNumericFieldNames); - auto &thisDomain = domains[DomainNum - 1]; + auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum - 1]; // Get the name, validate thisDomain.Name = DataIPShortCuts::cAlphaArgs(1); GlobalNames::VerifyUniqueInterObjectName(state, - GroundDomainUniqueNames, DataIPShortCuts::cAlphaArgs(1), ObjName_ZoneCoupled_Basement, + state.dataPlantPipingSysMgr->GroundDomainUniqueNames, DataIPShortCuts::cAlphaArgs(1), ObjName_ZoneCoupled_Basement, DataIPShortCuts::cAlphaFieldNames(1), ErrorsFound); // Read in the some of the inputs into the local type for clarity during transition @@ -1631,7 +1611,7 @@ namespace EnergyPlus { thisCircuit.pipeSegments.push_back(Segment::factory(state, segmentNameToFind)); } - circuits.push_back(thisCircuit); + state.dataPlantPipingSysMgr->circuits.push_back(thisCircuit); } // All pipe circuits in input @@ -1728,19 +1708,19 @@ namespace EnergyPlus { thisCircuit.RadialMeshThickness = thisCircuit.PipeSize.InnerDia / 2.0; // add it to the main vector, then get a reference to it here - circuits.push_back(thisCircuit); + state.dataPlantPipingSysMgr->circuits.push_back(thisCircuit); } } Segment *Segment::factory(EnergyPlusData &state, std::string segmentName) { - if (GetSegmentInputFlag) { + if (state.dataPlantPipingSysMgr->GetSegmentInputFlag) { bool errorsFound = false; ReadPipeSegmentInputs(state, errorsFound); - GetSegmentInputFlag = false; + state.dataPlantPipingSysMgr->GetSegmentInputFlag = false; } // Now look for this particular segment in the list - for (auto &segment : segments) { + for (auto &segment : state.dataPlantPipingSysMgr->segments) { if (segment.Name == segmentName) { return &segment; } @@ -1753,12 +1733,12 @@ namespace EnergyPlus { } Circuit *Circuit::factory(EnergyPlusData &state, std::string circuitName, bool & errorsFound) { - if (GetCircuitInputFlag) { + if (state.dataPlantPipingSysMgr->GetCircuitInputFlag) { ReadPipeCircuitInputs(state, errorsFound); - GetCircuitInputFlag = false; + state.dataPlantPipingSysMgr->GetCircuitInputFlag = false; } // Now look for this particular segment in the list - for (auto &circuit : circuits) { + for (auto &circuit : state.dataPlantPipingSysMgr->circuits) { if (circuit.Name == circuitName) { return &circuit; } @@ -1836,7 +1816,7 @@ namespace EnergyPlus { } } - segments.push_back(thisSegment); + state.dataPlantPipingSysMgr->segments.push_back(thisSegment); } } @@ -1889,7 +1869,7 @@ namespace EnergyPlus { DataIPShortCuts::cAlphaFieldNames, DataIPShortCuts::cNumericFieldNames); - auto &thisDomain = domains[DomainCtr - 1]; + auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainCtr - 1]; // Get the name, validate std::string thisTrenchName = DataIPShortCuts::cAlphaArgs(1); @@ -1956,14 +1936,14 @@ namespace EnergyPlus { segment.FlowDirection = SegmentFlow::DecreasingZ; } // add it to the main segment array so it has a place to live - segments.push_back(segment); + state.dataPlantPipingSysMgr->segments.push_back(segment); } // now that they are in the main vector, add them here - int const newSizeSegmentVector = static_cast(segments.size()); + int const newSizeSegmentVector = static_cast(state.dataPlantPipingSysMgr->segments.size()); for (int segmentIndexToGrab = newSizeSegmentVector - NumPipeSegments; segmentIndexToGrab < newSizeSegmentVector; ++segmentIndexToGrab) { - thisDomain.circuits[0]->pipeSegments.push_back(&segments[segmentIndexToGrab]); + thisDomain.circuits[0]->pipeSegments.push_back(&state.dataPlantPipingSysMgr->segments[segmentIndexToGrab]); } } } @@ -1976,7 +1956,7 @@ namespace EnergyPlus { // MODIFIED na // RE-ENGINEERED na - for (auto &thisSegment : segments) { + for (auto &thisSegment : state.dataPlantPipingSysMgr->segments) { if (!thisSegment.IsActuallyPartOfAHorizontalTrench) { @@ -2002,7 +1982,7 @@ namespace EnergyPlus { } } - for (auto &thisCircuit : circuits) { + for (auto &thisCircuit : state.dataPlantPipingSysMgr->circuits) { if (!thisCircuit.IsActuallyPartOfAHorizontalTrench) { @@ -2285,7 +2265,7 @@ namespace EnergyPlus { ShowSevereError( state, format( - "{}:{}=\"{}\", invalid {}=\"{:.3T}\", Condition: {}", RoutineName, ObjectName, InstanceName, FieldName, FieldEntry, Condition)); + R"({}:{}="{}", invalid {}="{:.3T}", Condition: {})", RoutineName, ObjectName, InstanceName, FieldName, FieldEntry, Condition)); ErrorsFound = true; } diff --git a/src/EnergyPlus/PlantPipingSystemsManager.hh b/src/EnergyPlus/PlantPipingSystemsManager.hh index 5901cfc3610..64895a7aef3 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.hh +++ b/src/EnergyPlus/PlantPipingSystemsManager.hh @@ -51,6 +51,7 @@ // C++ Headers #include #include +#include #include // ObjexxFCL Headers @@ -505,9 +506,9 @@ namespace PlantPipingSystemsManager { Real64 Width = 0; // m Real64 Length = 0; // m bool ShiftPipesByWidth = false; - std::string WallBoundaryOSCMName = ""; + std::string WallBoundaryOSCMName; int WallBoundaryOSCMIndex = 0; - std::string FloorBoundaryOSCMName = ""; + std::string FloorBoundaryOSCMName; int FloorBoundaryOSCMIndex = 0; std::vector WallSurfacePointers; std::vector FloorSurfacePointers; @@ -561,7 +562,7 @@ namespace PlantPipingSystemsManager { struct Segment { // Members // ID - std::string Name = ""; + std::string Name; // Misc inputs PointF PipeLocation; Point PipeCellCoordinates; @@ -591,10 +592,10 @@ namespace PlantPipingSystemsManager { // Members // ID - std::string Name = ""; + std::string Name; // Inlet and outlet information - std::string InletNodeName = ""; - std::string OutletNodeName = ""; + std::string InletNodeName; + std::string OutletNodeName; int InletNodeNum = 0; int OutletNodeNum = 0; Point3DInteger CircuitInletCell; @@ -923,13 +924,6 @@ namespace PlantPipingSystemsManager { }; - // Object Data - extern std::vector domains; - extern std::vector circuits; - extern std::vector segments; - - void clear_state(); - void SimulateGroundDomains(EnergyPlusData &state, bool initOnly); void CheckIfAnySlabs(EnergyPlusData &state); @@ -1015,9 +1009,25 @@ namespace PlantPipingSystemsManager { struct PlantPipingSysMgrData : BaseGlobalStruct { + bool GetInputFlag = true; + bool GetSegmentInputFlag = true; + bool GetCircuitInputFlag = true; + bool WriteEIOFlag = true; + std::vector domains; + std::vector circuits; + std::vector segments; + std::unordered_map GroundDomainUniqueNames; + void clear_state() override { - + this->GetInputFlag = true; + this->GetSegmentInputFlag = true; + this->GetCircuitInputFlag = true; + this->WriteEIOFlag = true; + this->domains.clear(); + this->circuits.clear(); + this->segments.clear(); + this->GroundDomainUniqueNames.clear(); } }; diff --git a/src/EnergyPlus/PlantPressureSystem.cc b/src/EnergyPlus/PlantPressureSystem.cc index 3dca5552c6c..53dd990915f 100644 --- a/src/EnergyPlus/PlantPressureSystem.cc +++ b/src/EnergyPlus/PlantPressureSystem.cc @@ -81,9 +81,6 @@ namespace EnergyPlus::PlantPressureSystem { // METHODOLOGY EMPLOYED: // General EnergyPlus Methodology: - // REFERENCES: - // na - // OTHER NOTES: // Phase 1: Pump Power Correction: -Loop/Parallel flows are not resolved based on pressure drop // -Every flow path must see at least one branch with pressure information @@ -99,15 +96,6 @@ namespace EnergyPlus::PlantPressureSystem { // Using/Aliasing using namespace DataBranchAirLoopPlant; - namespace { - bool InitPressureDropOneTimeInit(true); - } - - void clear_state() - { - InitPressureDropOneTimeInit = true; - } - void SimPressureDropSystem(EnergyPlusData &state, int const LoopNum, // Plant Loop to update pressure information bool const FirstHVACIteration, // System flag @@ -177,11 +165,11 @@ namespace EnergyPlus::PlantPressureSystem { static Array1D_bool FullParallelBranchSetFound(2); static bool CommonPipeErrorEncountered(false); - if (InitPressureDropOneTimeInit) { + if (state.dataPlantPressureSys->InitPressureDropOneTimeInit) { // First allocate the initialization array to each plant loop LoopInit.allocate(size(state.dataPlnt->PlantLoop)); LoopInit = true; - InitPressureDropOneTimeInit = false; + state.dataPlantPressureSys->InitPressureDropOneTimeInit = false; } auto &loop(state.dataPlnt->PlantLoop(LoopNum)); diff --git a/src/EnergyPlus/PlantPressureSystem.hh b/src/EnergyPlus/PlantPressureSystem.hh index 559d0cd9872..191ad6f1a57 100644 --- a/src/EnergyPlus/PlantPressureSystem.hh +++ b/src/EnergyPlus/PlantPressureSystem.hh @@ -62,9 +62,6 @@ struct EnergyPlusData; namespace PlantPressureSystem { - // Functions - void clear_state(); - void SimPressureDropSystem(EnergyPlusData &state, int const LoopNum, // Plant Loop to update pressure information bool const FirstHVACIteration, // System flag @@ -105,9 +102,11 @@ namespace PlantPressureSystem { struct PlantPressureSysData : BaseGlobalStruct { + bool InitPressureDropOneTimeInit = true; + void clear_state() override { - + this->InitPressureDropOneTimeInit = true; } }; diff --git a/src/EnergyPlus/PlantUtilities.cc b/src/EnergyPlus/PlantUtilities.cc index b31ea1f335e..dbda4c68ace 100644 --- a/src/EnergyPlus/PlantUtilities.cc +++ b/src/EnergyPlus/PlantUtilities.cc @@ -64,9 +64,7 @@ #include #include -namespace EnergyPlus { - -namespace PlantUtilities { +namespace EnergyPlus::PlantUtilities { // Module containing the routines dealing with the @@ -76,53 +74,6 @@ namespace PlantUtilities { // MODIFIED na // RE-ENGINEERED na - // PURPOSE OF THIS MODULE: - // - - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // USE STATEMENTS: - // - // - // Using/Aliasing - namespace { - struct CriteriaData - { - // Members - int CallingCompLoopNum; // for debug error handling - int CallingCompLoopSideNum; // for debug error handling - int CallingCompBranchNum; // for debug error handling - int CallingCompCompNum; // for debug error handling - Real64 ThisCriteriaCheckValue; // the previous value, to check the current against - - // Default Constructor - CriteriaData() - : CallingCompLoopNum(0), CallingCompLoopSideNum(0), CallingCompBranchNum(0), CallingCompCompNum(0), ThisCriteriaCheckValue(0.0) - { - } - }; - - // Object Data - Array1D CriteriaChecks; // stores criteria information - } // namespace - // MODULE VARIABLE DECLARATIONS: - // na - - // SUBROUTINE SPECIFICATIONS FOR MODULE : - - // Functions - void clear_state() - { - CriteriaChecks.deallocate(); - } - void InitComponentNodes(Real64 const MinCompMdot, Real64 const MaxCompMdot, int const InletNode, // component's inlet node index in node structure @@ -148,25 +99,11 @@ namespace PlantUtilities { // set MassFlowRate variables on inlet node // reset inlet node if more restrictive - // REFERENCES: - // na - // Using/Aliasing using DataLoopNode::Node; using DataLoopNode::NodeID; using DataPlant::DemandOpSchemeType; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 tmpMinCompMdot; // local value Real64 tmpMaxCompMdot; // local value @@ -179,10 +116,6 @@ namespace PlantUtilities { // reset outlet node Node(OutletNode).MassFlowRate = 0.0; - // Node(OutletNode)%MassFlowRateMin = MinCompMdot - // Node(OutletNode)%MassFlowRateMinAvail = MinCompMdot - // Node(OutletNode)%MassFlowRateMax = MaxCompMdot - // Node(OutletNode)%MassFlowRateMaxAvail = MaxCompMdot Node(InletNode).MassFlowRateMin = tmpMinCompMdot; Node(InletNode).MassFlowRateMinAvail = tmpMinCompMdot; @@ -191,26 +124,6 @@ namespace PlantUtilities { // reset inlet node, but only change from inlet setting if set and more restrictive Node(InletNode).MassFlowRate = 0.0; Node(InletNode).MassFlowRateRequest = 0.0; - // IF (Node(InletNode)%MassFlowRateMax > 0.0d0) THEN !if inlet has been set, only change it if more restrictive - // Node(InletNode)%MassFlowRateMax = MIN(tmpMaxCompMdot, Node(InletNode)%MassFlowRateMax) - // ELSE - // Node(InletNode)%MassFlowRateMax = tmpMaxCompMdot - // ENDIF - // IF (Node(InletNode)%MassFlowRateMaxAvail> 0.0d0) THEN !if inlet has been set, only change it if more restrictive - // Node(InletNode)%MassFlowRateMaxAvail = MIN(tmpMaxCompMdot, Node(InletNode)%MassFlowRateMaxAvail) - // ELSE - // Node(InletNode)%MassFlowRateMaxAvail = tmpMaxCompMdot - // ENDIF - // IF (Node(InletNode)%MassFlowRateMin > 0.0d0) THEN - // Node(InletNode)%MassFlowRateMin = MAX(tmpMinCompMdot, Node(InletNode)%MassFlowRateMin) - // ELSE - // Node(InletNode)%MassFlowRateMin = tmpMinCompMdot - // ENDIF - // IF (Node(InletNode)%MassFlowRateMinAvail > 0.0d0) THEN - // Node(InletNode)%MassFlowRateMinAvail = MAX(tmpMinCompMdot, Node(InletNode)%MassFlowRateMinAvail) - // ELSE - // Node(InletNode)%MassFlowRateMinAvail = tmpMinCompMdot - // ENDIF } void SetComponentFlowRate(EnergyPlusData &state, Real64 &CompFlow, // [kg/s] @@ -448,19 +361,7 @@ namespace PlantUtilities { if (ActuatedNode == comp.NodeNumIn) { // ! found controller set to inlet of a component. now set that component's outlet int const NodeNum = comp.NodeNumOut; - // Node(ActuatedNode)%MassFlowRate = MAX( Node(ActuatedNode)%MassFlowRate , Node(NodeNum)%MassFlowRateMinAvail) - // Node(ActuatedNode)%MassFlowRate = MAX( Node(ActuatedNode)%MassFlowRate , Node(ActuatedNode)%MassFlowRateMin) - // Node(ActuatedNode)%MassFlowRate = MIN( Node(ActuatedNode)%MassFlowRate , Node(NodeNum)%MassFlowRateMaxAvail) - // Node(ActuatedNode)%MassFlowRate = MIN( Node(ActuatedNode)%MassFlowRate , Node(ActuatedNode)%MassFlowRateMax) - - // virtual 2-way valve - // Node(NodeNum)%MassFlowRateMinAvail = MAX(Node(ActuatedNode)%MassFlowRateMinAvail - // ,Node(ActuatedNode)%MassFlowRateMin) Node(NodeNum)%MassFlowRateMinAvail = - // MAX(Node(ActuatedNode)%MassFlowRateMinAvail , CompFlow) DataLoopNode::Node(NodeNum).MassFlowRateMinAvail = max(a_node.MassFlowRateMinAvail, a_node.MassFlowRateMin); - // Node(NodeNum)%MassFlowRateMaxAvail = - // MIN(Node(ActuatedNode)%MassFlowRateMaxAvail,Node(ActuatedNode)%MassFlowRateMax) Node(NodeNum)%MassFlowRateMaxAvail - // = MIN(Node(ActuatedNode)%MassFlowRateMaxAvail , CompFlow) DataLoopNode::Node(NodeNum).MassFlowRateMaxAvail = min(a_node.MassFlowRateMaxAvail, a_node.MassFlowRateMax); DataLoopNode::Node(NodeNum).MassFlowRate = a_node.MassFlowRate; } @@ -985,14 +886,14 @@ namespace PlantUtilities { if (UniqueCriteriaCheckIndex <= 0) { // If we don't yet have an index, we need to initialize // We need to start by allocating, or REallocating the array - int const CurrentNumChecksStored(CriteriaChecks.size() + 1); - CriteriaChecks.redimension(CurrentNumChecksStored); + int const CurrentNumChecksStored(static_cast(state.dataPlantUtilities->CriteriaChecks.size() + 1)); + state.dataPlantUtilities->CriteriaChecks.redimension(CurrentNumChecksStored); // Store the unique name and location - CriteriaChecks(CurrentNumChecksStored).CallingCompLoopNum = LoopNum; - CriteriaChecks(CurrentNumChecksStored).CallingCompLoopSideNum = LoopSide; - CriteriaChecks(CurrentNumChecksStored).CallingCompBranchNum = BranchNum; - CriteriaChecks(CurrentNumChecksStored).CallingCompCompNum = CompNum; + state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopNum = LoopNum; + state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopSideNum = LoopSide; + state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompBranchNum = BranchNum; + state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompCompNum = CompNum; // Since this was the first pass, it is safe to assume something has changed! // Therefore we'll set the sim flag to true @@ -1007,7 +908,7 @@ namespace PlantUtilities { // sim flag status based on the criteria type // First store the current check in a single variable instead of array for readability - CurCriteria = CriteriaChecks(UniqueCriteriaCheckIndex); + CurCriteria = state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex); // Check to make sure we didn't reuse the index in multiple components if (CurCriteria.CallingCompLoopNum != LoopNum || CurCriteria.CallingCompLoopSideNum != LoopSide || @@ -1041,7 +942,7 @@ namespace PlantUtilities { } // if we have an index or not // Store the value for the next pass - CriteriaChecks(UniqueCriteriaCheckIndex).ThisCriteriaCheckValue = CriteriaValue; + state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex).ThisCriteriaCheckValue = CriteriaValue; } void UpdateChillerComponentCondenserSide(EnergyPlusData &state, @@ -1098,7 +999,7 @@ namespace PlantUtilities { if ((Node(InletNodeNum).MassFlowRate == 0.0) && (ModelCondenserHeatRate > 0.0)) { - // DSU3 TODO also send a request that condenser loop be made available, interlock message infrastructure?? + // TODO also send a request that condenser loop be made available, interlock message infrastructure?? DidAnythingChange = true; } @@ -1250,22 +1151,12 @@ namespace PlantUtilities { int OtherLoopSide; // local loop side pointer for remote connected loop int ConnectLoopNum; // local do loop counter -// TODO: Umm, this block seems like it doesn't do much... -// // check if node heat rate compares well with generator heat rate -// if (HeatSourceType == NodeType_Water) { -// -// } else if (HeatSourceType == NodeType_Steam) { -// -// } else { -// // throw error -// } - // check if any conditions have changed if (Node(InletNodeNum).MassFlowRate != ModelMassFlowRate) DidAnythingChange = true; if ((Node(InletNodeNum).MassFlowRate == 0.0) && (ModelGeneratorHeatRate > 0.0)) { - // DSU3 TODO also send a request that generator loop be made available, interlock message infrastructure?? + // TODO also send a request that generator loop be made available, interlock message infrastructure?? DidAnythingChange = true; } @@ -1530,10 +1421,6 @@ namespace PlantUtilities { Node(OutletNodeNum).TempMin = Node(InletNodeNum).TempMin; Node(OutletNodeNum).TempMax = Node(InletNodeNum).TempMax; - // DSU3 not don't do this, upstream components outlet might stomp on this components inlet - // so don't propagate hardware limits downstream. Node(OutletNodeNum)%MassFlowRateMin = Node(InletNodeNum)%MassFlowRateMin - // DSU3 not don't do this Node(OutletNodeNum)%MassFlowRateMax = Node(InletNodeNum)%MassFlowRateMax - // DSU3 hopefully these next two go away once changes are broadly implemented... Node(OutletNodeNum).MassFlowRateMinAvail = max(Node(InletNodeNum).MassFlowRateMin, Node(InletNodeNum).MassFlowRateMinAvail); Node(OutletNodeNum).MassFlowRateMaxAvail = min(Node(InletNodeNum).MassFlowRateMax, Node(InletNodeNum).MassFlowRateMaxAvail); @@ -1940,29 +1827,10 @@ namespace PlantUtilities { // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This subroutine scans the plant LoopSide simflags and returns if any of them are still true - // METHODOLOGY EMPLOYED: - // Standard EnergyPlus methodology. - // REFERENCES: - // na - // USE STATEMENTS: - // na // Return value bool AnyPlantLoopSidesNeedSim; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - // na - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: int LoopCtr; int LoopSideCtr; @@ -1990,14 +1858,9 @@ namespace PlantUtilities { // AUTHOR Edwin Lee // DATE WRITTEN November 2009 // MODIFIED na - // RE-ENGINEERED B. Griffith Feb 2009 DSU3 + // RE-ENGINEERED B. Griffith Feb 2009 // PURPOSE OF THIS SUBROUTINE: // Quickly sets all sim flags of a certain type (loop type/side) to a value - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int LoopCtr; @@ -2078,13 +1941,10 @@ namespace PlantUtilities { using DataSizing::NumPltSizInput; using DataSizing::PlantSizData; using DataSizing::PlantSizingData; - // USE DataPlant, ONLY: PlantLoop, ScanPlantLoopsForNodeNum // Return value int MyPltSizNum; // returned plant sizing index - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int MyPltLoopNum; int PlantLoopNum; int DummyLoopSideNum; @@ -2153,6 +2013,4 @@ namespace PlantUtilities { return (matchedIndexA == matchedIndexB) && (matchedIndexA != 0); // only return true if both are equal and non-zero } -} // namespace PlantUtilities - } // namespace EnergyPlus diff --git a/src/EnergyPlus/PlantUtilities.hh b/src/EnergyPlus/PlantUtilities.hh index 5cd43991cdd..03a8ef5c0da 100644 --- a/src/EnergyPlus/PlantUtilities.hh +++ b/src/EnergyPlus/PlantUtilities.hh @@ -66,128 +66,129 @@ namespace PlantUtilities { // Functions void clear_state(); - void InitComponentNodes(Real64 const MinCompMdot, - Real64 const MaxCompMdot, - int const InletNode, // component's inlet node index in node structure - int const OutletNode, // component's outlet node index in node structure - int const LoopNum, // plant loop index for PlantLoop structure - int const LoopSideNum, // Loop side index for PlantLoop structure - int const BranchIndex, // branch index for PlantLoop - int const CompIndex // component index for PlantLoop + void InitComponentNodes(Real64 MinCompMdot, + Real64 MaxCompMdot, + int InletNode, // component's inlet node index in node structure + int OutletNode, // component's outlet node index in node structure + int LoopNum, // plant loop index for PlantLoop structure + int LoopSideNum, // Loop side index for PlantLoop structure + int BranchIndex, // branch index for PlantLoop + int CompIndex // component index for PlantLoop ); - void SetComponentFlowRate(EnergyPlusData &state, Real64 &CompFlow, // [kg/s] - int const InletNode, // component's inlet node index in node structure - int const OutletNode, // component's outlet node index in node structure - int const LoopNum, // plant loop index for PlantLoop structure - int const LoopSideNum, // Loop side index for PlantLoop structure - int const BranchIndex, // branch index for PlantLoop - int const CompIndex // component index for PlantLoop + void SetComponentFlowRate(EnergyPlusData &state, + Real64 &CompFlow, // [kg/s] + int InletNode, // component's inlet node index in node structure + int OutletNode, // component's outlet node index in node structure + int LoopNum, // plant loop index for PlantLoop structure + int LoopSideNum, // Loop side index for PlantLoop structure + int BranchIndex, // branch index for PlantLoop + int CompIndex // component index for PlantLoop ); - void SetActuatedBranchFlowRate(EnergyPlusData &state, Real64 &CompFlow, - int const ActuatedNode, - int const LoopNum, - int const LoopSideNum, - int const BranchNum, - bool const ResetMode // flag to indicate if this is a real flow set, or a reset flow setting. + void SetActuatedBranchFlowRate(EnergyPlusData &state, + Real64 &CompFlow, + int ActuatedNode, + int LoopNum, + int LoopSideNum, + int BranchNum, + bool ResetMode // flag to indicate if this is a real flow set, or a reset flow setting. ); - Real64 RegulateCondenserCompFlowReqOp( - EnergyPlusData &state, int const LoopNum, int const LoopSideNum, int const BranchNum, int const CompNum, Real64 const TentativeFlowRequest); + Real64 + RegulateCondenserCompFlowReqOp(EnergyPlusData &state, int LoopNum, int LoopSideNum, int BranchNum, int CompNum, Real64 TentativeFlowRequest); bool AnyPlantSplitterMixerLacksContinuity(EnergyPlusData &state); - void - CheckPlantMixerSplitterConsistency(EnergyPlusData &state, int const LoopNum, int const LoopSideNum, bool const FirstHVACIteration); + void CheckPlantMixerSplitterConsistency(EnergyPlusData &state, int LoopNum, int LoopSideNum, bool FirstHVACIteration); - void CheckForRunawayPlantTemps(EnergyPlusData &state, int const LoopNum, int const LoopSideNum); + void CheckForRunawayPlantTemps(EnergyPlusData &state, int LoopNum, int LoopSideNum); - void SetAllFlowLocks(EnergyPlusData &state, DataPlant::iFlowLock const Value); + void SetAllFlowLocks(EnergyPlusData &state, DataPlant::iFlowLock Value); void ResetAllPlantInterConnectFlags(EnergyPlusData &state); void PullCompInterconnectTrigger(EnergyPlusData &state, - int const LoopNum, // component's loop index - int const LoopSide, // component's loop side number - int const BranchNum, // Component's branch number - int const CompNum, // Component's comp number - int &UniqueCriteriaCheckIndex, // An integer given to this particular check - int const ConnectedLoopNum, // Component's interconnected loop number - int const ConnectedLoopSide, // Component's interconnected loop side number - DataPlant::iCriteriaType const CriteriaType, // The criteria check to use, see DataPlant: SimFlagCriteriaTypes - Real64 const CriteriaValue // The value of the criteria check to evaluate + int LoopNum, // component's loop index + int LoopSide, // component's loop side number + int BranchNum, // Component's branch number + int CompNum, // Component's comp number + int &UniqueCriteriaCheckIndex, // An integer given to this particular check + int ConnectedLoopNum, // Component's interconnected loop number + int ConnectedLoopSide, // Component's interconnected loop side number + DataPlant::iCriteriaType CriteriaType, // The criteria check to use, see DataPlant: SimFlagCriteriaTypes + Real64 CriteriaValue // The value of the criteria check to evaluate ); void UpdateChillerComponentCondenserSide(EnergyPlusData &state, - int const LoopNum, // component's loop index - int const LoopSide, // component's loop side number - int const TypeOfNum, // Component's type index - int const InletNodeNum, // Component's inlet node pointer - int const OutletNodeNum, // Component's outlet node pointer - Real64 const ModelCondenserHeatRate, // model's heat rejection rate at condenser (W) - Real64 const ModelInletTemp, // model's inlet temperature (C) - Real64 const ModelOutletTemp, // model's outlet temperature (C) - Real64 const ModelMassFlowRate, // model's condenser water mass flow rate (kg/s) - bool const FirstHVACIteration); + int LoopNum, // component's loop index + int LoopSide, // component's loop side number + int TypeOfNum, // Component's type index + int InletNodeNum, // Component's inlet node pointer + int OutletNodeNum, // Component's outlet node pointer + Real64 ModelCondenserHeatRate, // model's heat rejection rate at condenser (W) + Real64 ModelInletTemp, // model's inlet temperature (C) + Real64 ModelOutletTemp, // model's outlet temperature (C) + Real64 ModelMassFlowRate, // model's condenser water mass flow rate (kg/s) + bool FirstHVACIteration); void UpdateComponentHeatRecoverySide(EnergyPlusData &state, - int const LoopNum, // component's loop index - int const LoopSide, // component's loop side number - int const TypeOfNum, // Component's type index - int const InletNodeNum, // Component's inlet node pointer - int const OutletNodeNum, // Component's outlet node pointer - Real64 const ModelRecoveryHeatRate, // model's heat rejection rate at recovery (W) - Real64 const ModelInletTemp, // model's inlet temperature (C) - Real64 const ModelOutletTemp, // model's outlet temperature (C) - Real64 const ModelMassFlowRate, // model's condenser water mass flow rate (kg/s) - bool const FirstHVACIteration); + int LoopNum, // component's loop index + int LoopSide, // component's loop side number + int TypeOfNum, // Component's type index + int InletNodeNum, // Component's inlet node pointer + int OutletNodeNum, // Component's outlet node pointer + Real64 ModelRecoveryHeatRate, // model's heat rejection rate at recovery (W) + Real64 ModelInletTemp, // model's inlet temperature (C) + Real64 ModelOutletTemp, // model's outlet temperature (C) + Real64 ModelMassFlowRate, // model's condenser water mass flow rate (kg/s) + bool FirstHVACIteration); void UpdateAbsorberChillerComponentGeneratorSide(EnergyPlusData &state, - int const LoopNum, // component's loop index - int const LoopSide, // component's loop side number - int const TypeOfNum, // Component's type index - int const InletNodeNum, // Component's inlet node pointer - int const OutletNodeNum, // Component's outlet node pointer - int const HeatSourceType, // Type of fluid in Generator loop - Real64 const ModelGeneratorHeatRate, // model's generator heat rate (W) - Real64 const ModelMassFlowRate, // model's generator mass flow rate (kg/s) - bool const FirstHVACIteration); + int LoopNum, // component's loop index + int LoopSide, // component's loop side number + int TypeOfNum, // Component's type index + int InletNodeNum, // Component's inlet node pointer + int OutletNodeNum, // Component's outlet node pointer + int HeatSourceType, // Type of fluid in Generator loop + Real64 ModelGeneratorHeatRate, // model's generator heat rate (W) + Real64 ModelMassFlowRate, // model's generator mass flow rate (kg/s) + bool FirstHVACIteration); void InterConnectTwoPlantLoopSides(EnergyPlusData &state, - int const Loop1Num, - int const Loop1LoopSideNum, - int const Loop2Num, - int const Loop2LoopSideNum, - int const PlantComponentTypeOfNum, - bool const Loop1DemandsOnLoop2); + int Loop1Num, + int Loop1LoopSideNum, + int Loop2Num, + int Loop2LoopSideNum, + int PlantComponentTypeOfNum, + bool Loop1DemandsOnLoop2); - void ShiftPlantLoopSideCallingOrder(EnergyPlusData &state, int const OldIndex, int const NewIndex); + void ShiftPlantLoopSideCallingOrder(EnergyPlusData &state, int OldIndex, int NewIndex); - void RegisterPlantCompDesignFlow(int const ComponentInletNodeNum, // the component's water inlet node number - Real64 const DesPlantFlow // the component's design fluid volume flow rate [m3/s] + void RegisterPlantCompDesignFlow(int ComponentInletNodeNum, // the component's water inlet node number + Real64 DesPlantFlow // the component's design fluid volume flow rate [m3/s] ); void SafeCopyPlantNode(EnergyPlusData &state, - int const InletNodeNum, - int const OutletNodeNum, + int InletNodeNum, + int OutletNodeNum, Optional_int_const LoopNum = _, Optional OutletTemp = _ // set on outlet node if present and water. ); - Real64 BoundValueToNodeMinMaxAvail(Real64 const ValueToBound, int const NodeNumToBoundWith); + Real64 BoundValueToNodeMinMaxAvail(Real64 ValueToBound, int NodeNumToBoundWith); - void TightenNodeMinMaxAvails(int const NodeNum, Real64 const NewMinAvail, Real64 const NewMaxAvail); + void TightenNodeMinMaxAvails(int NodeNum, Real64 NewMinAvail, Real64 NewMaxAvail); - Real64 BoundValueToWithinTwoValues(Real64 const ValueToBound, Real64 const LowerBound, Real64 const UpperBound); + Real64 BoundValueToWithinTwoValues(Real64 ValueToBound, Real64 LowerBound, Real64 UpperBound); - bool IntegerIsWithinTwoValues(int const ValueToCheck, int const LowerBound, int const UpperBound); + bool IntegerIsWithinTwoValues(int ValueToCheck, int LowerBound, int UpperBound); - void LogPlantConvergencePoints(EnergyPlusData &state, bool const FirstHVACIteration); + void LogPlantConvergencePoints(EnergyPlusData &state, bool FirstHVACIteration); void ScanPlantLoopsForObject(EnergyPlusData &state, std::string const &CompName, - int const CompType, + int CompType, int &LoopNum, int &LoopSideNum, int &BranchNum, @@ -201,7 +202,7 @@ namespace PlantUtilities { void ScanPlantLoopsForNodeNum(EnergyPlusData &state, std::string const &CallerName, // really used for error messages - int const NodeNum, // index in Node structure of node to be scanned + int NodeNum, // index in Node structure of node to be scanned int &LoopNum, // return value for plant loop int &LoopSideNum, // return value for plant loop side int &BranchNum, @@ -209,27 +210,46 @@ namespace PlantUtilities { bool AnyPlantLoopSidesNeedSim(EnergyPlusData &state); - void SetAllPlantSimFlagsToValue(EnergyPlusData &state, bool const Value); + void SetAllPlantSimFlagsToValue(EnergyPlusData &state, bool Value); - void ShowBranchesOnLoop(EnergyPlusData &state, int const LoopNum); // Loop number of loop + void ShowBranchesOnLoop(EnergyPlusData &state, int LoopNum); // Loop number of loop - int MyPlantSizingIndex(EnergyPlusData &state, std::string const &CompType, // component description + int MyPlantSizingIndex(EnergyPlusData &state, + std::string const &CompType, // component description std::string const &CompName, // user name of component - int const NodeNumIn, // component water inlet node - int const NodeNumOut, // component water outlet node + int NodeNumIn, // component water inlet node + int NodeNumOut, // component water outlet node bool &ErrorsFound, // set to true if there's an error Optional_bool_const SupressErrors = _ // used for WSHP's where condenser loop may not be on a plant loop ); - bool verifyTwoNodeNumsOnSamePlantLoop(EnergyPlusData &state, int const nodeIndexA, int const nodeIndexB); + bool verifyTwoNodeNumsOnSamePlantLoop(EnergyPlusData &state, int nodeIndexA, int nodeIndexB); + + struct CriteriaData + { + // Members + int CallingCompLoopNum; // for debug error handling + int CallingCompLoopSideNum; // for debug error handling + int CallingCompBranchNum; // for debug error handling + int CallingCompCompNum; // for debug error handling + Real64 ThisCriteriaCheckValue; // the previous value, to check the current against + + // Default Constructor + CriteriaData() : CallingCompLoopNum(0), CallingCompLoopSideNum(0), CallingCompBranchNum(0), CallingCompCompNum(0), ThisCriteriaCheckValue(0.0) + { + } + }; } // namespace PlantUtilities -struct PlantUtilitiesData : BaseGlobalStruct { +struct PlantUtilitiesData : BaseGlobalStruct +{ + + Array1D CriteriaChecks; // stores criteria information void clear_state() override { - + this->CriteriaChecks.deallocate(); } }; diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index 852f3aef810..880a0d1b594 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -45,8 +45,6 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#include - #include #include #include diff --git a/src/EnergyPlus/PondGroundHeatExchanger.cc b/src/EnergyPlus/PondGroundHeatExchanger.cc index 91a0e723d94..2a4bff1e6ff 100644 --- a/src/EnergyPlus/PondGroundHeatExchanger.cc +++ b/src/EnergyPlus/PondGroundHeatExchanger.cc @@ -73,9 +73,7 @@ #include #include -namespace EnergyPlus { - -namespace PondGroundHeatExchanger { +namespace EnergyPlus::PondGroundHeatExchanger { // Module containing the routines dealing with pond ground heat exchangers @@ -118,16 +116,6 @@ namespace PondGroundHeatExchanger { Real64 constexpr StefBoltzmann(5.6697e-08); // Stefan-Boltzmann constant auto constexpr fluidNameWater("WATER"); - int NumOfPondGHEs(0); // Number of pond ground heat exchangers - bool GetInputFlag(true); - Array1D PondGHE; - - void clear_state() { - NumOfPondGHEs = 0; - GetInputFlag = true; - PondGHE.clear(); - } - void PondGroundHeatExchangerData::simulate(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation, bool const FirstHVACIteration, @@ -141,11 +129,11 @@ namespace PondGroundHeatExchanger { PlantComponent *PondGroundHeatExchangerData::factory(EnergyPlusData &state, std::string const &objectName) { - if (GetInputFlag) { + if (state.dataPondGHE->GetInputFlag) { GetPondGroundHeatExchanger(state); - GetInputFlag = false; + state.dataPondGHE->GetInputFlag = false; } - for (auto &ghx : PondGHE) { + for (auto &ghx : state.dataPondGHE->PondGHE) { if (ghx.Name == objectName) { return &ghx; } @@ -195,14 +183,14 @@ namespace PondGroundHeatExchanger { // Initializations and allocations DataIPShortCuts::cCurrentModuleObject = "GroundHeatExchanger:Pond"; - NumOfPondGHEs = inputProcessor->getNumObjectsFound(state, DataIPShortCuts::cCurrentModuleObject); + state.dataPondGHE->NumOfPondGHEs = inputProcessor->getNumObjectsFound(state, DataIPShortCuts::cCurrentModuleObject); // allocate data structures - if (allocated(PondGHE)) PondGHE.deallocate(); + if (allocated(state.dataPondGHE->PondGHE)) state.dataPondGHE->PondGHE.deallocate(); - PondGHE.allocate(NumOfPondGHEs); + state.dataPondGHE->PondGHE.allocate(state.dataPondGHE->NumOfPondGHEs); // Obtain all of the user data related to the ponds... - for (Item = 1; Item <= NumOfPondGHEs; ++Item) { + for (Item = 1; Item <= state.dataPondGHE->NumOfPondGHEs; ++Item) { // get the input data inputProcessor->getObjectItem(state, @@ -218,14 +206,14 @@ namespace PondGroundHeatExchanger { DataIPShortCuts::cAlphaFieldNames, DataIPShortCuts::cNumericFieldNames); - PondGHE(Item).WaterIndex = FluidProperties::FindGlycol(state, fluidNameWater); + state.dataPondGHE->PondGHE(Item).WaterIndex = FluidProperties::FindGlycol(state, fluidNameWater); // General user input data - PondGHE(Item).Name = DataIPShortCuts::cAlphaArgs(1); + state.dataPondGHE->PondGHE(Item).Name = DataIPShortCuts::cAlphaArgs(1); // get inlet node data - PondGHE(Item).InletNode = DataIPShortCuts::cAlphaArgs(2); - PondGHE(Item).InletNodeNum = NodeInputManager::GetOnlySingleNode(state, + state.dataPondGHE->PondGHE(Item).InletNode = DataIPShortCuts::cAlphaArgs(2); + state.dataPondGHE->PondGHE(Item).InletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(2), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, @@ -234,15 +222,15 @@ namespace PondGroundHeatExchanger { DataLoopNode::NodeConnectionType_Inlet, 1, DataLoopNode::ObjectIsNotParent); - if (PondGHE(Item).InletNodeNum == 0) { + if (state.dataPondGHE->PondGHE(Item).InletNodeNum == 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(2) + '=' + DataIPShortCuts::cAlphaArgs(2)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; } // get outlet node data - PondGHE(Item).OutletNode = DataIPShortCuts::cAlphaArgs(3); - PondGHE(Item).OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), + state.dataPondGHE->PondGHE(Item).OutletNode = DataIPShortCuts::cAlphaArgs(3); + state.dataPondGHE->PondGHE(Item).OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, DataIPShortCuts::cAlphaArgs(3), ErrorsFound, DataIPShortCuts::cCurrentModuleObject, DataIPShortCuts::cAlphaArgs(1), @@ -250,7 +238,7 @@ namespace PondGroundHeatExchanger { DataLoopNode::NodeConnectionType_Outlet, 1, DataLoopNode::ObjectIsNotParent); - if (PondGHE(Item).OutletNodeNum == 0) { + if (state.dataPondGHE->PondGHE(Item).OutletNodeNum == 0) { ShowSevereError(state, "Invalid " + DataIPShortCuts::cAlphaFieldNames(3) + '=' + DataIPShortCuts::cAlphaArgs(3)); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); ErrorsFound = true; @@ -263,8 +251,8 @@ namespace PondGroundHeatExchanger { "Condenser Water Nodes"); // pond geometry data - PondGHE(Item).Depth = DataIPShortCuts::rNumericArgs(1); - PondGHE(Item).Area = DataIPShortCuts::rNumericArgs(2); + state.dataPondGHE->PondGHE(Item).Depth = DataIPShortCuts::rNumericArgs(1); + state.dataPondGHE->PondGHE(Item).Area = DataIPShortCuts::rNumericArgs(2); if (DataIPShortCuts::rNumericArgs(1) <= 0.0) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(1), DataIPShortCuts::rNumericArgs(1))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); @@ -279,8 +267,8 @@ namespace PondGroundHeatExchanger { } // tube data - PondGHE(Item).TubeInDiameter = DataIPShortCuts::rNumericArgs(3); - PondGHE(Item).TubeOutDiameter = DataIPShortCuts::rNumericArgs(4); + state.dataPondGHE->PondGHE(Item).TubeInDiameter = DataIPShortCuts::rNumericArgs(3); + state.dataPondGHE->PondGHE(Item).TubeOutDiameter = DataIPShortCuts::rNumericArgs(4); if (DataIPShortCuts::rNumericArgs(3) <= 0.0) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(3), DataIPShortCuts::rNumericArgs(3))); @@ -306,8 +294,8 @@ namespace PondGroundHeatExchanger { } // thermal conductivity data - PondGHE(Item).TubeConductivity = DataIPShortCuts::rNumericArgs(5); - PondGHE(Item).GrndConductivity = DataIPShortCuts::rNumericArgs(6); + state.dataPondGHE->PondGHE(Item).TubeConductivity = DataIPShortCuts::rNumericArgs(5); + state.dataPondGHE->PondGHE(Item).GrndConductivity = DataIPShortCuts::rNumericArgs(6); if (DataIPShortCuts::rNumericArgs(5) <= 0.0) { ShowSevereError(state, format("Invalid {}={:.4R}", DataIPShortCuts::cNumericFieldNames(5), DataIPShortCuts::rNumericArgs(5))); @@ -323,7 +311,7 @@ namespace PondGroundHeatExchanger { } // circuits - PondGHE(Item).NumCircuits = DataIPShortCuts::rNumericArgs(7); + state.dataPondGHE->PondGHE(Item).NumCircuits = DataIPShortCuts::rNumericArgs(7); if (DataIPShortCuts::rNumericArgs(7) <= 0) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(7), DataIPShortCuts::rNumericArgs(7))); @@ -331,7 +319,7 @@ namespace PondGroundHeatExchanger { ShowContinueError(state, "Value must be greater than 0.0"); ErrorsFound = true; } - PondGHE(Item).CircuitLength = DataIPShortCuts::rNumericArgs(8); + state.dataPondGHE->PondGHE(Item).CircuitLength = DataIPShortCuts::rNumericArgs(8); if (DataIPShortCuts::rNumericArgs(8) <= 0) { ShowSevereError(state, format("Invalid {}={:.2R}", DataIPShortCuts::cNumericFieldNames(8), DataIPShortCuts::rNumericArgs(8))); ShowContinueError(state, "Entered in " + DataIPShortCuts::cCurrentModuleObject + '=' + DataIPShortCuts::cAlphaArgs(1)); @@ -471,8 +459,6 @@ namespace PondGroundHeatExchanger { this->MassFlowRate = DataLoopNode::Node(InletNodeNum).MassFlowRate; } - //============================================================================== - void PondGroundHeatExchangerData::CalcPondGroundHeatExchanger(EnergyPlusData &state) { @@ -892,6 +878,4 @@ namespace PondGroundHeatExchanger { this->BulkTemperature = this->PondTemp; } -} // namespace PondGroundHeatExchanger - } // namespace EnergyPlus diff --git a/src/EnergyPlus/PondGroundHeatExchanger.hh b/src/EnergyPlus/PondGroundHeatExchanger.hh index a56fe83b576..e4a4dbb397a 100644 --- a/src/EnergyPlus/PondGroundHeatExchanger.hh +++ b/src/EnergyPlus/PondGroundHeatExchanger.hh @@ -65,8 +65,6 @@ struct EnergyPlusData; namespace PondGroundHeatExchanger { - extern int NumOfPondGHEs; // Number of pond ground heat exchangers - struct PondGroundHeatExchangerData : PlantComponent { // Members @@ -150,20 +148,21 @@ namespace PondGroundHeatExchanger { }; - // Object Data - extern Array1D PondGHE; - - void clear_state(); - void GetPondGroundHeatExchanger(EnergyPlusData &state); } // namespace PondGroundHeatExchanger struct PondGroundHeatExchangerData : BaseGlobalStruct { + bool GetInputFlag = true; + int NumOfPondGHEs = 0; + Array1D PondGHE; + void clear_state() override { - + this->GetInputFlag = true; + this->NumOfPondGHEs = 0; + this->PondGHE.deallocate(); } }; diff --git a/src/EnergyPlus/RootFinder.cc b/src/EnergyPlus/RootFinder.cc index dcaa20fce51..96f80c19aea 100644 --- a/src/EnergyPlus/RootFinder.cc +++ b/src/EnergyPlus/RootFinder.cc @@ -925,14 +925,14 @@ namespace RootFinder { // na // FLOW: - if (RootFinderData.MinPoint.DefinedFlag) { // DSU3 testing + if (RootFinderData.MinPoint.DefinedFlag) { if (X < RootFinderData.MinPoint.X) { CheckMinMaxRange = false; return CheckMinMaxRange; } } - if (RootFinderData.MaxPoint.DefinedFlag) { // DSU3 testing + if (RootFinderData.MaxPoint.DefinedFlag) { if (X > RootFinderData.MaxPoint.X) { CheckMinMaxRange = false; return CheckMinMaxRange; @@ -991,14 +991,14 @@ namespace RootFinder { // FLOW: if (RootFinderData.LowerPoint.DefinedFlag) { - if (X < RootFinderData.LowerPoint.X) { // DSU3 test with < instead of <= + if (X < RootFinderData.LowerPoint.X) { CheckLowerUpperBracket = false; return CheckLowerUpperBracket; } } if (RootFinderData.UpperPoint.DefinedFlag) { - if (X > RootFinderData.UpperPoint.X) { // DSU3 test with > instead of >= + if (X > RootFinderData.UpperPoint.X) { CheckLowerUpperBracket = false; return CheckLowerUpperBracket; } diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index 0b520ee5424..ed2f79d849e 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -85,14 +85,10 @@ #include #include #include -#include #include -#include #include #include #include -#include -#include #include #include #include @@ -110,16 +106,12 @@ #include #include #include -#include -#include -#include #include #include #include #include #include #include -#include #include #include #include @@ -138,14 +130,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include #include -#include #include #include #include @@ -195,23 +180,16 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) FanCoilUnits::clear_state(); Fans::clear_state(); FaultsManager::clear_state(); - FluidCoolers::clear_state(); FluidProperties::clear_state(); - FuelCellElectricGenerator::clear_state(); Furnaces::clear_state(); General::clear_state(); GeneralRoutines_clear_state(); // GeneralRoutines does not have a namespace - GeneratorFuelSupply::clear_state(); - GlobalNames::clear_state(); GroundTemperatureManager::clear_state(); HeatBalanceAirManager::clear_state(); HeatBalanceIntRadExchange::clear_state(); HeatBalanceManager::clear_state(); HeatBalanceSurfaceManager::clear_state(); HeatBalFiniteDiffManager::clear_state(); - HeatPumpWaterToWaterSimple::GshpSpecs::clear_state(); - HeatPumpWaterToWaterCOOLING::clear_state(); - HeatPumpWaterToWaterHEATING::clear_state(); HeatRecovery::clear_state(); HeatingCoils::clear_state(); HighTempRadiantSystem::clear_state(); @@ -230,9 +208,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) HybridModel::clear_state(); HybridUnitaryAirConditioners::clear_state(); HysteresisPhaseChange::clear_state(); - // EnergyPlus::inputProcessor->clear_state(); this is done by the unit test fixture, other reset approaches (API) should just get an entirely new - // inputprocessor instance - IceThermalStorage::clear_state(); IntegratedHeatPump::clear_state(); InternalHeatGains::clear_state(); LowTempRadiantSystem::clear_state(); @@ -249,15 +224,7 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) PackagedThermalStorageCoil::clear_state(); Photovoltaics::clear_state(); PhotovoltaicThermalCollectors::clear_state(); - PlantHeatExchangerFluidToFluid::clear_state(); - PlantLoadProfile::clear_state(); - PlantManager::clear_state(); - PlantPipingSystemsManager::clear_state(); - PlantPressureSystem::clear_state(); - PlantUtilities::clear_state(); - PlantPipingSystemsManager::clear_state(); PollutionModule::clear_state(); - PondGroundHeatExchanger::clear_state(); PoweredInductionUnits::clear_state(); Psychrometrics::clear_state(); PVWatts::clear_state(); diff --git a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc index cbc09da7c95..185338c72f1 100644 --- a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc +++ b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc @@ -923,8 +923,8 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) outletNodeIndex = std::distance(DataLoopNode::NodeID.begin(), outletNode); } // TODO: FIXME: This is failing. Actual is -10.409381032746095, expected is 30. - // EXPECT_GT( DataLoopNode::Node( inletNodeIndex ).Temp, 30.0 ); // inlet node temperature - // EXPECT_DOUBLE_EQ( 30.0, DataLoopNode::Node( outletNodeIndex ).Temp ); // outlet node temperature + EXPECT_GT( DataLoopNode::Node( inletNodeIndex ).Temp, 30.0 ); // inlet node temperature + EXPECT_DOUBLE_EQ( 30.0, DataLoopNode::Node( outletNodeIndex ).Temp ); // outlet node temperature // input not needed for sizing (WasAutoSized = false) using NominalCapacity method but this variable should still size EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); @@ -3045,7 +3045,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_Sizing SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(*state, 1); PlantManager::SizePlantLoop(*state, 1, true); - PlantManager::InitLoopEquip = true; + state->dataPlantMgr->InitLoopEquip = true; // Fake having more than small load DataSizing::PlantSizData(1).DesVolFlowRate = 1000.0; @@ -3437,7 +3437,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_UserSp SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(*state, 1); PlantManager::SizePlantLoop(*state, 1, true); - PlantManager::InitLoopEquip = true; + state->dataPlantMgr->InitLoopEquip = true; // Fake having more than small load // DataSizing::PlantSizData(1).DesVolFlowRate = 1000.0; @@ -3911,7 +3911,7 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(*state, 1); PlantManager::SizePlantLoop(*state, 1, true); - PlantManager::InitLoopEquip = true; + state->dataPlantMgr->InitLoopEquip = true; state->dataGlobal->DoingSizing = false; state->dataGlobal->KickOffSimulation = true; diff --git a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc index 2777d42b39c..f3de2faba9c 100644 --- a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc +++ b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc @@ -122,7 +122,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -412,7 +412,6 @@ namespace EnergyPlus { state->dataWaterCoils->WaterCoil.deallocate(); state->dataZoneEquip->ZoneEquipConfig.deallocate(); Zone.deallocate(); - CoilNames.clear(); } TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) { @@ -433,7 +432,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -725,7 +724,6 @@ namespace EnergyPlus { state->dataWaterCoils->WaterCoil.deallocate(); state->dataZoneEquip->ZoneEquipConfig.deallocate(); Zone.deallocate(); - CoilNames.clear(); } TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) { @@ -746,7 +744,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -1133,7 +1131,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -1420,7 +1418,6 @@ namespace EnergyPlus { state->dataWaterCoils->WaterCoil.deallocate(); state->dataZoneEquip->ZoneEquipConfig.deallocate(); Zone.deallocate(); - CoilNames.clear(); } TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) { @@ -1441,7 +1438,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -1793,7 +1790,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -2174,7 +2171,6 @@ namespace EnergyPlus { state->dataWaterCoils->WaterCoil.deallocate(); state->dataZoneEquip->ZoneEquipConfig.deallocate(); Zone.deallocate(); - CoilNames.clear(); } Real64 ResidualFancoil(EnergyPlusData &state, Real64 const mdot, @@ -2211,7 +2207,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -2496,7 +2492,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -2901,7 +2897,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -3305,7 +3301,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -3672,7 +3668,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; @@ -4039,7 +4035,7 @@ namespace EnergyPlus { state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index e3391c5fcb8..48e8bbd266b 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -82,52 +82,52 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test1) } std::string const cCurrentModuleObject("FluidCooler:TwoSpeed"); int FluidCoolerNum(1); - SimpleFluidCooler.allocate(FluidCoolerNum); - - SimpleFluidCooler(FluidCoolerNum).Name = "Test"; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; - SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::NOMINAL_CAPACITY; - SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = 1; - SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = 1; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = 50000; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = AutoSize; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = 30000; + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); + + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name = "Test"; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::NOMINAL_CAPACITY; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = 1; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = 1; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = 50000; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = 30000; AlphArray(4) = "NominalCapacity"; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = 0; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = 0; - SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; - bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = 0; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = 0; + state->dataFluidCoolers->SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; + bool testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler(1).DesignEnteringWaterTemp = -10; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(1).DesignEnteringWaterTemp = -10; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered - SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; - SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = AutoSize; - SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = true; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; + state->dataFluidCoolers->SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = true; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = 0; // this should trigger the original error condition - SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = false; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = 0; // this should trigger the original error condition + state->dataFluidCoolers->SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = false; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered - SimpleFluidCooler.deallocate(); + state->dataFluidCoolers->SimpleFluidCooler.deallocate(); } TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test2) @@ -148,42 +148,40 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test2) } std::string const cCurrentModuleObject("FluidCooler:TwoSpeed"); int FluidCoolerNum(1); - bool ErrrorsFound(false); - SimpleFluidCooler.allocate(FluidCoolerNum); - - SimpleFluidCooler(FluidCoolerNum).Name = "Test"; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 1.0; - SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::U_FACTOR; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = AutoSize; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = 30000; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = AutoSize; - SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUAWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); + + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name = "Test"; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 1.0; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::U_FACTOR; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedAirFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPower = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFanPowerWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerLowSpeedNomCap = 30000; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUAWasAutoSized = true; AlphArray(4) = "UFactorTimesAreaAndDesignWaterFlowRate"; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = false; - bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = false; + bool testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered - ErrrorsFound = false; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler.deallocate(); + state->dataFluidCoolers->SimpleFluidCooler.deallocate(); cNumericFieldNames.deallocate(); cAlphaFieldNames.deallocate(); AlphArray.deallocate(); @@ -206,43 +204,43 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test3) } std::string const cCurrentModuleObject("FluidCooler:SingleSpeed"); int FluidCoolerNum(1); - SimpleFluidCooler.allocate(FluidCoolerNum); - - SimpleFluidCooler(FluidCoolerNum).Name = "Test"; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; - SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::U_FACTOR; - SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = 1; - SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = 1; - SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = 50000; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; - SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; - SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); + + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).Name = "Test"; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerMassFlowRateMultiplier = 2.5; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).PerformanceInputMethod_Num = PerfInputMethod::U_FACTOR; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterInletNodeNum = 1; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterOutletNodeNum = 1; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).FluidCoolerNominalCapacity = 50000; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringWaterTemp = 52; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirTemp = 35; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignEnteringAirWetBulbTemp = 25; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRate = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedAirFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPower = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFanPowerWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; AlphArray(4) = "UFactorTimesAreaAndDesignWaterFlowRate"; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; - bool testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; + bool testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; - SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; + testResult = state->dataFluidCoolers->SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered } @@ -269,7 +267,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test4) ASSERT_TRUE(process_idf(idf_objects)); GetFluidCoolerInput(*state); - auto &thisFluidCooler = FluidCoolers::SimpleFluidCooler(FluidCoolerNum); + auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); EXPECT_TRUE(thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized); EXPECT_EQ(thisFluidCooler.HighSpeedFluidCoolerUA, DataSizing::AutoSize); EXPECT_EQ(thisFluidCooler.FluidCoolerNominalCapacity, 0.0); @@ -292,8 +290,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test5) } std::string const cCurrentModuleObject("FluidCooler:SingleSpeed"); int FluidCoolerNum(1); - FluidCoolers::SimpleFluidCooler.allocate(FluidCoolerNum); - auto &thisFluidCooler = FluidCoolers::SimpleFluidCooler(FluidCoolerNum); + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); + auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); thisFluidCooler.Name = "Test"; thisFluidCooler.FluidCoolerMassFlowRateMultiplier = 2.5; @@ -345,11 +343,11 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) GetFluidCoolerInput(*state); - auto &thisFluidCooler = FluidCoolers::SimpleFluidCooler(FluidCoolerNum); + auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); state->dataPlnt->PlantLoop.allocate(FluidCoolerNum); - SimpleFluidCooler.allocate(FluidCoolerNum); - SimpleFluidCooler(FluidCoolerNum).LoopNum = 1; + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); + state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).LoopNum = 1; state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0; EXPECT_FALSE(thisFluidCooler.HighSpeedFanPowerWasAutoSized); diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 44be7aa6e73..6c408397504 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -5601,7 +5601,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(*state, 1); PlantManager::SizePlantLoop(*state, 1, true); - PlantManager::InitLoopEquip = true; + state->dataPlantMgr->InitLoopEquip = true; // call air-side VRF bool HeatingActive = false; bool CoolingActive = false; diff --git a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc index dbcb2f2584d..e71cef86093 100644 --- a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc +++ b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc @@ -1482,27 +1482,27 @@ TEST_F(EnergyPlusFixture, WWHP_AutosizeTest1) // should be sized now - EXPECT_TRUE(HeatPumpWaterToWaterSimple::GSHP(1).ratedLoadVolFlowHeatWasAutoSized); - EXPECT_TRUE(HeatPumpWaterToWaterSimple::GSHP(1).ratedSourceVolFlowHeatWasAutoSized); - EXPECT_TRUE(HeatPumpWaterToWaterSimple::GSHP(1).ratedCapHeatWasAutoSized); - EXPECT_TRUE(HeatPumpWaterToWaterSimple::GSHP(1).ratedPowerHeatWasAutoSized); + EXPECT_TRUE(state->dataHPWaterToWaterSimple->GSHP(1).ratedLoadVolFlowHeatWasAutoSized); + EXPECT_TRUE(state->dataHPWaterToWaterSimple->GSHP(1).ratedSourceVolFlowHeatWasAutoSized); + EXPECT_TRUE(state->dataHPWaterToWaterSimple->GSHP(1).ratedCapHeatWasAutoSized); + EXPECT_TRUE(state->dataHPWaterToWaterSimple->GSHP(1).ratedPowerHeatWasAutoSized); - EXPECT_NEAR(HeatPumpWaterToWaterSimple::GSHP(1).RatedLoadVolFlowHeat, 0.00025, 0.0000001); - EXPECT_NEAR(HeatPumpWaterToWaterSimple::GSHP(1).RatedSourceVolFlowHeat, 0.00025, 0.0000001); - EXPECT_NEAR(HeatPumpWaterToWaterSimple::GSHP(1).RatedCapHeat, 7200.71, 0.1); - EXPECT_NEAR(HeatPumpWaterToWaterSimple::GSHP(1).RatedPowerHeat, 2151.07, 0.1); + EXPECT_NEAR(state->dataHPWaterToWaterSimple->GSHP(1).RatedLoadVolFlowHeat, 0.00025, 0.0000001); + EXPECT_NEAR(state->dataHPWaterToWaterSimple->GSHP(1).RatedSourceVolFlowHeat, 0.00025, 0.0000001); + EXPECT_NEAR(state->dataHPWaterToWaterSimple->GSHP(1).RatedCapHeat, 7200.71, 0.1); + EXPECT_NEAR(state->dataHPWaterToWaterSimple->GSHP(1).RatedPowerHeat, 2151.07, 0.1); // Check that we are outputing the correct values EXPECT_EQ("HeatPump:WaterToWater:EquationFit:Heating", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchMechType, - HeatPumpWaterToWaterSimple::GSHP(1).Name)); + state->dataHPWaterToWaterSimple->GSHP(1).Name)); EXPECT_EQ("3.35", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchMechNomEff, - HeatPumpWaterToWaterSimple::GSHP(1).Name)); + state->dataHPWaterToWaterSimple->GSHP(1).Name)); EXPECT_EQ("7200.71", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchMechNomCap, - HeatPumpWaterToWaterSimple::GSHP(1).Name)); + state->dataHPWaterToWaterSimple->GSHP(1).Name)); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc index 910030081fd..9ce0061421a 100644 --- a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc +++ b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc @@ -65,10 +65,6 @@ using namespace EnergyPlus::General; TEST_F(EnergyPlusFixture, IceThermalStorage_CalcQstarTest) { - - IceThermalStorage::clear_state(); - state->dataCurveManager->clear_state(); - int TotDetailedIce = 4; int TotCurves = 4; enum CurveVars IceStorageCurveType; @@ -77,7 +73,7 @@ TEST_F(EnergyPlusFixture, IceThermalStorage_CalcQstarTest) Real64 ExpectedValue = 0.0; Real64 Tolerance = 0.001; - IceThermalStorage::DetailedIceStorage.allocate(TotDetailedIce); + state->dataIceThermalStorage->DetailedIceStorage.allocate(TotDetailedIce); state->dataCurveManager->PerfCurve.allocate(TotCurves); state->dataCurveManager->NumCurves = TotCurves; state->dataGlobal->BeginEnvrnFlag = false; diff --git a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc index b7cae72089b..afaff26b2f8 100644 --- a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc +++ b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc @@ -2263,7 +2263,7 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) // flow request at the design max and if it is false set the flow request to 0.0. The intent is setup enough structures to be able to call the // routine ControlFluidHeatExchanger and check its behavior with FirstHVACIteration. - PlantHeatExchangerFluidToFluid::FluidHX.allocate(1); + state->dataPlantHXFluidToFluid->FluidHX.allocate(1); // get availability schedule to work state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized @@ -2279,33 +2279,33 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); ScheduleManager::UpdateScheduleValues(*state); - PlantHeatExchangerFluidToFluid::FluidHX(1).AvailSchedNum = -1; + state->dataPlantHXFluidToFluid->FluidHX(1).AvailSchedNum = -1; // setup four plant nodes for HX DataLoopNode::Node.allocate(4); - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.inletNodeNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.outletNodeNum = 3; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.inletNodeNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.outletNodeNum = 3; DataLoopNode::Node(1).Temp = 18.0; DataLoopNode::Node(1).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(1).MassFlowRateMax = 2.0; DataLoopNode::Node(3).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(3).MassFlowRateMax = 2.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.InletTemp = 18.0; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.InletTemp = 18.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.inletNodeNum = 2; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.outletNodeNum = 4; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.inletNodeNum = 2; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.outletNodeNum = 4; DataLoopNode::Node(2).Temp = 19.0; DataLoopNode::Node(2).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(2).MassFlowRateMax = 2.0; DataLoopNode::Node(4).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(4).MassFlowRateMax = 2.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.InletTemp = 19.0; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.InletTemp = 19.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).ControlMode = PlantHeatExchangerFluidToFluid::CoolingDifferentialOnOff; - PlantHeatExchangerFluidToFluid::FluidHX(1).MinOperationTemp = 10.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).MaxOperationTemp = 30.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).Name = "Test HX"; + state->dataPlantHXFluidToFluid->FluidHX(1).ControlMode = PlantHeatExchangerFluidToFluid::iCtrlType::CoolingDifferentialOnOff; + state->dataPlantHXFluidToFluid->FluidHX(1).MinOperationTemp = 10.0; + state->dataPlantHXFluidToFluid->FluidHX(1).MaxOperationTemp = 30.0; + state->dataPlantHXFluidToFluid->FluidHX(1).Name = "Test HX"; // setup two plant loops, need for SetComponenetFlowRate state->dataPlnt->TotNumLoops = 2; @@ -2325,35 +2325,35 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) state->dataPlnt->PlantLoop(1).Name = "HX supply side loop "; state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = PlantHeatExchangerFluidToFluid::FluidHX(1).Name; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_FluidToFluidPlantHtExchg; - state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.inletNodeNum; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.loopNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.loopSideNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.branchNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.compNum = 1; + state->dataPlnt->PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.inletNodeNum; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.loopNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.loopSideNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.branchNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "HX demand side loop "; state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = PlantHeatExchangerFluidToFluid::FluidHX(1).Name; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_FluidToFluidPlantHtExchg; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.inletNodeNum; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.loopNum = 2; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.loopSideNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.branchNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.compNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.MassFlowRateMax = 2.0; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.inletNodeNum; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.loopNum = 2; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.loopSideNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.branchNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.compNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.MassFlowRateMax = 2.0; // when FirstHVACIteration is true, mass flow should match design max bool testFirstHVACIteration = true; - PlantHeatExchangerFluidToFluid::FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); + state->dataPlantHXFluidToFluid->FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); - EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.MassFlowRateMax, 0.001); + EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.MassFlowRateMax, 0.001); // when FirstHVACIteration is false, mass flow should be zero testFirstHVACIteration = false; - PlantHeatExchangerFluidToFluid::FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); + state->dataPlantHXFluidToFluid->FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, 0.0, 0.001); } @@ -2362,7 +2362,7 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri // this unit test is for issue #5626. Fixed logic for CoolingSetpointOnOffWithComponentOverride. // unit test checks that the change for #5626 adjusts the temperature value used in central plant dispatch routines by the tolerance value. - PlantHeatExchangerFluidToFluid::FluidHX.allocate(1); + state->dataPlantHXFluidToFluid->FluidHX.allocate(1); // get availability schedule to work state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized @@ -2378,14 +2378,14 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); ScheduleManager::UpdateScheduleValues(*state); - PlantHeatExchangerFluidToFluid::FluidHX(1).AvailSchedNum = -1; + state->dataPlantHXFluidToFluid->FluidHX(1).AvailSchedNum = -1; // setup four plant nodes for HX DataLoopNode::Node.allocate(6); - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.inletNodeNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.outletNodeNum = 3; - PlantHeatExchangerFluidToFluid::FluidHX(1).SetPointNodeNum = 3; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.MassFlowRateMax = 2.0; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.inletNodeNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.outletNodeNum = 3; + state->dataPlantHXFluidToFluid->FluidHX(1).SetPointNodeNum = 3; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.MassFlowRateMax = 2.0; DataLoopNode::Node(1).Temp = 18.0; DataLoopNode::Node(1).MassFlowRateMaxAvail = 2.0; @@ -2393,21 +2393,21 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri DataLoopNode::Node(3).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(3).MassFlowRateMax = 2.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.InletTemp = 18.0; + state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.InletTemp = 18.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.inletNodeNum = 2; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.outletNodeNum = 4; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.inletNodeNum = 2; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.outletNodeNum = 4; DataLoopNode::Node(2).Temp = 19.0; DataLoopNode::Node(2).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(2).MassFlowRateMax = 2.0; DataLoopNode::Node(4).MassFlowRateMaxAvail = 2.0; DataLoopNode::Node(4).MassFlowRateMax = 2.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.InletTemp = 19.0; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.InletTemp = 19.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).ControlMode = PlantHeatExchangerFluidToFluid::CoolingSetPointOnOffWithComponentOverride; - PlantHeatExchangerFluidToFluid::FluidHX(1).MinOperationTemp = 10.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).MaxOperationTemp = 30.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).Name = "Test HX"; + state->dataPlantHXFluidToFluid->FluidHX(1).ControlMode = PlantHeatExchangerFluidToFluid::iCtrlType::CoolingSetPointOnOffWithComponentOverride; + state->dataPlantHXFluidToFluid->FluidHX(1).MinOperationTemp = 10.0; + state->dataPlantHXFluidToFluid->FluidHX(1).MaxOperationTemp = 30.0; + state->dataPlantHXFluidToFluid->FluidHX(1).Name = "Test HX"; // setup two plant loops, need for SetComponenetFlowRate state->dataPlnt->TotNumLoops = 2; @@ -2443,41 +2443,41 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri state->dataPlnt->PlantLoop(1).Name = "HX supply side loop "; state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(1).Comp(1).Name = PlantHeatExchangerFluidToFluid::FluidHX(1).Name; + state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_FluidToFluidPlantHtExchg; - state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(1).Comp(1).NodeNumIn = PlantHeatExchangerFluidToFluid::FluidHX(1).SupplySideLoop.inletNodeNum; + state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(1).Comp(1).NodeNumIn = state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.inletNodeNum; state->dataPlnt->PlantLoop(2).Name = "HX demand side loop "; state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = PlantHeatExchangerFluidToFluid::FluidHX(1).Name; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_FluidToFluidPlantHtExchg; - state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.inletNodeNum; + state->dataPlnt->PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.inletNodeNum; - PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.MassFlowRateMax = 2.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).ControlSignalTemp = PlantHeatExchangerFluidToFluid::DryBulbTemperature; - PlantHeatExchangerFluidToFluid::FluidHX(1).OtherCompSupplySideLoop.inletNodeNum = 5; - PlantHeatExchangerFluidToFluid::FluidHX(1).OtherCompSupplySideLoop.loopNum = 1; - PlantHeatExchangerFluidToFluid::FluidHX(1).OtherCompSupplySideLoop.loopSideNum = 2; - PlantHeatExchangerFluidToFluid::FluidHX(1).OtherCompSupplySideLoop.branchNum = 2; - PlantHeatExchangerFluidToFluid::FluidHX(1).OtherCompSupplySideLoop.compNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).DemandSideLoop.MassFlowRateMax = 2.0; + state->dataPlantHXFluidToFluid->FluidHX(1).ControlSignalTemp = PlantHeatExchangerFluidToFluid::iCtrlTemp::DryBulbTemperature; + state->dataPlantHXFluidToFluid->FluidHX(1).OtherCompSupplySideLoop.inletNodeNum = 5; + state->dataPlantHXFluidToFluid->FluidHX(1).OtherCompSupplySideLoop.loopNum = 1; + state->dataPlantHXFluidToFluid->FluidHX(1).OtherCompSupplySideLoop.loopSideNum = 2; + state->dataPlantHXFluidToFluid->FluidHX(1).OtherCompSupplySideLoop.branchNum = 2; + state->dataPlantHXFluidToFluid->FluidHX(1).OtherCompSupplySideLoop.compNum = 1; - PlantHeatExchangerFluidToFluid::NumberOfPlantFluidHXs = 1; + state->dataPlantHXFluidToFluid->NumberOfPlantFluidHXs = 1; state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(2).Comp(1).HowLoadServed = DataPlant::HowMet_ByNominalCap; state->dataEnvrn->OutDryBulbTemp = 9.0; - PlantHeatExchangerFluidToFluid::FluidHX(1).TempControlTol = 0.0; + state->dataPlantHXFluidToFluid->FluidHX(1).TempControlTol = 0.0; DataLoopNode::Node(3).TempSetPoint = 11.0; // now call the init routine - PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(*state); + state->dataPlantHXFluidToFluid->FluidHX(1).initialize(*state); // check value in FreeCoolCntrlMinCntrlTemp EXPECT_NEAR(state->dataPlnt->PlantLoop(1).LoopSide(2).Branch(2).Comp(1).FreeCoolCntrlMinCntrlTemp, 11.0, 0.001); // change the tolerance and check the result, issue 5626 fix subtracts tolerance - PlantHeatExchangerFluidToFluid::FluidHX(1).TempControlTol = 1.5; - PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(*state); + state->dataPlantHXFluidToFluid->FluidHX(1).TempControlTol = 1.5; + state->dataPlantHXFluidToFluid->FluidHX(1).initialize(*state); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc index 03395897505..404c7b929ad 100644 --- a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc @@ -132,7 +132,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_CorrectInputs) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_FALSE(errorsFound); @@ -201,7 +201,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadOSCMName) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -270,7 +270,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadSlabLocation) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -339,7 +339,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadSlabMaterialName) GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -408,7 +408,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsSelection) GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -477,7 +477,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsMaterialNa GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -546,7 +546,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsExtentsSel GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -615,7 +615,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_PerimeterInsulationWi GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -684,7 +684,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsSelection) GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -753,7 +753,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsMaterialNam GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -822,7 +822,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsDepth) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -891,7 +891,7 @@ TEST_F(EnergyPlusFixture, DISABLED_SiteGroundDomainSlab_CheckInputs_BadTimeStepS GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -960,7 +960,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_CorrectInputs) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_FALSE(errorsFound); @@ -1029,7 +1029,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadOSCMName) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1098,7 +1098,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsSelect GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1167,7 +1167,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsMateri GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1236,7 +1236,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsExtent GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1305,7 +1305,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadBasementDepth) GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1374,7 +1374,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadFloorOSCMName) GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1443,7 +1443,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadVertInsSelecti GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1512,7 +1512,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadVertInsName) { GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1581,7 +1581,7 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadTimestepSelect GetOSCMData(*state, errorsFound); GetMaterialData(*state, errorsFound); - PlantPipingSystemsManager::domains.resize(1); + state->dataPlantPipingSysMgr->domains.resize(1); ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); @@ -1734,17 +1734,17 @@ TEST_F(EnergyPlusFixture, PipingSystemFullSimulation) { PlantComponent *thisCircuit = PlantPipingSystemsManager::Circuit::factory(*state, DataPlant::TypeOf_PipingSystemPipeCircuit, "MY PIPE CIRCUIT"); - EXPECT_EQ(2u, PlantPipingSystemsManager::domains.size()); + EXPECT_EQ(2u, state->dataPlantPipingSysMgr->domains.size()); - EXPECT_TRUE(PlantPipingSystemsManager::domains[0].HasAPipeCircuit); - EXPECT_EQ(2, PlantPipingSystemsManager::domains[0].Mesh.X.RegionMeshCount); - EXPECT_EQ(2, PlantPipingSystemsManager::domains[0].Mesh.Y.RegionMeshCount); - EXPECT_EQ(6, PlantPipingSystemsManager::domains[0].Mesh.Z.RegionMeshCount); + EXPECT_TRUE(state->dataPlantPipingSysMgr->domains[0].HasAPipeCircuit); + EXPECT_EQ(2, state->dataPlantPipingSysMgr->domains[0].Mesh.X.RegionMeshCount); + EXPECT_EQ(2, state->dataPlantPipingSysMgr->domains[0].Mesh.Y.RegionMeshCount); + EXPECT_EQ(6, state->dataPlantPipingSysMgr->domains[0].Mesh.Z.RegionMeshCount); - EXPECT_FALSE(PlantPipingSystemsManager::domains[1].HasAPipeCircuit); - EXPECT_EQ(4, PlantPipingSystemsManager::domains[1].Mesh.X.RegionMeshCount); - EXPECT_EQ(4, PlantPipingSystemsManager::domains[1].Mesh.Y.RegionMeshCount); - EXPECT_EQ(4, PlantPipingSystemsManager::domains[1].Mesh.Z.RegionMeshCount); + EXPECT_FALSE(state->dataPlantPipingSysMgr->domains[1].HasAPipeCircuit); + EXPECT_EQ(4, state->dataPlantPipingSysMgr->domains[1].Mesh.X.RegionMeshCount); + EXPECT_EQ(4, state->dataPlantPipingSysMgr->domains[1].Mesh.Y.RegionMeshCount); + EXPECT_EQ(4, state->dataPlantPipingSysMgr->domains[1].Mesh.Z.RegionMeshCount); // second call, turn off initLoopEquip so it tries to do a simulation initLoopEquip = false; diff --git a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc index feb34ed1ad1..e456de21cb9 100644 --- a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc +++ b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc @@ -81,11 +81,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlabAndBasementModelsIndexChecking) EXPECT_TRUE(process_idf(idf_objects)); - domains.resize(2); + state->dataPlantPipingSysMgr->domains.resize(2); - domains[0].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA1"); + state->dataPlantPipingSysMgr->domains[0].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA1"); - domains[1].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA2"); + state->dataPlantPipingSysMgr->domains[1].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA2"); - EXPECT_NE(domains[0].groundTempModel, domains[1].groundTempModel); + EXPECT_NE(state->dataPlantPipingSysMgr->domains[0].groundTempModel, state->dataPlantPipingSysMgr->domains[1].groundTempModel); } diff --git a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc index 50a818615a3..0a182264c20 100644 --- a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc +++ b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc @@ -1393,4 +1393,123 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateOptionalError } +TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_RuntimeFraction_Initialization) +{ + std::vector snippet = getAllLinesInFile2(configured_source_directory() + "/tst/EnergyPlus/unit/Resources/UnitaryHybridUnitTest_DOSA.idf"); + std::string string = delimited_string(snippet); + ASSERT_TRUE(process_idf(string)); + // setup environment + bool ErrorsFound(false); + GetZoneData(*state, ErrorsFound); + EXPECT_FALSE(ErrorsFound); + // Initialize schedule values + state->dataGlobal->TimeStep = 1; + DataHVACGlobals::TimeStepSys = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataEnvrn->Month = 1; + state->dataEnvrn->DayOfMonth = 21; + state->dataGlobal->HourOfDay = 1; + state->dataEnvrn->DSTIndicator = 0; + state->dataEnvrn->DayOfWeek = 2; + state->dataEnvrn->HolidayIndex = 0; + state->dataGlobal->WarmupFlag = false; + state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); + ScheduleManager::UpdateScheduleValues(*state); + // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines + DataHeatBalance::Zone(1).FloorArea = 232.26; + state->dataEnvrn->StdRhoAir = 1.225; + state->dataEnvrn->OutBaroPress = 101325; + DataHeatBalance::ZoneIntGain.allocate(1); + + SizingManager::GetOARequirements(*state); + GetOAControllerInputs(*state); + using DataZoneEquipment::CalcDesignSpecificationOutdoorAir; + + // Setup performance tables + using namespace EnergyPlus::DataEnvironment; + // process schedules + ProcessScheduleInput(*state); // read schedules + UpdateScheduleValues(*state); + // Get Unitary system + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); + // All to get OA requirements + GetOARequirements(*state); + + EXPECT_FALSE(ErrorsFound); + // Initialize unit + InitZoneHybridUnitaryAirConditioners(*state, 1, 1); + Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); + // setup local variables for model inputs + Real64 Tosa, Tra, Wra, Wosa, RHosa, RHra, DesignMinVR, Requestedheating, RequestedCooling, Requested_Humidification, Requested_Dehumidification; + RHosa = 0; + std::string TimeDate; + Real64 MsaRatio, OSAF; + MsaRatio = OSAF = 1; + + Requestedheating = RequestedCooling = Requested_Humidification = Requested_Dehumidification = 0; + + DesignMinVR = 1.622720855; // Zone Hybrid Unitary HVAC Requested Outdoor Air Ventilation Mass Flow Rate + Tra = 22.93929413; // Zone Hybrid Unitary HVAC Return Air Temperature + Tosa = 26.67733333; // Zone Hybrid Unitary HVAC Outside Air Temperature + RHra = 17.3042157; // Zone Hybrid Unitary HVAC Return Air Relative Humidity + RHosa = 13.1602401; // Zone Hybrid Unitary HVAC Outside Air Relative Humidity + Wra = PsyWFnTdbRhPb(*state, Tra, RHra / 100, 101325); + Wosa = PsyWFnTdbRhPb(*state, Tosa, RHosa / 100, 101325); + pZoneHybridUnitaryAirConditioner->InletTemp = Tra; + pZoneHybridUnitaryAirConditioner->InletHumRat = Wra; + pZoneHybridUnitaryAirConditioner->InletEnthalpy = PsyHFnTdbRhPb(*state, Tra, RHra / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->InletPressure = 101325; + pZoneHybridUnitaryAirConditioner->InletRH = RHra / 100; + pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; + pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; + pZoneHybridUnitaryAirConditioner->SecInletEnthalpy = PsyHFnTdbRhPb(*state, Tosa, RHosa / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->SecInletPressure = 101325; + pZoneHybridUnitaryAirConditioner->SecInletRH = RHosa / 100; + + // Scenario 1: Low Cooling + + Requestedheating = -64358.68966; //- + RequestedCooling = -633.6613591; // W + pZoneHybridUnitaryAirConditioner->Initialize(1); + pZoneHybridUnitaryAirConditioner->InitializeModelParams(); + pZoneHybridUnitaryAirConditioner->doStep( + *state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + + // output results + Real64 Setting0Mode = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[0].Mode; + Real64 Setting0RuntimeFraction = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[0].Runtime_Fraction; + Real64 Setting1Mode = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[1].Mode; + Real64 Setting1RuntimeFraction = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[1].Runtime_Fraction; + + // checks + EXPECT_EQ(Setting0Mode, 1); // IEC Mode + EXPECT_NEAR(Setting0RuntimeFraction, 0.547, 0.001); // IEC RTF + EXPECT_EQ(Setting1Mode, 0); // Standby Mode + EXPECT_NEAR(Setting1RuntimeFraction, 0.453, 0.001); // Standby Mode + + // Scenario 2: Outside of env conditions. should go to standby and have standby energy + Requestedheating = -55795.8058; + RequestedCooling = 8171.47128; + pZoneHybridUnitaryAirConditioner->Initialize(1); + pZoneHybridUnitaryAirConditioner->InitializeModelParams(); + pZoneHybridUnitaryAirConditioner->SecInletTemp = 150; + pZoneHybridUnitaryAirConditioner->SecInletHumRat = 0; + pZoneHybridUnitaryAirConditioner->doStep( + *state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, 0); + + // output results + Setting0Mode = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[0].Mode; + Setting0RuntimeFraction = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[0].Runtime_Fraction; + Setting1Mode = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[1].Mode; + Setting1RuntimeFraction = pZoneHybridUnitaryAirConditioner->CurrentOperatingSettings[1].Runtime_Fraction; + + // checks + EXPECT_EQ(Setting0Mode, 0); // Standby Mode + EXPECT_EQ(Setting0RuntimeFraction, 1); // Standby RTF + EXPECT_EQ(Setting1Mode, 0); // Standby Mode + EXPECT_EQ(Setting1RuntimeFraction, 0); // Standby RTF + +} + } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index 53f9970a45b..03d7da80d6b 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -1458,7 +1458,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - NumCoils = 0; + state->dataGlobalNames->NumCoils = 0; state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60;