diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index 661706d7248..f4d53ba3fbb 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -225,8 +225,8 @@ namespace AirLoopHVACDOAS { ++AirLoopMixerNum; AirLoopMixer thisMixer; - thisMixer.name = UtilityRoutines::MakeUPPERCase(thisObjectName); - thisMixer.OutletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("outlet_node_name").get()); + thisMixer.name = UtilityRoutines::makeUPPER(thisObjectName); + thisMixer.OutletNodeName = UtilityRoutines::makeUPPER(fields.at("outlet_node_name").get()); thisMixer.m_AirLoopMixer_Num = AirLoopMixerNum - 1; thisMixer.OutletNodeNum = NodeInputManager::GetOnlySingleNode(state, thisMixer.OutletNodeName, @@ -245,7 +245,7 @@ namespace AirLoopHVACDOAS { int num = 0; for (auto const &NodeDOASName : NodeArray) { num += 1; - std::string name = UtilityRoutines::MakeUPPERCase(NodeDOASName.at("inlet_node_name").get()); + std::string name = UtilityRoutines::makeUPPER(NodeDOASName.at("inlet_node_name").get()); int NodeNum = UtilityRoutines::FindItemInList(name, state.dataLoopNodes->NodeID); if (NodeNum > 0 && num <= thisMixer.numOfInletNodes) { thisMixer.InletNodeName.push_back(name); @@ -380,8 +380,8 @@ namespace AirLoopHVACDOAS { ++AirLoopSplitterNum; AirLoopSplitter thisSplitter; - thisSplitter.name = UtilityRoutines::MakeUPPERCase(thisObjectName); - thisSplitter.InletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("inlet_node_name").get()); + thisSplitter.name = UtilityRoutines::makeUPPER(thisObjectName); + thisSplitter.InletNodeName = UtilityRoutines::makeUPPER(fields.at("inlet_node_name").get()); thisSplitter.m_AirLoopSplitter_Num = AirLoopSplitterNum - 1; auto NodeNames = fields.find("nodes"); @@ -391,7 +391,7 @@ namespace AirLoopHVACDOAS { int num = 0; for (auto const &NodeDOASName : NodeArray) { num += 1; - std::string name = UtilityRoutines::MakeUPPERCase(NodeDOASName.at("outlet_node_name").get()); + std::string name = UtilityRoutines::makeUPPER(NodeDOASName.at("outlet_node_name").get()); int NodeNum = UtilityRoutines::FindItemInList(name, state.dataLoopNodes->NodeID); if (NodeNum > 0 && num <= thisSplitter.numOfOutletNodes) { thisSplitter.OutletNodeName.push_back(name); @@ -431,9 +431,9 @@ namespace AirLoopHVACDOAS { ++AirLoopDOASNum; AirLoopDOAS thisDOAS; - thisDOAS.Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisDOAS.Name = UtilityRoutines::makeUPPER(thisObjectName); // get OA and avail num - thisDOAS.OASystemName = UtilityRoutines::MakeUPPERCase(fields.at("airloophvac_outdoorairsystem_name").get()); + thisDOAS.OASystemName = UtilityRoutines::makeUPPER(fields.at("airloophvac_outdoorairsystem_name").get()); thisDOAS.m_OASystemNum = UtilityRoutines::FindItemInList(thisDOAS.OASystemName, state.dataAirLoop->OutsideAirSys); if (thisDOAS.m_OASystemNum == 0) { cFieldName = "AirLoopHVAC:OutdoorAirSystem Name"; @@ -466,8 +466,8 @@ namespace AirLoopHVACDOAS { bool InletNodeErrFlag = false; bool OutletNodeErrFlag = false; - const std::string typeNameUC = UtilityRoutines::MakeUPPERCase(thisOutsideAirSys.ComponentType(CompNum)); - ValidEquipListType foundType = static_cast(getEnumerationValue(validEquipNamesUC, typeNameUC)); + const std::string typeNameUC = UtilityRoutines::makeUPPER(thisOutsideAirSys.ComponentType(CompNum)); + ValidEquipListType foundType = static_cast(getEnumValue(validEquipNamesUC, typeNameUC)); switch (foundType) { case ValidEquipListType::OutdoorAirMixer: @@ -713,7 +713,7 @@ namespace AirLoopHVACDOAS { thisDOAS.m_HeatExchangerFlag = true; } - thisDOAS.AvailManagerSchedName = UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get()); + thisDOAS.AvailManagerSchedName = UtilityRoutines::makeUPPER(fields.at("availability_schedule_name").get()); thisDOAS.m_AvailManagerSchedPtr = ScheduleManager::GetScheduleIndex(state, thisDOAS.AvailManagerSchedName); if (thisDOAS.m_AvailManagerSchedPtr == 0) { cFieldName = "Availability Schedule Name"; @@ -723,7 +723,7 @@ namespace AirLoopHVACDOAS { errorsFound = true; } - thisDOAS.AirLoopMixerName = UtilityRoutines::MakeUPPERCase(fields.at("airloophvac_mixer_name").get()); // + thisDOAS.AirLoopMixerName = UtilityRoutines::makeUPPER(fields.at("airloophvac_mixer_name").get()); // thisDOAS.m_AirLoopMixerIndex = getAirLoopMixerIndex(state, thisDOAS.AirLoopMixerName); if (thisDOAS.m_AirLoopMixerIndex < 0) { cFieldName = "AirLoopHVAC:Mixer Name"; @@ -733,7 +733,7 @@ namespace AirLoopHVACDOAS { } AirLoopMixer thisAirLoopMixer; thisDOAS.m_CompPointerAirLoopMixer = thisAirLoopMixer.factory(state, thisDOAS.m_AirLoopMixerIndex, thisDOAS.AirLoopMixerName); - thisDOAS.AirLoopSplitterName = UtilityRoutines::MakeUPPERCase(fields.at("airloophvac_splitter_name").get()); // + thisDOAS.AirLoopSplitterName = UtilityRoutines::makeUPPER(fields.at("airloophvac_splitter_name").get()); // thisDOAS.m_AirLoopSplitterIndex = getAirLoopSplitterIndex(state, thisDOAS.AirLoopSplitterName); if (thisDOAS.m_AirLoopSplitterIndex < 0) { cFieldName = "AirLoopHVAC:Splitter Name"; @@ -766,7 +766,7 @@ namespace AirLoopHVACDOAS { auto const &AirLoopArray = AirLoopNames.value(); int num = 0; for (auto const &AirLoopHVACName : AirLoopArray) { - std::string name = UtilityRoutines::MakeUPPERCase(AirLoopHVACName.at("airloophvac_name").get()); + std::string name = UtilityRoutines::makeUPPER(AirLoopHVACName.at("airloophvac_name").get()); int LoopNum = UtilityRoutines::FindItemInList(name, state.dataAirSystemsData->PrimaryAirSystems); num += 1; if (LoopNum > 0 && num <= thisDOAS.NumOfAirLoops) { diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 838065ed442..c383d81e934 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -343,7 +343,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); Real64 temperature(20.0); if (fields.find("reference_temperature") != fields.end()) { // required field, has default value temperature = fields.at("reference_temperature").get(); @@ -403,7 +403,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient_at_reference_conditions")}; // Required field @@ -417,7 +417,7 @@ namespace AirflowNetwork { if (!conditionsAreDefaulted) { if (fields.find("reference_crack_conditions") != fields.end()) { // not required field, *should* have default value auto refCrackCondName = fields.at("reference_crack_conditions").get(); - auto result = referenceConditions.find(UtilityRoutines::MakeUPPERCase(refCrackCondName)); + auto result = referenceConditions.find(UtilityRoutines::makeUPPER(refCrackCondName)); if (result == referenceConditions.end()) { ShowSevereError(m_state, format("{}: {}: {}. Cannot find reference crack conditions object \"{}\".", @@ -461,7 +461,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient_when_the_zone_exhaust_fan_is_off_at_reference_conditions")}; // Required field @@ -506,7 +506,7 @@ namespace AirflowNetwork { if (!conditionsAreDefaulted) { if (fields.find("reference_crack_conditions") != fields.end()) { // not required field, *should* have default value auto refCrackCondName = fields.at("reference_crack_conditions").get(); - auto result = referenceConditions.find(UtilityRoutines::MakeUPPERCase(refCrackCondName)); + auto result = referenceConditions.find(UtilityRoutines::makeUPPER(refCrackCondName)); if (result == referenceConditions.end()) { ShowSevereError(m_state, format("{}: {}: {}. Cannot find reference crack conditions object \"{}\".", @@ -562,10 +562,10 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround - std::string mixer_name = UtilityRoutines::MakeUPPERCase(fields.at("outdoor_air_mixer_name").get()); + std::string mixer_name = UtilityRoutines::makeUPPER(fields.at("outdoor_air_mixer_name").get()); Real64 coeff{fields.at("air_mass_flow_coefficient_when_no_outdoor_air_flow_at_reference_conditions")}; Real64 expnt{0.65}; if (fields.find("air_mass_flow_exponent_when_no_outdoor_air_flow") != fields.end()) { @@ -589,7 +589,7 @@ namespace AirflowNetwork { if (!conditionsAreDefaulted) { if (fields.find("reference_crack_conditions") != fields.end()) { // not required field, *should* have default value auto refCrackCondName = fields.at("reference_crack_conditions").get(); - auto result = referenceConditions.find(UtilityRoutines::MakeUPPERCase(refCrackCondName)); + auto result = referenceConditions.find(UtilityRoutines::makeUPPER(refCrackCondName)); if (result == referenceConditions.end()) { ShowSevereError(m_state, format("{}: {}: {}. Cannot find reference crack conditions object \"{}\".", @@ -643,10 +643,10 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround - std::string mixer_name = UtilityRoutines::MakeUPPERCase(fields.at("outdoor_air_mixer_name").get()); + std::string mixer_name = UtilityRoutines::makeUPPER(fields.at("outdoor_air_mixer_name").get()); Real64 coeff{fields.at("air_mass_flow_coefficient_when_no_outdoor_air_flow_at_reference_conditions")}; Real64 expnt{0.65}; if (fields.find("air_mass_flow_exponent_when_no_outdoor_air_flow") != fields.end()) { @@ -667,7 +667,7 @@ namespace AirflowNetwork { if (!conditionsAreDefaulted) { if (fields.find("reference_crack_conditions") != fields.end()) { // not required field, *should* have default value auto refCrackCondName = fields.at("reference_crack_conditions").get(); - auto result = referenceConditions.find(UtilityRoutines::MakeUPPERCase(refCrackCondName)); + auto result = referenceConditions.find(UtilityRoutines::makeUPPER(refCrackCondName)); if (result == referenceConditions.end()) { ShowSevereError(m_state, format("{}: {}: {}. Cannot find reference crack conditions object \"{}\".", @@ -720,7 +720,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient_when_opening_is_closed")}; @@ -1003,7 +1003,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient_when_opening_is_closed")}; @@ -1046,7 +1046,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient_when_opening_is_closed")}; @@ -1092,7 +1092,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 ela{fields.at("effective_leakage_area")}; @@ -1144,7 +1144,7 @@ namespace AirflowNetwork { instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 flow_rate{fields.at("air_flow_value")}; @@ -1193,7 +1193,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 coeff{fields.at("air_mass_flow_coefficient")}; @@ -1231,7 +1231,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 elr{fields.at("effective_leakage_ratio")}; @@ -1273,7 +1273,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 L{fields.at("duct_length")}; @@ -1358,10 +1358,10 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround - std::string fan_name = UtilityRoutines::MakeUPPERCase(fields.at("fan_name").get()); + std::string fan_name = UtilityRoutines::makeUPPER(fields.at("fan_name").get()); std::string fan_type = fields.at("supply_fan_object_type").get(); int fanIndex; @@ -1370,7 +1370,7 @@ namespace AirflowNetwork { int inletNode; int outletNode; - if (UtilityRoutines::SameString(UtilityRoutines::MakeUPPERCase(fan_type), "FAN:SYSTEMMODEL")) { + if (UtilityRoutines::SameString(UtilityRoutines::makeUPPER(fan_type), "FAN:SYSTEMMODEL")) { m_state.dataHVACFan->fanObjs.emplace_back(new HVACFan::FanSystem(m_state, fan_name)); fanIndex = HVACFan::getFanObjectVectorIndex(m_state, fan_name); if (fanIndex < 0) { @@ -1477,7 +1477,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - // auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + // auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround std::string coil_name = fields.at("coil_name").get(); @@ -1485,10 +1485,10 @@ namespace AirflowNetwork { Real64 L{fields.at("air_path_length")}; Real64 D{fields.at("air_path_hydraulic_diameter")}; - DisSysCompCoilData(i).name = UtilityRoutines::MakeUPPERCase(coil_name); // Name of associated EPlus coil component - DisSysCompCoilData(i).EPlusType = coil_type; // coil type - DisSysCompCoilData(i).L = L; // Air path length - DisSysCompCoilData(i).hydraulicDiameter = D; // Air path hydraulic diameter + DisSysCompCoilData(i).name = UtilityRoutines::makeUPPER(coil_name); // Name of associated EPlus coil component + DisSysCompCoilData(i).EPlusType = coil_type; // coil type + DisSysCompCoilData(i).L = L; // Air path length + DisSysCompCoilData(i).hydraulicDiameter = D; // Air path hydraulic diameter // Add the element to the lookup table, check for name overlaps if (elements.find(DisSysCompCoilData(i).name) == elements.end()) { @@ -1517,7 +1517,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - // auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + // auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround std::string hx_name = fields.at("heatexchanger_name").get(); @@ -1525,10 +1525,10 @@ namespace AirflowNetwork { Real64 L{fields.at("air_path_length")}; Real64 D{fields.at("air_path_hydraulic_diameter")}; - DisSysCompHXData(i).name = UtilityRoutines::MakeUPPERCase(hx_name); // Name of associated EPlus heat exchange component - DisSysCompHXData(i).EPlusType = hx_type; // coil type - DisSysCompHXData(i).L = L; // Air path length - DisSysCompHXData(i).hydraulicDiameter = D; // Air path hydraulic diameter + DisSysCompHXData(i).name = UtilityRoutines::makeUPPER(hx_name); // Name of associated EPlus heat exchange component + DisSysCompHXData(i).EPlusType = hx_type; // coil type + DisSysCompHXData(i).L = L; // Air path length + DisSysCompHXData(i).hydraulicDiameter = D; // Air path hydraulic diameter DisSysCompHXData(i).CoilParentExists = HVACHXAssistedCoolingCoil::VerifyHeatExchangerParent(m_state, hx_type, hx_name); // Add the element to the lookup table, check for name overlaps @@ -1557,7 +1557,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - // auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + // auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround std::string tu_name = fields.at("terminal_unit_name").get(); @@ -1565,10 +1565,10 @@ namespace AirflowNetwork { Real64 L{fields.at("air_path_length")}; Real64 D{fields.at("air_path_hydraulic_diameter")}; - DisSysCompTermUnitData(i).name = UtilityRoutines::MakeUPPERCase(tu_name); // Name of associated EPlus coil component - DisSysCompTermUnitData(i).EPlusType = tu_type; // Terminal unit type - DisSysCompTermUnitData(i).L = L; // Air path length - DisSysCompTermUnitData(i).hydraulicDiameter = D; // Air path hydraulic diameter + DisSysCompTermUnitData(i).name = UtilityRoutines::makeUPPER(tu_name); // Name of associated EPlus coil component + DisSysCompTermUnitData(i).EPlusType = tu_type; // Terminal unit type + DisSysCompTermUnitData(i).L = L; // Air path length + DisSysCompTermUnitData(i).hydraulicDiameter = D; // Air path hydraulic diameter // Add the element to the lookup table, check for name overlaps if (elements.find(DisSysCompTermUnitData(i).name) == elements.end()) { @@ -1597,7 +1597,7 @@ namespace AirflowNetwork { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - auto const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + auto const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); m_state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, instance.key()); // Temporary workaround Real64 dp{fields.at("pressure_difference_across_the_component")}; @@ -1643,7 +1643,7 @@ namespace AirflowNetwork { using MixedAir::GetOAMixerNumber; using NodeInputManager::GetOnlySingleNode; using OutAirNodeManager::SetOutAirNodes; - using RoomAirModelManager::GetRAFNNodeNum; + using RoomAir::GetRAFNNodeNum; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("AirflowNetwork::Solver::get_input: "); // include trailing blank space @@ -1986,7 +1986,7 @@ namespace AirflowNetwork { // Find a flag for possible combination of vent and distribution system // This SELECT_CASE_var will go on input refactor, no need to fix { - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(Alphas(2))); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(Alphas(2))); if (SELECT_CASE_var == "NOMULTIZONEORDISTRIBUTION") { simulation_control.type = ControlType::NoMultizoneOrDistribution; SimAirNetworkKey = "NoMultizoneOrDistribution"; @@ -2264,11 +2264,11 @@ namespace AirflowNetwork { cNumericFields); simulation_control.ductSizing.name = Alphas(1); - if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::MakeUPPERCase("MaximumVelocity"))) { + if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::makeUPPER("MaximumVelocity"))) { simulation_control.ductSizing.method = DuctSizingMethod::MaxVelocity; - } else if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::MakeUPPERCase("PressureLoss"))) { + } else if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::makeUPPER("PressureLoss"))) { simulation_control.ductSizing.method = DuctSizingMethod::PressureLoss; - } else if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::MakeUPPERCase("PressureLossWithMaximumVelocity"))) { + } else if (UtilityRoutines::SameString(Alphas(2), UtilityRoutines::makeUPPER("PressureLossWithMaximumVelocity"))) { simulation_control.ductSizing.method = DuctSizingMethod::VelocityAndLoss; } else { ShowSevereError(m_state, format("{} {} object, {} = {} is invalid.", RoutineName, CurrentModuleObject, cAlphaFields(2), Alphas(2))); @@ -2452,7 +2452,7 @@ namespace AirflowNetwork { { // These SELECT_CASE_vars will go on input refactor, no need to fix - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(MultizoneZoneData(i).VentControl)); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(MultizoneZoneData(i).VentControl)); if (SELECT_CASE_var == "TEMPERATURE") { // checks on Temperature control if (MultizoneZoneData(i).LowValueTemp < 0.0) { // Code will never be executed, validation will catch invalid input @@ -2720,7 +2720,7 @@ namespace AirflowNetwork { if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentSchName = Alphas(5); { // This SELECT_CASE_var will go on input refactor, no need to fix - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(MultizoneSurfaceData(i).VentControl)); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(MultizoneSurfaceData(i).VentControl)); if (SELECT_CASE_var == "TEMPERATURE") { MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Temp; MultizoneSurfaceData(i).IndVentControl = true; @@ -4116,7 +4116,7 @@ namespace AirflowNetwork { { // This SELECT_CASE_var will go on input refactor, no need to fix - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(Alphas(3))); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(Alphas(3))); if (SELECT_CASE_var == "AIRFLOWNETWORK:MULTIZONE:COMPONENT:ZONEEXHAUSTFAN") { PressureControllerData(i).ControlTypeSet = PressureCtrlExhaust; } else if (SELECT_CASE_var == "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT:RELIEFAIRFLOW") { @@ -4802,7 +4802,7 @@ namespace AirflowNetwork { n = AirflowNetworkNodeData(i).EPlusZoneNum; AirflowNetworkNodeData(i).NumOfLinks = 0; if (n > 0 && AirflowNetworkNodeData(i).RAFNNodeNum > 0) { - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirflowNetworkNodeID = i; + m_state.dataRoomAir->AFNZoneInfo(n).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AFNNodeID = i; for (j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { if (AirflowNetworkLinkageData(j).NodeNums[0] == i) { AirflowNetworkNodeData(i).NumOfLinks = AirflowNetworkNodeData(i).NumOfLinks + 1; @@ -4813,21 +4813,21 @@ namespace AirflowNetwork { } } if (AirflowNetworkNodeData(i).RAFNNodeNum > 0) { - for (j = 1; j <= m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).NumOfAirNodes; ++j) { - if (m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).AirflowNetworkNodeID == i) { - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).NumOfAirflowLinks = AirflowNetworkNodeData(i).NumOfLinks; - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).Link.allocate(AirflowNetworkNodeData(i).NumOfLinks); + for (j = 1; j <= m_state.dataRoomAir->AFNZoneInfo(n).NumOfAirNodes; ++j) { + if (m_state.dataRoomAir->AFNZoneInfo(n).Node(j).AFNNodeID == i) { + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).NumOfAirflowLinks = AirflowNetworkNodeData(i).NumOfLinks; + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).Link.allocate(AirflowNetworkNodeData(i).NumOfLinks); k = 1; for (int m = 1; m <= AirflowNetworkNumOfSurfaces; ++m) { if (AirflowNetworkLinkageData(m).NodeNums[0] == i) { - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).Link(k).AirflowNetworkLinkSimuID = m; - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).Link(k).AirflowNetworkLinkageDataID = m; + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).Link(k).AFNSimuID = m; + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).Link(k).AFNDataID = m; k = k + 1; if (k > AirflowNetworkNodeData(i).NumOfLinks) break; } if (AirflowNetworkLinkageData(m).NodeNums[1] == i) { - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).Link(k).AirflowNetworkLinkSimuID = m; - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(n).Node(j).Link(k).AirflowNetworkLinkageDataID = m; + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).Link(k).AFNSimuID = m; + m_state.dataRoomAir->AFNZoneInfo(n).Node(j).Link(k).AFNDataID = m; k = k + 1; if (k > AirflowNetworkNodeData(i).NumOfLinks) break; } @@ -5386,8 +5386,8 @@ namespace AirflowNetwork { } if (AirflowNetworkNodeData(i).RAFNNodeNum > 0) { ZoneNum = AirflowNetworkNodeData(i).EPlusZoneNum; - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp = 23.0; - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat = 0.0; + m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp = 23.0; + m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat = 0.0; } } @@ -5469,13 +5469,11 @@ namespace AirflowNetwork { if (AirflowNetworkNodeData(i).RAFNNodeNum > 0) { ZoneNum = AirflowNetworkNodeData(i).EPlusZoneNum; - if (m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum) - .Node(AirflowNetworkNodeData(i).RAFNNodeNum) - .AirflowNetworkNodeID == i) { + if (m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AFNNodeID == i) { AirflowNetworkNodeSimu(i).TZ = - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp; + m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp; AirflowNetworkNodeSimu(i).WZ = - m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat; + m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat; } } } @@ -7736,9 +7734,8 @@ namespace AirflowNetwork { if (AirflowNetworkNodeData(i).RAFNNodeNum > 0 && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 0.9e10) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; ZoneNum = AirflowNetworkNodeData(i).EPlusZoneNum; - if (m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirflowNetworkNodeID == - i) { - MV(i) = m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp * 1.0e10; + if (m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AFNNodeID == i) { + MV(i) = m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirTemp * 1.0e10; } } } @@ -8030,9 +8027,8 @@ namespace AirflowNetwork { if (AirflowNetworkNodeData(i).RAFNNodeNum > 0 && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 0.9e10) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; ZoneNum = AirflowNetworkNodeData(i).EPlusZoneNum; - if (m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AirflowNetworkNodeID == - i) { - MV(i) = m_state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat * 1.0e10; + if (m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).AFNNodeID == i) { + MV(i) = m_state.dataRoomAir->AFNZoneInfo(ZoneNum).Node(AirflowNetworkNodeData(i).RAFNNodeNum).HumRat * 1.0e10; } } } @@ -10513,7 +10509,7 @@ namespace AirflowNetwork { MultiSpeedHPIndicator = 0; for (int i = 1; i <= DisSysNumOfCoils; ++i) { { - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(DisSysCompCoilData(i).EPlusType)); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(DisSysCompCoilData(i).EPlusType)); if (SELECT_CASE_var == "COIL:COOLING:DX") { ValidateComponent(m_state, "Coil:Cooling:DX", DisSysCompCoilData(i).name, IsNotOK, format(RoutineName) + CurrentModuleObject); @@ -10690,7 +10686,7 @@ namespace AirflowNetwork { CurrentModuleObject = "AirflowNetwork:Distribution:Component:HeatExchanger"; for (int i = 1; i <= DisSysNumOfHXs; ++i) { { - auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(DisSysCompHXData(i).EPlusType)); + auto const SELECT_CASE_var(UtilityRoutines::makeUPPER(DisSysCompHXData(i).EPlusType)); if (SELECT_CASE_var == "HEATEXCHANGER:AIRTOAIR:FLATPLATE") { ValidateComponent( @@ -11214,7 +11210,7 @@ namespace AirflowNetwork { for (int j = 1; j <= m_state.dataGlobal->NumOfZones; ++j) { if (!m_state.dataZoneEquip->ZoneEquipConfig(j).IsControlled) continue; for (int EquipTypeNum = 1; EquipTypeNum <= m_state.dataZoneEquip->ZoneEquipList(j).NumOfEquipTypes; ++EquipTypeNum) { - if (m_state.dataZoneEquip->ZoneEquipList(j).EquipTypeEnum(EquipTypeNum) == DataZoneEquipment::ZoneEquip::ZoneExhaustFan) { + if (m_state.dataZoneEquip->ZoneEquipList(j).EquipType(EquipTypeNum) == DataZoneEquipment::ZoneEquipType::ExhaustFan) { bool found = false; for (int k = 1; k <= m_state.dataZoneEquip->ZoneEquipConfig(j).NumExhaustNodes; ++k) { for (int i = 1; i <= AirflowNetworkNumOfExhFan; ++i) { @@ -11789,10 +11785,9 @@ namespace AirflowNetwork { return AirLoopNum; } if (m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).NumSubComps == 0) { - DataLoopNode::ConnectionObjectType TypeOfComp = - static_cast(EnergyPlus::getEnumerationValue( - BranchNodeConnections::ConnectionObjectTypeNamesUC, - m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).TypeOf)); + DataLoopNode::ConnectionObjectType TypeOfComp = static_cast(EnergyPlus::getEnumValue( + BranchNodeConnections::ConnectionObjectTypeNamesUC, + m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).TypeOf)); std::string const &NameOfComp = m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).Name; if (IsParentObject(m_state, TypeOfComp, NameOfComp)) { @@ -12090,7 +12085,7 @@ namespace AirflowNetwork { if (!m_state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) continue; NumOfCtrlZones++; for (int EquipTypeNum = 1; EquipTypeNum <= m_state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++EquipTypeNum) { - if (m_state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(EquipTypeNum) == DataZoneEquipment::ZoneEquip::AirDistUnit) { + if (m_state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipType(EquipTypeNum) == DataZoneEquipment::ZoneEquipType::AirDistributionUnit) { int AirDistUnitNum = m_state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipIndex(EquipTypeNum); MdotBranch = m_state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).MassFlowRateTU; break; diff --git a/src/EnergyPlus/BaseboardElectric.cc b/src/EnergyPlus/BaseboardElectric.cc index 6455e7e8edd..af04ae276e2 100644 --- a/src/EnergyPlus/BaseboardElectric.cc +++ b/src/EnergyPlus/BaseboardElectric.cc @@ -215,8 +215,8 @@ namespace BaseboardElectric { ++BaseboardNum; auto &thisBaseboard = baseboard->baseboards(BaseboardNum); - thisBaseboard.EquipName = state.dataIPShortCut->cAlphaArgs(1); // name of this baseboard - thisBaseboard.EquipType = UtilityRoutines::MakeUPPERCase(cCurrentModuleObject); // the type of baseboard-rename change + thisBaseboard.EquipName = state.dataIPShortCut->cAlphaArgs(1); // name of this baseboard + thisBaseboard.EquipType = UtilityRoutines::makeUPPER(cCurrentModuleObject); // the type of baseboard-rename change thisBaseboard.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { thisBaseboard.SchedPtr = ScheduleManager::ScheduleAlwaysOn; @@ -330,7 +330,7 @@ namespace BaseboardElectric { } thisBaseboard.ZonePtr = DataZoneEquipment::GetZoneEquipControlledZoneNum( - state, DataZoneEquipment::ZoneEquip::BBElectricConvective, thisBaseboard.EquipName); + state, DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric, thisBaseboard.EquipName); } if (ErrorsFound) { diff --git a/src/EnergyPlus/BaseboardRadiator.cc b/src/EnergyPlus/BaseboardRadiator.cc index 3fff34f01be..1590070af5f 100644 --- a/src/EnergyPlus/BaseboardRadiator.cc +++ b/src/EnergyPlus/BaseboardRadiator.cc @@ -416,8 +416,8 @@ namespace BaseboardRadiator { thisBaseboard.Offset = 0.001; } - thisBaseboard.ZonePtr = - DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquip::BBWaterConvective, thisBaseboard.EquipID); + thisBaseboard.ZonePtr = DataZoneEquipment::GetZoneEquipControlledZoneNum( + state, DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater, thisBaseboard.EquipID); } if (ErrorsFound) { diff --git a/src/EnergyPlus/BoilerSteam.cc b/src/EnergyPlus/BoilerSteam.cc index 61e87b39eb6..11053f560e1 100644 --- a/src/EnergyPlus/BoilerSteam.cc +++ b/src/EnergyPlus/BoilerSteam.cc @@ -196,7 +196,7 @@ namespace BoilerSteam { thisBoiler.Name = state.dataIPShortCut->cAlphaArgs(1); // Validate fuel type input - thisBoiler.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(2))); + thisBoiler.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(2))); // INPUTS from the IDF file thisBoiler.BoilerMaxOperPress = state.dataIPShortCut->rNumericArgs(1); diff --git a/src/EnergyPlus/Boilers.cc b/src/EnergyPlus/Boilers.cc index 7f7a12d8dd6..3d37f682608 100644 --- a/src/EnergyPlus/Boilers.cc +++ b/src/EnergyPlus/Boilers.cc @@ -206,7 +206,7 @@ void GetBoilerInput(EnergyPlusData &state) thisBoiler.Type = DataPlant::PlantEquipmentType::Boiler_Simple; // Validate fuel type input - thisBoiler.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(2))); + thisBoiler.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(2))); thisBoiler.NomCap = state.dataIPShortCut->rNumericArgs(1); if (state.dataIPShortCut->rNumericArgs(1) == 0.0) { diff --git a/src/EnergyPlus/BranchNodeConnections.cc b/src/EnergyPlus/BranchNodeConnections.cc index ac6567bb98d..6ab32aab23e 100644 --- a/src/EnergyPlus/BranchNodeConnections.cc +++ b/src/EnergyPlus/BranchNodeConnections.cc @@ -1790,15 +1790,15 @@ void SetUpCompSets(EnergyPlusData &state, // inlet/outlet nodes have been input. This routine assumes that identical // "CompSets" cannot be used in multiple places and issues a warning if they are. - std::string ParentTypeUC = UtilityRoutines::MakeUPPERCase(ParentType); - std::string CompTypeUC = UtilityRoutines::MakeUPPERCase(CompType); + std::string ParentTypeUC = UtilityRoutines::makeUPPER(ParentType); + std::string CompTypeUC = UtilityRoutines::makeUPPER(CompType); // TODO: Refactor this away by passing in enums DataLoopNode::ConnectionObjectType ParentTypeEnum = - static_cast(getEnumerationValue(ConnectionObjectTypeNamesUC, ParentTypeUC)); + static_cast(getEnumValue(ConnectionObjectTypeNamesUC, ParentTypeUC)); assert(ParentTypeEnum != DataLoopNode::ConnectionObjectType::Invalid); DataLoopNode::ConnectionObjectType ComponentTypeEnum = - static_cast(getEnumerationValue(ConnectionObjectTypeNamesUC, CompTypeUC)); + static_cast(getEnumValue(ConnectionObjectTypeNamesUC, CompTypeUC)); assert(ComponentTypeEnum != DataLoopNode::ConnectionObjectType::Invalid); int Found = 0; @@ -1957,9 +1957,9 @@ void SetUpCompSets(EnergyPlusData &state, state.dataBranchNodeConnections->CompSets(state.dataBranchNodeConnections->NumCompSets).ComponentObjectType = ComponentTypeEnum; state.dataBranchNodeConnections->CompSets(state.dataBranchNodeConnections->NumCompSets).CName = CompName; state.dataBranchNodeConnections->CompSets(state.dataBranchNodeConnections->NumCompSets).InletNodeName = - UtilityRoutines::MakeUPPERCase(InletNode); // TODO: Fix this.... + UtilityRoutines::makeUPPER(InletNode); // TODO: Fix this.... state.dataBranchNodeConnections->CompSets(state.dataBranchNodeConnections->NumCompSets).OutletNodeName = - UtilityRoutines::MakeUPPERCase(OutletNode); // TODO: Fix this.... + UtilityRoutines::makeUPPER(OutletNode); // TODO: Fix this.... if (!Description.empty()) { state.dataBranchNodeConnections->CompSets(state.dataBranchNodeConnections->NumCompSets).Description = Description; } else { @@ -2092,10 +2092,10 @@ void TestCompSet(EnergyPlusData &state, // c) If not found, call SetUpCompSets (with parent type and name UNDEFINED) // to add a new item in the CompSets array - std::string CompTypeUC = UtilityRoutines::MakeUPPERCase(CompType); + std::string CompTypeUC = UtilityRoutines::makeUPPER(CompType); // TODO: Refactor this away by passing in enums DataLoopNode::ConnectionObjectType ComponentTypeEnum = - static_cast(getEnumerationValue(ConnectionObjectTypeNamesUC, CompTypeUC)); + static_cast(getEnumValue(ConnectionObjectTypeNamesUC, CompTypeUC)); assert(ComponentTypeEnum != DataLoopNode::ConnectionObjectType::Invalid); // See if Already there diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 8bceeaf86de..37f61443507 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -215,7 +215,6 @@ set(SRC DataSystemVariables.cc DataSystemVariables.hh DataTimings.hh - DataUCSDSharedData.hh DataVectorTypes.hh DataViewFactorInformation.hh DataWater.hh diff --git a/src/EnergyPlus/CTElectricGenerator.cc b/src/EnergyPlus/CTElectricGenerator.cc index 13bce9b2821..c07b1a2000d 100644 --- a/src/EnergyPlus/CTElectricGenerator.cc +++ b/src/EnergyPlus/CTElectricGenerator.cc @@ -316,7 +316,7 @@ namespace CTElectricGenerator { // Validate fuel type input state.dataCTElectricGenerator->CTGenerator(genNum).FuelType = - static_cast(getEnumerationValue(Constant::eFuelNamesUC, AlphArray(11))); + static_cast(getEnumValue(Constant::eFuelNamesUC, AlphArray(11))); if (state.dataCTElectricGenerator->CTGenerator(genNum).FuelType == Constant::eFuel::Invalid) { ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), AlphArray(11))); ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index 0e018636d99..134344ca61e 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -601,7 +601,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) // search zone equipment list structure for zone index for (int ctrlZone = 1; ctrlZone <= state.dataGlobal->NumOfZones; ++ctrlZone) { for (int zoneEquipTypeNum = 1; zoneEquipTypeNum <= state.dataZoneEquip->ZoneEquipList(ctrlZone).NumOfEquipTypes; ++zoneEquipTypeNum) { - if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipTypeEnum(zoneEquipTypeNum) == DataZoneEquipment::ZoneEquip::CoolingPanel && + if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipType(zoneEquipTypeNum) == DataZoneEquipment::ZoneEquipType::CoolingPanel && state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipName(zoneEquipTypeNum) == thisCP.Name) { thisCP.ZonePtr = ctrlZone; } diff --git a/src/EnergyPlus/ChillerAbsorption.cc b/src/EnergyPlus/ChillerAbsorption.cc index b9c31f7efe1..c918dcf9bbe 100644 --- a/src/EnergyPlus/ChillerAbsorption.cc +++ b/src/EnergyPlus/ChillerAbsorption.cc @@ -449,7 +449,7 @@ void GetBLASTAbsorberInput(EnergyPlusData &state) thisChiller.PumpPowerCoef[2] = state.dataIPShortCut->rNumericArgs(14); thisChiller.TempLowLimitEvapOut = state.dataIPShortCut->rNumericArgs(15); - thisChiller.FlowMode = static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(8))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(8))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); diff --git a/src/EnergyPlus/ChillerElectricASHRAE205.cc b/src/EnergyPlus/ChillerElectricASHRAE205.cc index 998a6f43ebd..fc85aff6e07 100644 --- a/src/EnergyPlus/ChillerElectricASHRAE205.cc +++ b/src/EnergyPlus/ChillerElectricASHRAE205.cc @@ -146,7 +146,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) ++ChillerNum; auto &thisChiller = state.dataChillerElectricASHRAE205->Electric205Chiller(ChillerNum); - thisChiller.Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisChiller.Name = UtilityRoutines::makeUPPER(thisObjectName); ip->markObjectAsUsed(state.dataIPShortCut->cCurrentModuleObject, thisObjectName); std::string const rep_file_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "representation_file_name"); @@ -169,7 +169,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) ErrorsFound = true; } thisChiller.InterpolationType = - InterpMethods[UtilityRoutines::MakeUPPERCase(ip->getAlphaFieldValue(fields, objectSchemaProps, "performance_interpolation_method"))]; + InterpMethods[UtilityRoutines::makeUPPER(ip->getAlphaFieldValue(fields, objectSchemaProps, "performance_interpolation_method"))]; const auto &compressorSequence = thisChiller.Representation->performance.performance_map_cooling.grid_variables.compressor_sequence_number; // minmax_element is sound but perhaps overkill; as sequence numbers are required by A205 to be in ascending order @@ -260,7 +260,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) "Condenser Water Nodes"); thisChiller.FlowMode = static_cast( - getEnumerationValue(DataPlant::FlowModeNamesUC, ip->getAlphaFieldValue(fields, objectSchemaProps, "chiller_flow_mode"))); + getEnumValue(DataPlant::FlowModeNamesUC, ip->getAlphaFieldValue(fields, objectSchemaProps, "chiller_flow_mode"))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisObjectName)); @@ -294,8 +294,8 @@ void getChillerASHRAE205Input(EnergyPlusData &state) } } - thisChiller.AmbientTempType = static_cast(getEnumerationValue( - AmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator")))); + thisChiller.AmbientTempType = static_cast(getEnumValue( + AmbientTempNamesUC, UtilityRoutines::makeUPPER(ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator")))); switch (thisChiller.AmbientTempType) { case AmbientTempIndicator::Schedule: { std::string const ambient_temp_schedule = ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_schedule"); diff --git a/src/EnergyPlus/ChillerElectricEIR.cc b/src/EnergyPlus/ChillerElectricEIR.cc index 382f7955f34..8184169039f 100644 --- a/src/EnergyPlus/ChillerElectricEIR.cc +++ b/src/EnergyPlus/ChillerElectricEIR.cc @@ -444,8 +444,7 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) "Condenser (unknown?) Nodes"); } - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); diff --git a/src/EnergyPlus/ChillerGasAbsorption.cc b/src/EnergyPlus/ChillerGasAbsorption.cc index d686248ff6f..b20bebe4b59 100644 --- a/src/EnergyPlus/ChillerGasAbsorption.cc +++ b/src/EnergyPlus/ChillerGasAbsorption.cc @@ -514,7 +514,7 @@ void GetGasAbsorberInput(EnergyPlusData &state) thisChiller.SizFac = state.dataIPShortCut->rNumericArgs(17); // Validate fuel type input - thisChiller.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(17))); + thisChiller.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(17))); if (thisChiller.FuelType == Constant::eFuel::Invalid) { ShowSevereError(state, format("{}=\"{}\", invalid value", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(17), state.dataIPShortCut->cAlphaArgs(17))); diff --git a/src/EnergyPlus/ChillerIndirectAbsorption.cc b/src/EnergyPlus/ChillerIndirectAbsorption.cc index b33640d19a7..88c6d514a97 100644 --- a/src/EnergyPlus/ChillerIndirectAbsorption.cc +++ b/src/EnergyPlus/ChillerIndirectAbsorption.cc @@ -441,8 +441,7 @@ void GetIndirectAbsorberInput(EnergyPlusData &state) } { - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(6))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(6))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); diff --git a/src/EnergyPlus/ChillerReformulatedEIR.cc b/src/EnergyPlus/ChillerReformulatedEIR.cc index fcb54330e65..f609f5540a6 100644 --- a/src/EnergyPlus/ChillerReformulatedEIR.cc +++ b/src/EnergyPlus/ChillerReformulatedEIR.cc @@ -399,8 +399,7 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) "Condenser Water Nodes"); { - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index e5a33c49930..e1c1f06d275 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -84,7 +84,7 @@ int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const int handle = -1; for (auto const &thisCoil : state.dataCoilCooingDX->coilCoolingDXs) { handle++; - if (EnergyPlus::UtilityRoutines::MakeUPPERCase(coilName) == EnergyPlus::UtilityRoutines::MakeUPPERCase(thisCoil.name)) { + if (EnergyPlus::UtilityRoutines::makeUPPER(coilName) == EnergyPlus::UtilityRoutines::makeUPPER(thisCoil.name)) { return handle; } } diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index 1de2008db17..3a6018ce2e7 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -107,7 +107,7 @@ void CoilCoolingDXCurveFitPerformance::instantiateFromInputSpec(EnergyPlus::Ener } // Validate fuel type input this->compressorFuelType = - static_cast(getEnumerationValue(Constant::eFuelNamesUC, UtilityRoutines::MakeUPPERCase(input_data.compressor_fuel_type))); + static_cast(getEnumValue(Constant::eFuelNamesUC, UtilityRoutines::makeUPPER(input_data.compressor_fuel_type))); if (this->compressorFuelType == Constant::eFuel::Invalid) { ShowSevereError(state, std::string{routineName} + this->object_name + "=\"" + this->name + "\", invalid"); ShowContinueError(state, "...Compressor Fuel Type=\"" + input_data.compressor_fuel_type + "\"."); diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index 7fa756384b3..dd0901368bc 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -333,7 +333,7 @@ namespace CondenserLoopTowers { } tower.TowerFreeConvNomCapSizingFactor = NumArray(12); if (NumAlphas >= 4) { - tower.PerformanceInputMethod_Num = static_cast(getEnumerationValue(PIMNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + tower.PerformanceInputMethod_Num = static_cast(getEnumValue(PIMNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); if (tower.PerformanceInputMethod_Num == PIM::Invalid) { ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); ShowContinueError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4))); @@ -404,7 +404,7 @@ namespace CondenserLoopTowers { } // begin water use and systems get input - tower.EvapLossMode = static_cast(getEnumerationValue(EvapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(6)))); + tower.EvapLossMode = static_cast(getEnumValue(EvapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(6)))); tower.UserEvapLossFactor = NumArray(19); // N11 , \field Evaporation Loss Factor tower.DriftLossFraction = NumArray(20) / 100.0; // N12, \field Drift Loss Percent @@ -412,7 +412,7 @@ namespace CondenserLoopTowers { tower.SizFac = NumArray(25); // N17 \field Sizing Factor if (tower.SizFac <= 0.0) tower.SizFac = 1.0; - tower.BlowdownMode = static_cast(getEnumerationValue(BlowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(7)))); + tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(7)))); tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(8)); if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); @@ -457,8 +457,7 @@ namespace CondenserLoopTowers { if (state.dataIPShortCut->lAlphaFieldBlanks(11) || AlphArray(11).empty()) { tower.CapacityControl = CapacityCtrl::FanCycling; // FanCycling } else { - tower.CapacityControl = - static_cast(getEnumerationValue(CapacityCtrlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(11)))); + tower.CapacityControl = static_cast(getEnumValue(CapacityCtrlNamesUC, UtilityRoutines::makeUPPER(AlphArray(11)))); if (tower.CapacityControl == CapacityCtrl::Invalid) { tower.CapacityControl = CapacityCtrl::FanCycling; ShowWarningError(state, @@ -487,7 +486,7 @@ namespace CondenserLoopTowers { // cell control for single speed tower if (!state.dataIPShortCut->lAlphaFieldBlanks(12)) { - tower.cellCtrl = static_cast(getEnumerationValue(CellCtrlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(12)))); + tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, UtilityRoutines::makeUPPER(AlphArray(12)))); } // High speed air flow rate must be greater than free convection air flow rate. @@ -646,7 +645,7 @@ namespace CondenserLoopTowers { BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); if (NumAlphas >= 4) { - tower.PerformanceInputMethod_Num = static_cast(getEnumerationValue(PIMNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + tower.PerformanceInputMethod_Num = static_cast(getEnumValue(PIMNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); } else { // Since Performance Input Method has been omitted then assume it to be UA and DESIGN WATER FLOW RATE tower.PerformanceInputMethod_Num = PIM::UFactor; @@ -766,7 +765,7 @@ namespace CondenserLoopTowers { } // begin water use and systems get input - tower.EvapLossMode = static_cast(getEnumerationValue(EvapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(6)))); + tower.EvapLossMode = static_cast(getEnumValue(EvapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(6)))); tower.UserEvapLossFactor = NumArray(27); // N23 , \field Evaporation Loss Factor tower.DriftLossFraction = NumArray(28) / 100.0; // N24, \field Drift Loss Percent @@ -774,7 +773,7 @@ namespace CondenserLoopTowers { tower.SizFac = NumArray(33); // N21 \field Sizing Factor if (tower.SizFac <= 0.0) tower.SizFac = 1.0; - tower.BlowdownMode = static_cast(getEnumerationValue(BlowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(7)))); + tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(7)))); tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(8)); if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); @@ -801,7 +800,7 @@ namespace CondenserLoopTowers { // cell control for two speed tower if (!state.dataIPShortCut->lAlphaFieldBlanks(11)) { - tower.cellCtrl = static_cast(getEnumerationValue(CellCtrlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(11)))); + tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, UtilityRoutines::makeUPPER(AlphArray(11)))); } if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { @@ -1435,7 +1434,7 @@ namespace CondenserLoopTowers { } // begin water use and systems get input - tower.EvapLossMode = static_cast(getEnumerationValue(EvapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(8)))); + tower.EvapLossMode = static_cast(getEnumValue(EvapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(8)))); tower.UserEvapLossFactor = NumArray(11); // N11 , \field Evaporation Loss Factor tower.DriftLossFraction = NumArray(12) / 100.0; // N12, \field Drift Loss Percent @@ -1443,7 +1442,7 @@ namespace CondenserLoopTowers { tower.SizFac = NumArray(17); // N14 \field Sizing Factor if (tower.SizFac <= 0.0) tower.SizFac = 1.0; - tower.BlowdownMode = static_cast(getEnumerationValue(BlowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(9)))); + tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(9)))); tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(10)); if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(10), AlphArray(10))); @@ -1470,7 +1469,7 @@ namespace CondenserLoopTowers { // cell control for variable speed tower if (!state.dataIPShortCut->lAlphaFieldBlanks(13)) { - tower.cellCtrl = static_cast(getEnumerationValue(CellCtrlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(13)))); + tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, UtilityRoutines::makeUPPER(AlphArray(13)))); } if (state.dataIPShortCut->lAlphaFieldBlanks(11)) { @@ -1695,7 +1694,7 @@ namespace CondenserLoopTowers { } // begin water use and systems get input - tower.EvapLossMode = static_cast(getEnumerationValue(EvapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(10)))); + tower.EvapLossMode = static_cast(getEnumValue(EvapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(10)))); tower.UserEvapLossFactor = NumArray(23); // N23 , \field Evaporation Loss Factor tower.DriftLossFraction = NumArray(24) / 100.0; // N24, \field Drift Loss Percent @@ -1703,7 +1702,7 @@ namespace CondenserLoopTowers { tower.SizFac = NumArray(29); // N29 \field Sizing Factor if (tower.SizFac <= 0.0) tower.SizFac = 1.0; - tower.BlowdownMode = static_cast(getEnumerationValue(BlowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(11)))); + tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(11)))); tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(12)); if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(12), AlphArray(12))); @@ -1730,7 +1729,7 @@ namespace CondenserLoopTowers { tower.TowerMassFlowRateMultiplier = tower.MaxFracFlowRate; // cell control for variable speed Merkel tower if (!state.dataIPShortCut->lAlphaFieldBlanks(15)) { - tower.cellCtrl = static_cast(getEnumerationValue(CellCtrlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(15)))); + tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, UtilityRoutines::makeUPPER(AlphArray(15)))); } if (state.dataIPShortCut->lAlphaFieldBlanks(13)) { diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index efd3ca0b335..21d74f047aa 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -761,7 +761,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) intConvUserCurve.Name = ipsc->cAlphaArgs(1); ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, intConvUserCurve.Name}; - intConvUserCurve.refTempType = static_cast(getEnumerationValue(RefTempNamesUC, ipsc->cAlphaArgs(2))); + intConvUserCurve.refTempType = static_cast(getEnumValue(RefTempNamesUC, ipsc->cAlphaArgs(2))); if (intConvUserCurve.refTempType == RefTemp::Invalid) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; @@ -855,8 +855,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) extConvUserCurve.Name = ipsc->cAlphaArgs(1); ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, extConvUserCurve.Name}; - extConvUserCurve.windSpeedType = - static_cast(getEnumerationValue(RefWindNamesUC, UtilityRoutines::MakeUPPERCase(ipsc->cAlphaArgs(2)))); + extConvUserCurve.windSpeedType = static_cast(getEnumValue(RefWindNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(2)))); if (extConvUserCurve.windSpeedType == RefWind::Invalid) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; @@ -1039,7 +1038,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) ErrorsFound = true; } - HcExt hcExt = static_cast(getEnumerationValue(HcExtNamesUC, Alphas(Ptr + 1))); + HcExt hcExt = static_cast(getEnumValue(HcExtNamesUC, Alphas(Ptr + 1))); switch (hcExt) { @@ -1160,7 +1159,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) continue; } - HcInt hcInt = static_cast(getEnumerationValue(HcIntNamesUC, Alphas(Ptr + 1))); + HcInt hcInt = static_cast(getEnumValue(HcIntNamesUC, Alphas(Ptr + 1))); switch (hcInt) { // Are these not used anymore? They can be deleted then @@ -1295,7 +1294,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) ipsc->cNumericFieldNames); // Check Field 1 for validity ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, ""}; - SurfaceFilter surfaceFilter = static_cast(getEnumerationValue(SurfaceFilterNamesUC, Alphas(1))); + SurfaceFilter surfaceFilter = static_cast(getEnumValue(SurfaceFilterNamesUC, Alphas(1))); for (int Pass = 1, Ptr = 2, FieldNo = 2, NumField = 1; Pass <= 2; ++Pass, Ptr += 4, FieldNo += 4, ++NumField) { @@ -1303,7 +1302,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) if (Alphas(Ptr) == "OUTSIDE") { - HcExt hcExt = static_cast(getEnumerationValue(HcExtNamesUC, Alphas(Ptr + 1))); + HcExt hcExt = static_cast(getEnumValue(HcExtNamesUC, Alphas(Ptr + 1))); switch (hcExt) { @@ -1411,7 +1410,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) } // switch (hcExt) } else if (Alphas(Ptr) == "INSIDE") { - HcInt hcInt = static_cast(getEnumerationValue(HcIntNamesUC, Alphas(Ptr + 1))); + HcInt hcInt = static_cast(getEnumValue(HcIntNamesUC, Alphas(Ptr + 1))); switch (hcInt) { @@ -1590,7 +1589,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) auto &intAlgo = state.dataConvect->intAdaptiveConvAlgo; for (int iInConvClass = 0, i = 2; iInConvClass < (int)IntConvClass::Num && i <= NumAlphas; ++iInConvClass, i += 2) { - intAlgo.intConvClassEqNums[iInConvClass] = static_cast(getEnumerationValue(HcIntNamesUC, ipsc->cAlphaArgs(i))); + intAlgo.intConvClassEqNums[iInConvClass] = static_cast(getEnumValue(HcIntNamesUC, ipsc->cAlphaArgs(i))); if (intAlgo.intConvClassEqNums[iInConvClass] == HcInt::Invalid) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(i), ipsc->cAlphaArgs(i)); @@ -1628,7 +1627,7 @@ void GetUserConvCoeffs(EnergyPlusData &state) for (int iOutConvClass = 0, i = 2; i < (int)ExtConvClass::Num && i <= NumAlphas; ++iOutConvClass, i += 2) { - extAlgo.extConvClass2EqNums[iOutConvClass] = static_cast(getEnumerationValue(HcExtNamesUC, ipsc->cAlphaArgs(i))); + extAlgo.extConvClass2EqNums[iOutConvClass] = static_cast(getEnumValue(HcExtNamesUC, ipsc->cAlphaArgs(i))); if (extAlgo.extConvClass2EqNums[iOutConvClass] == HcExt::Invalid) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(i), ipsc->cAlphaArgs(i)); @@ -1980,10 +1979,10 @@ void CalcDetailedHcInForDVModel(EnergyPlusData &state, } } - assert(state.dataRoomAirMod->AirModel.allocated()); - if (state.dataRoomAirMod->AirModel(surface.Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV || - state.dataRoomAirMod->AirModel(surface.Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI || - state.dataRoomAirMod->AirModel(surface.Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { + assert(state.dataRoomAir->AirModel.allocated()); + if (state.dataRoomAir->AirModel(surface.Zone).AirModel == RoomAir::RoomAirModel::DispVent3Node || + state.dataRoomAir->AirModel(surface.Zone).AirModel == RoomAir::RoomAirModel::UFADInt || + state.dataRoomAir->AirModel(surface.Zone).AirModel == RoomAir::RoomAirModel::UFADExt) { // Set HConvIn using the proper correlation based on DeltaTemp and CosTiltSurf if (state.dataSurface->surfIntConv(SurfNum).userModelNum != 0) { @@ -1996,7 +1995,7 @@ void CalcDetailedHcInForDVModel(EnergyPlusData &state, -surface.CosTilt); // negative CosTilt because CosTilt is relative to exterior } - } else if (state.dataRoomAirMod->AirModel(surface.Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDCV) { + } else if (state.dataRoomAir->AirModel(surface.Zone).AirModel == RoomAir::RoomAirModel::CrossVent) { Hf = 4.3 * Vhc()(surface.Zone); @@ -3995,9 +3994,9 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu auto &zoneEquipList = state.dataZoneEquip->ZoneEquipList(zoneEquipConfig.EquipListIndex); for (int EquipNum = 1; EquipNum <= zoneEquipList.NumOfEquipTypes; ++EquipNum) { - switch (zoneEquipList.EquipTypeEnum(EquipNum)) { - case DataZoneEquipment::ZoneEquip::AirDistUnit: - case DataZoneEquipment::ZoneEquip::PurchasedAir: { + switch (zoneEquipList.EquipType(EquipNum)) { + case DataZoneEquipment::ZoneEquipType::AirDistributionUnit: + case DataZoneEquipment::ZoneEquipType::PurchasedAir: { if (!allocated(zoneEquipList.EquipData(EquipNum).OutletNodeNums)) continue; // get inlet node, not zone node if possible @@ -4010,15 +4009,15 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu CoolingPriorityStack[EquipOnCount] = zoneEquipList.CoolingPriority(EquipNum); } } break; - case DataZoneEquipment::ZoneEquip::WindowAC: - case DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir: - case DataZoneEquipment::ZoneEquip::PkgTermACAirToAir: - case DataZoneEquipment::ZoneEquip::ZoneDXDehumidifier: - case DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir: - case DataZoneEquipment::ZoneEquip::FanCoil4Pipe: - case DataZoneEquipment::ZoneEquip::UnitVentilator: - case DataZoneEquipment::ZoneEquip::UnitHeater: - case DataZoneEquipment::ZoneEquip::OutdoorAirUnit: { + case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: + case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: + case DataZoneEquipment::ZoneEquipType::DehumidifierDX: + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: + case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: + case DataZoneEquipment::ZoneEquipType::UnitVentilator: + case DataZoneEquipment::ZoneEquipType::UnitHeater: + case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { if (!allocated(zoneEquipList.EquipData(EquipNum).OutletNodeNums)) continue; int zoneInletNodeNum = zoneEquipList.EquipData(EquipNum).OutletNodeNums(1); @@ -4031,11 +4030,11 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu CoolingPriorityStack[EquipOnCount] = zoneEquipList.CoolingPriority(EquipNum); } } break; - case DataZoneEquipment::ZoneEquip::CoolingPanel: - case DataZoneEquipment::ZoneEquip::BBSteam: - case DataZoneEquipment::ZoneEquip::BBWaterConvective: - case DataZoneEquipment::ZoneEquip::BBElectricConvective: - case DataZoneEquipment::ZoneEquip::BBWater: { + case DataZoneEquipment::ZoneEquipType::CoolingPanel: + case DataZoneEquipment::ZoneEquipType::BaseboardSteam: + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: + case DataZoneEquipment::ZoneEquipType::BaseboardWater: { if (zoneEquipList.EquipData(EquipNum).ON) { EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); FlowRegimeStack[EquipOnCount] = InConvFlowRegime::B; @@ -4044,8 +4043,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu } } break; // Is this the same case as above? - case DataZoneEquipment::ZoneEquip::BBElectric: - case DataZoneEquipment::ZoneEquip::HiTempRadiant: { + case DataZoneEquipment::ZoneEquipType::BaseboardElectric: + case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: { if (zoneEquipList.EquipData(EquipNum).ON) { EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); FlowRegimeStack[EquipOnCount] = InConvFlowRegime::B; @@ -4053,8 +4052,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu CoolingPriorityStack[EquipOnCount] = zoneEquipList.CoolingPriority(EquipNum); } } break; - case DataZoneEquipment::ZoneEquip::VentilatedSlab: - case DataZoneEquipment::ZoneEquip::LoTempRadiant: { + case DataZoneEquipment::ZoneEquipType::VentilatedSlab: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiant: { if (zoneEquipConfig.InFloorActiveElement) { for (int spaceNum : zone.spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); diff --git a/src/EnergyPlus/CoolTower.cc b/src/EnergyPlus/CoolTower.cc index 107b7180fe8..3f80f4eb588 100644 --- a/src/EnergyPlus/CoolTower.cc +++ b/src/EnergyPlus/CoolTower.cc @@ -233,7 +233,7 @@ namespace CoolTower { { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FlowCtrlType = - static_cast(getEnumerationValue(FlowCtrlNamesUC, state.dataIPShortCut->cAlphaArgs(5))); // Type of flow control + static_cast(getEnumValue(FlowCtrlNamesUC, state.dataIPShortCut->cAlphaArgs(5))); // Type of flow control if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FlowCtrlType == FlowCtrl::Invalid) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index 3c2d4584982..17a6439640c 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -182,7 +182,7 @@ namespace CostEstimateManager { IOStatus); state.dataCostEstimateManager->CostLineItem(Item).LineName = state.dataIPShortCut->cAlphaArgs(1); state.dataCostEstimateManager->CostLineItem(Item).ParentObjType = - static_cast(getEnumerationValue(ParentObjectNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + static_cast(getEnumValue(ParentObjectNamesUC, state.dataIPShortCut->cAlphaArgs(3))); state.dataCostEstimateManager->CostLineItem(Item).ParentObjName = state.dataIPShortCut->cAlphaArgs(4); state.dataCostEstimateManager->CostLineItem(Item).PerEach = state.dataIPShortCut->rNumericArgs(1); state.dataCostEstimateManager->CostLineItem(Item).PerSquareMeter = state.dataIPShortCut->rNumericArgs(2); diff --git a/src/EnergyPlus/CrossVentMgr.cc b/src/EnergyPlus/CrossVentMgr.cc index c38d76f155f..7843cc084d2 100644 --- a/src/EnergyPlus/CrossVentMgr.cc +++ b/src/EnergyPlus/CrossVentMgr.cc @@ -64,7 +64,6 @@ #include #include #include -#include #include #include #include @@ -73,7 +72,7 @@ namespace EnergyPlus { -namespace CrossVentMgr { +namespace RoomAir { // MODULE INFORMATION: // AUTHOR G. Carrilho da Graca @@ -86,7 +85,6 @@ namespace CrossVentMgr { using namespace DataHeatBalance; using namespace DataHeatBalSurface; using namespace DataSurfaces; - using namespace DataRoomAirModel; using Convect::CalcDetailedHcInForDVModel; Real64 constexpr Cjet1(1.873); // First correlation constant for the jet velocity @@ -98,8 +96,8 @@ namespace CrossVentMgr { Real64 constexpr CrecFlow1(0.415); // First correlation constant for the recirculation flow rate Real64 constexpr CrecFlow2(0.466); // Second correlation constant for the recirculation flow rate - void ManageUCSDCVModel(EnergyPlusData &state, - int const ZoneNum) // index number for the specified zone + void ManageCrossVent(EnergyPlusData &state, + int const ZoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: @@ -109,13 +107,13 @@ namespace CrossVentMgr { // PURPOSE OF THIS SUBROUTINE: // manage the UCSD Cross Ventilation model - InitUCSDCV(state, ZoneNum); + InitCrossVent(state, ZoneNum); // perform Cross Ventilation model calculations - CalcUCSDCV(state, ZoneNum); + CalcCrossVent(state, ZoneNum); } - void InitUCSDCV(EnergyPlusData &state, int const ZoneNum) + void InitCrossVent(EnergyPlusData &state, int const ZoneNum) { // SUBROUTINE INFORMATION: @@ -144,7 +142,7 @@ namespace CrossVentMgr { } } - void HcUCSDCV(EnergyPlusData &state, int const ZoneNum) + void HcCrossVent(EnergyPlusData &state, int const ZoneNum) { // SUBROUTINE INFORMATION: @@ -166,181 +164,164 @@ namespace CrossVentMgr { state.dataCrossVentMgr->HA_R = 0.0; // Is the air flow model for this zone set to UCSDCV Cross Ventilation? - if (state.dataRoomAirMod->IsZoneCV(ZoneNum)) { + if (state.dataRoomAir->IsZoneCrossVent(ZoneNum)) { + + Real64 zoneJetRecAreaRatio = state.dataRoomAir->JetRecAreaRatio(ZoneNum); + // WALL Hc, HA and HAT calculation - for (int Ctd = state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Wall(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Wall(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Wall(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Wall(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - state.dataUCSDShared->HWall(Ctd) = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataCrossVentMgr->HAT_R += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWall(Ctd); - state.dataCrossVentMgr->HA_R += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWall(Ctd); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataCrossVentMgr->HAT_R += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd); + state.dataCrossVentMgr->HA_R += surf.Area * state.dataRoomAir->HWall(Ctd); } // END WALL // WINDOW Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Window(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Window(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).Tilt > 10.0 && state.dataSurface->Surface(SurfNum).Tilt < 170.0) { // Window Wall - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Window Wall + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataCrossVentMgr->HAT_R += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataCrossVentMgr->HA_R += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataCrossVentMgr->HAT_R += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + state.dataCrossVentMgr->HA_R += surf.Area * state.dataRoomAir->HWindow(Ctd); } - if (state.dataSurface->Surface(SurfNum).Tilt <= 10.0) { // Window Ceiling - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTJET(ZoneNum); + if (surf.Tilt <= 10.0) { // Window Ceiling + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTJET(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Ujet); - Real64 Hjet = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Ujet); + Real64 Hjet = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - Real64 Hrec = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataUCSDShared->HWindow(Ctd) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet + (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_R += state.dataSurface->Surface(SurfNum).Area * - (1.0 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; - state.dataCrossVentMgr->HA_R += - state.dataSurface->Surface(SurfNum).Area * (1.0 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; - state.dataCrossVentMgr->HA_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet; + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + Real64 Hrec = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataRoomAir->HWindow(Ctd) = zoneJetRecAreaRatio * Hjet + (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_R += surf.Area * (1.0 - zoneJetRecAreaRatio) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; + state.dataCrossVentMgr->HA_R += surf.Area * (1.0 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_J += surf.Area * zoneJetRecAreaRatio * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; + state.dataCrossVentMgr->HA_J += surf.Area * zoneJetRecAreaRatio * Hjet; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * state.dataRoomAirMod->ZTJET(ZoneNum) + - (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * state.dataRoomAirMod->ZTREC(ZoneNum); + zoneJetRecAreaRatio * state.dataRoomAir->ZTJET(ZoneNum) + (1 - zoneJetRecAreaRatio) * state.dataRoomAir->ZTREC(ZoneNum); } - if (state.dataSurface->Surface(SurfNum).Tilt >= 170.0) { // Window Floor - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTJET(ZoneNum); + if (surf.Tilt >= 170.0) { // Window Floor + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTJET(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Ujet); - Real64 Hjet = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Ujet); + Real64 Hjet = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - Real64 Hrec = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataUCSDShared->HWindow(Ctd) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet + (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_R += state.dataSurface->Surface(SurfNum).Area * - (1.0 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; - state.dataCrossVentMgr->HA_R += - state.dataSurface->Surface(SurfNum).Area * (1.0 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; - state.dataCrossVentMgr->HA_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet; + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + Real64 Hrec = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataRoomAir->HWindow(Ctd) = zoneJetRecAreaRatio * Hjet + (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_R += surf.Area * (1.0 - zoneJetRecAreaRatio) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; + state.dataCrossVentMgr->HA_R += surf.Area * (1.0 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_J += surf.Area * zoneJetRecAreaRatio * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; + state.dataCrossVentMgr->HA_J += surf.Area * zoneJetRecAreaRatio * Hjet; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * state.dataRoomAirMod->ZTJET(ZoneNum) + - (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * state.dataRoomAirMod->ZTREC(ZoneNum); + zoneJetRecAreaRatio * state.dataRoomAir->ZTJET(ZoneNum) + (1 - zoneJetRecAreaRatio) * state.dataRoomAir->ZTREC(ZoneNum); } - state.dataRoomAirMod->CVHcIn(SurfNum) = state.dataUCSDShared->HWindow(Ctd); + state.dataRoomAir->CrossVentHcIn(SurfNum) = state.dataRoomAir->HWindow(Ctd); } // END WINDOW // DOOR Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 2); - ++Ctd) { // DOOR - int SurfNum = state.dataUCSDShared->APos_Door(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Door(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Door(ZoneNum).end; ++Ctd) { // DOOR + int SurfNum = state.dataRoomAir->APos_Door(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataCrossVentMgr->HAT_R += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataCrossVentMgr->HA_R += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataCrossVentMgr->HAT_R += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + state.dataCrossVentMgr->HA_R += surf.Area * state.dataRoomAir->HDoor(Ctd); } // END DOOR + // INTERNAL Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 1); - Ctd <= state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Internal(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Internal(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Internal(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Internal(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - state.dataUCSDShared->HInternal(Ctd) = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataCrossVentMgr->HAT_R += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HInternal(Ctd); - state.dataCrossVentMgr->HA_R += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HInternal(Ctd); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + state.dataRoomAir->HInternal(Ctd) = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataCrossVentMgr->HAT_R += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HInternal(Ctd); + state.dataCrossVentMgr->HA_R += surf.Area * state.dataRoomAir->HInternal(Ctd); } // END INTERNAL // CEILING Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 1); - Ctd <= state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Ceiling(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTJET(ZoneNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTJET(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Ujet); - Real64 Hjet = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Ujet); + Real64 Hjet = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - Real64 Hrec = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataUCSDShared->HCeiling(Ctd) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet + (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_R += state.dataSurface->Surface(SurfNum).Area * (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; - state.dataCrossVentMgr->HA_R += - state.dataSurface->Surface(SurfNum).Area * (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; - state.dataCrossVentMgr->HA_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet; + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + Real64 Hrec = state.dataRoomAir->CrossVentHcIn(SurfNum); + + state.dataRoomAir->HCeiling(Ctd) = zoneJetRecAreaRatio * Hjet + (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_R += surf.Area * (1 - zoneJetRecAreaRatio) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; + state.dataCrossVentMgr->HA_R += surf.Area * (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_J += surf.Area * zoneJetRecAreaRatio * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; + state.dataCrossVentMgr->HA_J += surf.Area * zoneJetRecAreaRatio * Hjet; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * state.dataRoomAirMod->ZTJET(ZoneNum) + - (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * state.dataRoomAirMod->ZTREC(ZoneNum); - state.dataRoomAirMod->CVHcIn(SurfNum) = state.dataUCSDShared->HCeiling(Ctd); + zoneJetRecAreaRatio * state.dataRoomAir->ZTJET(ZoneNum) + (1 - zoneJetRecAreaRatio) * state.dataRoomAir->ZTREC(ZoneNum); + state.dataRoomAir->CrossVentHcIn(SurfNum) = state.dataRoomAir->HCeiling(Ctd); } // END CEILING // FLOOR Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Floor(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Floor(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTJET(ZoneNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTJET(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Ujet); - Real64 Hjet = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTREC(ZoneNum); + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Ujet); + Real64 Hjet = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTREC(ZoneNum); CalcDetailedHcInForDVModel( - state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->CVHcIn, state.dataRoomAirMod->Urec); - Real64 Hrec = state.dataRoomAirMod->CVHcIn(SurfNum); - state.dataUCSDShared->HFloor(Ctd) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet + (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_R += state.dataSurface->Surface(SurfNum).Area * (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; - state.dataCrossVentMgr->HA_R += - state.dataSurface->Surface(SurfNum).Area * (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * Hrec; - state.dataCrossVentMgr->HAT_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; - state.dataCrossVentMgr->HA_J += state.dataSurface->Surface(SurfNum).Area * state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * Hjet; + state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->CrossVentHcIn, state.dataRoomAir->Urec); + Real64 Hrec = state.dataRoomAir->CrossVentHcIn(SurfNum); + state.dataRoomAir->HFloor(Ctd) = zoneJetRecAreaRatio * Hjet + (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_R += surf.Area * (1 - zoneJetRecAreaRatio) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hrec; + state.dataCrossVentMgr->HA_R += surf.Area * (1 - zoneJetRecAreaRatio) * Hrec; + state.dataCrossVentMgr->HAT_J += surf.Area * zoneJetRecAreaRatio * state.dataHeatBalSurf->SurfTempIn(SurfNum) * Hjet; + state.dataCrossVentMgr->HA_J += surf.Area * zoneJetRecAreaRatio * Hjet; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) * state.dataRoomAirMod->ZTJET(ZoneNum) + - (1 - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum)) * state.dataRoomAirMod->ZTREC(ZoneNum); - state.dataRoomAirMod->CVHcIn(SurfNum) = state.dataUCSDShared->HFloor(Ctd); + zoneJetRecAreaRatio * state.dataRoomAir->ZTJET(ZoneNum) + (1 - zoneJetRecAreaRatio) * state.dataRoomAir->ZTREC(ZoneNum); + state.dataRoomAir->CrossVentHcIn(SurfNum) = state.dataRoomAir->HFloor(Ctd); } // END FLOOR } } - void EvolveParaUCSDCV(EnergyPlusData &state, int const ZoneNum) + void EvolveParaCrossVent(EnergyPlusData &state, int const ZoneNum) { // SUBROUTINE INFORMATION: @@ -361,49 +342,46 @@ namespace CrossVentMgr { Real64 SumToZone(0.0); // Sum of velocities through Real64 MaxFlux(0.0); int MaxSurf(0); - Real64 XX; - Real64 YY; - Real64 ZZ; - Real64 XX_Wall; - Real64 YY_Wall; - Real64 ZZ_Wall; Real64 ActiveSurfNum; int NSides; // Number of sides in surface Real64 Wroom; // Room width Real64 Aroom; // Room area cross section - assert(state.dataRoomAirMod->AirModel.allocated()); - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = 0.0; + assert(state.dataRoomAir->AirModel.allocated()); + state.dataRoomAir->RecInflowRatio(ZoneNum) = 0.0; auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); // Identify the dominant aperture: - MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum); + MaxSurf = state.dataRoomAir->AFNSurfaceCrossVent(1, ZoneNum); int const surfNum = state.afn->MultizoneSurfaceData(MaxSurf).SurfNum; auto const &thisSurface = state.dataSurface->Surface(surfNum); + + int afnSurfNum1 = state.dataRoomAir->AFNSurfaceCrossVent(1, ZoneNum); + if (thisSurface.Zone == ZoneNum) { // this is a direct airflow network aperture - SumToZone = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; - MaxFlux = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; + SumToZone = state.afn->AirflowNetworkLinkSimu(afnSurfNum1).VolFLOW2; + MaxFlux = state.afn->AirflowNetworkLinkSimu(afnSurfNum1).VolFLOW2; } else { // this is an indirect airflow network aperture - SumToZone = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; - MaxFlux = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; + SumToZone = state.afn->AirflowNetworkLinkSimu(afnSurfNum1).VolFLOW; + MaxFlux = state.afn->AirflowNetworkLinkSimu(afnSurfNum1).VolFLOW; } - for (int Ctd2 = 2; Ctd2 <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd2) { - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).SurfNum) - .Zone == ZoneNum) { - if (state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2 > MaxFlux) { - MaxFlux = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; - MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum); + for (int Ctd2 = 2; Ctd2 <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd2) { + int afnSurfNum = state.dataRoomAir->AFNSurfaceCrossVent(Ctd2, ZoneNum); + if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(afnSurfNum).SurfNum).Zone == ZoneNum) { + if (state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW2 > MaxFlux) { + MaxFlux = state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW2; + MaxSurf = afnSurfNum; } - SumToZone += state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; + SumToZone += state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW2; } else { - if (state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW > MaxFlux) { - MaxFlux = state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; - MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum); + if (state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW > MaxFlux) { + MaxFlux = state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW; + MaxSurf = afnSurfNum; } - SumToZone += state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; + SumToZone += state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW; } } @@ -411,45 +389,44 @@ namespace CrossVentMgr { SurfNorm = thisSurface.Azimuth; CosPhi = std::cos((state.dataEnvrn->WindDir - SurfNorm) * Constant::DegToRadians); if (CosPhi <= 0) { - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - auto flows(state.dataRoomAirMod->CVJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + auto flows(state.dataRoomAir->CrossVentJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) for (int i = 1, u = flows.u(); i <= u; ++i) { auto &e(flows(i)); e.Ujet = e.Urec = 0.0; } - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; if (thisSurface.ExtBoundCond > 0) { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).MAT; } else if (thisSurface.ExtBoundCond == ExternalEnvironment) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == Ground) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == OtherSideCoefNoCalcExt || thisSurface.ExtBoundCond == OtherSideCoefCalcExt) { auto &thisOSC = state.dataSurface->OSC(thisSurface.OSCPtr); thisOSC.OSCTempCalc = (thisOSC.ZoneAirTempCoef * thisZoneHB.MAT + thisOSC.ExtDryBulbCoef * state.dataSurface->SurfOutDryBulbTemp(surfNum) + thisOSC.ConstTempCoef * thisOSC.ConstTemp + thisOSC.GroundTempCoef * state.dataEnvrn->GroundTemp + thisOSC.WindSpeedCoef * state.dataSurface->SurfOutWindSpeed(surfNum) * state.dataSurface->SurfOutDryBulbTemp(surfNum)); - state.dataRoomAirMod->Tin(ZoneNum) = thisOSC.OSCTempCalc; + state.dataRoomAir->Tin(ZoneNum) = thisOSC.OSCTempCalc; } else { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } return; } // Calculate the opening area for all apertures - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { + for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { + auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); + auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(Ctd); int cCompNum = state.afn->AirflowNetworkLinkageData(Ctd).CompNum; if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area = state.dataRoomAirMod->SurfParametersCVDV(Ctd).Width * - state.dataRoomAirMod->SurfParametersCVDV(Ctd).Height * - state.afn->MultizoneSurfaceData(Ctd).OpenFactor; + jetRecFlows.Area = surfParams.Width * surfParams.Height * state.afn->MultizoneSurfaceData(Ctd).OpenFactor; } else if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::SCR) { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area = - state.dataRoomAirMod->SurfParametersCVDV(Ctd).Width * state.dataRoomAirMod->SurfParametersCVDV(Ctd).Height; + jetRecFlows.Area = surfParams.Width * surfParams.Height; } else { ShowSevereError( state, "RoomAirModelCrossVent:EvolveParaUCSDCV: Illegal leakage component referenced in the cross ventilation room air model"); @@ -468,77 +445,66 @@ namespace CrossVentMgr { // Droom the distance between the average point of the base surface of the airflow network Surface (if the base surface // is a Window or Door it looks for the second base surface). // Dstar is Droom corrected for wind angle + + Vector3 baseCentroid; + Wroom = state.dataHeatBal->Zone(ZoneNum).Volume / state.dataHeatBal->Zone(ZoneNum).FloorArea; - auto const &baseSurface(state.dataSurface->Surface(thisSurface.BaseSurf)); + auto const &baseSurface = state.dataSurface->Surface(thisSurface.BaseSurf); if ((baseSurface.Sides == 3) || (baseSurface.Sides == 4)) { - XX = baseSurface.Centroid.x; - YY = baseSurface.Centroid.y; - ZZ = baseSurface.Centroid.z; + baseCentroid = baseSurface.Centroid; } else { // If the surface has more than 4 vertex then average the vertex coordinates in X, Y and Z. NSides = baseSurface.Sides; assert(NSides > 0); - XX = YY = ZZ = 0.0; + baseCentroid = {0.0, 0.0, 0.0}; for (int i = 1; i <= NSides; ++i) { - auto const &v(baseSurface.Vertex(i)); - XX += v.x; - YY += v.y; - ZZ += v.z; + baseCentroid += baseSurface.Vertex(i); } - XX /= double(NSides); - YY /= double(NSides); - ZZ /= double(NSides); + baseCentroid /= double(NSides); } + Vector3 wallCentroid; Real64 const Wroom_2(pow_2(Wroom)); - for (int Ctd = state.dataUCSDShared->PosZ_Wall(2 * ZoneNum - 1); Ctd <= state.dataUCSDShared->PosZ_Wall(2 * ZoneNum); ++Ctd) { - if ((state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Sides == 3) || - (state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Sides == 4)) { - XX_Wall = state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Centroid.x; - YY_Wall = state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Centroid.y; - ZZ_Wall = state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Centroid.z; + for (int Ctd = state.dataRoomAir->PosZ_Wall(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Wall(ZoneNum).end; ++Ctd) { + if ((state.dataSurface->Surface(state.dataRoomAir->APos_Wall(Ctd)).Sides == 3) || + (state.dataSurface->Surface(state.dataRoomAir->APos_Wall(Ctd)).Sides == 4)) { + wallCentroid = state.dataSurface->Surface(state.dataRoomAir->APos_Wall(Ctd)).Centroid; } else { - NSides = state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Sides; + NSides = state.dataSurface->Surface(state.dataRoomAir->APos_Wall(Ctd)).Sides; assert(NSides > 0); - XX_Wall = YY_Wall = ZZ_Wall = 0.0; + wallCentroid = {0.0, 0.0, 0.0}; for (int i = 1; i <= NSides; ++i) { - auto const &v(state.dataSurface->Surface(state.dataUCSDShared->APos_Wall(Ctd)).Vertex(i)); - XX_Wall += v.x; - YY_Wall += v.y; - ZZ_Wall += v.z; + wallCentroid += state.dataSurface->Surface(state.dataRoomAir->APos_Wall(Ctd)).Vertex(i); } - XX_Wall /= double(NSides); - YY_Wall /= double(NSides); - ZZ_Wall /= double(NSides); + wallCentroid /= double(NSides); } - double DroomTemp = std::sqrt(pow_2(XX - XX_Wall) + pow_2(YY - YY_Wall) + pow_2(ZZ - ZZ_Wall)); - if (DroomTemp > state.dataRoomAirMod->Droom(ZoneNum)) { - state.dataRoomAirMod->Droom(ZoneNum) = DroomTemp; + double DroomTemp = + std::sqrt(pow_2(baseCentroid.x - wallCentroid.x) + pow_2(baseCentroid.y - wallCentroid.y) + pow_2(baseCentroid.z - wallCentroid.z)); + if (DroomTemp > state.dataRoomAir->Droom(ZoneNum)) { + state.dataRoomAir->Droom(ZoneNum) = DroomTemp; } - state.dataRoomAirMod->Dstar(ZoneNum) = - min(state.dataRoomAirMod->Droom(ZoneNum) / CosPhi, std::sqrt(Wroom_2 + pow_2(state.dataRoomAirMod->Droom(ZoneNum)))); + state.dataRoomAir->Dstar(ZoneNum) = + min(state.dataRoomAir->Droom(ZoneNum) / CosPhi, std::sqrt(Wroom_2 + pow_2(state.dataRoomAir->Droom(ZoneNum)))); } // Room area - Aroom = state.dataHeatBal->Zone(ZoneNum).Volume / state.dataRoomAirMod->Droom(ZoneNum); + Aroom = state.dataHeatBal->Zone(ZoneNum).Volume / state.dataRoomAir->Droom(ZoneNum); // Populate an array of inflow volume fluxes (Fin) for all apertures in the zone // Calculate inflow velocity (%Uin) for each aperture in the zone - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { + for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { + auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(Ctd).SurfNum).Zone == ZoneNum) { // this is a direct airflow network aperture - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW2; + jetRecFlows.Fin = state.afn->AirflowNetworkLinkSimu(state.dataRoomAir->AFNSurfaceCrossVent(Ctd, ZoneNum)).VolFLOW2; } else { // this is an indirect airflow network aperture - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW; + jetRecFlows.Fin = state.afn->AirflowNetworkLinkSimu(state.dataRoomAir->AFNSurfaceCrossVent(Ctd, ZoneNum)).VolFLOW; } - if (state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area != 0) { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin = - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin / state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area; + if (jetRecFlows.Area != 0) { + jetRecFlows.Uin = jetRecFlows.Fin / jetRecFlows.Area; } else { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin = 0.0; + jetRecFlows.Uin = 0.0; } } @@ -546,42 +512,39 @@ namespace CrossVentMgr { // Create a flow flag for each aperture // Calculate the total area of all active apertures ActiveSurfNum = 0.0; - state.dataRoomAirMod->Ain(ZoneNum) = 0.0; - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { - if (state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin <= MinUin) { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag = 0; - } else { - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag = 1; - } - ActiveSurfNum += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag; - state.dataRoomAirMod->Ain(ZoneNum) += - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag; + state.dataRoomAir->Ain(ZoneNum) = 0.0; + for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { + auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); + jetRecFlows.FlowFlag = (int)(jetRecFlows.Uin > MinUin); + + ActiveSurfNum += jetRecFlows.FlowFlag; + state.dataRoomAir->Ain(ZoneNum) += jetRecFlows.Area * jetRecFlows.FlowFlag; } // Verify if any of the apertures have minimum flow if (ActiveSurfNum == 0) { - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; if (thisSurface.ExtBoundCond > 0) { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).MAT; } else if (thisSurface.ExtBoundCond == ExternalEnvironment) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == Ground) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == OtherSideCoefNoCalcExt || thisSurface.ExtBoundCond == OtherSideCoefCalcExt) { auto &thisOSC = state.dataSurface->OSC(thisSurface.OSCPtr); thisOSC.OSCTempCalc = (thisOSC.ZoneAirTempCoef * thisZoneHB.MAT + thisOSC.ExtDryBulbCoef * state.dataSurface->SurfOutDryBulbTemp(surfNum) + thisOSC.ConstTempCoef * thisOSC.ConstTemp + thisOSC.GroundTempCoef * state.dataEnvrn->GroundTemp + thisOSC.WindSpeedCoef * state.dataSurface->SurfOutWindSpeed(surfNum) * state.dataSurface->SurfOutDryBulbTemp(surfNum)); - state.dataRoomAirMod->Tin(ZoneNum) = thisOSC.OSCTempCalc; + state.dataRoomAir->Tin(ZoneNum) = thisOSC.OSCTempCalc; } else { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; - auto flows(state.dataRoomAirMod->CVJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; + auto flows(state.dataRoomAir->CrossVentJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) for (int i = 1, u = flows.u(); i <= u; ++i) { auto &e(flows(i)); e.Ujet = e.Urec = 0.0; @@ -593,128 +556,107 @@ namespace CrossVentMgr { // Calculate Qtot, the total volumetric flow rate through all active openings in the zone Uin = 0.0; - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { - Uin += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag / state.dataRoomAirMod->Ain(ZoneNum); + for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { + auto const &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); + Uin += jetRecFlows.Area * jetRecFlows.Uin * jetRecFlows.FlowFlag / state.dataRoomAir->Ain(ZoneNum); } // Verify if Uin is higher than minimum: if (Uin < MinUin) { - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = 0.0; - auto flows(state.dataRoomAirMod->CVJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; + state.dataRoomAir->RecInflowRatio(ZoneNum) = 0.0; + auto flows(state.dataRoomAir->CrossVentJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) for (int i = 1, u = flows.u(); i <= u; ++i) { auto &e(flows(i)); e.Ujet = e.Urec = 0.0; } if (thisSurface.ExtBoundCond > 0) { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).MAT; } else if (thisSurface.ExtBoundCond == ExternalEnvironment) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == Ground) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == OtherSideCoefNoCalcExt || thisSurface.ExtBoundCond == OtherSideCoefCalcExt) { auto &thisOSC = state.dataSurface->OSC(thisSurface.OSCPtr); thisOSC.OSCTempCalc = (thisOSC.ZoneAirTempCoef * thisZoneHB.MAT + thisOSC.ExtDryBulbCoef * state.dataSurface->SurfOutDryBulbTemp(surfNum) + thisOSC.ConstTempCoef * thisOSC.ConstTemp + thisOSC.GroundTempCoef * state.dataEnvrn->GroundTemp + thisOSC.WindSpeedCoef * state.dataSurface->SurfOutWindSpeed(surfNum) * state.dataSurface->SurfOutDryBulbTemp(surfNum)); - state.dataRoomAirMod->Tin(ZoneNum) = thisOSC.OSCTempCalc; + state.dataRoomAir->Tin(ZoneNum) = thisOSC.OSCTempCalc; } else { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } return; } // Evaluate parameter that determines whether recirculations are present - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->TotUCSDCV; ++Ctd) { - if (ZoneNum == state.dataRoomAirMod->ZoneUCSDCV(Ctd).ZonePtr) { - if (state.dataRoomAirMod->Ain(ZoneNum) / Aroom > 1.0 / 2.0) { - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) = 1.0; + for (int Ctd = 1; Ctd <= state.dataRoomAir->TotCrossVent; ++Ctd) { + if (ZoneNum == state.dataRoomAir->ZoneCrossVent(Ctd).ZonePtr) { + if (state.dataRoomAir->Ain(ZoneNum) / Aroom > 1.0 / 2.0) { + state.dataRoomAir->JetRecAreaRatio(ZoneNum) = 1.0; } else { - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) = std::sqrt(state.dataRoomAirMod->Ain(ZoneNum) / Aroom); + state.dataRoomAir->JetRecAreaRatio(ZoneNum) = std::sqrt(state.dataRoomAir->Ain(ZoneNum) / Aroom); } } } - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; // Calculate jet and recirculation velocities for all active apertures - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; - state.dataRoomAirMod->Qtot(ZoneNum) = 0.0; - auto flows(state.dataRoomAirMod->CVJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; + state.dataRoomAir->Qtot(ZoneNum) = 0.0; + auto flows(state.dataRoomAir->CrossVentJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) for (int i = 1, u = flows.u(); i <= u; ++i) { auto &e(flows(i)); e.Ujet = e.Urec = e.Qrec = 0.0; } - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { - if (state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin != 0) { - Real64 dstarexp = - max(state.dataRoomAirMod->Dstar(ZoneNum) / (6.0 * std::sqrt(state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area)), 1.0); - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Vjet = state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin * - std::sqrt(state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area) * 6.3 * - std::log(dstarexp) / state.dataRoomAirMod->Dstar(ZoneNum); - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Yjet = - Cjet1 * std::sqrt(state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area / Aroom) * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Vjet / state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin + - Cjet2; - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Yrec = - Crec1 * std::sqrt(state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area / Aroom) * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Vjet / state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin + - Crec2; - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).YQrec = - CrecFlow1 * std::sqrt(state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * Aroom) * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Vjet / state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin + - CrecFlow2; - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Ujet = state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Yjet / - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin; - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Urec = state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Yrec / - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin; - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Qrec = state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).YQrec / - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin; - state.dataRoomAirMod->Ujet(ZoneNum) += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Ujet / state.dataRoomAirMod->Ain(ZoneNum); - state.dataRoomAirMod->Urec(ZoneNum) += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Urec / state.dataRoomAirMod->Ain(ZoneNum); - state.dataRoomAirMod->Qrec(ZoneNum) += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Qrec; - state.dataRoomAirMod->Qtot(ZoneNum) += - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin * state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).FlowFlag; - state.dataRoomAirMod->Urec(ZoneNum) += state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area * - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Urec / state.dataRoomAirMod->Ain(ZoneNum); - } + for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { + auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); + if (jetRecFlows.Uin == 0) continue; + + Real64 dstarexp = max(state.dataRoomAir->Dstar(ZoneNum) / (6.0 * std::sqrt(jetRecFlows.Area)), 1.0); + jetRecFlows.Vjet = jetRecFlows.Uin * std::sqrt(jetRecFlows.Area) * 6.3 * std::log(dstarexp) / state.dataRoomAir->Dstar(ZoneNum); + jetRecFlows.Yjet = Cjet1 * std::sqrt(jetRecFlows.Area / Aroom) * jetRecFlows.Vjet / jetRecFlows.Uin + Cjet2; + jetRecFlows.Yrec = Crec1 * std::sqrt(jetRecFlows.Area / Aroom) * jetRecFlows.Vjet / jetRecFlows.Uin + Crec2; + jetRecFlows.YQrec = CrecFlow1 * std::sqrt(jetRecFlows.Area * Aroom) * jetRecFlows.Vjet / jetRecFlows.Uin + CrecFlow2; + jetRecFlows.Ujet = jetRecFlows.FlowFlag * jetRecFlows.Yjet / jetRecFlows.Uin; + jetRecFlows.Urec = jetRecFlows.FlowFlag * jetRecFlows.Yrec / jetRecFlows.Uin; + jetRecFlows.Qrec = jetRecFlows.FlowFlag * jetRecFlows.YQrec / jetRecFlows.Uin; + state.dataRoomAir->Ujet(ZoneNum) += jetRecFlows.Area * jetRecFlows.Ujet / state.dataRoomAir->Ain(ZoneNum); + state.dataRoomAir->Urec(ZoneNum) += jetRecFlows.Area * jetRecFlows.Urec / state.dataRoomAir->Ain(ZoneNum); + state.dataRoomAir->Qrec(ZoneNum) += jetRecFlows.Qrec; + state.dataRoomAir->Qtot(ZoneNum) += jetRecFlows.Fin * jetRecFlows.FlowFlag; + state.dataRoomAir->Urec(ZoneNum) += jetRecFlows.Area * jetRecFlows.Urec / state.dataRoomAir->Ain(ZoneNum); } // Ratio between recirculation flow rate and total inflow rate - if (state.dataRoomAirMod->Qtot(ZoneNum) != 0) { - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = state.dataRoomAirMod->Qrec(ZoneNum) / state.dataRoomAirMod->Qtot(ZoneNum); + if (state.dataRoomAir->Qtot(ZoneNum) != 0) { + state.dataRoomAir->RecInflowRatio(ZoneNum) = state.dataRoomAir->Qrec(ZoneNum) / state.dataRoomAir->Qtot(ZoneNum); } else { - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = 0.0; + state.dataRoomAir->RecInflowRatio(ZoneNum) = 0.0; } // Set Tin based on external conditions of the dominant aperture if (thisSurface.ExtBoundCond <= 0) { if (thisSurface.ExtBoundCond == ExternalEnvironment) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == Ground) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } else if (thisSurface.ExtBoundCond == OtherSideCoefNoCalcExt || thisSurface.ExtBoundCond == OtherSideCoefCalcExt) { auto &thisOSC = state.dataSurface->OSC(thisSurface.OSCPtr); thisOSC.OSCTempCalc = (thisOSC.ZoneAirTempCoef * thisZoneHB.MAT + thisOSC.ExtDryBulbCoef * state.dataSurface->SurfOutDryBulbTemp(surfNum) + thisOSC.ConstTempCoef * thisOSC.ConstTemp + thisOSC.GroundTempCoef * state.dataEnvrn->GroundTemp + thisOSC.WindSpeedCoef * state.dataSurface->SurfOutWindSpeed(surfNum) * state.dataSurface->SurfOutDryBulbTemp(surfNum)); - state.dataRoomAirMod->Tin(ZoneNum) = thisOSC.OSCTempCalc; + state.dataRoomAir->Tin(ZoneNum) = thisOSC.OSCTempCalc; } else { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); } } else { // adiabatic surface @@ -723,49 +665,49 @@ namespace CrossVentMgr { int NodeNum2 = state.afn->AirflowNetworkLinkageData(MaxSurf).NodeNums[1]; if (thisSurface.Zone == ZoneNum) { if (state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum <= 0) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); - } else if (state.dataRoomAirMod->AirModel(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum).AirModelType == - DataRoomAirModel::RoomAirModel::UCSDCV) { - state.dataRoomAirMod->Tin(ZoneNum) = - state.dataRoomAirMod->RoomOutflowTemp(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + } else if (state.dataRoomAir->AirModel(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum).AirModel == + RoomAir::RoomAirModel::CrossVent) { + state.dataRoomAir->Tin(ZoneNum) = + state.dataRoomAir->RoomOutflowTemp(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum); } else { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.afn->AirflowNetworkNodeData(NodeNum1).EPlusZoneNum).MAT; } } else { if (state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum <= 0) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); - } else if (state.dataRoomAirMod->AirModel(state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum).AirModelType == - DataRoomAirModel::RoomAirModel::UCSDCV) { - state.dataRoomAirMod->Tin(ZoneNum) = - state.dataRoomAirMod->RoomOutflowTemp(state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum); + state.dataRoomAir->Tin(ZoneNum) = state.dataSurface->SurfOutDryBulbTemp(surfNum); + } else if (state.dataRoomAir->AirModel(state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum).AirModel == + RoomAir::RoomAirModel::CrossVent) { + state.dataRoomAir->Tin(ZoneNum) = + state.dataRoomAir->RoomOutflowTemp(state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum); } else { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.afn->AirflowNetworkNodeData(NodeNum2).EPlusZoneNum).MAT; } } } else if ((thisSurface.Zone == ZoneNum) && - (state.dataRoomAirMod->AirModel(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).AirModelType == - DataRoomAirModel::RoomAirModel::UCSDCV)) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataRoomAirMod->RoomOutflowTemp(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone); + (state.dataRoomAir->AirModel(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).AirModel == + RoomAir::RoomAirModel::CrossVent)) { + state.dataRoomAir->Tin(ZoneNum) = state.dataRoomAir->RoomOutflowTemp(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone); } else if ((thisSurface.Zone != ZoneNum) && - (state.dataRoomAirMod->AirModel(thisSurface.Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDCV)) { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataRoomAirMod->RoomOutflowTemp(surfNum); + (state.dataRoomAir->AirModel(thisSurface.Zone).AirModel == RoomAir::RoomAirModel::CrossVent)) { + state.dataRoomAir->Tin(ZoneNum) = state.dataRoomAir->RoomOutflowTemp(surfNum); } else { if (thisSurface.Zone == ZoneNum) { - state.dataRoomAirMod->Tin(ZoneNum) = + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(thisSurface.ExtBoundCond).Zone).MAT; } else { - state.dataRoomAirMod->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisSurface.Zone).MAT; + state.dataRoomAir->Tin(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisSurface.Zone).MAT; } } } } - void CalcUCSDCV(EnergyPlusData &state, - int const ZoneNum) // Which Zonenum + void CalcCrossVent(EnergyPlusData &state, + int const ZoneNum) // Which Zonenum { // SUBROUTINE INFORMATION: @@ -788,9 +730,9 @@ namespace CrossVentMgr { Real64 ZoneMult = zone.Multiplier * zone.ListMultiplier; // total zone multiplier auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - for (int Ctd = 1; Ctd <= state.dataRoomAirMod->TotUCSDCV; ++Ctd) { - if (ZoneNum == state.dataRoomAirMod->ZoneUCSDCV(Ctd).ZonePtr) { - GainsFrac = ScheduleManager::GetCurrentScheduleValue(state, state.dataRoomAirMod->ZoneUCSDCV(Ctd).SchedGainsPtr); + for (int Ctd = 1; Ctd <= state.dataRoomAir->TotCrossVent; ++Ctd) { + if (ZoneNum == state.dataRoomAir->ZoneCrossVent(Ctd).ZonePtr) { + GainsFrac = ScheduleManager::GetCurrentScheduleValue(state, state.dataRoomAir->ZoneCrossVent(Ctd).SchedGainsPtr); } } @@ -817,103 +759,103 @@ namespace CrossVentMgr { state.afn->exchangeData(ZoneNum).SumMCpT + state.afn->exchangeData(ZoneNum).SumMVCpT + state.afn->exchangeData(ZoneNum).SumMMCpT; } - EvolveParaUCSDCV(state, ZoneNum); - // Real64 L = state.dataRoomAirMod->Droom(ZoneNum); + EvolveParaCrossVent(state, ZoneNum); + // Real64 L = state.dataRoomAir->Droom(ZoneNum); - if (state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel) { + if (state.dataRoomAir->AirModel(ZoneNum).SimAirModel) { //=============================== CROSS VENTILATION Calculation ============================================== - state.dataRoomAirMod->ZoneCVisMixing(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneCVhasREC(ZoneNum) = 1.0; + state.dataRoomAir->ZoneCrossVentIsMixing(ZoneNum) = 0.0; + state.dataRoomAir->ZoneCrossVentHasREC(ZoneNum) = 1.0; for (int Ctd = 1; Ctd <= 4; ++Ctd) { - HcUCSDCV(state, ZoneNum); - if (state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) != 1.0) { - state.dataRoomAirMod->ZTREC(ZoneNum) = - (ConvGainsRec * CrecTemp + CrecTemp * state.dataCrossVentMgr->HAT_R + state.dataRoomAirMod->Tin(ZoneNum) * MCp_Total) / + HcCrossVent(state, ZoneNum); + if (state.dataRoomAir->JetRecAreaRatio(ZoneNum) != 1.0) { + state.dataRoomAir->ZTREC(ZoneNum) = + (ConvGainsRec * CrecTemp + CrecTemp * state.dataCrossVentMgr->HAT_R + state.dataRoomAir->Tin(ZoneNum) * MCp_Total) / (CrecTemp * state.dataCrossVentMgr->HA_R + MCp_Total); } - state.dataRoomAirMod->ZTJET(ZoneNum) = (ConvGainsJet * CjetTemp + ConvGainsRec * CjetTemp + CjetTemp * state.dataCrossVentMgr->HAT_J + - CjetTemp * state.dataCrossVentMgr->HAT_R + state.dataRoomAirMod->Tin(ZoneNum) * MCp_Total - - CjetTemp * state.dataCrossVentMgr->HA_R * state.dataRoomAirMod->ZTREC(ZoneNum)) / - (CjetTemp * state.dataCrossVentMgr->HA_J + MCp_Total); - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = + state.dataRoomAir->ZTJET(ZoneNum) = (ConvGainsJet * CjetTemp + ConvGainsRec * CjetTemp + CjetTemp * state.dataCrossVentMgr->HAT_J + + CjetTemp * state.dataCrossVentMgr->HAT_R + state.dataRoomAir->Tin(ZoneNum) * MCp_Total - + CjetTemp * state.dataCrossVentMgr->HA_R * state.dataRoomAir->ZTREC(ZoneNum)) / + (CjetTemp * state.dataCrossVentMgr->HA_J + MCp_Total); + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = (ConvGainsJet + ConvGainsRec + state.dataCrossVentMgr->HAT_J + state.dataCrossVentMgr->HAT_R + - state.dataRoomAirMod->Tin(ZoneNum) * MCp_Total - state.dataCrossVentMgr->HA_J * state.dataRoomAirMod->ZTJET(ZoneNum) - - state.dataCrossVentMgr->HA_R * state.dataRoomAirMod->ZTREC(ZoneNum)) / + state.dataRoomAir->Tin(ZoneNum) * MCp_Total - state.dataCrossVentMgr->HA_J * state.dataRoomAir->ZTJET(ZoneNum) - + state.dataCrossVentMgr->HA_R * state.dataRoomAir->ZTREC(ZoneNum)) / MCp_Total; } - if (state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) == 1.0) { - state.dataRoomAirMod->ZoneCVhasREC(ZoneNum) = 0.0; - state.dataRoomAirMod->ZTREC(ZoneNum) = state.dataRoomAirMod->RoomOutflowTemp(ZoneNum); - state.dataRoomAirMod->ZTREC(ZoneNum) = state.dataRoomAirMod->ZTJET(ZoneNum); - state.dataRoomAirMod->ZTREC(ZoneNum) = state.dataRoomAirMod->ZTJET(ZoneNum); + if (state.dataRoomAir->JetRecAreaRatio(ZoneNum) == 1.0) { + state.dataRoomAir->ZoneCrossVentHasREC(ZoneNum) = 0.0; + state.dataRoomAir->ZTREC(ZoneNum) = state.dataRoomAir->RoomOutflowTemp(ZoneNum); + state.dataRoomAir->ZTREC(ZoneNum) = state.dataRoomAir->ZTJET(ZoneNum); + state.dataRoomAir->ZTREC(ZoneNum) = state.dataRoomAir->ZTJET(ZoneNum); } // If temperature increase is above 1.5C then go to mixing - if (state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) - state.dataRoomAirMod->Tin(ZoneNum) > 1.5) { - state.dataRoomAirMod->ZoneCVisMixing(ZoneNum) = 1.0; - state.dataRoomAirMod->ZoneCVhasREC(ZoneNum) = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = 0.0; - for (auto &e : state.dataRoomAirMod->CVJetRecFlows) { + if (state.dataRoomAir->RoomOutflowTemp(ZoneNum) - state.dataRoomAir->Tin(ZoneNum) > 1.5) { + state.dataRoomAir->ZoneCrossVentIsMixing(ZoneNum) = 1.0; + state.dataRoomAir->ZoneCrossVentHasREC(ZoneNum) = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; + state.dataRoomAir->RecInflowRatio(ZoneNum) = 0.0; + for (auto &e : state.dataRoomAir->CrossVentJetRecFlows) { e.Ujet = 0.0; e.Urec = 0.0; } for (int Ctd = 1; Ctd <= 3; ++Ctd) { Real64 ZTAveraged = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - HcUCSDCV(state, ZoneNum); + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + HcCrossVent(state, ZoneNum); ZTAveraged = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; } } } else { //=============================== M I X E D Calculation ====================================================== - state.dataRoomAirMod->ZoneCVisMixing(ZoneNum) = 1.0; - state.dataRoomAirMod->ZoneCVhasREC(ZoneNum) = 0.0; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.0; - state.dataRoomAirMod->Urec(ZoneNum) = 0.0; - state.dataRoomAirMod->Qrec(ZoneNum) = 0.0; - state.dataRoomAirMod->RecInflowRatio(ZoneNum) = 0.0; - for (auto &e : state.dataRoomAirMod->CVJetRecFlows) { + state.dataRoomAir->ZoneCrossVentIsMixing(ZoneNum) = 1.0; + state.dataRoomAir->ZoneCrossVentHasREC(ZoneNum) = 0.0; + state.dataRoomAir->Ujet(ZoneNum) = 0.0; + state.dataRoomAir->Urec(ZoneNum) = 0.0; + state.dataRoomAir->Qrec(ZoneNum) = 0.0; + state.dataRoomAir->RecInflowRatio(ZoneNum) = 0.0; + for (auto &e : state.dataRoomAir->CrossVentJetRecFlows) { e.Ujet = 0.0; e.Urec = 0.0; } for (int Ctd = 1; Ctd <= 3; ++Ctd) { Real64 ZTAveraged = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - HcUCSDCV(state, ZoneNum); + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + HcCrossVent(state, ZoneNum); ZTAveraged = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTJET(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTJET(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTREC(ZoneNum) = ZTAveraged; } } } -} // namespace CrossVentMgr +} // namespace RoomAir } // namespace EnergyPlus diff --git a/src/EnergyPlus/CrossVentMgr.hh b/src/EnergyPlus/CrossVentMgr.hh index 0ffe03c4b1f..82987f4cb8b 100644 --- a/src/EnergyPlus/CrossVentMgr.hh +++ b/src/EnergyPlus/CrossVentMgr.hh @@ -57,19 +57,19 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace CrossVentMgr { +namespace RoomAir { - void ManageUCSDCVModel(EnergyPlusData &state, int ZoneNum); + void ManageCrossVent(EnergyPlusData &state, int ZoneNum); - void InitUCSDCV(EnergyPlusData &state, int ZoneNum); + void InitCrossVent(EnergyPlusData &state, int ZoneNum); - void HcUCSDCV(EnergyPlusData &state, int ZoneNum); + void HcCrossVent(EnergyPlusData &state, int ZoneNum); - void EvolveParaUCSDCV(EnergyPlusData &state, int ZoneNum); + void EvolveParaCrossVent(EnergyPlusData &state, int ZoneNum); - void CalcUCSDCV(EnergyPlusData &state, int ZoneNum); + void CalcCrossVent(EnergyPlusData &state, int ZoneNum); -} // namespace CrossVentMgr +} // namespace RoomAir struct CrossVentMgrData : BaseGlobalStruct { @@ -83,7 +83,7 @@ struct CrossVentMgrData : BaseGlobalStruct void clear_state() override { - *this = CrossVentMgrData(); + new (this) CrossVentMgrData(); } }; diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index 45b9aa5d573..bec8f4694b1 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -2269,7 +2269,7 @@ namespace Curve { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); state.dataInputProcessing->inputProcessor->markObjectAsUsed("Table:IndependentVariable", thisObjectName); - state.dataCurveManager->btwxtManager.independentVarRefs.emplace(UtilityRoutines::MakeUPPERCase(thisObjectName), fields); + state.dataCurveManager->btwxtManager.independentVarRefs.emplace(UtilityRoutines::makeUPPER(thisObjectName), fields); } } @@ -2285,13 +2285,13 @@ namespace Curve { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); state.dataInputProcessing->inputProcessor->markObjectAsUsed("Table:IndependentVariableList", thisObjectName); - std::string varListName = UtilityRoutines::MakeUPPERCase(thisObjectName); + std::string varListName = UtilityRoutines::makeUPPER(thisObjectName); std::vector gridAxes; // Loop through independent variables in list and add them to the grid for (auto &indVar : fields.at("independent_variables")) { - std::string indVarName = UtilityRoutines::MakeUPPERCase(indVar.at("independent_variable_name").get()); + std::string indVarName = UtilityRoutines::makeUPPER(indVar.at("independent_variable_name").get()); std::string contextString = format("Table:IndependentVariable \"{}\"", indVarName); std::pair callbackPair{&state, contextString}; Btwxt::setMessageCallback(BtwxtMessageCallback, &callbackPair); @@ -2404,7 +2404,7 @@ namespace Curve { } } // Add grid to btwxtManager - state.dataCurveManager->btwxtManager.addGrid(UtilityRoutines::MakeUPPERCase(thisObjectName), Btwxt::GriddedData(gridAxes)); + state.dataCurveManager->btwxtManager.addGrid(UtilityRoutines::makeUPPER(thisObjectName), Btwxt::GriddedData(gridAxes)); } } @@ -2419,10 +2419,10 @@ namespace Curve { ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); - thisCurve->Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisCurve->Name = UtilityRoutines::makeUPPER(thisObjectName); thisCurve->interpolationType = InterpType::BtwxtMethod; - std::string indVarListName = UtilityRoutines::MakeUPPERCase(fields.at("independent_variable_list_name").get()); + std::string indVarListName = UtilityRoutines::makeUPPER(fields.at("independent_variable_list_name").get()); std::string contextString = format("Table:Lookup \"{}\"", thisCurve->Name); std::pair callbackPair{&state, contextString}; @@ -2963,7 +2963,7 @@ namespace Curve { if (InInputType.empty()) { return true; // if not used it is valid } - CurveInputType found = static_cast(getEnumerationValue(inputTypes, UtilityRoutines::MakeUPPERCase(InInputType))); + CurveInputType found = static_cast(getEnumValue(inputTypes, UtilityRoutines::makeUPPER(InInputType))); return found != CurveInputType::Invalid; } @@ -2991,7 +2991,7 @@ namespace Curve { }; constexpr std::array(CurveOutputType::Num)> outputTypes = { "DIMENSIONLESS", "PRESSURE", "TEMPERATURE", "CAPACITY", "POWER"}; - CurveOutputType found = static_cast(getEnumerationValue(outputTypes, UtilityRoutines::MakeUPPERCase(InOutputType))); + CurveOutputType found = static_cast(getEnumValue(outputTypes, UtilityRoutines::makeUPPER(InOutputType))); return found != CurveOutputType::Invalid; } diff --git a/src/EnergyPlus/DElightManagerF.cc b/src/EnergyPlus/DElightManagerF.cc index 1e3786429ab..8e6dcb0f90d 100644 --- a/src/EnergyPlus/DElightManagerF.cc +++ b/src/EnergyPlus/DElightManagerF.cc @@ -836,7 +836,7 @@ namespace DElightManagerF { // FUNCTION INFORMATION: // AUTHOR Robert J. Hitchcock // DATE WRITTEN August 2003 - // MODIFIED From UtilityRoutines::MakeUPPERCase( function by Linda K. Lawrie + // MODIFIED From UtilityRoutines::makeUPPER( function by Linda K. Lawrie // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index b53875349ef..130eb4964ec 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -1727,17 +1727,17 @@ void GetDXCoils(EnergyPlusData &state) if (lAlphaBlanks2(7)) { thisDXCoil.CondenserInletNodeNum(PerfModeNum) = 0; } else { - thisDXCoil.CondenserInletNodeNum(PerfModeNum) = GetOnlySingleNode( - state, - Alphas2(7), - ErrorsFound, - (DataLoopNode::ConnectionObjectType)getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, - UtilityRoutines::MakeUPPERCase(PerfObjectType)), - PerfObjectName, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::OutsideAirReference, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + thisDXCoil.CondenserInletNodeNum(PerfModeNum) = + GetOnlySingleNode(state, + Alphas2(7), + ErrorsFound, + (DataLoopNode::ConnectionObjectType)getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, + UtilityRoutines::makeUPPER(PerfObjectType)), + PerfObjectName, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::OutsideAirReference, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent); if (!CheckOutAirNodeNumber(state, thisDXCoil.CondenserInletNodeNum(PerfModeNum))) { ShowWarningError(state, format("{}{}=\"{}\":", RoutineName, PerfObjectType, PerfObjectName)); ShowContinueError(state, format("may not be valid {}=\"{}\".", cAlphaFields2(7), Alphas2(7))); @@ -4017,7 +4017,7 @@ void GetDXCoils(EnergyPlusData &state) } // A12; \field Fuel type, Validate fuel type input - thisDXCoil.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, Alphas(12))); + thisDXCoil.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, Alphas(12))); thisDXCoil.NumOfSpeeds = Numbers(6); // Number of speeds if (thisDXCoil.NumOfSpeeds < 2) { @@ -4521,7 +4521,7 @@ void GetDXCoils(EnergyPlusData &state) } // A9; \field Fuel type, Validate fuel type input - thisDXCoil.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, Alphas(9))); + thisDXCoil.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, Alphas(9))); thisDXCoil.RegionNum = Numbers(8); // Region Number for HSPF Calc thisDXCoil.NumOfSpeeds = Numbers(9); // Number of speeds @@ -15504,7 +15504,7 @@ int GetHPCoolingCoilIndex(EnergyPlusData &state, DXCoolingCoilIndex = 0; DataLoopNode::ConnectionObjectType HeatingCoilTypeNum = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(HeatingCoilType))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(HeatingCoilType))); DataLoopNode::ConnectionObjectType CompSetsParentType; // Parent object type which uses DX heating coil pass into this function std::string CompSetsParentName; diff --git a/src/EnergyPlus/Data/CommonIncludes.hh b/src/EnergyPlus/Data/CommonIncludes.hh index e11f0653873..fc3e915bc6b 100644 --- a/src/EnergyPlus/Data/CommonIncludes.hh +++ b/src/EnergyPlus/Data/CommonIncludes.hh @@ -122,7 +122,6 @@ #include #include #include -#include #include #include #include diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index fb6aacc94a8..b6402a9df35 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -226,8 +226,7 @@ EnergyPlusData::EnergyPlusData() this->dataRetAirPathMrg = std::make_unique(); this->dataExhAirSystemMrg = std::make_unique(); this->dataExhCtrlSystemMrg = std::make_unique(); - this->dataRoomAirMod = std::make_unique(); - this->dataRoomAirModelMgr = std::make_unique(); + this->dataRoomAir = std::make_unique(); this->dataRoomAirModelTempPattern = std::make_unique(); this->dataRoomAirflowNetModel = std::make_unique(); this->dataRootFinder = std::make_unique(); @@ -270,7 +269,6 @@ EnergyPlusData::EnergyPlusData() this->dataTarcogShading = std::make_unique(); this->dataTimingsData = std::make_unique(); this->dataTranspiredCollector = std::make_unique(); - this->dataUCSDShared = std::make_unique(); this->dataUFADManager = std::make_unique(); this->dataUnitHeaters = std::make_unique(); this->dataUnitVentilators = std::make_unique(); @@ -484,8 +482,7 @@ void EnergyPlusData::clear_state() this->dataRetAirPathMrg->clear_state(); this->dataExhAirSystemMrg->clear_state(); this->dataExhCtrlSystemMrg->clear_state(); - this->dataRoomAirMod->clear_state(); - this->dataRoomAirModelMgr->clear_state(); + this->dataRoomAir->clear_state(); this->dataRoomAirModelTempPattern->clear_state(); this->dataRoomAirflowNetModel->clear_state(); this->dataRootFinder->clear_state(); @@ -528,7 +525,6 @@ void EnergyPlusData::clear_state() this->dataTarcogShading->clear_state(); this->dataTimingsData->clear_state(); this->dataTranspiredCollector->clear_state(); - this->dataUCSDShared->clear_state(); this->dataUFADManager->clear_state(); this->dataUnitHeaters->clear_state(); this->dataUnitVentilators->clear_state(); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index dcd939a871f..b13040e86fe 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -244,7 +244,6 @@ struct ExhaustAirSystemMgr; struct ExhaustControlSystemMgr; struct RoomAirModelAirflowNetworkData; struct RoomAirModelData; -struct RoomAirModelManagerData; struct RoomAirModelUserTempPatternData; struct RootFindingData; struct RuntimeLanguageData; @@ -283,7 +282,6 @@ struct TARCOGGasses90Data; struct TARCOGMainData; struct TarcogShadingData; struct TranspiredCollectorData; -struct UCSDSharedData; struct UFADManagerData; struct UnitHeatersData; struct UnitVentilatorsData; @@ -502,8 +500,7 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataExhAirSystemMrg; std::unique_ptr dataExhCtrlSystemMrg; std::unique_ptr dataRoomAirflowNetModel; - std::unique_ptr dataRoomAirMod; - std::unique_ptr dataRoomAirModelMgr; + std::unique_ptr dataRoomAir; std::unique_ptr dataRoomAirModelTempPattern; std::unique_ptr dataRootFinder; std::unique_ptr dataRuntimeLang; @@ -542,7 +539,6 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataTARCOGMain; std::unique_ptr dataTarcogShading; std::unique_ptr dataTranspiredCollector; - std::unique_ptr dataUCSDShared; std::unique_ptr dataUFADManager; std::unique_ptr dataUnitHeaters; std::unique_ptr dataUnitVentilators; diff --git a/src/EnergyPlus/DataHVACGlobals.cc b/src/EnergyPlus/DataHVACGlobals.cc index b42a7f17412..08fd51ad6e2 100644 --- a/src/EnergyPlus/DataHVACGlobals.cc +++ b/src/EnergyPlus/DataHVACGlobals.cc @@ -199,87 +199,87 @@ namespace DataHVACGlobals { Array1D_string const cVRFTUTypes(NumVRFTUTypes, std::string("ZoneHVAC:TerminalUnit:VariableRefrigerantFlow")); Array1D_string const cVRFHeatingPerformanceOATTypes(NumVRFHeatingPerformanceOATTypes, {"WetBulbTemperature", "DryBulbTemperature"}); +#ifdef GET_OUT + constexpr std::array zoneEquipTypeNamesUC = {"DUMMY", + "ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW", + "ZONEHVAC:ENERGYRECOVERYVENTILATOR", + "ZONEHVAC:FOURPIPEFANCOIL", + "ZONEHVAC:OUTDOORAIRUNIT", + "ZONEHVAC:PACKAGEDTERMINALAIRCONDITIONER", + "ZONEHVAC:PACKAGEDTERMINALHEATPUMP", + "ZONEHVAC:UNITHEATER", + "ZONEHVAC:UNITVENTILATOR", + "ZONEHVAC:VENTILATEDSLAB", + "ZONEHVAC:WATERTOAIRHEATPUMP", + "ZONEHVAC:WINDOWAIRCONDITIONER", + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:ELECTRIC", + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:WATER", + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:STEAM", + "ZONEHVAC:BASEBOARD:CONVECTIVE:ELECTRIC", + "ZONEHVAC:BASEBOARD:CONVECTIVE:WATER", + "ZONEHVAC:HIGHTEMPERATURERADIANT", + "ZONEHVAC:DEHUMIDIFIER:DX", + "ZONEHVAC:IDEALLOADSAIRSYSTEM", + "ZONEHVAC:REFRIGERATIONCHILLERSET", + "ZONEHVAC:HYBRIDUNITARYHVAC", + "FAN:ZONEEXHAUST", + "WATERHEATER:HEATPUMP", + "AIRTERMINAL:DUALDUCT:CONSTANTVOLUME", + "AIRTERMINAL:DUALDUCT:VAV", + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:REHEAT", + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:NOREHEAT", + "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT", + "AIRTERMINAL:SINGLEDUCT:VAV:NOREHEAT", + "AIRTERMINAL:SINGLEDUCT:SERIESPIU:REHEAT", + "AIRTERMINAL:SINGLEDUCT:PARALLELPIU:REHEAT", + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:FOURPIPEINDUCTION", + "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT:VARIABLESPEEDFAN", + "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:REHEAT", + "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:NOREHEAT", + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:COOLEDBEAM", + "AIRTERMINAL:DUALDUCT:VAV:OUTDOORAIR", + "AIRLOOPHVACRETURNAIR"}; - Array1D_string const ZoneHVACTerminalTypes(NumZoneHVACTerminalTypes, - {"ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW", - "ZONEHVAC:ENERGYRECOVERYVENTILATOR", - "ZONEHVAC:FOURPIPEFANCOIL", - "ZONEHVAC:OUTDOORAIRUNIT", - "ZONEHVAC:PACKAGEDTERMINALAIRCONDITIONER", - "ZONEHVAC:PACKAGEDTERMINALHEATPUMP", - "ZONEHVAC:UNITHEATER", - "ZONEHVAC:UNITVENTILATOR", - "ZONEHVAC:VENTILATEDSLAB", - "ZONEHVAC:WATERTOAIRHEATPUMP", - "ZONEHVAC:WINDOWAIRCONDITIONER", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:ELECTRIC", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:WATER", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:STEAM", - "ZONEHVAC:BASEBOARD:CONVECTIVE:ELECTRIC", - "ZONEHVAC:BASEBOARD:CONVECTIVE:WATER", - "ZONEHVAC:HIGHTEMPERATURERADIANT", - "ZONEHVAC:DEHUMIDIFIER:DX", - "ZONEHVAC:IDEALLOADSAIRSYSTEM", - "ZONEHVAC:REFRIGERATIONCHILLERSET", - "ZONEHVAC:HYBRIDUNITARYHVAC", - "FAN:ZONEEXHAUST", - "WATERHEATER:HEATPUMP", - "AIRTERMINAL:DUALDUCT:CONSTANTVOLUME", - "AIRTERMINAL:DUALDUCT:VAV", - "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:REHEAT", - "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:NOREHEAT", - "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT", - "AIRTERMINAL:SINGLEDUCT:VAV:NOREHEAT", - "AIRTERMINAL:SINGLEDUCT:SERIESPIU:REHEAT", - "AIRTERMINAL:SINGLEDUCT:PARALLELPIU:REHEAT", - "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:FOURPIPEINDUCTION", - "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT:VARIABLESPEEDFAN", - "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:REHEAT", - "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:NOREHEAT", - "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:COOLEDBEAM", - "AIRTERMINAL:DUALDUCT:VAV:OUTDOORAIR", - "AIRLOOPHVACRETURNAIR"}); - - Array1D_string const ccZoneHVACTerminalTypes(NumZoneHVACTerminalTypes, - {"ZoneHVAC:TerminalUnit:VariableRefrigerantFlow", - "ZoneHVAC:EnergyRecoveryVentilator", - "ZoneHVAC:FourPipeFanCoil", - "ZoneHVAC:OutdoorAirUnit", - "ZoneHVAC:PackagedTerminalAirConditioner", - "ZoneHVAC:PackagedTerminalHeatPump", - "ZoneHVAC:UnitHeater", - "ZoneHVAC:UnitVentilator", - "ZoneHVAC:VentilatedSlab", - "ZoneHVAC:WaterToAirHeatPump", - "ZoneHVAC:WindowAirConditioner", - "ZoneHVAC:Baseboard:RadiantConvective:Electric", - "ZoneHVAC:Baseboard:RadiantConvective:Water", - "ZoneHVAC:Baseboard:RadiantConvective:Steam", - "ZoneHVAC:Baseboard:Convective:Electric", - "ZoneHVAC:Baseboard:Convective:Water", - "ZoneHVAC:HighTemperatureRadiant", - "ZoneHVAC:Dehumidifier:DX", - "ZoneHVAC:IdealLoadsAirSystem", - "ZoneHVAC:RefrigerationChillerSet", - "ZoneHVAC:HybridUnitaryHVAC", - "Fan:ZoneExhaust", - "WaterHeater:HeatPump", - "AirTerminal:DualDuct:ConstantVolume", - "AirTerminal:DualDuct:VAV", - "AirTerminal:SingleDuct:ConstantVolume:Reheat", - "AirTerminal:SingleDuct:ConstantVolume:NoReheat", - "AirTerminal:SingleDuct:VAV:Reheat", - "AirTerminal:SingleDuct:VAV:NoReheat", - "AirTerminal:SingleDuct:SeriesPIU:Reheat", - "AirTerminal:SingleDuct:ParallelPIU:Reheat", - "AirTerminal:SingleDuct:ConstantVolume:FourPipeInduction", - "AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", - "AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", - "AirTerminal:SingleDuct:VAV:HeatAndCool:NoReheat", - "AirTerminal:SingleDuct:ConstantVolume:CooledBeam", - "AirTerminal:DualDuct:VAV:OutdoorAir", - "AirLoopHVACReturnAir"}); - + constexpr std::array zoneEquipTypeNames = {"DUMMY", + "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow", + "ZoneHVAC:EnergyRecoveryVentilator", + "ZoneHVAC:FourPipeFanCoil", + "ZoneHVAC:OutdoorAirUnit", + "ZoneHVAC:PackagedTerminalAirConditioner", + "ZoneHVAC:PackagedTerminalHeatPump", + "ZoneHVAC:UnitHeater", + "ZoneHVAC:UnitVentilator", + "ZoneHVAC:VentilatedSlab", + "ZoneHVAC:WaterToAirHeatPump", + "ZoneHVAC:WindowAirConditioner", + "ZoneHVAC:Baseboard:RadiantConvective:Electric", + "ZoneHVAC:Baseboard:RadiantConvective:Water", + "ZoneHVAC:Baseboard:RadiantConvective:Steam", + "ZoneHVAC:Baseboard:Convective:Electric", + "ZoneHVAC:Baseboard:Convective:Water", + "ZoneHVAC:HighTemperatureRadiant", + "ZoneHVAC:Dehumidifier:DX", + "ZoneHVAC:IdealLoadsAirSystem", + "ZoneHVAC:RefrigerationChillerSet", + "ZoneHVAC:HybridUnitaryHVAC", + "Fan:ZoneExhaust", + "WaterHeater:HeatPump", + "AirTerminal:DualDuct:ConstantVolume", + "AirTerminal:DualDuct:VAV", + "AirTerminal:SingleDuct:ConstantVolume:Reheat", + "AirTerminal:SingleDuct:ConstantVolume:NoReheat", + "AirTerminal:SingleDuct:VAV:Reheat", + "AirTerminal:SingleDuct:VAV:NoReheat", + "AirTerminal:SingleDuct:SeriesPIU:Reheat", + "AirTerminal:SingleDuct:ParallelPIU:Reheat", + "AirTerminal:SingleDuct:ConstantVolume:FourPipeInduction", + "AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", + "AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", + "AirTerminal:SingleDuct:VAV:HeatAndCool:NoReheat", + "AirTerminal:SingleDuct:ConstantVolume:CooledBeam", + "AirTerminal:DualDuct:VAV:OutdoorAir", + "AirLoopHVACReturnAir"}; +#endif // } // namespace DataHVACGlobals } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataHVACGlobals.hh b/src/EnergyPlus/DataHVACGlobals.hh index ceba5d4e247..529b3d60ac4 100644 --- a/src/EnergyPlus/DataHVACGlobals.hh +++ b/src/EnergyPlus/DataHVACGlobals.hh @@ -373,54 +373,12 @@ namespace DataHVACGlobals { // Parameters for HVACSystemRootFindingAlgorithm int constexpr Bisection(2); - int constexpr NumZoneHVACTerminalTypes = 38; - int constexpr ZoneEquipTypeOf_VariableRefrigerantFlow(1); - int constexpr ZoneEquipTypeOf_EnergyRecoveryVentilator(2); - int constexpr ZoneEquipTypeOf_FourPipeFanCoil(3); - int constexpr ZoneEquipTypeOf_OutdoorAirUnit(4); - int constexpr ZoneEquipTypeOf_PackagedTerminalAirConditioner(5); - int constexpr ZoneEquipTypeOf_PackagedTerminalHeatPump(6); - int constexpr ZoneEquipTypeOf_UnitHeater(7); - int constexpr ZoneEquipTypeOf_UnitVentilator(8); - int constexpr ZoneEquipTypeOf_VentilatedSlab(9); - int constexpr ZoneEquipTypeOf_WaterToAirHeatPump(10); - int constexpr ZoneEquipTypeOf_WindowAirConditioner(11); - int constexpr ZoneEquipTypeOf_BaseboardRadiantConvectiveElectric(12); - int constexpr ZoneEquipTypeOf_BaseboardRadiantConvectiveWater(13); - int constexpr ZoneEquipTypeOf_BaseboardRadiantConvectiveSteam(14); - int constexpr ZoneEquipTypeOf_BaseboardConvectiveElectric(15); - int constexpr ZoneEquipTypeOf_BaseboardConvectiveWater(16); - int constexpr ZoneEquipTypeOf_HighTemperatureRadiant(17); - int constexpr ZoneEquipTypeOf_DehumidifierDX(18); - int constexpr ZoneEquipTypeOf_IdealLoadsAirSystem(19); - int constexpr ZoneEquipTypeOf_RefrigerationChillerSet(20); - int constexpr ZoneEquipTypeOf_HybridUnitaryAirConditioners(21); - int constexpr ZoneEquipTypeOf_FanZoneExhaust(22); - int constexpr ZoneEquipTypeOf_WaterHeaterHeatPump(23); - int constexpr ZoneEquipTypeOf_AirTerminalDualDuctConstantVolume(24); - int constexpr ZoneEquipTypeOf_AirTerminalDualDuctVAV(25); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeReheat(26); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeNoReheat(27); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctVAVReheat(28); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctVAVNoReheat(29); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctSeriesPIUReheat(30); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctParallelPIUReheat(31); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctCAVFourPipeInduction(32); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctVAVReheatVariableSpeedFan(33); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctVAVHeatAndCoolReheat(34); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctVAVHeatAndCoolNoReheat(35); - int constexpr ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeCooledBeam(36); - int constexpr ZoneEquipTypeOf_AirTerminalDualDuctVAVOutdoorAir(37); - int constexpr ZoneEquipTypeOf_AirLoopHVACReturnAir(38); - int constexpr MaxSpeedLevels = 10; extern Array1D_string const cFanTypes; extern Array1D_string const cAllCoilTypes; extern Array1D_string const cCoolingCoilTypes; extern Array1D_string const cHeatingCoilTypes; - extern Array1D_string const ccZoneHVACTerminalTypes; - extern Array1D_string const ZoneHVACTerminalTypes; extern Array1D_string const cATMixerTypes; extern Array1D_string const cVRFTUTypes; extern Array1D_string const cVRFHeatingPerformanceOATTypes; @@ -575,7 +533,7 @@ struct HVACGlobalsData : BaseGlobalStruct void clear_state() override { - *this = HVACGlobalsData(); + new (this) HVACGlobalsData(); } }; diff --git a/src/EnergyPlus/DataRoomAirModel.hh b/src/EnergyPlus/DataRoomAirModel.hh index 92c6a914877..11a9291bc77 100644 --- a/src/EnergyPlus/DataRoomAirModel.hh +++ b/src/EnergyPlus/DataRoomAirModel.hh @@ -56,17 +56,18 @@ #include #include #include +#include #include namespace EnergyPlus { -namespace DataRoomAirModel { +namespace RoomAir { - auto constexpr cUserDefinedControlObject("RoomAir:TemperaturePattern:UserDefined"); - auto constexpr cTempPatternConstGradientObject("RoomAir:TemperaturePattern:ConstantGradient"); - auto constexpr cTempPatternTwoGradientObject("RoomAir:TemperaturePattern:TwoGradient"); - auto constexpr cTempPatternNDHeightObject("RoomAir:TemperaturePattern:NondimensionalHeight"); - auto constexpr cTempPatternSurfMapObject("RoomAir:TemperaturePattern:SurfaceMapping"); + constexpr std::string_view cUserDefinedControlObject("RoomAir:TemperaturePattern:UserDefined"); + constexpr std::string_view cTempPatternConstGradientObject("RoomAir:TemperaturePattern:ConstantGradient"); + constexpr std::string_view cTempPatternTwoGradientObject("RoomAir:TemperaturePattern:TwoGradient"); + constexpr std::string_view cTempPatternNDHeightObject("RoomAir:TemperaturePattern:NondimensionalHeight"); + constexpr std::string_view cTempPatternSurfMapObject("RoomAir:TemperaturePattern:SurfaceMapping"); // Parameters to indicate room air model selected enum class RoomAirModel : int @@ -74,16 +75,17 @@ namespace DataRoomAirModel { Invalid = -1, UserDefined, // user defined patterns Mixing, // mixing air model - Mundt, // Mundt nodal model - UCSDDV, // UCSD Displacement Ventilation model - UCSDCV, // UCSD-CV - UCSDUFI, // UCSD UFAD interior zone model - UCSDUFE, // UCSD UFAD exterior zone model + DispVent1Node, // Mundt nodal model + DispVent3Node, // UCSD Displacement Ventilation model + CrossVent, // UCSD-CV + UFADInt, // UCSD UFAD interior zone model + UFADExt, // UCSD UFAD exterior zone model AirflowNetwork, // RoomAirModel_AirflowNetwork interior zone model Num }; - constexpr const char *ChAirModel[] = { - "*Invalid*", "UserDefined", "Mixing", "Mundt", "UCSD_DV", "UCSD_CV", "UCSD_UFI", "UCSD_UFE", "AirflowNetwork"}; + + extern const std::array roomAirModelNames; + extern const std::array roomAirModelNamesUC; // Parameters to indicate air temperature coupling scheme enum class CouplingScheme @@ -98,18 +100,20 @@ namespace DataRoomAirModel { enum class AirNodeType { Invalid = -1, - InletAir, // air node at inlet (for Mundt and Rees&Haves Models) - FloorAir, // air node at floor (for Mundt and Rees&Haves Models) - ControlAir, // air node at control point (for Mundt Model) - CeilingAir, // air node at ceiling (for Mundt Model) - MundtRoomAir, // air node for vertical walls (for Mundt Model) - ReturnAir, // air node for return (for Mundt and Rees&Haves Models) - AirflowNetworkRoomAir, // air node for airflow network based room air model - PlumeAir, // air node for plume load (for Rees&Haves Model) - RoomAir, // air node for vertical walls (for Rees&Haves Model) + Inlet, // air node at inlet (for Mundt and Rees&Haves Models) + Floor, // air node at floor (for Mundt and Rees&Haves Models) + Control, // air node at control point (for Mundt Model) + Ceiling, // air node at ceiling (for Mundt Model) + Mundt, // air node for vertical walls (for Mundt Model) + Return, // air node for return (for Mundt and Rees&Haves Models) + AFN, // air node for airflow network based room air model + Plume, // air node for plume load (for Rees&Haves Model) + Rees, // air node for vertical walls (for Rees&Haves Model) Num }; + extern const std::array airNodeTypeNamesUC; + // user-defined pattern two gradient interpolation modes enum class UserDefinedPatternMode { @@ -122,6 +126,8 @@ namespace DataRoomAirModel { Num }; + extern const std::array userDefinedPatternModeNamesUC; + // user defined temperature pattern types enum class UserDefinedPatternType { @@ -133,6 +139,8 @@ namespace DataRoomAirModel { Num }; + extern const std::array userDefinedPatternNamesUC; + // parameters to indicate diffuser type enum class Diffuser { @@ -145,6 +153,8 @@ namespace DataRoomAirModel { Num }; + extern const std::array diffuserNamesUC; + enum class Comfort { Invalid = -1, @@ -153,185 +163,111 @@ namespace DataRoomAirModel { Num }; + extern const std::array comfortNamesUC; + struct AirModelData { // Members - std::string AirModelName; - std::string ZoneName; - int ZonePtr; // Pointer to the zone number for this statement - RoomAirModel AirModelType; // 1 = Mixing, 2 = Mundt, 3 = Rees and Haves, - // 4 = UCSDDV, 5 = UCSDCV, -1 = user defined - // 6 = UCSDUFI, 7 = UCSDUFE, 8 = AirflowNetwork - CouplingScheme TempCoupleScheme; // 1 = absolute (direct), - // 2 = relative air model temperature passing scheme (indirect) - bool SimAirModel; // FALSE if Mixing air model is currently used and + std::string Name = ""; + std::string ZoneName = ""; + int ZonePtr = 0; // Pointer to the zone number for this statement + RoomAirModel AirModel = RoomAirModel::Mixing; + CouplingScheme TempCoupleScheme = CouplingScheme::Direct; + bool SimAirModel = false; // FALSE if Mixing air model is currently used and // TRUE if other air models are currently used - - // Default Constructor - AirModelData() : ZonePtr(0), AirModelType(RoomAirModel::Mixing), TempCoupleScheme(CouplingScheme::Direct), SimAirModel(false) - { - } }; struct AirNodeData { // Members - std::string Name; // name - std::string ZoneName; - int ZonePtr; // Pointer to the zone number for this statement - AirNodeType ClassType; // depending on type of model - Real64 Height; // height - Real64 ZoneVolumeFraction; // portion of zone air volume associated with this node - Array1D_bool SurfMask; // limit of 60 surfaces at current sizing - bool IsZone; // TRUE if this node is zone node - - // Default Constructor - AirNodeData() : ZonePtr(0), ClassType(AirNodeType::Invalid), Height(0.0), ZoneVolumeFraction(0), IsZone(false) - { - } + std::string Name = ""; // name + std::string ZoneName = ""; + int ZonePtr = 0; // Pointer to the zone number for this statement + AirNodeType ClassType = AirNodeType::Invalid; // depending on type of model + Real64 Height = 0.0; // height + Real64 ZoneVolumeFraction = 0.0; // portion of zone air volume associated with this node + Array1D_bool SurfMask; // limit of 60 surfaces at current sizing + bool IsZone = false; // TRUE if this node is zone node }; - struct DVData + struct DispVentData { // Members - std::string ZoneName; // Name of zone - int ZonePtr; // Pointer to the zone number for this statement - int SchedGainsPtr; // Schedule for internal gain fraction to occupied zone - std::string SchedGainsName; // Gains Schedule name - Real64 NumPlumesPerOcc; // Effective number of plumes per occupant - Real64 ThermostatHeight; // Height of thermostat/ temperature control sensor - Real64 ComfortHeight; // Height at which air temperature is measured for comfort purposes - Real64 TempTrigger; // Minimum temperature difference between TOC TMX for stratification - - // Default Constructor - DVData() : ZonePtr(0), SchedGainsPtr(-1), NumPlumesPerOcc(1.0), ThermostatHeight(0.0), ComfortHeight(0.0), TempTrigger(0.0) - { - } + std::string ZoneName = ""; // Name of zone + int ZonePtr = 0; // Pointer to the zone number for this statement + int SchedGainsPtr = -1; // Schedule for internal gain fraction to occupied zone + std::string SchedGainsName = ""; // Gains Schedule name + Real64 NumPlumesPerOcc = 0.0; // Effective number of plumes per occupant + Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor + Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for comfort purposes + Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX for stratification }; - struct CVData + struct CrossVentData { // Members - std::string ZoneName; // Name of zone - int ZonePtr; // Pointer to the zone number for this statement - int SchedGainsPtr; // Schedule for internal gain fraction to occupied zone - std::string SchedGainsName; // Gains Schedule name - Comfort VforComfort; // Use Recirculation or Jet velocity and temperatures + std::string ZoneName = ""; // Name of zone + int ZonePtr = 0; // Pointer to the zone number for this statement + int SchedGainsPtr = 0; // Schedule for internal gain fraction to occupied zone + std::string SchedGainsName = ""; // Gains Schedule name + Comfort VforComfort = Comfort::Invalid; // Use Recirculation or Jet velocity and temperatures // for comfort models - - // Default Constructor - CVData() : ZonePtr(-1), SchedGainsPtr(-1), VforComfort(Comfort::Invalid) - { - } - }; - - struct CVFlow - { - // Members - int FlowFlag; // Equal to 1 if the opening has inflow, else equal to 0. - Real64 Width; // Width of the opening [m] - Real64 Area; // Area of the opening [m2] - Real64 Fin; // Inflow volume flux through the opening [m3/s] - Real64 Uin; // Inflow air velocity through the opening [m/s] - Real64 Vjet; // Average maximum jet velocity for the opening [m/s] - Real64 Yjet; // Y in "Y = aX + b" formula - Real64 Ujet; // Volume average jet region velocity [m/s] - Real64 Yrec; // Y in "Y = aX + b" formula - Real64 Urec; // Area-averaged velocity in the y-z plane with maximum flow [m/s] - Real64 YQrec; // Y in "Y = aX + b" formula - Real64 Qrec; // Total flow rate for the recirculation regions in the plane of maximum flow [m3/s] - - // Default Constructor - CVFlow() - : FlowFlag(0), Width(0.0), Area(0.0), Fin(0.0), Uin(0.0), Vjet(0.0), Yjet(0.0), Ujet(0.0), Yrec(0.0), Urec(0.0), YQrec(0.0), Qrec(0.0) - { - } }; - struct CVDVParameters + struct CrossVentFlow { // Members - Real64 Width; - Real64 Height; - int Shadow; - Real64 Zmin; - Real64 Zmax; - - // Default Constructor - CVDVParameters() : Width(0.0), Height(0.0), Shadow(0), Zmin(0.0), Zmax(0.0) - { - } + int FlowFlag = 0; // Equal to 1 if the opening has inflow, else equal to 0. + Real64 Width = 0.0; // Width of the opening [m] + Real64 Area = 0.0; // Area of the opening [m2] + Real64 Fin = 0.0; // Inflow volume flux through the opening [m3/s] + Real64 Uin = 0.0; // Inflow air velocity through the opening [m/s] + Real64 Vjet = 0.0; // Average maximum jet velocity for the opening [m/s] + Real64 Yjet = 0.0; // Y in "Y = aX + b" formula + Real64 Ujet = 0.0; // Volume average jet region velocity [m/s] + Real64 Yrec = 0.0; // Y in "Y = aX + b" formula + Real64 Urec = 0.0; // Area-averaged velocity in the y-z plane with maximum flow [m/s] + Real64 YQrec = 0.0; // Y in "Y = aX + b" formula + Real64 Qrec = 0.0; // Total flow rate for the recirculation regions in the plane of maximum flow [m3/s] }; - struct UFIData + struct CrossDispVentParameters { // Members - std::string ZoneName; // Name of zone - int ZonePtr; // Pointer to the zone number for this statement - int ZoneEquipPtr; // Pointer to zone equip for this UFAD zone - Real64 DiffusersPerZone; // Number of diffusers in this zone - Real64 PowerPerPlume; // Power in each plume [W] - Real64 DiffArea; // Effective area of a diffuser [m2] - Real64 DiffAngle; // angle between diffuser slots and vertical (degrees) - Real64 HeatSrcHeight; // height of heat source above floor [m] - Real64 ThermostatHeight; // Height of thermostat/ temperature control sensor [m] - Real64 ComfortHeight; // Height at which air temperature is measured for - // comfort purposes [m] - Real64 TempTrigger; // Minimum temperature difference between TOC TMX - // for stratification [deltaC] - Diffuser DiffuserType; // 1=Swirl, 2=variable area, 3=displacement, 4=linear bar grille, 5=custom - Real64 TransHeight; // user specified transition height [m] - bool CalcTransHeight; // flag to calc trans height or use user specified input - Real64 A_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 B_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 C_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 D_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 E_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - - // Default Constructor - UFIData() - : ZonePtr(0), ZoneEquipPtr(0), DiffusersPerZone(0.0), PowerPerPlume(0.0), DiffArea(0.0), DiffAngle(0.0), HeatSrcHeight(0.0), - ThermostatHeight(0.0), ComfortHeight(0.0), TempTrigger(0.0), DiffuserType(Diffuser::Invalid), TransHeight(0.0), CalcTransHeight(false), - A_Kc(0.0), B_Kc(0.0), C_Kc(0.0), D_Kc(0.0), E_Kc(0.0) - { - } + Real64 Width = 0.0; + Real64 Height = 0.0; + int Shadow = 0; + Real64 Zmin = 0.0; + Real64 Zmax = 0.0; }; - struct UFEData + struct UFADData { // Members - std::string ZoneName; // Name of zone - int ZonePtr; // Pointer to the zone number for this statement - int ZoneEquipPtr; // Pointer to zone equip for this UFAD zone - Real64 DiffusersPerZone; // Number of diffusers in this zone - Real64 PowerPerPlume; // Power in each plume [W] - Real64 DiffArea; // Effective area of a diffuser [m2] - Real64 DiffAngle; // angle between diffuser slots and vertical (degrees) - Real64 HeatSrcHeight; // height of heat source above floor [m] - Real64 ThermostatHeight; // Height of thermostat/ temperature control sensor [m] - Real64 ComfortHeight; // Height at which air temperature is measured for + std::string ZoneName = ""; // Name of zone + int ZonePtr = 0; // Pointer to the zone number for this statement + int ZoneEquipPtr = 0; // Pointer to zone equip for this UFAD zone + Real64 DiffusersPerZone = 0.0; // Number of diffusers in this zone + Real64 PowerPerPlume = 0.0; // Power in each plume [W] + Real64 DiffArea = 0.0; // Effective area of a diffuser [m2] + Real64 DiffAngle = 0.0; // angle between diffuser slots and vertical (degrees) + Real64 HeatSrcHeight = 0.0; // height of heat source above floor [m] + Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor [m] + Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for // comfort purposes [m] - Real64 TempTrigger; // Minimum temperature difference between TOC TMX + Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX // for stratification [deltaC] - Diffuser DiffuserType; // 1=Swirl, 2=variable area, 3=displacement, 4=linear bar grille, 5=custom - Real64 TransHeight; // user specified transition height [m] - bool CalcTransHeight; // flag to calc trans height or use user specified input - Real64 A_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 B_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 C_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 D_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 E_Kc; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - Real64 WinWidth; // sum of widths of exterior windows in zone - Real64 NumExtWin; // number of exterior windows in the zone - bool ShadeDown; // signals shade up or down - - // Default Constructor - UFEData() - : ZonePtr(0), ZoneEquipPtr(0), DiffusersPerZone(0.0), PowerPerPlume(0.0), DiffArea(0.0), DiffAngle(0.0), HeatSrcHeight(0.0), - ThermostatHeight(0.0), ComfortHeight(0.0), TempTrigger(0.0), DiffuserType(Diffuser::Invalid), TransHeight(0.0), CalcTransHeight(false), - A_Kc(0.0), B_Kc(0.0), C_Kc(0.0), D_Kc(0.0), E_Kc(0.0), WinWidth(0.0), NumExtWin(0.0), ShadeDown(true) - { - } + Diffuser DiffuserType = Diffuser::Invalid; // 1=Swirl, 2=variable area, 3=displacement, 4=linear bar grille, 5=custom + Real64 TransHeight = 0.0; // user specified transition height [m] + bool CalcTransHeight = false; // flag to calc trans height or use user specified input + Real64 A_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 + Real64 B_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 + Real64 C_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 + Real64 D_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 + Real64 E_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 + Real64 WinWidth = 0.0; // sum of widths of exterior windows in zone + Real64 NumExtWin = 0.0; // number of exterior windows in the zone + bool ShadeDown = false; // signals shade up or down }; struct SurfMapPattern // nested structure in RoomAirPattern @@ -340,52 +276,34 @@ namespace DataRoomAirModel { // user variables Array1D_string SurfName; // user defined name Array1D DeltaTai; // (Tai - MAT ) offset from mean air temp - int NumSurfs; // number of surfaces in this pattern + int NumSurfs = 0; // number of surfaces in this pattern // calculated and from elsewhere Array1D_int SurfID; // index in HB surface structure array - - // Default Constructor - SurfMapPattern() : NumSurfs(0) - { - } }; struct ConstGradPattern // nested structure in RoomAirPattern { // Members // user variables - std::string Name; // name - Real64 Gradient; // value of vertical gradient [C/m] - - // Default Constructor - ConstGradPattern() : Gradient(0.0) - { - } + std::string Name = ""; // name + Real64 Gradient = 0.0; // value of vertical gradient [C/m] }; struct TwoVertGradInterpolPattern // nested structure in RoomAirPattern { // Members // user variables - std::string Name; // name - Real64 TstatHeight; // Height of thermostat/ temperature control sensor - Real64 TleavingHeight; // height of return air node where leaving zone - Real64 TexhaustHeight; // height of exhaust air node where leaving zone - Real64 LowGradient; // lower value of vertical gradient [C/m] - Real64 HiGradient; // upper value of vertical gradient [C/m] - DataRoomAirModel::UserDefinedPatternMode InterpolationMode; // control for interpolation mode - Real64 UpperBoundTempScale; // temperature value for HiGradient - Real64 LowerBoundTempScale; // temperature value for LowGradient - Real64 UpperBoundHeatRateScale; // load value for HiGradient - Real64 LowerBoundHeatRateScale; // load value for lowGradient - - // Default Constructor - TwoVertGradInterpolPattern() - : TstatHeight(0.0), TleavingHeight(0.0), TexhaustHeight(0.0), LowGradient(0.0), HiGradient(0.0), - InterpolationMode(DataRoomAirModel::UserDefinedPatternMode::Invalid), UpperBoundTempScale(0.0), LowerBoundTempScale(0.0), - UpperBoundHeatRateScale(0.0), LowerBoundHeatRateScale(0.0) - { - } + std::string Name = ""; // name + Real64 TstatHeight = 0.0; // Height of thermostat/ temperature control sensor + Real64 TleavingHeight = 0.0; // height of return air node where leaving zone + Real64 TexhaustHeight = 0.0; // height of exhaust air node where leaving zone + Real64 LowGradient = 0.0; // lower value of vertical gradient [C/m] + Real64 HiGradient = 0.0; // upper value of vertical gradient [C/m] + UserDefinedPatternMode InterpolationMode = UserDefinedPatternMode::Invalid; // control for interpolation mode + Real64 UpperBoundTempScale = 0.0; // temperature value for HiGradient + Real64 LowerBoundTempScale = 0.0; // temperature value for LowGradient + Real64 UpperBoundHeatRateScale = 0.0; // load value for HiGradient + Real64 LowerBoundHeatRateScale = 0.0; // load value for lowGradient }; struct TempVsHeightPattern // to be used as nested structure in RoomAirPattern @@ -393,318 +311,204 @@ namespace DataRoomAirModel { // Members Array1D ZetaPatrn; // non dimensional height from floor, Array1D DeltaTaiPatrn; // Tai- MAT (TODO, check sign) - - // Default Constructor - TempVsHeightPattern() - { - } }; - struct TemperaturePatternStruct // RoomAirPattern + struct TemperaturePattern // RoomAirPattern { // Members - std::string Name; // unique identifier - int PatrnID; // control ID for referencing in Schedules - UserDefinedPatternType PatternMode; // Control for what type of calcs in this pattern - ConstGradPattern GradPatrn; // Constant gradient pattern - TwoVertGradInterpolPattern TwoGradPatrn; // Two gradient interpolation pattern - TempVsHeightPattern VertPatrn; // Vertical gradient profile pattern - SurfMapPattern MapPatrn; // Generic Surface map pattern - Real64 DeltaTstat; // (Tstat - MAT) offset deg C - Real64 DeltaTleaving; // (Tleaving - MAT) deg C - Real64 DeltaTexhaust; // (Texhaust - MAT) deg C - - // Default Constructor - TemperaturePatternStruct() : PatrnID(0), PatternMode(UserDefinedPatternType::Invalid), DeltaTstat(0.0), DeltaTleaving(0.0), DeltaTexhaust(0.0) - { - } + std::string Name = ""; // unique identifier + int PatrnID = 0; // control ID for referencing in Schedules + UserDefinedPatternType PatternMode = UserDefinedPatternType::Invalid; // Control for what type of calcs in this pattern + ConstGradPattern GradPatrn; // Constant gradient pattern + TwoVertGradInterpolPattern TwoGradPatrn; // Two gradient interpolation pattern + TempVsHeightPattern VertPatrn; // Vertical gradient profile pattern + SurfMapPattern MapPatrn; // Generic Surface map pattern + Real64 DeltaTstat = 0.0; // (Tstat - MAT) offset deg C + Real64 DeltaTleaving = 0.0; // (Tleaving - MAT) deg C + Real64 DeltaTexhaust = 0.0; // (Texhaust - MAT) deg C }; - struct SurfaceAssocNestedStruct + struct SurfaceAssocNested { // Members - std::string Name; // unique identifier - int SurfID; // id in HB surface structs - Real64 TadjacentAir; // place to put resulting temperature value - Real64 Zeta; // non-dimensional height in zone ot - - // Default Constructor - SurfaceAssocNestedStruct() : SurfID(0), TadjacentAir(23.0), Zeta(0.0) - { - } + std::string Name = ""; // unique identifier + int SurfID = 0; // id in HB surface structs + Real64 TadjacentAir = 23.0; // place to put resulting temperature value + Real64 Zeta = 0.0; // non-dimensional height in zone ot }; - struct AirPatternInfobyZoneStruct // becomes AirPatternZoneInfo + struct AirPatternInfobyZone // becomes AirPatternZoneInfo { // Members // user variables - bool IsUsed; // .TRUE. if user-defined patterns used in zone - std::string Name; // Name - std::string ZoneName; // Zone name in building - int ZoneID; // Index of Zone in Heat Balance - std::string AvailSched; // Name of availability schedule - int AvailSchedID; // index of availability schedule - std::string PatternCntrlSched; // name of schedule that selects pattern - int PatternSchedID; // index of pattern selecting schedule + bool IsUsed = false; // .TRUE. if user-defined patterns used in zone + std::string Name = ""; // Name + std::string ZoneName = ""; // Zone name in building + int ZoneID = 0; // Index of Zone in Heat Balance + std::string AvailSched = ""; // Name of availability schedule + int AvailSchedID = 0; // index of availability schedule + std::string PatternCntrlSched = ""; // name of schedule that selects pattern + int PatternSchedID = 0; // index of pattern selecting schedule // calculated and from elsewhere - Real64 ZoneHeight; // in meters, from Zone%CeilingHeight - int ZoneNodeID; // index in Node array for this zone - Array1D_int ExhaustAirNodeID; // indexes in Node array - Real64 TairMean; // comes from MAT - Real64 Tstat; // temperature for thermostat - Real64 Tleaving; // temperature for return air node - Real64 Texhaust; // temperature for exhaust air node - Array1D Surf; // nested struct w/ surface info - int totNumSurfs; // total surfs for this zone - int firstSurfID; // Index of first surface + Real64 ZoneHeight = 0.0; // in meters, from Zone%CeilingHeight + int ZoneNodeID = 0; // index in Node array for this zone + Array1D_int ExhaustAirNodeID; // indexes in Node array + // Is 23.0 a constexpr somewhere + Real64 TairMean = 23.0; // comes from MAT + Real64 Tstat = 23.0; // temperature for thermostat + Real64 Tleaving = 23.0; // temperature for return air node + Real64 Texhaust = 23.0; // temperature for exhaust air node + Array1D Surf; // nested struct w/ surface info + int totNumSurfs = 0; // total surfs for this zone + int firstSurfID = 0; // Index of first surface // report - Real64 Gradient; // result for modeled gradient if using two-gradient interpolation - - // Default Constructor - AirPatternInfobyZoneStruct() - : IsUsed(false), ZoneID(0), AvailSchedID(0), PatternSchedID(0), ZoneHeight(0.0), ZoneNodeID(0), TairMean(23.0), Tstat(23.0), - Tleaving(23.0), Texhaust(23.0), totNumSurfs(0), firstSurfID(0), Gradient(0.0) - { - } + Real64 Gradient = 0.0; // result for modeled gradient if using two-gradient interpolation }; - struct AirflowLinkagesInfoNestedStruct // becomes link + struct AFNLinkInfoNested // becomes link { // Members // user variables - int AirflowNetworkLinkSimuID; // point to this linkage in AirflowNetworkLinkSimu structure - int AirflowNetworkLinkageDataID; // point to this linkage in AirflowNetworkLinkageData structure - int AirflowNetworkLinkReportID; // point to this linkage in AirflowNetworkLinkReport structure - Real64 MdotIn; // mass flow rate of air into control volume(neg means leaving control volume) (kg / s) - Real64 TempIn; // drybulb temperature of air into control volume - Real64 HumRatIn; // humidity ratio of air into control volume - - // Default Constructor - AirflowLinkagesInfoNestedStruct() - : AirflowNetworkLinkSimuID(0), AirflowNetworkLinkageDataID(0), AirflowNetworkLinkReportID(0), MdotIn(0.0), TempIn(0.0), HumRatIn(0.0) - { - } + int AFNSimuID = 0; // point to this linkage in AirflowNetworkLinkSimu structure + int AFNDataID = 0; // point to this linkage in AirflowNetworkLinkageData structure + int AFNReportID = 0; // point to this linkage in AirflowNetworkLinkReport structure + Real64 MdotIn = 0.0; // mass flow rate of air into control volume(neg means leaving control volume) (kg / s) + Real64 TempIn = 0.0; // drybulb temperature of air into control volume + Real64 HumRatIn = 0.0; // humidity ratio of air into control volume }; - struct RoomAirflowNetworkNodeInternalGainsStruct // becomes IntGain + struct AFNNodeInternalGains // becomes IntGain { // Members // user variables - DataHeatBalance::IntGainType Type; // Internal type - std::string Name; // Intenral gain name - bool UseRoomAirModelTempForGains; // TRUE if user inputs temp for gains - bool FractionCheck; // TRUE if a fraction of internal gain for each object is checked - - // Default Constructor - RoomAirflowNetworkNodeInternalGainsStruct() - : Type(DataHeatBalance::IntGainType::Invalid), UseRoomAirModelTempForGains(false), FractionCheck(false) - { - } + DataHeatBalance::IntGainType type = DataHeatBalance::IntGainType::Invalid; // Internal type + std::string Name = ""; // Intenral gain name + bool UseRoomAirModelTempForGains = false; // TRUE if user inputs temp for gains + bool FractionCheck = false; // TRUE if a fraction of internal gain for each object is checked }; - struct RoomAirflowNetworkHVACStruct // becomes HVAC + struct AFNHVAC // becomes HVAC { // Members // user variables - std::string Name; // HVAC system name - std::string ObjectTypeName; // HVAC object type name - std::string SupplyNodeName; // HVAC system supply node name - std::string ReturnNodeName; // HVAC system return node name - int TypeOfNum; // HVAC type num - Real64 SupplyFraction; // Supply flow fraction - Real64 ReturnFraction; // Return flow fraction - int EquipConfigIndex; // HVAC equipment configuration index - int SupNodeNum; // HVAC supply node number - int RetNodeNum; // HVAC return node number - int CompIndex; // Component index - - // Default Constructor - RoomAirflowNetworkHVACStruct() - : TypeOfNum(0), // HVAC type num - SupplyFraction(0), // Supply flow fraction - ReturnFraction(0), // Return flow fraction - EquipConfigIndex(0), // HVAC equipment configuration index - SupNodeNum(0), // HVAC supply node number - RetNodeNum(0), // HVAC return node number - CompIndex(0) // Component index - { - } + std::string Name = ""; // HVAC system name + std::string ObjectTypeName = ""; // HVAC object type name + std::string SupplyNodeName = ""; // HVAC system supply node name + std::string ReturnNodeName = ""; // HVAC system return node name + DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::Invalid; // HVAC type num + Real64 SupplyFraction = 0.0; // Supply flow fraction + Real64 ReturnFraction = 0.0; // Return flow fraction + int EquipConfigIndex = 0; // HVAC equipment configuration index + int SupNodeNum = 0; // HVAC supply node number + int RetNodeNum = 0; // HVAC return node number + int CompIndex = 0; // Component index }; - struct RoomAirflowNetworkAirNodeNestedStruct // becomes Node + struct AFNAirNodeNested // becomes Node { // Members // user variables - std::string Name; // name of the node itself - Real64 ZoneVolumeFraction; // Zone volume fraction applied to this specific node - std::string NodeSurfListName; // name of nodes' adjacent surface list - bool HasSurfacesAssigned; // True if this node has surfaces assigned - Array1D SurfMask; // Sized to num of surfs in Zone, true if surface is associated with this node - std::string NodeIntGainsListName; // name of node's internal gains list - bool HasIntGainsAssigned; // True if this node has internal gain assigned - int NumIntGains; // Number of matching internal gain objects for all spaces in the zone - Array1D intGainsDeviceSpaces; // index pointers to space struct - Array1D IntGainsDeviceIndices; // index pointers to internal gains struct - Array1D IntGainsFractions; // gain fractions to this node - Array1D IntGain; // Internal gain struct - std::string NodeHVACListName; // name of node's HVAC list - bool HasHVACAssigned; // True if HVAC systems are assigned to this node - int NumHVACs; // Number of HVAC systems - Array1D HVAC; // HVAC struct - int AirflowNetworkNodeID; // pointer to AirflowNetworkNodeData structure - int NumOfAirflowLinks; // Number of intra zone links - Array1D Link; // Linkage struct - Real64 AirVolume; // air volume in control volume associated with this node(m3 / s) - Real64 RhoAir; // current density of air for nodal control volume - Real64 CpAir; // current heat capacity of air for nodal control volume - - Real64 AirTemp; // node air temperature - Real64 AirTempX1; // node air temperature at t minus 1 zone timestep - Real64 AirTempX2; // node air temperature at t minus 2 zone timestep - Real64 AirTempX3; // node air temperature at t minus 3 zone timestep - Real64 AirTempX4; // node air temperature at t minus 4 zone timestep - Real64 AirTempDSX1; // node air temperature at t minus 1 system timestep - Real64 AirTempDSX2; // node air temperature at t minus 2 system timestep - Real64 AirTempDSX3; // node air temperature at t minus 3 system timestep - Real64 AirTempDSX4; // node air temperature at t minus 4 system timestep - Real64 AirTempT1; // node air temperature at the previous time step used in Exact and Euler method - Real64 AirTempTMX; // temporary node air temperature to test convergence used in Exact and Euler method - Real64 AirTempTM2; // node air temperature at time step t-2 used in Exact and Euler method - - Real64 HumRat; // node air humidity ratio - Real64 HumRatX1; // node air humidity ratio at t minus 1 zone timestep - Real64 HumRatX2; // node air humidity ratio at t minus 2 zone timestep - Real64 HumRatX3; // node air humidity ratio at t minus 3 zone timestep - Real64 HumRatX4; // node air humidity ratio at t minus 4 zone timestep - Real64 HumRatDSX1; // node air humidity ratio at t minus 1 system timestep - Real64 HumRatDSX2; // node air humidity ratio at t minus 2 system timestep - Real64 HumRatDSX3; // node air humidity ratio at t minus 3 system timestep - Real64 HumRatDSX4; // node air humidity ratio at t minus 4 system timestep - Real64 HumRatW1; // node air humidity ratio at the previous time step used in Exact and Euler method - Real64 HumRatWMX; // temporary node air humidity ratio to test convergence used in Exact and Euler method - Real64 HumRatWM2; // node air humidity ratio at time step t-2 used in Exact and Euler method - - Real64 RelHumidity; // node air relative humidity + std::string Name = ""; // name of the node itself + Real64 ZoneVolumeFraction = 0.0; // Zone volume fraction applied to this specific node + std::string NodeSurfListName = ""; // name of nodes' adjacent surface list + bool HasSurfacesAssigned = false; // True if this node has surfaces assigned + Array1D SurfMask; // Sized to num of surfs in Zone, true if surface is associated with this node + std::string NodeIntGainsListName = ""; // name of node's internal gains list + bool HasIntGainsAssigned = false; // True if this node has internal gain assigned + int NumIntGains = 0; // Number of matching internal gain objects for all spaces in the zone + Array1D intGainsDeviceSpaces; // index pointers to space struct + Array1D IntGainsDeviceIndices; // index pointers to internal gains struct + Array1D IntGainsFractions; // gain fractions to this node + Array1D IntGain; // Internal gain struct + std::string NodeHVACListName = ""; // name of node's HVAC list + bool HasHVACAssigned = false; // True if HVAC systems are assigned to this node + int NumHVACs = 0; // Number of HVAC systems + Array1D HVAC; // HVAC struct + int AFNNodeID = 0; // pointer to AirflowNetworkNodeData structure + int NumOfAirflowLinks = 0; // Number of intra zone links + Array1D Link; // Linkage struct + Real64 AirVolume = 0.0; // air volume in control volume associated with this node(m3 / s) + Real64 RhoAir = 0.0; // current density of air for nodal control volume + Real64 CpAir = 0.0; // current heat capacity of air for nodal control volume + + Real64 AirTemp = 0.0; // node air temperature + std::array AirTempX = {0.0, 0.0, 0.0, 0.0}; // node air temperature at t minus X zone timestep + std::array AirTempDSX = {0.0, 0.0, 0.0, 0.0}; // node air temperature at t minus X system timestep + Real64 AirTempT1 = 0.0; // node air temperature at the previous time step used in Exact and Euler method + Real64 AirTempTX = 0.0; // temporary node air temperature to test convergence used in Exact and Euler method + Real64 AirTempT2 = 0.0; // node air temperature at time step t-2 used in Exact and Euler method + + Real64 HumRat = 0.0; // node air humidity ratio + std::array HumRatX = {0.0, 0.0, 0.0, 0.0}; // node air humidity ratio at t minus X zone timestep + std::array HumRatDSX = {0.0, 0.0, 0.0, 0.0}; // node air humidity ratio at t minus 1 system timestep + Real64 HumRatT1 = 0.0; // node air humidity ratio at the previous time step used in Exact and Euler method + Real64 HumRatTX = 0.0; // temporary node air humidity ratio to test convergence used in Exact and Euler method + Real64 HumRatT2 = 0.0; // node air humidity ratio at time step t-2 used in Exact and Euler method + + Real64 RelHumidity = 0.0; // node air relative humidity // sensible heat balance terms for node - Real64 SumIntSensibleGain; // rate of heat gain from internal sensible gains(after fraction) - Real64 SumHA; // sum of Hc * Area for surfaces associated with this node(surface convection sensible gain term) - Real64 SumHATsurf; // sum of Hc * Area * Temp for surfaces associated with this node for convective heat transfer - Real64 SumHATref; // sum of Hc * Area * Temp for surfaces associated with this node for radiation exchange - Real64 SumLinkMCp; // sum of mdor*Cp for incoming airflows for this node derived from the AirflowNetwork model - Real64 SumLinkMCpT; // sum of mdor*Cp*T for incoming airflows and source temperature for this node derived from the AirflowNetwork model - Real64 SumSysMCp; // sum of mdor*Cp for incoming supply airflows for this node - Real64 SumSysMCpT; // sum of mdor*Cp*T for incoming supply airflows and temperature for this node - Real64 SumSysM; // sum of mdot for incoming supply airflows for this node - Real64 SumSysMW; // sum of mdot*W for incoming supply airflows and temperature for this node - Real64 NonAirSystemResponse; // sum of convective system load - Real64 SysDepZoneLoadsLagged; // sum of system lagged load - Real64 SysDepZoneLoadsLaggedOld; // sum of system lagged load - Real64 AirCap; // Air storage term for energy balalce at each node - Real64 AirHumRat; // Air storage term for moisture balalce at each node + Real64 SumIntSensibleGain = 0.0; // rate of heat gain from internal sensible gains(after fraction) + Real64 SumHA = 0.0; // sum of Hc * Area for surfaces associated with this node(surface convection sensible gain term) + Real64 SumHATsurf = 0.0; // sum of Hc * Area * Temp for surfaces associated with this node for convective heat transfer + Real64 SumHATref = 0.0; // sum of Hc * Area * Temp for surfaces associated with this node for radiation exchange + Real64 SumLinkMCp = 0.0; // sum of mdor*Cp for incoming airflows for this node derived from the AirflowNetwork model + Real64 SumLinkMCpT = 0.0; // sum of mdor*Cp*T for incoming airflows and source temperature for this node derived from the AirflowNetwork model + Real64 SumSysMCp = 0.0; // sum of mdor*Cp for incoming supply airflows for this node + Real64 SumSysMCpT = 0.0; // sum of mdor*Cp*T for incoming supply airflows and temperature for this node + Real64 SumSysM = 0.0; // sum of mdot for incoming supply airflows for this node + Real64 SumSysMW = 0.0; // sum of mdot*W for incoming supply airflows and temperature for this node + Real64 NonAirSystemResponse = 0.0; // sum of convective system load + Real64 SysDepZoneLoadsLagged = 0.0; // sum of system lagged load + Real64 SysDepZoneLoadsLaggedOld = 0.0; // sum of system lagged load + Real64 AirCap = 0.0; // Air storage term for energy balalce at each node + Real64 AirHumRat = 0.0; // Air storage term for moisture balalce at each node // latent moisture balance terms for node - Real64 SumIntLatentGain; // rate of heat gain form internal latent gains(after fraction) - Real64 SumHmAW; // sum of AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio - Real64 SumHmARa; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air - Real64 SumHmARaW; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ratio - Real64 SumLinkM; // sum of mdor for incoming airflows for this node derived from the AirflowNetwork model - Real64 SumLinkMW; // sum of mdor*Cp*T for incoming airflows and source humidity ratio for this node derived from the AirflowNetwork model - - // Default Constructor - RoomAirflowNetworkAirNodeNestedStruct() - : ZoneVolumeFraction(0.0), HasSurfacesAssigned(false), HasIntGainsAssigned(false), NumIntGains(0), HasHVACAssigned(false), NumHVACs(0), - AirflowNetworkNodeID(0), // pointer to AirflowNetworkNodeData structure - NumOfAirflowLinks(0), AirVolume(0.0), // air volume in control volume associated with this node(m3 / s) - RhoAir(0.0), // current density of air for nodal control volume - CpAir(0.0), // current heat capacity of air for nodal control volume - AirTemp(0.0), // node air temperature - AirTempX1(0.0), // node air temperature at t minus 1 zone timestep - AirTempX2(0.0), // node air temperature at t minus 2 zone timestep - AirTempX3(0.0), // node air temperature at t minus 3 zone timestep - AirTempX4(0.0), // node air temperature at t minus 4 zone timestep - AirTempDSX1(0.0), // node air temperature at t minus 1 system timestep - AirTempDSX2(0.0), // node air temperature at t minus 2 system timestep - AirTempDSX3(0.0), // node air temperature at t minus 3 system timestep - AirTempDSX4(0.0), // node air temperature at t minus 4 system timestep - AirTempT1(0.0), // node air temperature at the previous time step used in Exact and Euler method - AirTempTMX(0.0), // temporary node air temperature to test convergence used in Exact and Euler method - AirTempTM2(0.0), // node air temperature at time step t-2 used in Exact and Euler method - HumRat(0.0), // node air humidity ratio - HumRatX1(0.0), // node air humidity ratio at t minus 1 zone timestep - HumRatX2(0.0), // node air humidity ratio at t minus 2 zone timestep - HumRatX3(0.0), // node air humidity ratio at t minus 3 zone timestep - HumRatX4(0.0), // node air humidity ratio at t minus 4 zone timestep - HumRatDSX1(0.0), // node air humidity ratio at t minus 1 system timestep - HumRatDSX2(0.0), // node air humidity ratio at t minus 2 system timestep - HumRatDSX3(0.0), // node air humidity ratio at t minus 3 system timestep - HumRatDSX4(0.0), // node air humidity ratio at t minus 4 system timestep - HumRatW1(0.0), // node air humidity ratio at the previous time step used in Exact and Euler method - HumRatWMX(0.0), // temporary node air humidity ratio to test convergence used in Exact and Euler method - HumRatWM2(0.0), // node air humidity ratio at time step t-2 used in Exact and Euler method - RelHumidity(0.0), // node air relative humidity - // sensible heat balance terms for node - SumIntSensibleGain(0.0), // rate of heat gain from internal sensible gains(after fraction) - SumHA(0.0), // sum of Hc * Area for surfaces associated with this node(surface convection sensible gain term) - SumHATsurf(0.0), SumHATref(0.0), // sum of Hc * Area * Temp for surfaces associated with this node - SumLinkMCp(0.0), SumLinkMCpT(0.0), SumSysMCp(0.0), SumSysMCpT(0.0), SumSysM(0.0), SumSysMW(0.0), NonAirSystemResponse(0.0), - SysDepZoneLoadsLagged(0.0), SysDepZoneLoadsLaggedOld(0.0), AirCap(0.0), AirHumRat(0.0), - // latent moisture balance terms for node - SumIntLatentGain(0.0), // rate of heat gain form internal latent gains(after fraction) - SumHmAW(0.0), // sum of AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio - SumHmARa(0.0), // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air - SumHmARaW(0.0), // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ratio - SumLinkM(0.0), SumLinkMW(0.0) - { - } + Real64 SumIntLatentGain = 0.0; // rate of heat gain form internal latent gains(after fraction) + Real64 SumHmAW = 0.0; // sum of AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio + Real64 SumHmARa = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air + Real64 SumHmARaW = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ratio + Real64 SumLinkM = 0.0; // sum of mdor for incoming airflows for this node derived from the AirflowNetwork model + Real64 SumLinkMW = + 0.0; // sum of mdor*Cp*T for incoming airflows and source humidity ratio for this node derived from the AirflowNetwork model }; - struct RoomAirflowNetworkInfoByZoneStruct // becomes RoomAirflowNetworkZoneInfo + struct AFNInfoByZone // becomes RoomAirflowNetworkZoneInfo { // Members // user variables - bool IsUsed; // true. if RoomAirflowNetwork model used in zone - std::string Name; // Name - std::string ZoneName; // Zone name in building - int ZoneID; // Index of Zone in Heat Balance - int ActualZoneID; // Index of controlled zones in ZoneCOnfigure - std::string AvailSched; // Name of availability schedule - int AvailSchedID; // index of availability schedule - int ControlAirNodeID; // index of roomair node that is HVAC control sensor location - int NumOfAirNodes; // Number of air nodes - Array1D Node; // Node struct - int ZoneNodeID; // index in system Node array for this zone - Real64 TairMean; // comes from MAT - Real64 Tstat; // temperature for thermostat - Real64 Tleaving; // temperature for return air node - Real64 Texhaust; // temperature for exhaust air node - int totNumSurfs; // total surfs for this zone - int firstSurfID; // Index of first surface - int RAFNNum; // RAFN number - - // Default Constructor - RoomAirflowNetworkInfoByZoneStruct() - : IsUsed(false), // true. if RoomAirflowNetwork model used in zone - ZoneID(0), // Index of Zone in Heat Balance - ActualZoneID(0), // Index of controlled zones in ZoneCOnfigure - AvailSchedID(0), // index of availability schedule - ControlAirNodeID(0), // index of roomair node that is HVAC control sensor location - NumOfAirNodes(0), // Number of air nodes - ZoneNodeID(0), // index in system Node array for this zone - TairMean(23.0), // comes from MAT - Tstat(23.0), // temperature for thermostat - Tleaving(23.0), // temperature for return air node - Texhaust(23.0), // temperature for exhaust air node - totNumSurfs(0), // total surfs for this zone - firstSurfID(0), // Index of first surface - RAFNNum(0) // RAFN number - { - } + bool IsUsed = false; // true. if RoomAirflowNetwork model used in zone + std::string Name = ""; // Name + std::string ZoneName = ""; // Zone name in building + int ZoneID = 0; // Index of Zone in Heat Balance + int ActualZoneID = 0; // Index of controlled zones in ZoneCOnfigure + std::string AvailSched = ""; // Name of availability schedule + int AvailSchedID = 0; // index of availability schedule + int ControlAirNodeID = 0; // index of roomair node that is HVAC control sensor location + int NumOfAirNodes = 0; // Number of air nodes + Array1D Node; // Node struct + int ZoneNodeID = 0; // index in system Node array for this zone + Real64 TairMean = 0.0; // comes from MAT + Real64 Tstat = 0.0; // temperature for thermostat + Real64 Tleaving = 0.0; // temperature for return air node + Real64 Texhaust = 0.0; // temperature for exhaust air node + int totNumSurfs = 0; // total surfs for this zone + int firstSurfID = 0; // Index of first surface }; -} // namespace DataRoomAirModel + struct BegEnd + { + int beg = 0; + int end = 0; + }; +} // namespace RoomAir struct RoomAirModelData : BaseGlobalStruct { + bool GetAirModelData = true; // Used to "get" all air model data + bool MyOneTimeFlag = true; + Array1D_bool MyEnvrnFlag; + bool anyNonMixingRoomAirModel = false; // True if any zone RoomAirModelType is not Mixing int TotNumOfAirNodes = 0; int TotNumOfRoomAFNNodes = 0; @@ -712,59 +516,36 @@ struct RoomAirModelData : BaseGlobalStruct Array1D ConvectiveFloorSplit; Array1D InfiltratFloorSplit; // UCSD - int TotUCSDDV = 0; // Total number of UCSDDV zones - Array1D DVHcIn; - Array1D_bool IsZoneDV; // Is the air model for the zone UCSDDV? - Array1D ZTOC; // Temperature of occupied (lower) zone - Array1D AvgTempGrad; // vertical Average Temperature Gradient in the room - Array1D ZTMX; // Temperature of the mixing(upper) layer - Array1D MaxTempGrad; // maximum Average Temperature Gradient in the room - Array1D HVACAirTemp; // HVAC system temperature (DEG C) - Array1D HVACMassFlow; // HVAC system mass flow rate (KG/S) + int TotDispVent3Node = 0; // Total number of UCSDDV zones + Array1D DispVent3NodeHcIn; + Array1D_bool IsZoneDispVent3Node; // Is the air model for the zone UCSDDV? + Array1D ZTOC; // Temperature of occupied (lower) zone + Array1D AvgTempGrad; // vertical Average Temperature Gradient in the room + Array1D ZTMX; // Temperature of the mixing(upper) layer + Array1D MaxTempGrad; // maximum Average Temperature Gradient in the room + Array1D HVACAirTemp; // HVAC system temperature (DEG C) + Array1D HVACMassFlow; // HVAC system mass flow rate (KG/S) Array1D ZTFloor; Array1D HeightTransition; Array1D FracMinFlow; - Array1D_int ZoneDVMixedFlag; - Array1D ZoneDVMixedFlagRep; + Array1D_int ZoneDispVent3NodeMixedFlag; + Array1D ZoneDispVent3NodeMixedFlagRep; Array1D_bool ZoneAirSystemON; Array1D TCMF; // comfort temperature - Array1D ZoneCeilingHeight; - Array1D MATFloor; // [C] floor level mean air temp - Array1D XMATFloor; // [C] floor level mean air temp at t minus 1 zone time step - Array1D XM2TFloor; // [C] floor level mean air temp at t minus 2 zone time step - Array1D XM3TFloor; // [C] floor level mean air temp at t minus 3 zone time step - Array1D XM4TFloor; // [C] floor level mean air temp at t minus 4 zone time step - Array1D DSXMATFloor; // [C] floor level mean air temp at t minus 1 system time step - Array1D DSXM2TFloor; // [C] floor level mean air temp at t minus 2 system time step - Array1D DSXM3TFloor; // [C] floor level mean air temp at t minus 3 system time step - Array1D DSXM4TFloor; // [C] floor level mean air temp at t minus 4 system time step - Array1D MATOC; // [C] occupied mean air temp - Array1D XMATOC; // [C] occupied mean air temp at t minus 1 zone time step - Array1D XM2TOC; // [C] occupied mean air temp at t minus 2 zone time step - Array1D XM3TOC; // [C] occupied mean air temp at t minus 3 zone time step - Array1D XM4TOC; // [C] occupied mean air temp at t minus 4 zone time step - Array1D DSXMATOC; // [C] occupied mean air temp at t minus 1 system time step - Array1D DSXM2TOC; // [C] occupied mean air temp at t minus 2 system time step - Array1D DSXM3TOC; // [C] occupied mean air temp at t minus 3 system time step - Array1D DSXM4TOC; // [C] occupied mean air temp at t minus 4 system time step - Array1D MATMX; // [C] mixed (upper) mean air temp - Array1D XMATMX; // [C] mixed (upper) mean air temp at t minus 1 zone time step - Array1D XM2TMX; // [C] mixed (upper) mean air temp at t minus 2 zone time step - Array1D XM3TMX; // [C] mixed (upper) mean air temp at t minus 3 zone time step - Array1D XM4TMX; // [C] mixed (upper) mean air temp at t minus 4 zone time step - Array1D DSXMATMX; // [C] mixed mean air temp at t minus 1 system time step - Array1D DSXM2TMX; // [C] mixed mean air temp at t minus 2 system time step - Array1D DSXM3TMX; // [C] mixed mean air temp at t minus 3 system time step - Array1D DSXM4TMX; // [C] mixed mean air temp at t minus 4 system time step - Array1D ZTM1Floor; // [C] difference equation's Floor air temp at t minus 1 - Array1D ZTM2Floor; // [C] difference equation's Floor air temp at t minus 2 - Array1D ZTM3Floor; // [C] difference equation's Floor air temp at t minus 3 - Array1D ZTM1OC; // [C] difference equation's Occupied air temp at t minus 1 - Array1D ZTM2OC; // [C] difference equation's Occupied air temp at t minus 2 - Array1D ZTM3OC; // [C] difference equation's Occupied air temp at t minus 3 - Array1D ZTM1MX; // [C] difference equation's Mixed air temp at t minus 1 - Array1D ZTM2MX; // [C] difference equation's Mixed air temp at t minus 1 - Array1D ZTM3MX; // [C] difference equation's Mixed air temp at t minus 1 + Array1D ZoneCeilingHeight1; + Array1D ZoneCeilingHeight2; + Array1D MATFloor; // [C] floor level mean air temp + EPVector> XMATFloor; // [C] floor level mean air temp at t minus X zone time step + EPVector> DSXMATFloor; // [C] floor level mean air temp at t minus X system time step + Array1D MATOC; // [C] occupied mean air temp + EPVector> XMATOC; // [C] occupied mean air temp at t minus X zone time step + EPVector> DSXMATOC; // [C] occupied mean air temp at t minus X system time step + Array1D MATMX; // [C] mixed (upper) mean air temp + EPVector> XMATMX; // [C] mixed (upper) mean air temp at t minus X zone time step + EPVector> DSXMATMX; // [C] mixed mean air temp at t minus X system time step + EPVector> ZTMFloor; // [C] difference equation's Floor air temp at t minus X + EPVector> ZTMOC; // [C] difference equation's Occupied air temp at t minus X + EPVector> ZTMMX; // [C] difference equation's Mixed air temp at t minus X Array1D AIRRATFloor; Array1D AIRRATOC; Array1D AIRRATMX; @@ -778,15 +559,41 @@ struct RoomAirModelData : BaseGlobalStruct Array1D Zone1MX; // [C] difference equation's Mixed air temp at previous dt Array1D ZoneMXMX; // [C] difference equation's Mixed air temp at t minus 1 Array1D ZoneM2MX; // [C] difference equation's Mixed air temp at t minus 2 + + // UCSD-Shared + // The Eplus surface numbers will be stored in the arrays Apos according to the + // type of surface. The PosZ_Wall array has dimension 2 times the Number of Zones and + // for each zone it has 2 positions: the start and end positions in the Apos_Wall array + // for that specific zone. + Array1D_int APos_Wall; + Array1D_int APos_Floor; + Array1D_int APos_Ceiling; + EPVector PosZ_Wall; + EPVector PosZ_Floor; + EPVector PosZ_Ceiling; + Array1D_int APos_Window; + Array1D_int APos_Door; + Array1D_int APos_Internal; + EPVector PosZ_Window; + EPVector PosZ_Door; + EPVector PosZ_Internal; + // Convection coefficients for the various surfaces + Array1D HCeiling; + Array1D HWall; + Array1D HFloor; + Array1D HInternal; + Array1D HWindow; + Array1D HDoor; + // UCSD-CV - int TotUCSDCV = 0; // Total number of UCSDDV zones - int CVNumAirflowNetworkSurfaces = 0; // total number of AirFlowNetwork surfaces. - Array1D CVHcIn; - Array1D_bool IsZoneCV; // Is the air model for the zone UCSDDV? - Array1D ZoneCVisMixing; // Zone set to CV is actually using a mixing model - Array1D ZTJET; // Jet Temperatures - Array1D ZTREC; // Recirculation Temperatures - Array1D RoomOutflowTemp; // Temperature of air flowing out of the room + int TotCrossVent = 0; // Total number of UCSDDV zones + int CrossVentNumAFNSurfaces = 0; // total number of AirFlowNetwork surfaces. + Array1D CrossVentHcIn; + Array1D_bool IsZoneCrossVent; // Is the air model for the zone UCSDDV? + Array1D ZoneCrossVentIsMixing; // Zone set to CV is actually using a mixing model + Array1D ZTJET; // Jet Temperatures + Array1D ZTREC; // Recirculation Temperatures + Array1D RoomOutflowTemp; // Temperature of air flowing out of the room Array1D JetRecAreaRatio; Array1D Urec; // Recirculation region average velocity Array1D Ujet; // Jet region average velocity @@ -794,29 +601,29 @@ struct RoomAirModelData : BaseGlobalStruct Array1D Qtot; // Total volumetric inflow rate through all active aperatures [m3/s] Array1D RecInflowRatio; // Ratio of the recirculation volumetric flow rate to the total inflow flow rate [] Array1D Uhc; - Array1D Ain; // Inflow aperture area - Array1D Droom; // CV Zone average length - Array1D Dstar; // CV Zone average length, wind direction corrected - Array1D Tin; // Inflow air temperature - Array1D TotArea; // Sum of the areas of all apertures in the zone - Array2D_int AirflowNetworkSurfaceUCSDCV; // table for AirflowNetwork surfaces organization + Array1D Ain; // Inflow aperture area + Array1D Droom; // CV Zone average length + Array1D Dstar; // CV Zone average length, wind direction corrected + Array1D Tin; // Inflow air temperature + Array1D TotArea; // Sum of the areas of all apertures in the zone + Array2D_int AFNSurfaceCrossVent; // table for AirflowNetwork surfaces organization // Interzone surfaces counts twice. - Array1D Rfr; // Ration between inflow and recirculation air flows - Array1D ZoneCVhasREC; // Airflow pattern is C = 0, CR(1) + Array1D Rfr; // Ration between inflow and recirculation air flows + Array1D ZoneCrossVentHasREC; // Airflow pattern is C = 0, CR(1) bool UCSDModelUsed = false; - bool MundtModelUsed = false; + bool DispVent1NodeModelUsed = false; // UCSD-UF - int TotUCSDUI = 0; // total number of UCSDUI zones - int TotUCSDUE = 0; // total number of UCSDUE zones - Array1D_bool IsZoneUI; // controls program flow, for interior or exterior UFAD model - Array1D_int ZoneUFPtr; - Array1D UFHcIn; - Array1D_int ZoneUFMixedFlag; - Array1D ZoneUFMixedFlagRep; - Array1D ZoneUFGamma; - Array1D ZoneUFPowInPlumes; // [W] - Array1D ZoneUFPowInPlumesfromWindows; // [W] - Array1D Phi; // dimensionless measure of occupied subzone temperature + int TotUFADInt = 0; // total number of UCSDUI zones + int TotUFADExt = 0; // total number of UCSDUE zones + Array1D_bool IsZoneUFAD; // controls program flow, for interior or exterior UFAD model + Array1D_int ZoneUFADPtr; + Array1D UFADHcIn; + Array1D_int ZoneUFADMixedFlag; + Array1D ZoneUFADMixedFlagRep; + Array1D ZoneUFADGamma; + Array1D ZoneUFADPowInPlumes; // [W] + Array1D ZoneUFADPowInPlumesfromWindows; // [W] + Array1D Phi; // dimensionless measure of occupied subzone temperature // END UCSD // Begin NREL User-defined patterns int numTempDistContrldZones = 0; // count of zones with user-defined patterns @@ -829,20 +636,19 @@ struct RoomAirModelData : BaseGlobalStruct // End User-defined patterns // RoomAirflowNetwork - int NumOfRoomAirflowNetControl = 0; // count of RoomAirSettings:AirflowNetwork + int NumOfRoomAFNControl = 0; // count of RoomAirSettings:AirflowNetwork // Object Data - Array1D AirModel; - Array1D AirNode; - Array1D ZoneUCSDDV; // UCSD - Array1D ZoneUCSDCV; - Array1D ZoneUCSDUI; - Array1D ZoneUCSDUE; - Array2D CVJetRecFlows; // Jet and recirculation zone flows and properties - Array1D SurfParametersCVDV; // Surface parameters - Array1D RoomAirPattern; // user defined patterns ,various types - Array1D AirPatternZoneInfo; // added zone information for user defined patterns - Array1D RoomAirflowNetworkZoneInfo; // added zone info + EPVector AirModel; + EPVector AirNode; + EPVector ZoneDispVent3Node; // UCSD + EPVector ZoneCrossVent; + EPVector ZoneUFAD; + Array2D CrossVentJetRecFlows; // Jet and recirculation zone flows and properties + EPVector SurfParametersCrossDispVent; // Surface parameters + EPVector AirPattern; // user defined patterns ,various types + EPVector AirPatternZoneInfo; // added zone information for user defined patterns + EPVector AFNZoneInfo; // added zone info void clear_state() override { @@ -853,59 +659,56 @@ struct RoomAirModelData : BaseGlobalStruct ConvectiveFloorSplit.clear(); InfiltratFloorSplit.clear(); // UCSD - TotUCSDDV = 0; // Total number of UCSDDV zones - DVHcIn.clear(); - IsZoneDV.clear(); // Is the air model for the zone UCSDDV? - ZTOC.clear(); // Temperature of occupied (lower) zone - AvgTempGrad.clear(); // vertical Average Temperature Gradient in the room - ZTMX.clear(); // Temperature of the mixing(upper) layer - MaxTempGrad.clear(); // maximum Average Temperature Gradient in the room - HVACAirTemp.clear(); // HVAC system temperature (DEG C) - HVACMassFlow.clear(); // HVAC system mass flow rate (KG/S) + APos_Wall.clear(); + APos_Floor.clear(); + APos_Ceiling.clear(); + PosZ_Wall.clear(); + PosZ_Floor.clear(); + PosZ_Ceiling.clear(); + APos_Window.clear(); + APos_Door.clear(); + APos_Internal.clear(); + PosZ_Window.clear(); + PosZ_Door.clear(); + PosZ_Internal.clear(); + // Convection coeficients for the various surfaces + HCeiling.clear(); + HWall.clear(); + HFloor.clear(); + HInternal.clear(); + HWindow.clear(); + HDoor.clear(); + + TotDispVent3Node = 0; // Total number of UCSDDV zones + DispVent3NodeHcIn.clear(); + IsZoneDispVent3Node.clear(); // Is the air model for the zone UCSDDV? + ZTOC.clear(); // Temperature of occupied (lower) zone + AvgTempGrad.clear(); // vertical Average Temperature Gradient in the room + ZTMX.clear(); // Temperature of the mixing(upper) layer + MaxTempGrad.clear(); // maximum Average Temperature Gradient in the room + HVACAirTemp.clear(); // HVAC system temperature (DEG C) + HVACMassFlow.clear(); // HVAC system mass flow rate (KG/S) ZTFloor.clear(); HeightTransition.clear(); FracMinFlow.clear(); - ZoneDVMixedFlag.clear(); - ZoneDVMixedFlagRep.clear(); + ZoneDispVent3NodeMixedFlag.clear(); + ZoneDispVent3NodeMixedFlagRep.clear(); ZoneAirSystemON.clear(); TCMF.clear(); // comfort temperature - ZoneCeilingHeight.clear(); + ZoneCeilingHeight1.clear(); + ZoneCeilingHeight2.clear(); MATFloor.clear(); // [C] floor level mean air temp XMATFloor.clear(); // [C] floor level mean air temp at t minus 1 zone time step - XM2TFloor.clear(); // [C] floor level mean air temp at t minus 2 zone time step - XM3TFloor.clear(); // [C] floor level mean air temp at t minus 3 zone time step - XM4TFloor.clear(); // [C] floor level mean air temp at t minus 4 zone time step DSXMATFloor.clear(); // [C] floor level mean air temp at t minus 1 system time step - DSXM2TFloor.clear(); // [C] floor level mean air temp at t minus 2 system time step - DSXM3TFloor.clear(); // [C] floor level mean air temp at t minus 3 system time step - DSXM4TFloor.clear(); // [C] floor level mean air temp at t minus 4 system time step MATOC.clear(); // [C] occupied mean air temp XMATOC.clear(); // [C] occupied mean air temp at t minus 1 zone time step - XM2TOC.clear(); // [C] occupied mean air temp at t minus 2 zone time step - XM3TOC.clear(); // [C] occupied mean air temp at t minus 3 zone time step - XM4TOC.clear(); // [C] occupied mean air temp at t minus 4 zone time step DSXMATOC.clear(); // [C] occupied mean air temp at t minus 1 system time step - DSXM2TOC.clear(); // [C] occupied mean air temp at t minus 2 system time step - DSXM3TOC.clear(); // [C] occupied mean air temp at t minus 3 system time step - DSXM4TOC.clear(); // [C] occupied mean air temp at t minus 4 system time step MATMX.clear(); // [C] mixed (upper) mean air temp XMATMX.clear(); // [C] mixed (upper) mean air temp at t minus 1 zone time step - XM2TMX.clear(); // [C] mixed (upper) mean air temp at t minus 2 zone time step - XM3TMX.clear(); // [C] mixed (upper) mean air temp at t minus 3 zone time step - XM4TMX.clear(); // [C] mixed (upper) mean air temp at t minus 4 zone time step DSXMATMX.clear(); // [C] mixed mean air temp at t minus 1 system time step - DSXM2TMX.clear(); // [C] mixed mean air temp at t minus 2 system time step - DSXM3TMX.clear(); // [C] mixed mean air temp at t minus 3 system time step - DSXM4TMX.clear(); // [C] mixed mean air temp at t minus 4 system time step - ZTM1Floor.clear(); // [C] difference equation's Floor air temp at t minus 1 - ZTM2Floor.clear(); // [C] difference equation's Floor air temp at t minus 2 - ZTM3Floor.clear(); // [C] difference equation's Floor air temp at t minus 3 - ZTM1OC.clear(); // [C] difference equation's Occupied air temp at t minus 1 - ZTM2OC.clear(); // [C] difference equation's Occupied air temp at t minus 2 - ZTM3OC.clear(); // [C] difference equation's Occupied air temp at t minus 3 - ZTM1MX.clear(); // [C] difference equation's Mixed air temp at t minus 1 - ZTM2MX.clear(); // [C] difference equation's Mixed air temp at t minus 1 - ZTM3MX.clear(); // [C] difference equation's Mixed air temp at t minus 1 + ZTMFloor.clear(); // [C] difference equation's Floor air temp at t minus 1 + ZTMOC.clear(); // [C] difference equation's Occupied air temp at t minus 1 + ZTMMX.clear(); // [C] difference equation's Mixed air temp at t minus 1 AIRRATFloor.clear(); AIRRATOC.clear(); AIRRATMX.clear(); @@ -920,14 +723,14 @@ struct RoomAirModelData : BaseGlobalStruct ZoneMXMX.clear(); // [C] difference equation's Mixed air temp at t minus 1 ZoneM2MX.clear(); // [C] difference equation's Mixed air temp at t minus 2 // UCSD-CV - TotUCSDCV = 0; // Total number of UCSDDV zones - CVNumAirflowNetworkSurfaces = 0; // total number of AirFlowNetwork surfaces. - CVHcIn.clear(); - IsZoneCV.clear(); // Is the air model for the zone UCSDDV? - ZoneCVisMixing.clear(); // Zone set to CV is actually using a mixing model - ZTJET.clear(); // Jet Temperatures - ZTREC.clear(); // Recirculation Temperatures - RoomOutflowTemp.clear(); // Temperature of air flowing out of the room + TotCrossVent = 0; // Total number of UCSDDV zones + CrossVentNumAFNSurfaces = 0; // total number of AirFlowNetwork surfaces. + CrossVentHcIn.clear(); + IsZoneCrossVent.clear(); // Is the air model for the zone UCSDDV? + ZoneCrossVentIsMixing.clear(); // Zone set to CV is actually using a mixing model + ZTJET.clear(); // Jet Temperatures + ZTREC.clear(); // Recirculation Temperatures + RoomOutflowTemp.clear(); // Temperature of air flowing out of the room JetRecAreaRatio.clear(); Urec.clear(); // Recirculation region average velocity Ujet.clear(); // Jet region average velocity @@ -935,29 +738,29 @@ struct RoomAirModelData : BaseGlobalStruct Qtot.clear(); // Total volumetric inflow rate through all active aperatures [m3/s] RecInflowRatio.clear(); // Ratio of the recirculation volumetric flow rate to the total inflow flow rate [] Uhc.clear(); - Ain.clear(); // Inflow aperture area - Droom.clear(); // CV Zone average length - Dstar.clear(); // CV Zone average length, wind direction corrected - Tin.clear(); // Inflow air temperature - TotArea.clear(); // Sum of the areas of all apertures in the zone - AirflowNetworkSurfaceUCSDCV.clear(); // table for AirflowNetwork surfaces organization + Ain.clear(); // Inflow aperture area + Droom.clear(); // CV Zone average length + Dstar.clear(); // CV Zone average length, wind direction corrected + Tin.clear(); // Inflow air temperature + TotArea.clear(); // Sum of the areas of all apertures in the zone + AFNSurfaceCrossVent.clear(); // table for AirflowNetwork surfaces organization // Interzone surfaces counts twice. - Rfr.clear(); // Ration between inflow and recirculation air flows - ZoneCVhasREC.clear(); // Airflow pattern is C = 0, CR(1) + Rfr.clear(); // Ration between inflow and recirculation air flows + ZoneCrossVentHasREC.clear(); // Airflow pattern is C = 0, CR(1) UCSDModelUsed = false; - MundtModelUsed = false; + DispVent1NodeModelUsed = false; // UCSD-UF - TotUCSDUI = 0; // total number of UCSDUI zones - TotUCSDUE = 0; // total number of UCSDUE zones - IsZoneUI.clear(); // controls program flow, for interior or exterior UFAD model - ZoneUFPtr.clear(); - UFHcIn.clear(); - ZoneUFMixedFlag.clear(); - ZoneUFMixedFlagRep.clear(); - ZoneUFGamma.clear(); - ZoneUFPowInPlumes.clear(); // [W] - ZoneUFPowInPlumesfromWindows.clear(); // [W] - Phi.clear(); // dimensionless measure of occupied subzone temperature + TotUFADInt = 0; // total number of UCSDUI zones + TotUFADExt = 0; // total number of UCSDUE zones + IsZoneUFAD.clear(); // controls program flow, for interior or exterior UFAD model + ZoneUFADPtr.clear(); + UFADHcIn.clear(); + ZoneUFADMixedFlag.clear(); + ZoneUFADMixedFlagRep.clear(); + ZoneUFADGamma.clear(); + ZoneUFADPowInPlumes.clear(); // [W] + ZoneUFADPowInPlumesfromWindows.clear(); // [W] + Phi.clear(); // dimensionless measure of occupied subzone temperature // END UCSD // Begin NREL User-defined patterns numTempDistContrldZones = 0; // count of zones with user-defined patterns @@ -970,20 +773,19 @@ struct RoomAirModelData : BaseGlobalStruct // End User-defined patterns // RoomAirflowNetwork - NumOfRoomAirflowNetControl = 0; // count of RoomAirSettings:AirflowNetwork + NumOfRoomAFNControl = 0; // count of RoomAirSettings:AirflowNetwork // Object Data AirModel.clear(); AirNode.clear(); - ZoneUCSDDV.clear(); // UCSD - ZoneUCSDCV.clear(); - ZoneUCSDUI.clear(); - ZoneUCSDUE.clear(); - CVJetRecFlows.clear(); // Jet and recirculation zone flows and properties - SurfParametersCVDV.clear(); // Surface parameters - RoomAirPattern.clear(); // user defined patterns ,various types - AirPatternZoneInfo.clear(); // added zone information for user defined patterns - RoomAirflowNetworkZoneInfo.clear(); // added zone info + ZoneDispVent3Node.clear(); // UCSD + ZoneCrossVent.clear(); + ZoneUFAD.clear(); + CrossVentJetRecFlows.clear(); // Jet and recirculation zone flows and properties + SurfParametersCrossDispVent.clear(); // Surface parameters + AirPattern.clear(); // user defined patterns ,various types + AirPatternZoneInfo.clear(); // added zone information for user defined patterns + AFNZoneInfo.clear(); // added zone info } }; diff --git a/src/EnergyPlus/DataSurfaceColors.cc b/src/EnergyPlus/DataSurfaceColors.cc index 512bd66dae5..9cfa6c4733a 100644 --- a/src/EnergyPlus/DataSurfaceColors.cc +++ b/src/EnergyPlus/DataSurfaceColors.cc @@ -101,7 +101,7 @@ bool MatchAndSetColorTextString(EnergyPlusData &state, if (ColorType != "DXF") return false; // try to find enum value - int foundIdx = getEnumerationValue(colorkeys, UtilityRoutines::MakeUPPERCase(String)); + int foundIdx = getEnumValue(colorkeys, UtilityRoutines::makeUPPER(String)); if (foundIdx == -1) return false; // if we've made it here, we found the value diff --git a/src/EnergyPlus/DataUCSDSharedData.hh b/src/EnergyPlus/DataUCSDSharedData.hh deleted file mode 100644 index 1c076069ffa..00000000000 --- a/src/EnergyPlus/DataUCSDSharedData.hh +++ /dev/null @@ -1,111 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#ifndef DataUCSDSharedData_hh_INCLUDED -#define DataUCSDSharedData_hh_INCLUDED - -// ObjexxFCL Headers -#include - -// EnergyPlus Headers -#include -#include - -namespace EnergyPlus { - -struct UCSDSharedData : BaseGlobalStruct -{ - // The Eplus surface numbers will be stored in the arrays Apos according to the - // type of surface. The PosZ_Wall array has dimension 2 times the Number of Zones and - // for each zone it has 2 positions: the start and end positions in the Apos_Wall array - // for that specific zone. - Array1D_int APos_Wall; - Array1D_int APos_Floor; - Array1D_int APos_Ceiling; - Array1D_int PosZ_Wall; - Array1D_int PosZ_Floor; - Array1D_int PosZ_Ceiling; - Array1D_int APos_Window; - Array1D_int APos_Door; - Array1D_int APos_Internal; - Array1D_int PosZ_Window; - Array1D_int PosZ_Door; - Array1D_int PosZ_Internal; - // Convection coefficients for the various surfaces - Array1D HCeiling; - Array1D HWall; - Array1D HFloor; - Array1D HInternal; - Array1D HWindow; - Array1D HDoor; - void clear_state() override - { - this->APos_Wall.clear(); - this->APos_Floor.clear(); - this->APos_Ceiling.clear(); - this->PosZ_Wall.clear(); - this->PosZ_Floor.clear(); - this->PosZ_Ceiling.clear(); - this->APos_Window.clear(); - this->APos_Door.clear(); - this->APos_Internal.clear(); - this->PosZ_Window.clear(); - this->PosZ_Door.clear(); - this->PosZ_Internal.clear(); - // Convection coeficients for the various surfaces - this->HCeiling.clear(); - this->HWall.clear(); - this->HFloor.clear(); - this->HInternal.clear(); - this->HWindow.clear(); - this->HDoor.clear(); - } -}; - -} // namespace EnergyPlus - -#endif diff --git a/src/EnergyPlus/DataZoneEquipment.cc b/src/EnergyPlus/DataZoneEquipment.cc index e5210507b9e..427e3cc4a8c 100644 --- a/src/EnergyPlus/DataZoneEquipment.cc +++ b/src/EnergyPlus/DataZoneEquipment.cc @@ -94,37 +94,59 @@ Array1D_string const cValidSysAvailManagerCompTypes(NumValidSysAvailZoneComponen "ZoneHVAC:EvaporativeCoolerUnit", "ZoneHVAC:HybridUnitaryHVAC"}); -constexpr std::array(ZoneEquip::Num)> ZoneEquipTypeNamesUC = {"NONE", - "ZONEHVAC:FOURPIPEFANCOIL", - "ZONEHVAC:PACKAGEDTERMINALHEATPUMP", - "ZONEHVAC:PACKAGEDTERMINALAIRCONDITIONER", - "ZONEHVAC:WATERTOAIRHEATPUMP", - "ZONEHVAC:WINDOWAIRCONDITIONER", - "ZONEHVAC:UNITHEATER", - "ZONEHVAC:UNITVENTILATOR", - "ZONEHVAC:ENERGYRECOVERYVENTILATOR", - "ZONEHVAC:VENTILATEDSLAB", - "ZONEHVAC:OUTDOORAIRUNIT", - "ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW", - "ZONEHVAC:IDEALLOADSAIRSYSTEM", - "ZONEHVAC:EVAPORATIVECOOLERUNIT", - "ZONEHVAC:HYBRIDUNITARYHVAC", - "ZONEHVAC:AIRDISTRIBUTIONUNIT", - "ZONEHVAC:BASEBOARD:CONVECTIVE:WATER", - "ZONEHVAC:BASEBOARD:CONVECTIVE:ELECTRIC", - "ZONEHVAC:HIGHTEMPERATURERADIANT", - "ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", - "FAN:ZONEEXHAUST", - "HEATEXCHANGER:AIRTOAIR:FLATPLATE", - "WATERHEATER:HEATPUMP:PUMPEDCONDENSER", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:WATER", - "ZONEHVAC:DEHUMIDIFIER:DX", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:STEAM", - "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:ELECTRIC", - "ZONEHVAC:REFRIGERATIONCHILLERSET", - "ZONEHVAC:FORCEDAIR:USERDEFINED", - "ZONEHVAC:COOLINGPANEL:RADIANTCONVECTIVE:WATER", - "AIRLOOPHVAC:UNITARYSYSTEM"}; +constexpr std::array(ZoneEquipType::Num)> zoneEquipTypeNamesUC = { + "DUMMY", // DUMMY, + + "ZONEHVAC:FOURPIPEFANCOIL", // FanCoilFourPipe + "ZONEHVAC:PACKAGEDTERMINALHEATPUMP", // PackagedTerminalHeatPump + "ZONEHVAC:PACKAGEDTERMINALAIRCONDITIONER", // PackagedTerminalAirConditioner + "ZONEHVAC:WATERTOAIRHEATPUMP", // PackagedTerminalHeatPumpWaterToAir + "ZONEHVAC:WINDOWAIRCONDITIONER", // WindowAirConditioner + "ZONEHVAC:UNITHEATER", // UnitHeater + "ZONEHVAC:UNITVENTILATOR", // UnitVentilator + "ZONEHVAC:ENERGYRECOVERYVENTILATOR", // EnergyRecoveryVentilator + "ZONEHVAC:VENTILATEDSLAB", // VentilatedSlab + "ZONEHVAC:OUTDOORAIRUNIT", // OutdoorAirUnit + "ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW", // VariableRefrigerantFlowTerminal + "ZONEHVAC:IDEALLOADSAIRSYSTEM", // IdealLoadsAirSystem + "ZONEHVAC:EVAPORATIVECOOLERUNIT", // EvaporativeCooler + "ZONEHVAC:HYBRIDUNITARYHVAC", // HybridEvaporativeCooler, + + // last zone equipment type to use zone availability manager. The above list must not change or + // NumValidSysAvailZoneComponents must also change. + + "ZONEHVAC:AIRDISTRIBUTIONUNIT", // AirDistributionUnit + "ZONEHVAC:BASEBOARD:CONVECTIVE:WATER", // BaseboardWaterConvective + "ZONEHVAC:BASEBOARD:CONVECTIVE:ELECTRIC", // BaseboardElectricConvective + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:STEAM", // BaseboardSteam + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:WATER", // BaseboardWater + "ZONEHVAC:BASEBOARD:RADIANTCONVECTIVE:ELECTRIC", // BaseboardElectric + "ZONEHVAC:HIGHTEMPERATURERADIANT", // HighTempRadiant + "ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", // LowTempRadiant + "FAN:ZONEEXHAUST", // ExhaustFan + "HEATEXCHANGER:AIRTOAIR:FLATPLATE", // HeatExchanger + "WATERHEATER:HEATPUMP:PUMPEDCONDENSER", // HeatPumpWaterHeater + "ZONEHVAC:DEHUMIDIFIER:DX", // DXDehumidifier + "ZONEHVAC:REFRIGERATIONCHILLERSET", // RefrigerationAirChillerSet + "ZONEHVAC:FORCEDAIR:USERDEFINED", // UserDefinedVACForcedAir + "ZONEHVAC:COOLINGPANEL:RADIANTCONVECTIVE:WATER", // CoolingPanel + "AIRLOOPHVAC:UNITARYSYSTEM", // UnitarySystem + "AIRTERMINAL:DUALDUCT:CONSTANTVOLUME", // AirTerminalDualDuctConstantVolume + "AIRTERMINAL:DUALDUCT:VAV", // AirTerminalDualDuctVAV + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:REHEAT", // AirTerminalSingleDuctConstantVolumeReheat + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:NOREHEAT", // AirTerminalSingleDuctConstantVolumeNoReheat + "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT", // AirTerminalSingleDuctVAVReheat + "AIRTERMINAL:SINGLEDUCT:VAV:NOREHEAT", // AirTerminalSingleDuctVAVNoReheat + "AIRTERMINAL:SINGLEDUCT:SERIESPIU:REHEAT", // AirTerminalSingleDuctSeriesPIUReheat + "AIRTERMINAL:SINGLEDUCT:PARALLELPIU:REHEAT", // AirTerminalSingleDuctParallelPIUReheat + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:FOURPIPEINDUCTION", // AirTerminalSingleDuctCAVFourPipeInduction + "AIRTERMINAL:SINGLEDUCT:VAV:REHEAT:VARIABLESPEEDFAN", // AirTerminalSingleDuctVAVReheatVariableSpeedFan + "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:REHEAT", // AirTerminalSingleDuctVAVHeatAndCoolReheat + "AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:NOREHEAT", // AirTerminalSingleDuctVAVHeatAndCoolNoReheat + "AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:COOLEDBEAM", // AirTerminalSingleDuctConstantVolumeCooledBeam + "AIRTERMINAL:DUALDUCT:VAV:OUTDOORAIR", // AirTerminalDualDuctVAVOutdoorAir + "AIRLOOPHVACRETURNAIR" // AirLoopHVACReturnAir +}; static constexpr std::array(LoadDist::Num)> LoadDistNamesUC = { "SEQUENTIALLOAD", "UNIFORMLOAD", "UNIFORMPLR", "SEQUENTIALUNIFORMPLR"}; @@ -392,8 +414,8 @@ void GetZoneEquipmentData(EnergyPlusData &state) thisZoneEquipList.Name = thisZoneEquipConfig.EquipListName; std::string loadDistName = ip->getAlphaFieldValue(epListFields, objectSchemaProps, "load_distribution_scheme"); - thisZoneEquipList.LoadDistScheme = static_cast( - getEnumerationValue(DataZoneEquipment::LoadDistNamesUC, UtilityRoutines::MakeUPPERCase(loadDistName))); + thisZoneEquipList.LoadDistScheme = + static_cast(getEnumValue(DataZoneEquipment::LoadDistNamesUC, UtilityRoutines::makeUPPER(loadDistName))); if (thisZoneEquipList.LoadDistScheme == DataZoneEquipment::LoadDist::Invalid) { ShowSevereError(state, format("{}{} = \"{}, Invalid choice\".", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); ShowContinueError(state, format("...load_distribution_scheme=\"{}\".", loadDistName)); @@ -408,8 +430,8 @@ void GetZoneEquipmentData(EnergyPlusData &state) // Increment overall count of equipment overallEquipCount += thisZoneEquipList.NumOfEquipTypes; + thisZoneEquipList.EquipTypeName.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.EquipType.allocate(thisZoneEquipList.NumOfEquipTypes); - thisZoneEquipList.EquipTypeEnum.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.compPointer.resize(thisZoneEquipList.NumOfEquipTypes + 1); thisZoneEquipList.EquipName.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.EquipIndex.allocate(thisZoneEquipList.NumOfEquipTypes); @@ -420,8 +442,8 @@ void GetZoneEquipmentData(EnergyPlusData &state) thisZoneEquipList.HeatingCapacity.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.SequentialCoolingFractionSchedPtr.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.SequentialHeatingFractionSchedPtr.allocate(thisZoneEquipList.NumOfEquipTypes); - thisZoneEquipList.EquipType = ""; - thisZoneEquipList.EquipTypeEnum = DataZoneEquipment::ZoneEquip::Invalid; + thisZoneEquipList.EquipTypeName = ""; + thisZoneEquipList.EquipType = DataZoneEquipment::ZoneEquipType::Invalid; thisZoneEquipList.EquipName = ""; thisZoneEquipList.EquipIndex = 0; thisZoneEquipList.CoolingPriority = 0; @@ -437,13 +459,13 @@ void GetZoneEquipmentData(EnergyPlusData &state) for (auto &extensibleInstance : extensiblesArray) { ++ZoneEquipTypeNum; - thisZoneEquipList.EquipType(ZoneEquipTypeNum) = + thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) = ip->getAlphaFieldValue(extensibleInstance, extensionSchemaProps, "zone_equipment_object_type"); thisZoneEquipList.EquipName(ZoneEquipTypeNum) = ip->getAlphaFieldValue(extensibleInstance, extensionSchemaProps, "zone_equipment_name"); ValidateComponent(state, - thisZoneEquipList.EquipType(ZoneEquipTypeNum), + thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum), thisZoneEquipList.EquipName(ZoneEquipTypeNum), IsNotOK, CurrentModuleObject); @@ -520,13 +542,13 @@ void GetZoneEquipmentData(EnergyPlusData &state) ++thisZoneEquipList.NumAvailCoolEquip; } - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) = static_cast( - getEnumerationValue(ZoneEquipTypeNamesUC, UtilityRoutines::MakeUPPERCase(thisZoneEquipList.EquipType(ZoneEquipTypeNum)))); + thisZoneEquipList.EquipType(ZoneEquipTypeNum) = static_cast( + getEnumValue(zoneEquipTypeNamesUC, UtilityRoutines::makeUPPER(thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum)))); - if (thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) == ZoneEquip::ZoneUnitarySys || - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) == ZoneEquip::PkgTermACAirToAir || - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) == ZoneEquip::PkgTermHPAirToAir || - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) == ZoneEquip::PkgTermHPWaterToAir) { + if (thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::UnitarySystem || + thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::PackagedTerminalAirConditioner || + thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::PackagedTerminalHeatPump || + thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::PackagedTerminalHeatPumpWaterToAir) { // loop index accesses correct pointer to equipment on this equipment list // EquipIndex is used to access specific equipment for a single class of equipment (e.g., PTAC 1, 2 and 3) thisZoneEquipList.compPointer[ZoneEquipTypeNum] = UnitarySystems::UnitarySys::factory( @@ -534,12 +556,12 @@ void GetZoneEquipmentData(EnergyPlusData &state) thisZoneEquipList.EquipIndex(ZoneEquipTypeNum) = thisZoneEquipList.compPointer[ZoneEquipTypeNum]->getEquipIndex(); } - if (thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) == ZoneEquip::Invalid) { - if (thisZoneEquipList.EquipType(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW" || - thisZoneEquipList.EquipType(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") { - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) = ZoneEquip::LoTempRadiant; - } else if (thisZoneEquipList.EquipType(ZoneEquipTypeNum) == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") { - thisZoneEquipList.EquipTypeEnum(ZoneEquipTypeNum) = DataZoneEquipment::ZoneEquip::HPWaterHeater; + if (thisZoneEquipList.EquipType(ZoneEquipTypeNum) == ZoneEquipType::Invalid) { + if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW" || + thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") { + thisZoneEquipList.EquipType(ZoneEquipTypeNum) = ZoneEquipType::LowTemperatureRadiant; + } else if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") { + thisZoneEquipList.EquipType(ZoneEquipTypeNum) = DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater; } else { ShowSevereError(state, format("{}{} = {}", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); ShowContinueError(state, format("..Invalid Equipment Type = {}", thisZoneEquipList.EquipType(ZoneEquipTypeNum))); @@ -853,7 +875,7 @@ void GetZoneEquipmentData(EnergyPlusData &state) state.dataZoneEquip->SupplyAirPath(PathNum).SplitterIndex(CompNum) = 0; state.dataZoneEquip->SupplyAirPath(PathNum).PlenumIndex(CompNum) = 0; state.dataZoneEquip->SupplyAirPath(PathNum).ComponentTypeEnum(CompNum) = - (AirLoopHVACZone)getEnumerationValue(AirLoopHVACTypeNamesUC, AlphArray(Counter)); + (AirLoopHVACZone)getEnumValue(AirLoopHVACTypeNamesUC, AlphArray(Counter)); } else { ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cAlphaFields(1), state.dataZoneEquip->SupplyAirPath(PathNum).Name)); ShowContinueError(state, format("Unhandled component type =\"{}\".", AlphArray(Counter))); @@ -922,7 +944,7 @@ void GetZoneEquipmentData(EnergyPlusData &state) state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } state.dataZoneEquip->ReturnAirPath(PathNum).ComponentTypeEnum(CompNum) = - static_cast(getEnumerationValue(AirLoopHVACTypeNamesUC, AlphArray(Counter))); + static_cast(getEnumValue(AirLoopHVACTypeNamesUC, AlphArray(Counter))); } else { ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cAlphaFields(1), state.dataZoneEquip->ReturnAirPath(PathNum).Name)); ShowContinueError(state, format("Unhandled component type =\"{}\".", AlphArray(Counter))); @@ -975,7 +997,7 @@ bool CheckZoneEquipmentList(EnergyPlusData &state, for (Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) { // NumOfZoneEquipLists if (state.dataZoneEquip->ZoneEquipList(Loop).Name.empty()) continue; // dimensioned by NumOfZones. Only valid ones have names. for (ListLoop = 1; ListLoop <= state.dataZoneEquip->ZoneEquipList(Loop).NumOfEquipTypes; ++ListLoop) { - if (!UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(Loop).EquipType(ListLoop), ComponentType)) continue; + if (!UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(Loop).EquipTypeName(ListLoop), ComponentType)) continue; if (ComponentName == "*") { IsOnList = true; CtrlZoneNumLocal = Loop; @@ -1195,7 +1217,7 @@ void EquipList::getPrioritiesForInletNode(EnergyPlusData &state, { bool equipFound = false; for (int equipNum = 1; equipNum <= this->NumOfEquipTypes; ++equipNum) { - if (this->EquipTypeEnum(equipNum) == DataZoneEquipment::ZoneEquip::AirDistUnit) { + if (this->EquipType(equipNum) == DataZoneEquipment::ZoneEquipType::AirDistributionUnit) { if (inletNodeNum == state.dataDefineEquipment->AirDistUnit(this->EquipIndex(equipNum)).OutletNodeNum) { equipFound = true; } @@ -1233,7 +1255,7 @@ Real64 EquipList::SequentialCoolingFraction(EnergyPlusData &state, const int equ return ScheduleManager::GetCurrentScheduleValue(state, SequentialCoolingFractionSchedPtr(equipNum)); } -int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquip const ZoneEquipTypeNum, std::string const &EquipmentName) +int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquipType const zoneEquipType, std::string const &EquipmentName) { static constexpr std::string_view RoutineName("GetZoneEquipControlledZoneNum: "); int ControlZoneNum = 0; @@ -1241,7 +1263,7 @@ int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::Zone for (int CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (int Num = 1; Num <= state.dataZoneEquip->ZoneEquipList(CtrlZone).NumOfEquipTypes; ++Num) { - if (ZoneEquipTypeNum == state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipTypeEnum(Num) && + if (zoneEquipType == state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipType(Num) && UtilityRoutines::SameString(EquipmentName, state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipName(Num))) { return ControlZoneNum = CtrlZone; } @@ -1250,7 +1272,7 @@ int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::Zone ShowSevereError(state, fmt::format("{}{}=\"{}\" is not on any ZoneHVAC:Equipmentlist. It will not be simulated.", RoutineName, - DataZoneEquipment::ZoneEquipTypeNamesUC[ZoneEquipTypeNum], + zoneEquipTypeNamesUC[(int)zoneEquipType], EquipmentName)); return ControlZoneNum; } diff --git a/src/EnergyPlus/DataZoneEquipment.hh b/src/EnergyPlus/DataZoneEquipment.hh index 8e4043f3480..3ea1322aa7b 100644 --- a/src/EnergyPlus/DataZoneEquipment.hh +++ b/src/EnergyPlus/DataZoneEquipment.hh @@ -105,43 +105,61 @@ namespace DataZoneEquipment { // Start zone equip objects // list units that are valid for zone system availability managers first - enum ZoneEquip + enum ZoneEquipType { Invalid = -1, - FanCoil4Pipe = 1, - PkgTermHPAirToAir, - PkgTermACAirToAir, - PkgTermHPWaterToAir, - WindowAC, + DUMMY, + FourPipeFanCoil, + PackagedTerminalHeatPump, + PackagedTerminalAirConditioner, + PackagedTerminalHeatPumpWaterToAir, + WindowAirConditioner, UnitHeater, UnitVentilator, - ERVStandAlone, + EnergyRecoveryVentilator, VentilatedSlab, OutdoorAirUnit, - VRFTerminalUnit, + VariableRefrigerantFlowTerminal, PurchasedAir, - ZoneEvaporativeCoolerUnit, - ZoneHybridEvaporativeCooler, // last zone equipment type to use zone availability manager. The above list must not change or - // NumValidSysAvailZoneComponents must also change. - AirDistUnit, - BBWaterConvective, - BBElectricConvective, - HiTempRadiant, - LoTempRadiant, - ZoneExhaustFan, - HeatXchngr, - HPWaterHeater, - BBWater, - ZoneDXDehumidifier, - BBSteam, - BBElectric, - RefrigerationAirChillerSet, - UserDefinedZoneHVACForcedAir, + EvaporativeCooler, + HybridEvaporativeCooler, // last zone equipment type to use zone availability manager. The above list must not change or + // NumValidSysAvailZoneComponents must also change. + AirDistributionUnit, + BaseboardConvectiveWater, + BaseboardConvectiveElectric, + BaseboardSteam, + BaseboardWater, + BaseboardElectric, + HighTemperatureRadiant, + LowTemperatureRadiant, + ExhaustFan, + HeatExchanger, + HeatPumpWaterHeater, + DehumidifierDX, + RefrigerationChillerSet, + UserDefinedHVACForcedAir, CoolingPanel, - ZoneUnitarySys, + UnitarySystem, + AirTerminalDualDuctConstantVolume, + AirTerminalDualDuctVAV, + AirTerminalSingleDuctConstantVolumeReheat, + AirTerminalSingleDuctConstantVolumeNoReheat, + AirTerminalSingleDuctVAVReheat, + AirTerminalSingleDuctVAVNoReheat, + AirTerminalSingleDuctSeriesPIUReheat, + AirTerminalSingleDuctParallelPIUReheat, + AirTerminalSingleDuctCAVFourPipeInduction, + AirTerminalSingleDuctVAVReheatVariableSpeedFan, + AirTerminalSingleDuctVAVHeatAndCoolReheat, + AirTerminalSingleDuctVAVHeatAndCoolNoReheat, + AirTerminalSingleDuctConstantVolumeCooledBeam, + AirTerminalDualDuctVAVOutdoorAir, + AirLoopHVACReturnAir, Num }; + extern const std::array(ZoneEquipType::Num)> zoneEquipTypeNamesUC; + constexpr int NumValidSysAvailZoneComponents(14); extern Array1D_string const cValidSysAvailManagerCompTypes; @@ -383,8 +401,8 @@ namespace DataZoneEquipment { int NumOfEquipTypes; // Number of items on this list int NumAvailHeatEquip; // Number of pieces of equipment available for heating int NumAvailCoolEquip; // Number of pieces of equipment available for cooling - Array1D_string EquipType; // TODO: Convert this from string to enum and remove EquipTypeEnum below - Array1D EquipTypeEnum; + Array1D_string EquipTypeName; // TODO: Convert this from string to enum and remove EquipTypeEnum below + Array1D EquipType; Array1D_string EquipName; Array1D_int EquipIndex; // SystemAvailManagers need to know the index of specific equipment (e.g., PTAC as 1,2,3) @@ -494,7 +512,7 @@ namespace DataZoneEquipment { std::string const &NodeName // Return air node name to match (may be blank) ); - int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquip const ZoneEquipTypeNum, std::string const &EquipmentName); + int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquipType const ZoneEquipType, std::string const &EquipmentName); bool VerifyLightsExhaustNodeForZone(EnergyPlusData &state, int const ZoneNum, int const ZoneExhaustNodeNum); diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index ccc241ef754..175568e7a0b 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -4684,7 +4684,7 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) daylightControl.DaylightMethod = DaylightingMethod::SplitFlux; } else { daylightControl.DaylightMethod = - static_cast(getEnumerationValue(DaylightingMethodNamesUC, UtilityRoutines::MakeUPPERCase(ipsc->cAlphaArgs(3)))); + static_cast(getEnumValue(DaylightingMethodNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(3)))); if (daylightControl.DaylightMethod == DaylightingMethod::Invalid) { daylightControl.DaylightMethod = DaylightingMethod::SplitFlux; @@ -4719,7 +4719,7 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) } daylightControl.LightControlType = - static_cast(getEnumerationValue(LtgCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(ipsc->cAlphaArgs(5)))); + static_cast(getEnumValue(LtgCtrlTypeNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(5)))); if (daylightControl.LightControlType == LtgCtrlType::Invalid) { ShowWarningError(state, format("Invalid {} = {}, occurs in {}object for {}=\"{}", diff --git a/src/EnergyPlus/DemandManager.cc b/src/EnergyPlus/DemandManager.cc index fbde2642d1c..1014a5bf22e 100644 --- a/src/EnergyPlus/DemandManager.cc +++ b/src/EnergyPlus/DemandManager.cc @@ -426,8 +426,8 @@ void GetDemandManagerListInput(EnergyPlusData &state) thisDemandMgrList.History = 0.0; // Validate Demand Manager Priority - thisDemandMgrList.ManagerPriority = static_cast( - getEnumerationValue(ManagePriorityNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(6)))); + thisDemandMgrList.ManagerPriority = + static_cast(getEnumValue(ManagePriorityNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(6)))); ErrorsFound = ErrorsFound || (thisDemandMgrList.ManagerPriority == ManagePriorityType::Invalid); // Get DEMAND MANAGER Type and Name pairs @@ -440,7 +440,7 @@ void GetDemandManagerListInput(EnergyPlusData &state) auto &thisManager = thisDemandMgrList.Manager(MgrNum); // Validate DEMAND MANAGER Type ManagerType MgrType = static_cast( - getEnumerationValue(ManagerNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 5)))); + getEnumValue(ManagerNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 5)))); if (MgrType != ManagerType::Invalid) { thisManager = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 6), state.dataDemandManager->DemandMgr); @@ -676,8 +676,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } // Validate Limiting Control - demandMgr.LimitControl = - static_cast(getEnumerationValue(ManagerLimitNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(3)))); + demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitNamesUC, UtilityRoutines::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) @@ -689,7 +688,7 @@ void GetDemandManagerInput(EnergyPlusData &state) // Validate Selection Control demandMgr.SelectionControl = - static_cast(getEnumerationValue(ManagerSelectionNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(ManagerSelectionNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) @@ -775,8 +774,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } // Validate Limiting Control - demandMgr.LimitControl = - static_cast(getEnumerationValue(ManagerLimitNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(3)))); + demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitNamesUC, UtilityRoutines::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) @@ -788,7 +786,7 @@ void GetDemandManagerInput(EnergyPlusData &state) // Validate Selection Control demandMgr.SelectionControl = - static_cast(getEnumerationValue(ManagerSelectionNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(ManagerSelectionNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) @@ -895,8 +893,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } // Validate Limiting Control - demandMgr.LimitControl = - static_cast(getEnumerationValue(ManagerLimitNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(3)))); + demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitNamesUC, UtilityRoutines::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) @@ -908,7 +905,7 @@ void GetDemandManagerInput(EnergyPlusData &state) // Validate Selection Control demandMgr.SelectionControl = - static_cast(getEnumerationValue(ManagerSelectionNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(ManagerSelectionNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) @@ -1016,8 +1013,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } // Validate Limiting Control - demandMgr.LimitControl = - static_cast(getEnumerationValue(ManagerLimitNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(3)))); + demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitNamesUC, UtilityRoutines::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) @@ -1044,7 +1040,7 @@ void GetDemandManagerInput(EnergyPlusData &state) // Validate Selection Control demandMgr.SelectionControl = - static_cast(getEnumerationValue(ManagerSelectionNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(ManagerSelectionNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(5) == 0.0) @@ -1149,8 +1145,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } // Validate Limiting Control - demandMgr.LimitControl = - static_cast(getEnumerationValue(ManagerLimitVentNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(3)))); + demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitVentNamesUC, UtilityRoutines::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) @@ -1165,7 +1160,7 @@ void GetDemandManagerInput(EnergyPlusData &state) // Validate Selection Control demandMgr.SelectionControl = - static_cast(getEnumerationValue(ManagerSelectionNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(ManagerSelectionNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(5) == 0.0) diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index 03b739ed1e3..f2309eadd55 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -65,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -74,1051 +73,992 @@ #include #include -namespace EnergyPlus::DisplacementVentMgr { +namespace EnergyPlus { -// MODULE INFORMATION: -// AUTHOR G. Carrilho da Graca -// DATE WRITTEN February 2004 -// MODIFIED na -// RE-ENGINEERED na +namespace RoomAir { -// PURPOSE OF THIS MODULE: -// Routines that implement the UCSD Displacement Ventilation - -// Using/Aliasing -using namespace DataLoopNode; -using namespace DataEnvironment; -using namespace DataHeatBalance; -using namespace DataHeatBalSurface; -using namespace DataSurfaces; -using namespace DataRoomAirModel; -using Convect::CalcDetailedHcInForDVModel; - -void ManageUCSDDVModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone -{ - - // SUBROUTINE INFORMATION: + // MODULE INFORMATION: // AUTHOR G. Carrilho da Graca // DATE WRITTEN February 2004 // MODIFIED na // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // manage the UCSD Displacement Ventilation model + // PURPOSE OF THIS MODULE: + // Routines that implement the UCSD Displacement Ventilation - // initialize Displacement Ventilation model - InitUCSDDV(state, ZoneNum); + // Using/Aliasing + using namespace DataLoopNode; + using namespace DataEnvironment; + using namespace DataHeatBalance; + using namespace DataHeatBalSurface; + using namespace DataSurfaces; + using Convect::CalcDetailedHcInForDVModel; - // perform Displacement Ventilation model calculations - CalcUCSDDV(state, ZoneNum); -} + void ManageDispVent3Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + { -//************************************************************************************************** + // SUBROUTINE INFORMATION: + // AUTHOR G. Carrilho da Graca + // DATE WRITTEN February 2004 -void InitUCSDDV(EnergyPlusData &state, int const ZoneNum) -{ + // PURPOSE OF THIS SUBROUTINE: + // manage the UCSD Displacement Ventilation model - // SUBROUTINE INFORMATION: - // AUTHOR G. Carrilho da Graca - // DATE WRITTEN February 2004 - // MODIFIED - - // RE-ENGINEERED - - - // PURPOSE OF THIS SUBROUTINE: - // Low Energy Cooling by Ventilation initialization subroutine. - // All the data preparation needed to run the LECV models. - // The subroutines sets up arrays with the locations in the main EnergyPlus surface array of - // ceiling, windows, doors and walls. The zone maximum and minimum height is calculated. - - // Do the one time initializations - if (state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag) { - state.dataDispVentMgr->MyEnvrnFlag.dimension(state.dataGlobal->NumOfZones, true); - state.dataDispVentMgr->HeightFloorSubzoneTop = 0.2; - state.dataDispVentMgr->ThickOccupiedSubzoneMin = 0.2; - state.dataDispVentMgr->HeightIntMassDefault = 2.0; - state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag = false; + // initialize Displacement Ventilation model + InitDispVent3Node(state, ZoneNum); + + // perform Displacement Ventilation model calculations + CalcDispVent3Node(state, ZoneNum); + } + + //************************************************************************************************** + + void InitDispVent3Node(EnergyPlusData &state, int const ZoneNum) + { + + // SUBROUTINE INFORMATION: + // AUTHOR G. Carrilho da Graca + // DATE WRITTEN February 2004 + // MODIFIED - + // RE-ENGINEERED - + + // PURPOSE OF THIS SUBROUTINE: + // Low Energy Cooling by Ventilation initialization subroutine. + // All the data preparation needed to run the LECV models. + // The subroutines sets up arrays with the locations in the main EnergyPlus surface array of + // ceiling, windows, doors and walls. The zone maximum and minimum height is calculated. + + // Do the one time initializations + if (state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag) { + state.dataDispVentMgr->MyEnvrnFlag.dimension(state.dataGlobal->NumOfZones, true); + state.dataDispVentMgr->HeightFloorSubzoneTop = 0.2; + state.dataDispVentMgr->ThickOccupiedSubzoneMin = 0.2; + state.dataDispVentMgr->HeightIntMassDefault = 2.0; + state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag = false; + } + + // Do the begin environment initializations + if (state.dataGlobal->BeginEnvrnFlag && state.dataDispVentMgr->MyEnvrnFlag(ZoneNum)) { + state.dataDispVentMgr->HAT_MX = 0.0; + state.dataDispVentMgr->HAT_OC = 0.0; + state.dataDispVentMgr->HA_MX = 0.0; + state.dataDispVentMgr->HA_OC = 0.0; + state.dataDispVentMgr->HAT_FLOOR = 0.0; + state.dataDispVentMgr->HA_FLOOR = 0.0; + state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = false; + } + + if (!state.dataGlobal->BeginEnvrnFlag) { + state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = true; + } + + // initialize these module variables every timestep + state.dataDispVentMgr->HeightIntMass = state.dataDispVentMgr->HeightIntMassDefault; } - // Do the begin environment initializations - if (state.dataGlobal->BeginEnvrnFlag && state.dataDispVentMgr->MyEnvrnFlag(ZoneNum)) { + //************************************************************************************************** + + void HcDispVent3Node(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight) + { + + // SUBROUTINE INFORMATION: + // AUTHOR G. Carrilho da Graca + // DATE WRITTEN February 2004 + // MODIFIED - + // RE-ENGINEERED - + + // PURPOSE OF THIS SUBROUTINE: + // Main subroutine for convection calculation in the UCSD Displacement Ventilation model. + // It calls CalcDetailedHcInForDVModel for convection coefficient + // initial calculations and averages the final result comparing the position of the surface with + // the interface subzone height. + + // Using/Aliasing + using namespace DataEnvironment; + using namespace DataHeatBalance; + using ScheduleManager::GetScheduleIndex; + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 HLD; // Convection coefficient for the lower area of surface + Real64 TmedDV; // Average temperature for DV + Real64 Z1; // auxiliary var for lowest height + Real64 Z2; // auxiliary var for highest height + Real64 ZSupSurf; // highest height for this surface + Real64 ZInfSurf; // lowest height for this surface + Real64 HLU; // Convection coefficient for the upper area of surface + Real64 LayH; // Height of the Occupied/Mixed subzone interface + Real64 LayFrac; // Fraction height of the Occupied/Mixed subzone interface + state.dataDispVentMgr->HAT_MX = 0.0; state.dataDispVentMgr->HAT_OC = 0.0; state.dataDispVentMgr->HA_MX = 0.0; state.dataDispVentMgr->HA_OC = 0.0; state.dataDispVentMgr->HAT_FLOOR = 0.0; state.dataDispVentMgr->HA_FLOOR = 0.0; - state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = false; - } - - if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = true; - } - - // initialize these module variables every timestep - state.dataDispVentMgr->HeightIntMass = state.dataDispVentMgr->HeightIntMassDefault; -} - -//************************************************************************************************** + auto &SurfTempIn(state.dataHeatBalSurf->SurfTempIn); + + // Is the air flow model for this zone set to UCSDDV Displacement Ventilation? + if (state.dataRoomAir->IsZoneDispVent3Node(ZoneNum)) { + LayFrac = FractionHeight; + LayH = FractionHeight * (state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum)); + // WALL Hc, HA and HAT calculation + for (int Ctd = state.dataRoomAir->PosZ_Wall(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Wall(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Wall(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + Z1 = minval(surf.Vertex, &Vector::z); + Z2 = maxval(surf.Vertex, &Vector::z); + ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + + // The Wall surface is in the upper subzone + if (ZInfSurf > LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWall(Ctd); + } -void HcUCSDDV(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight) -{ + // The Wall surface is in the lower subzone + if (ZSupSurf < LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWall(Ctd); + } - // SUBROUTINE INFORMATION: - // AUTHOR G. Carrilho da Graca - // DATE WRITTEN February 2004 - // MODIFIED - - // RE-ENGINEERED - + // The Wall surface is partially in upper and partially in lower subzone + if (ZInfSurf <= LayH && ZSupSurf >= LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); + state.dataRoomAir->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; + state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; + state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; + } - // PURPOSE OF THIS SUBROUTINE: - // Main subroutine for convection calculation in the UCSD Displacement Ventilation model. - // It calls CalcDetailedHcInForDVModel for convection coefficient - // initial calculations and averages the final result comparing the position of the surface with - // the interface subzone height. + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWall(Ctd); + + } // END WALL + + // WINDOW Hc, HA and HAT CALCULATION + for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Window(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Window Wall + Z1 = minval(surf.Vertex, &Vector::z); + Z2 = maxval(surf.Vertex, &Vector::z); + ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + + if (ZInfSurf > LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd); + } - // Using/Aliasing - using namespace DataEnvironment; - using namespace DataHeatBalance; - using ScheduleManager::GetScheduleIndex; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 HLD; // Convection coefficient for the lower area of surface - Real64 TmedDV; // Average temperature for DV - Real64 Z1; // auxiliary var for lowest height - Real64 Z2; // auxiliary var for highest height - Real64 ZSupSurf; // highest height for this surface - Real64 ZInfSurf; // lowest height for this surface - Real64 HLU; // Convection coefficient for the upper area of surface - Real64 LayH; // Height of the Occupied/Mixed subzone interface - Real64 LayFrac; // Fraction height of the Occupied/Mixed subzone interface - - state.dataDispVentMgr->HAT_MX = 0.0; - state.dataDispVentMgr->HAT_OC = 0.0; - state.dataDispVentMgr->HA_MX = 0.0; - state.dataDispVentMgr->HA_OC = 0.0; - state.dataDispVentMgr->HAT_FLOOR = 0.0; - state.dataDispVentMgr->HA_FLOOR = 0.0; - auto &SurfTempIn(state.dataHeatBalSurf->SurfTempIn); - - // Is the air flow model for this zone set to UCSDDV Displacement Ventilation? - if (state.dataRoomAirMod->IsZoneDV(ZoneNum)) { - LayFrac = FractionHeight; - LayH = FractionHeight * - (state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1)); - // WALL Hc, HA and HAT calculation - for (int Ctd = state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 2); ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Wall(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - - // The Wall surface is in the upper subzone - if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWall(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWall(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWall(Ctd); - } + if (ZSupSurf < LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd); + } - // The Wall surface is in the lower subzone - if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWall(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWall(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWall(Ctd); - } + if (ZInfSurf <= LayH && ZSupSurf >= LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); + state.dataRoomAir->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; + state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; + state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; + } + } - // The Wall surface is partially in upper and partially in lower subzone - if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLU = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLD = state.dataRoomAirMod->DVHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; - } + if (surf.Tilt <= 10.0) { // Window Ceiling + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd); + } - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HWall(Ctd); + if (surf.Tilt >= 170.0) { // Window Floor + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd); + } - } // END WALL + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWindow(Ctd); + + } // END WINDOW + + // DOOR Hc, HA and HAT CALCULATION + for (int Ctd = state.dataRoomAir->PosZ_Door(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Door(ZoneNum).end; ++Ctd) { // DOOR + int SurfNum = state.dataRoomAir->APos_Door(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Door Wall + Z1 = minval(surf.Vertex, &Vector::z); + Z2 = maxval(surf.Vertex, &Vector::z); + ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + + if (ZInfSurf > LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd); + } - // WINDOW Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Window(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).Tilt > 10.0 && state.dataSurface->Surface(SurfNum).Tilt < 170.0) { // Window Wall - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); + if (ZSupSurf < LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd); + } - if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + if (ZInfSurf <= LayH && ZSupSurf >= LayH) { + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); + state.dataRoomAir->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; + state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; + state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; + } } - if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + if (surf.Tilt <= 10.0) { // Door Ceiling + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd); } - if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLU = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLD = state.dataRoomAirMod->DVHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; + if (surf.Tilt >= 170.0) { // Door Floor + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd); } - } - - if (state.dataSurface->Surface(SurfNum).Tilt <= 10.0) { // Window Ceiling - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); - } - - if (state.dataSurface->Surface(SurfNum).Tilt >= 170.0) { // Window Floor - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); - } - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HWindow(Ctd); + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HDoor(Ctd); - } // END WINDOW + } // END DOOR - // DOOR Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 2); - ++Ctd) { // DOOR - int SurfNum = state.dataUCSDShared->APos_Door(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).Tilt > 10.0 && state.dataSurface->Surface(SurfNum).Tilt < 170.0) { // Door Wall - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); + // INTERNAL Hc, HA and HAT CALCULATION + state.dataDispVentMgr->HeightIntMass = + min(state.dataDispVentMgr->HeightIntMassDefault, + (state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum))); + for (int Ctd = state.dataRoomAir->PosZ_Internal(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Internal(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Internal(Ctd); + if (SurfNum == 0) continue; - if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); - } + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + ZSupSurf = state.dataDispVentMgr->HeightIntMass; + ZInfSurf = 0.0; if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HInternal(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HInternal(Ctd); + state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HInternal(Ctd); } if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLU = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLD = state.dataRoomAirMod->DVHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataRoomAir->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; + state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; + state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; } - } - - if (state.dataSurface->Surface(SurfNum).Tilt <= 10.0) { // Door Ceiling - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); - } - - if (state.dataSurface->Surface(SurfNum).Tilt >= 170.0) { // Door Floor - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); - } - - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HDoor(Ctd); - - } // END DOOR - - // INTERNAL Hc, HA and HAT CALCULATION - state.dataDispVentMgr->HeightIntMass = - min(state.dataDispVentMgr->HeightIntMassDefault, - (state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1))); - for (int Ctd = state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Internal(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - ZSupSurf = state.dataDispVentMgr->HeightIntMass; - ZInfSurf = 0.0; - - if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HInternal(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HInternal(Ctd); - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HInternal(Ctd); - } - - if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLU = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - HLD = state.dataRoomAirMod->DVHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataDispVentMgr->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU; - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataDispVentMgr->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD; - state.dataDispVentMgr->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; - } - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HInternal(Ctd); - } // END INTERNAL - - // CEILING Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Ceiling(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HCeiling(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_MX += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HCeiling(Ctd); - state.dataDispVentMgr->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HCeiling(Ctd); - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HCeiling(Ctd); - } // END CEILING - - // FLOOR Hc, HA and HAT CALCULATION - for (int Ctd = state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Floor(Ctd); - state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; - state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAirMod->DVHcIn); - state.dataUCSDShared->HFloor(Ctd) = state.dataRoomAirMod->DVHcIn(SurfNum); - state.dataDispVentMgr->HAT_FLOOR += state.dataSurface->Surface(SurfNum).Area * SurfTempIn(SurfNum) * state.dataUCSDShared->HFloor(Ctd); - state.dataDispVentMgr->HA_FLOOR += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HFloor(Ctd); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - state.dataRoomAirMod->DVHcIn(SurfNum) = state.dataUCSDShared->HFloor(Ctd); - } // END FLOOR + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HInternal(Ctd); + } // END INTERNAL + + // CEILING Hc, HA and HAT CALCULATION + for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HCeiling(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HCeiling(Ctd); + state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HCeiling(Ctd); + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HCeiling(Ctd); + } // END CEILING + + // FLOOR Hc, HA and HAT CALCULATION + for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Floor(Ctd); + if (SurfNum == 0) continue; + + auto const &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; + state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn); + state.dataRoomAir->HFloor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum); + state.dataDispVentMgr->HAT_FLOOR += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HFloor(Ctd); + state.dataDispVentMgr->HA_FLOOR += surf.Area * state.dataRoomAir->HFloor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum); + state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HFloor(Ctd); + } // END FLOOR + } } -} - -//************************************************************************************************** - -Real64 calculateThirdOrderFloorTemperature(Real64 temperatureHistoryTerm, - Real64 HAT_floor, - Real64 HA_floor, - Real64 MCpT_Total, - Real64 MCp_Total, - Real64 occupiedTemp, - Real64 nonAirSystemResponse, - Real64 zoneMultiplier, - Real64 airCap) -{ - const Real64 elevenOverSix = 11.0 / 6.0; - return (temperatureHistoryTerm + HAT_floor + MCpT_Total + 0.6 * occupiedTemp * MCp_Total + nonAirSystemResponse / zoneMultiplier) / - (elevenOverSix * airCap + HA_floor + 1.6 * MCp_Total); -} - -void CalcUCSDDV(EnergyPlusData &state, int const ZoneNum) // Which Zonenum -{ - - // SUBROUTINE INFORMATION: - // AUTHOR G. Carrilho da Graca - // DATE WRITTEN February 2004 - // MODIFIED Brent Griffith June 2008 for new interpolation and time history - // RE-ENGINEERED - - // PURPOSE OF THIS SUBROUTINE: - // Subroutine for displacement ventilation modelling. - // This subroutine calculates the mixed subzone height, surface heat transfer coefficients and - // room air equivalent temperatures and three space temperatures (floor subzone, occupied zone and upper, - // mixed subzone temperature) - - // REFERENCES: - // Model developed by Paul Linden (UCSD), G. Carrilho da Graca (UCSD) and P. Haves (LBL). - // Work funded by the California Energy Comission. More information on the model can found in: - // "Simplified Models for Heat Transfer in Rooms" G. Carrilho da Graca, Ph.D. thesis UCSD. December 2003. - - // Using/Aliasing - using namespace DataEnvironment; - using namespace DataHeatBalance; + //************************************************************************************************** + + Real64 calculateThirdOrderFloorTemperature(Real64 temperatureHistoryTerm, + Real64 HAT_floor, + Real64 HA_floor, + Real64 MCpT_Total, + Real64 MCp_Total, + Real64 occupiedTemp, + Real64 nonAirSystemResponse, + Real64 zoneMultiplier, + Real64 airCap) + { + const Real64 elevenOverSix = 11.0 / 6.0; + return (temperatureHistoryTerm + HAT_floor + MCpT_Total + 0.6 * occupiedTemp * MCp_Total + nonAirSystemResponse / zoneMultiplier) / + (elevenOverSix * airCap + HA_floor + 1.6 * MCp_Total); + } - Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - - using InternalHeatGains::SumInternalConvectionGainsByTypes; - using InternalHeatGains::SumReturnAirConvectionGainsByTypes; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleIndex; - - // SUBROUTINE PARAMETER DEFINITIONS: - Real64 const OneThird(1.0 / 3.0); - Real64 const MinFlow_pow_fac(std::pow(1.0 / 24.55 * 1.0, 1.0 / 0.6)); - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 HeightFrac; // Fractional height of transition between occupied and mixed subzones - Real64 GainsFrac; // Fraction of lower subzone internal gains that mix as opposed to forming plumes - Real64 ConvGains; // Total convective gains in the room - Real64 ConvGainsOccupiedSubzone; // Total convective gains released in occupied subzone - Real64 ConvGainsMixedSubzone; // Total convective gains released in mixed subzone - Real64 MCp_Total; // Total capacity rate into the zone - assumed to enter at low level - Real64 ZTAveraged; - Real64 TempDiffCritRep; // Minimum temperature difference between mixed and occupied subzones for reporting - bool MIXFLAG; - int Ctd; - Real64 MinFlow; - Real64 NumPLPP; // Number of plumes per person - Real64 MTGAUX; - int ZoneEquipConfigNum; - Real64 PowerInPlumes; - Real64 SumSysMCp; - Real64 SumSysMCpT; - Real64 NodeTemp; - Real64 MassFlowRate; - Real64 CpAir; - Real64 MCpT_Total; - Real64 NumberOfPlumes; - Real64 SumMCp; - Real64 SumMCpT; - Real64 TempHistTerm; - Real64 PowerPerPlume; - Real64 HeightMixedSubzoneAve; // Height of center of mixed air subzone - Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone - Real64 HeightFloorSubzoneAve; // Height of center of floor air subzone - Real64 HeightThermostat; // Height of center of thermostat/temperature control sensor - Real64 HeightComfort; // Height at which air temperature value is used to calculate comfort - Real64 CeilingHeight; - Real64 ZoneMult; // total zone multiplier - int FlagApertures; - - auto &TempDepCoef = state.dataDispVentMgr->TempDepCoef; - auto &TempIndCoef = state.dataDispVentMgr->TempIndCoef; - - Real64 RetAirGain; - assert(state.dataRoomAirMod->AirModel.allocated()); - - // Exact solution or Euler method - if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { - if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { - state.dataRoomAirMod->Zone1Floor(ZoneNum) = state.dataRoomAirMod->ZoneM2Floor(ZoneNum); - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneM2OC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneM2MX(ZoneNum); + void CalcDispVent3Node(EnergyPlusData &state, int const ZoneNum) // Which Zonenum + { + + // SUBROUTINE INFORMATION: + // AUTHOR G. Carrilho da Graca + // DATE WRITTEN February 2004 + // MODIFIED Brent Griffith June 2008 for new interpolation and time history + // RE-ENGINEERED - + + // PURPOSE OF THIS SUBROUTINE: + // Subroutine for displacement ventilation modelling. + // This subroutine calculates the mixed subzone height, surface heat transfer coefficients and + // room air equivalent temperatures and three space temperatures (floor subzone, occupied zone and upper, + // mixed subzone temperature) + + // REFERENCES: + // Model developed by Paul Linden (UCSD), G. Carrilho da Graca (UCSD) and P. Haves (LBL). + // Work funded by the California Energy Comission. More information on the model can found in: + // "Simplified Models for Heat Transfer in Rooms" G. Carrilho da Graca, Ph.D. thesis UCSD. December 2003. + + // Using/Aliasing + using namespace DataEnvironment; + using namespace DataHeatBalance; + + Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + + using InternalHeatGains::SumInternalConvectionGainsByTypes; + using InternalHeatGains::SumReturnAirConvectionGainsByTypes; + using Psychrometrics::PsyCpAirFnW; + using Psychrometrics::PsyRhoAirFnPbTdbW; + using ScheduleManager::GetCurrentScheduleValue; + using ScheduleManager::GetScheduleIndex; + + // SUBROUTINE PARAMETER DEFINITIONS: + Real64 const OneThird(1.0 / 3.0); + Real64 const MinFlow_pow_fac(std::pow(1.0 / 24.55 * 1.0, 1.0 / 0.6)); + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 HeightFrac; // Fractional height of transition between occupied and mixed subzones + Real64 GainsFrac; // Fraction of lower subzone internal gains that mix as opposed to forming plumes + Real64 ConvGains; // Total convective gains in the room + Real64 ConvGainsOccupiedSubzone; // Total convective gains released in occupied subzone + Real64 ConvGainsMixedSubzone; // Total convective gains released in mixed subzone + Real64 MCp_Total; // Total capacity rate into the zone - assumed to enter at low level + Real64 ZTAveraged; + Real64 TempDiffCritRep; // Minimum temperature difference between mixed and occupied subzones for reporting + bool MIXFLAG; + int Ctd; + Real64 MinFlow; + Real64 NumPLPP; // Number of plumes per person + Real64 MTGAUX; + int ZoneEquipConfigNum; + Real64 PowerInPlumes; + Real64 SumSysMCp; + Real64 SumSysMCpT; + Real64 NodeTemp; + Real64 MassFlowRate; + Real64 CpAir; + Real64 MCpT_Total; + Real64 NumberOfPlumes; + Real64 SumMCp; + Real64 SumMCpT; + Real64 TempHistTerm; + Real64 PowerPerPlume; + Real64 HeightMixedSubzoneAve; // Height of center of mixed air subzone + Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone + Real64 HeightFloorSubzoneAve; // Height of center of floor air subzone + Real64 HeightThermostat; // Height of center of thermostat/temperature control sensor + Real64 HeightComfort; // Height at which air temperature value is used to calculate comfort + Real64 CeilingHeight; + Real64 ZoneMult; // total zone multiplier + int FlagApertures; + + auto &TempDepCoef = state.dataDispVentMgr->TempDepCoef; + auto &TempIndCoef = state.dataDispVentMgr->TempIndCoef; + + Real64 RetAirGain; + assert(state.dataRoomAir->AirModel.allocated()); + + // Exact solution or Euler method + if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { + if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { + if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { + state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneM2Floor(ZoneNum); + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneM2OC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneM2MX(ZoneNum); + } else { + state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneMXFloor(ZoneNum); + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneMXOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneMXMX(ZoneNum); + } } else { - state.dataRoomAirMod->Zone1Floor(ZoneNum) = state.dataRoomAirMod->ZoneMXFloor(ZoneNum); - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneMXOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneMXMX(ZoneNum); + state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum); + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); } - } else { - state.dataRoomAirMod->Zone1Floor(ZoneNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); } - } - auto &zone = state.dataHeatBal->Zone(ZoneNum); - - MIXFLAG = false; - FlagApertures = 1; - state.dataRoomAirMod->DVHcIn = state.dataHeatBalSurf->SurfHConvInt; - CeilingHeight = state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZoneMult = zone.Multiplier * zone.ListMultiplier; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - - for (Ctd = 1; Ctd <= state.dataRoomAirMod->TotUCSDDV; ++Ctd) { - if (ZoneNum == state.dataRoomAirMod->ZoneUCSDDV(Ctd).ZonePtr) { - GainsFrac = GetCurrentScheduleValue(state, state.dataRoomAirMod->ZoneUCSDDV(Ctd).SchedGainsPtr); - NumPLPP = state.dataRoomAirMod->ZoneUCSDDV(Ctd).NumPlumesPerOcc; - HeightThermostat = state.dataRoomAirMod->ZoneUCSDDV(Ctd).ThermostatHeight; - HeightComfort = state.dataRoomAirMod->ZoneUCSDDV(Ctd).ComfortHeight; - TempDiffCritRep = state.dataRoomAirMod->ZoneUCSDDV(Ctd).TempTrigger; + auto &zone = state.dataHeatBal->Zone(ZoneNum); + + MIXFLAG = false; + FlagApertures = 1; + state.dataRoomAir->DispVent3NodeHcIn = state.dataHeatBalSurf->SurfHConvInt; + CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + ZoneMult = zone.Multiplier * zone.ListMultiplier; + auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + + for (int Ctd = 1; Ctd <= state.dataRoomAir->TotDispVent3Node; ++Ctd) { + auto &zoneDV3N = state.dataRoomAir->ZoneDispVent3Node(Ctd); + if (ZoneNum == zoneDV3N.ZonePtr) { + GainsFrac = GetCurrentScheduleValue(state, zoneDV3N.SchedGainsPtr); + NumPLPP = zoneDV3N.NumPlumesPerOcc; + HeightThermostat = zoneDV3N.ThermostatHeight; + HeightComfort = zoneDV3N.ComfortHeight; + TempDiffCritRep = zoneDV3N.TempTrigger; + } } - } - - ConvGainsOccupiedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, DisplacementVentMgr::IntGainTypesOccupied); - ConvGainsOccupiedSubzone += 0.5 * thisZoneHB.SysDepZoneLoadsLagged; + ConvGainsOccupiedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); - // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very - // low or zero) - if (zone.NoHeatToReturnAir) { - RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, DisplacementVentMgr::IntGainTypesOccupied); - ConvGainsOccupiedSubzone += RetAirGain; - } + ConvGainsOccupiedSubzone += 0.5 * thisZoneHB.SysDepZoneLoadsLagged; - ConvGainsMixedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, DisplacementVentMgr::IntGainTypesMixedSubzone); - ConvGainsMixedSubzone += - state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) + state.dataHeatBalFanSys->SumConvPool(ZoneNum) + 0.5 * thisZoneHB.SysDepZoneLoadsLagged; - if (zone.NoHeatToReturnAir) { - RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, DisplacementVentMgr::IntGainTypesMixedSubzone); - ConvGainsMixedSubzone += RetAirGain; - } + // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very + // low or zero) + if (zone.NoHeatToReturnAir) { + RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); + ConvGainsOccupiedSubzone += RetAirGain; + } - ConvGains = ConvGainsOccupiedSubzone + ConvGainsMixedSubzone; - - //=================== Entering air system temperature and flow==================== - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - // Check to make sure if this is a controlled zone and determine ZoneEquipConfigNum - ZoneEquipConfigNum = ZoneNum; - if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).IsControlled) { - for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { - NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; - MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + ConvGainsMixedSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone); + ConvGainsMixedSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) + state.dataHeatBalFanSys->SumConvPool(ZoneNum) + + 0.5 * thisZoneHB.SysDepZoneLoadsLagged; + if (zone.NoHeatToReturnAir) { + RetAirGain = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone); + ConvGainsMixedSubzone += RetAirGain; } - } - SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA; - SumMCpT = - thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + thisZoneHB.MDotCPOA * zone.OutDryBulbTemp; - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithoutDistribution) { - SumMCp = state.afn->exchangeData(ZoneNum).SumMCp + state.afn->exchangeData(ZoneNum).SumMVCp + state.afn->exchangeData(ZoneNum).SumMMCp; - SumMCpT = state.afn->exchangeData(ZoneNum).SumMCpT + state.afn->exchangeData(ZoneNum).SumMVCpT + state.afn->exchangeData(ZoneNum).SumMMCpT; - } + ConvGains = ConvGainsOccupiedSubzone + ConvGainsMixedSubzone; + + //=================== Entering air system temperature and flow==================== + SumSysMCp = 0.0; + SumSysMCpT = 0.0; + // Check to make sure if this is a controlled zone and determine ZoneEquipConfigNum + ZoneEquipConfigNum = ZoneNum; + if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).IsControlled) { + for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { + NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; + MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; + CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + SumSysMCp += MassFlowRate * CpAir; + SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + } + } - MCp_Total = SumMCp + SumSysMCp; - MCpT_Total = SumMCpT + SumSysMCpT; + SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA; + SumMCpT = + thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + thisZoneHB.MDotCPOA * zone.OutDryBulbTemp; + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithoutDistribution) { + SumMCp = state.afn->exchangeData(ZoneNum).SumMCp + state.afn->exchangeData(ZoneNum).SumMVCp + state.afn->exchangeData(ZoneNum).SumMMCp; + SumMCpT = + state.afn->exchangeData(ZoneNum).SumMCpT + state.afn->exchangeData(ZoneNum).SumMVCpT + state.afn->exchangeData(ZoneNum).SumMMCpT; + } - if (state.dataHeatBal->TotPeople > 0) { - int NumberOfOccupants = 0; - NumberOfPlumes = 0.0; - for (Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { - if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) { - NumberOfOccupants += state.dataHeatBal->People(Ctd).NumberOfPeople; // *GetCurrentScheduleValue(state, People(Ctd)%NumberOfPeoplePtr) - NumberOfPlumes = NumberOfOccupants * NumPLPP; + MCp_Total = SumMCp + SumSysMCp; + MCpT_Total = SumMCpT + SumSysMCpT; + + if (state.dataHeatBal->TotPeople > 0) { + int NumberOfOccupants = 0; + NumberOfPlumes = 0.0; + for (Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { + if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) { + NumberOfOccupants += + state.dataHeatBal->People(Ctd).NumberOfPeople; // *GetCurrentScheduleValue(state, People(Ctd)%NumberOfPeoplePtr) + NumberOfPlumes = NumberOfOccupants * NumPLPP; + } } - } - if (NumberOfPlumes == 0.0) { + if (NumberOfPlumes == 0.0) { + NumberOfPlumes = 1.0; + } + PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone; + PowerPerPlume = PowerInPlumes / NumberOfPlumes; + } else { NumberOfPlumes = 1.0; + PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone; + PowerPerPlume = PowerInPlumes / NumberOfPlumes; } - PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone; - PowerPerPlume = PowerInPlumes / NumberOfPlumes; - } else { - NumberOfPlumes = 1.0; - PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone; - PowerPerPlume = PowerInPlumes / NumberOfPlumes; - } - // When AirflowNetwork is used verify if bottom apertures are inflowing and upper apertures are - // outflowing. The lower apertures have to be located below 0.8m and the upper apertures - // have to be located above 1.8m. + // When AirflowNetwork is used verify if bottom apertures are inflowing and upper apertures are + // outflowing. The lower apertures have to be located below 0.8m and the upper apertures + // have to be located above 1.8m. + + if (state.afn->NumOfLinksMultiZone > 0) { + for (int Loop = 1; Loop <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Loop) { + // direct AirflowNetwork surface + int afnSurfNum = state.dataRoomAir->AFNSurfaceCrossVent(Loop, ZoneNum); + auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(afnSurfNum); + auto const &afnLinkSimu = state.afn->AirflowNetworkLinkSimu(afnSurfNum); + auto const &afnMzSurfData = state.afn->MultizoneSurfaceData(afnSurfNum); + auto const &afnMzSurf = state.dataSurface->Surface(afnMzSurfData.SurfNum); + if (afnMzSurf.Zone == ZoneNum) { + + if ((surfParams.Zmax < 0.8 && afnLinkSimu.VolFLOW > 0)) { + FlagApertures = 0; + break; + } + if (surfParams.Zmin > 1.8 && afnLinkSimu.VolFLOW2 > 0) { + FlagApertures = 0; + break; + } - if (state.afn->NumOfLinksMultiZone > 0) { - for (int Loop = 1; Loop <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Loop) { - // direct AirflowNetwork surface + if ((surfParams.Zmin > 0.8 && surfParams.Zmin < 1.8) || (surfParams.Zmax > 0.8 && surfParams.Zmax < 1.8)) { + FlagApertures = 0; + break; + } + // indirect AirflowNetwork surface; this is an interzone surface + } else { + auto const &afnZone = state.dataHeatBal->Zone(afnMzSurf.Zone); + if (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 0.8 && afnLinkSimu.VolFLOW2 > 0) { + FlagApertures = 0; + break; + } + if (surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 1.8 && afnLinkSimu.VolFLOW > 0) { + FlagApertures = 0; + break; + } + if ((surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmin + afnZone.OriginZ - zone.OriginZ < 1.8) || + (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 1.8)) { + FlagApertures = 0; + break; + } + } + } + } - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum) - .Zone == ZoneNum) { + if ((PowerInPlumes == 0.0) || (MCpT_Total == 0.0) || FlagApertures == 0) { + // The system will mix + HeightFrac = 0.0; + } else { + Real64 const plume_fac(NumberOfPlumes * std::pow(PowerPerPlume, OneThird)); + HeightFrac = min(24.55 * std::pow(MCp_Total * 0.000833 / plume_fac, 0.6) / CeilingHeight, 1.0); + for (Ctd = 1; Ctd <= 4; ++Ctd) { + HcDispVent3Node(state, ZoneNum, HeightFrac); + // HeightFrac = min( 24.55 * std::pow( MCp_Total * 0.000833 / ( NumberOfPlumes * std::pow( PowerPerPlume, OneThird ) ), 0.6 ) / + // CeilingHeight, 1.0 ); //Tuned This does not vary in loop EPTeam-replaces above (cause diffs) HeightFrac = + // MIN(24.55d0*(MCp_Total*0.000833d0/(NumberOfPlumes*PowerPerPlume**(1.0d0/3.d0)))**0.6 / CeilingHeight , 1.0d0) + state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; + state.dataRoomAir->AIRRATFloor(ZoneNum) = + zone.Volume * min(state.dataRoomAir->HeightTransition(ZoneNum), state.dataDispVentMgr->HeightFloorSubzoneTop) / CeilingHeight * + zone.ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATFloor(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + state.dataRoomAir->AIRRATOC(ZoneNum) = + zone.Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / + CeilingHeight * zone.ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + state.dataRoomAir->AIRRATMX(ZoneNum) = + zone.Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * zone.ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + + if (state.dataHVACGlobal->UseZoneTimeStepHistory) { + state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->XMATFloor(ZoneNum)[2]; + state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->XMATFloor(ZoneNum)[1]; + state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->XMATFloor(ZoneNum)[0]; + + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->XMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->XMATOC(ZoneNum)[0]; + + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->XMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->XMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->XMATMX(ZoneNum)[0]; - if ((state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax < 0.8 && - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0)) { - FlagApertures = 0; - break; - } - if (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin > 1.8 && - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { - FlagApertures = 0; - break; - } + } else { + state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->DSXMATFloor(ZoneNum)[2]; + state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->DSXMATFloor(ZoneNum)[1]; + state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->DSXMATFloor(ZoneNum)[0]; - if ((state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin > 0.8 && - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin < 1.8) || - (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax > 0.8 && - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax < 1.8)) { - FlagApertures = 0; - break; + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->DSXMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->DSXMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->DSXMATOC(ZoneNum)[0]; + + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->DSXMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->DSXMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->DSXMATMX(ZoneNum)[0]; } - // indirect AirflowNetwork surface; this is an interzone surface - } else { - if (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface( - state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum) - .Zone) - .OriginZ - - zone.OriginZ < - 0.8 && - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { - FlagApertures = 0; + Real64 AirCap = state.dataRoomAir->AIRRATFloor(ZoneNum); + TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMFloor(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMFloor(ZoneNum)[1] + + OneThird * state.dataRoomAir->ZTMFloor(ZoneNum)[2]); + TempDepCoef = state.dataDispVentMgr->HA_FLOOR + MCp_Total; + TempIndCoef = state.dataDispVentMgr->HAT_FLOOR + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTFloor(ZoneNum) = calculateThirdOrderFloorTemperature(TempHistTerm, + state.dataDispVentMgr->HAT_FLOOR, + state.dataDispVentMgr->HA_FLOOR, + MCpT_Total, + MCp_Total, + state.dataRoomAir->ZTOC(ZoneNum), + thisZoneHB.NonAirSystemResponse, + ZoneMult, + AirCap); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTFloor(ZoneNum) = state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef / AirCap; + } else { + state.dataRoomAir->ZTFloor(ZoneNum) = + (state.dataRoomAir->Zone1Floor(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTFloor(ZoneNum) = (AirCap * state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: break; } - if (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface( - state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum) - .Zone) - .OriginZ - - zone.OriginZ > - 1.8 && - state.afn->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0) { - FlagApertures = 0; + AirCap = state.dataRoomAir->AIRRATOC(ZoneNum); + TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMOC(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMOC(ZoneNum)[1] + + OneThird * state.dataRoomAir->ZTMOC(ZoneNum)[2]); + TempDepCoef = state.dataDispVentMgr->HA_OC + MCp_Total; + TempIndCoef = ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTOC(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + + 1.6 * state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total) / + ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_OC + 1.6 * MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTOC(ZoneNum) = state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef / AirCap; + } else { + if (AirCap == 0.0) { + state.dataRoomAir->ZTOC(ZoneNum) = TempIndCoef / TempDepCoef; + } else { + state.dataRoomAir->ZTOC(ZoneNum) = + (state.dataRoomAir->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTOC(ZoneNum) = (AirCap * state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: break; } - if ((state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)) - .SurfNum) - .Zone) - .OriginZ - - zone.OriginZ > - 0.8 && - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)) - .SurfNum) - .Zone) - .OriginZ - - zone.OriginZ < - 1.8) || - (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)) - .SurfNum) - .Zone) - .OriginZ - - zone.OriginZ > - 0.8 && - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax + - state.dataHeatBal - ->Zone( - state.dataSurface - ->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)) - .SurfNum) - .Zone) - .OriginZ - - zone.OriginZ < - 1.8)) { - FlagApertures = 0; + AirCap = state.dataRoomAir->AIRRATMX(ZoneNum); + TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMMX(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMMX(ZoneNum)[1] + + OneThird * state.dataRoomAir->ZTMMX(ZoneNum)[2]); + TempDepCoef = state.dataDispVentMgr->HA_MX + MCp_Total; + TempIndCoef = ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + state.dataDispVentMgr->HAT_MX + + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTMX(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + + state.dataDispVentMgr->HAT_MX + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total) / + ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTMX(ZoneNum) = state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef / AirCap; + } else { + if (AirCap == 0.0) { + state.dataRoomAir->ZTMX(ZoneNum) = TempIndCoef / TempDepCoef; + } else { + state.dataRoomAir->ZTMX(ZoneNum) = + (state.dataRoomAir->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTMX(ZoneNum) = (AirCap * state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: break; } } - } - } - - if ((PowerInPlumes == 0.0) || (MCpT_Total == 0.0) || FlagApertures == 0) { - // The system will mix - HeightFrac = 0.0; - } else { - Real64 const plume_fac(NumberOfPlumes * std::pow(PowerPerPlume, OneThird)); - HeightFrac = min(24.55 * std::pow(MCp_Total * 0.000833 / plume_fac, 0.6) / CeilingHeight, 1.0); - for (Ctd = 1; Ctd <= 4; ++Ctd) { - HcUCSDDV(state, ZoneNum, HeightFrac); - // HeightFrac = min( 24.55 * std::pow( MCp_Total * 0.000833 / ( NumberOfPlumes * std::pow( PowerPerPlume, OneThird ) ), 0.6 ) / - // CeilingHeight, 1.0 ); //Tuned This does not vary in loop EPTeam-replaces above (cause diffs) HeightFrac = - // MIN(24.55d0*(MCp_Total*0.000833d0/(NumberOfPlumes*PowerPerPlume**(1.0d0/3.d0)))**0.6 / CeilingHeight , 1.0d0) - state.dataRoomAirMod->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; - state.dataRoomAirMod->AIRRATFloor(ZoneNum) = - zone.Volume * min(state.dataRoomAirMod->HeightTransition(ZoneNum), state.dataDispVentMgr->HeightFloorSubzoneTop) / CeilingHeight * - zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATFloor(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - state.dataRoomAirMod->AIRRATOC(ZoneNum) = - zone.Volume * (state.dataRoomAirMod->HeightTransition(ZoneNum) - min(state.dataRoomAirMod->HeightTransition(ZoneNum), 0.2)) / - CeilingHeight * zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - state.dataRoomAirMod->AIRRATMX(ZoneNum) = - zone.Volume * (CeilingHeight - state.dataRoomAirMod->HeightTransition(ZoneNum)) / CeilingHeight * zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - - if (state.dataHVACGlobal->UseZoneTimeStepHistory) { - state.dataRoomAirMod->ZTM3Floor(ZoneNum) = state.dataRoomAirMod->XM3TFloor(ZoneNum); - state.dataRoomAirMod->ZTM2Floor(ZoneNum) = state.dataRoomAirMod->XM2TFloor(ZoneNum); - state.dataRoomAirMod->ZTM1Floor(ZoneNum) = state.dataRoomAirMod->XMATFloor(ZoneNum); - - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->XM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->XM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->XMATOC(ZoneNum); - - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->XM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->XM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->XMATMX(ZoneNum); + // MinFlow for interface layer at z = 1.0 + MinFlow = MinFlow_pow_fac * plume_fac; + // EPTeam above replaces (cause diffs?) MinFlow = (1.0d0/24.55d0*1.0d0)**(1.0d0/0.6d0)*NumberOfPlumes*PowerPerPlume**(1.0/3.0) + if (MinFlow != 0.0) { + state.dataRoomAir->FracMinFlow(ZoneNum) = MCp_Total * 0.000833 / MinFlow; } else { - state.dataRoomAirMod->ZTM3Floor(ZoneNum) = state.dataRoomAirMod->DSXM3TFloor(ZoneNum); - state.dataRoomAirMod->ZTM2Floor(ZoneNum) = state.dataRoomAirMod->DSXM2TFloor(ZoneNum); - state.dataRoomAirMod->ZTM1Floor(ZoneNum) = state.dataRoomAirMod->DSXMATFloor(ZoneNum); - - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->DSXM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->DSXM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->DSXMATOC(ZoneNum); - - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->DSXM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->DSXM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->DSXMATMX(ZoneNum); + state.dataRoomAir->FracMinFlow(ZoneNum) = 9.999; } + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + } - Real64 AirCap = state.dataRoomAirMod->AIRRATFloor(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1Floor(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2Floor(ZoneNum) + - OneThird * state.dataRoomAirMod->ZTM3Floor(ZoneNum)); - TempDepCoef = state.dataDispVentMgr->HA_FLOOR + MCp_Total; - TempIndCoef = state.dataDispVentMgr->HAT_FLOOR + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTFloor(ZoneNum) = calculateThirdOrderFloorTemperature(TempHistTerm, - state.dataDispVentMgr->HAT_FLOOR, - state.dataDispVentMgr->HA_FLOOR, - MCpT_Total, - MCp_Total, - state.dataRoomAirMod->ZTOC(ZoneNum), - thisZoneHB.NonAirSystemResponse, - ZoneMult, - AirCap); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTFloor(ZoneNum) = state.dataRoomAirMod->Zone1Floor(ZoneNum) + TempIndCoef / AirCap; - } else { - state.dataRoomAirMod->ZTFloor(ZoneNum) = - (state.dataRoomAirMod->Zone1Floor(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; - } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTFloor(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1Floor(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - AirCap = state.dataRoomAirMod->AIRRATOC(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1OC(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2OC(ZoneNum) + - OneThird * state.dataRoomAirMod->ZTM3OC(ZoneNum)); - TempDepCoef = state.dataDispVentMgr->HA_OC + MCp_Total; - TempIndCoef = ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + state.dataRoomAirMod->ZTFloor(ZoneNum) * MCp_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + - 1.6 * state.dataRoomAirMod->ZTFloor(ZoneNum) * MCp_Total) / - ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_OC + 1.6 * MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTOC(ZoneNum) = state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef / AirCap; - } else { - if (AirCap == 0.0) { - state.dataRoomAirMod->ZTOC(ZoneNum) = TempIndCoef / TempDepCoef; + //=============================== M I X E D Calculation ============================================== + if (state.dataRoomAir->ZTMX(ZoneNum) < state.dataRoomAir->ZTOC(ZoneNum) || MCp_Total <= 0.0 || + HeightFrac * CeilingHeight < (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataDispVentMgr->ThickOccupiedSubzoneMin)) { + MIXFLAG = true; + HeightFrac = 0.0; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + Real64 const thisZoneT1 = thisZoneHB.ZoneT1; + Real64 AirCap = thisZoneHB.AirPowerCap; + TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]); + + for (Ctd = 1; Ctd <= 3; ++Ctd) { + TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total; + TempIndCoef = + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) / + ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + + state.dataDispVentMgr->HA_FLOOR + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; } else { - state.dataRoomAirMod->ZTOC(ZoneNum) = - (state.dataRoomAirMod->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - AirCap = state.dataRoomAirMod->AIRRATMX(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1MX(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2MX(ZoneNum) + - OneThird * state.dataRoomAirMod->ZTM3MX(ZoneNum)); - TempDepCoef = state.dataDispVentMgr->HA_MX + MCp_Total; - TempIndCoef = ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + state.dataDispVentMgr->HAT_MX + - state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTMX(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + - state.dataDispVentMgr->HAT_MX + state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total) / - ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTMX(ZoneNum) = state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef / AirCap; - } else { - if (AirCap == 0.0) { - state.dataRoomAirMod->ZTMX(ZoneNum) = TempIndCoef / TempDepCoef; + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; + HcDispVent3Node(state, ZoneNum, HeightFrac); + TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total; + TempIndCoef = + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) / + ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + + state.dataDispVentMgr->HA_FLOOR + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; } else { - state.dataRoomAirMod->ZTMX(ZoneNum) = - (state.dataRoomAirMod->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTMX(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; } } + //========================================================================================= + + // Comfort temperature and temperature at the thermostat/temperature control sensor + + state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; + HeightMixedSubzoneAve = (CeilingHeight + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0; + HeightOccupiedSubzoneAve = (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0; + HeightFloorSubzoneAve = state.dataDispVentMgr->HeightFloorSubzoneTop / 2.0; + + // Comfort temperature - // MinFlow for interface layer at z = 1.0 - MinFlow = MinFlow_pow_fac * plume_fac; - // EPTeam above replaces (cause diffs?) MinFlow = (1.0d0/24.55d0*1.0d0)**(1.0d0/0.6d0)*NumberOfPlumes*PowerPerPlume**(1.0/3.0) - if (MinFlow != 0.0) { - state.dataRoomAirMod->FracMinFlow(ZoneNum) = MCp_Total * 0.000833 / MinFlow; + if (MIXFLAG) { + state.dataRoomAir->TCMF(ZoneNum) = ZTAveraged; } else { - state.dataRoomAirMod->FracMinFlow(ZoneNum) = 9.999; + if (HeightComfort >= 0.0 && HeightComfort < HeightFloorSubzoneAve) { + ShowWarningError(state, format("Displacement ventilation comfort height is in floor subzone in Zone: {}", zone.Name)); + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum); + } else if (HeightComfort >= HeightFloorSubzoneAve && HeightComfort < HeightOccupiedSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) + + state.dataRoomAir->ZTOC(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) / + (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); + //! TCMF(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) & + //! + ZTMX(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) & + //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) + } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightMixedSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightComfort) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / + (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightComfort >= HeightMixedSubzoneAve && HeightComfort <= CeilingHeight) { + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, format("Displacement ventilation comfort height is above ceiling or below floor in Zone: {}", zone.Name)); + } } - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - } - //=============================== M I X E D Calculation ============================================== - if (state.dataRoomAirMod->ZTMX(ZoneNum) < state.dataRoomAirMod->ZTOC(ZoneNum) || MCp_Total <= 0.0 || - HeightFrac * CeilingHeight < (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataDispVentMgr->ThickOccupiedSubzoneMin)) { - MIXFLAG = true; - HeightFrac = 0.0; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; - Real64 AirCap = thisZoneHB.AirPowerCap; - TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]); - - for (Ctd = 1; Ctd <= 3; ++Ctd) { - TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total; - TempIndCoef = ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + - state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + - MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; - } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; - HcUCSDDV(state, ZoneNum, HeightFrac); - TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total; - TempIndCoef = ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + - state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + - MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; - } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + // Temperature at the thermostat/temperature control sensor + + if (MIXFLAG) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; + } else { + if (HeightThermostat >= 0.0 && HeightThermostat < HeightFloorSubzoneAve) { + ShowWarningError(state, format("Displacement thermostat is in floor subzone in Zone: {}", zone.Name)); + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum); + } else if (HeightThermostat >= HeightFloorSubzoneAve && HeightThermostat < HeightOccupiedSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = + (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) + + state.dataRoomAir->ZTOC(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) / + (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); + //! TempTstatAir(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) & + //! + ZTMX(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) & + //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) + } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightMixedSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightThermostat) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / + (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightThermostat >= HeightMixedSubzoneAve && HeightThermostat <= CeilingHeight) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, format("Displacement ventilation thermostat height is above ceiling or below floor in Zone: {}", zone.Name)); } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; } - } - //========================================================================================= - - // Comfort temperature and temperature at the thermostat/temperature control sensor - - state.dataRoomAirMod->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; - HeightMixedSubzoneAve = (CeilingHeight + state.dataRoomAirMod->HeightTransition(ZoneNum)) / 2.0; - HeightOccupiedSubzoneAve = (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataRoomAirMod->HeightTransition(ZoneNum)) / 2.0; - HeightFloorSubzoneAve = state.dataDispVentMgr->HeightFloorSubzoneTop / 2.0; - - // Comfort temperature - - if (MIXFLAG) { - state.dataRoomAirMod->TCMF(ZoneNum) = ZTAveraged; - } else { - if (HeightComfort >= 0.0 && HeightComfort < HeightFloorSubzoneAve) { - ShowWarningError(state, format("Displacement ventilation comfort height is in floor subzone in Zone: {}", zone.Name)); - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - } else if (HeightComfort >= HeightFloorSubzoneAve && HeightComfort < HeightOccupiedSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = (state.dataRoomAirMod->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) + - state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) / - (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); - //! TCMF(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) & - //! + ZTMX(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) & - //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) - } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightMixedSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightComfort) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / - (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightComfort >= HeightMixedSubzoneAve && HeightComfort <= CeilingHeight) { - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + + // Temperature gradients + + if ((HeightMixedSubzoneAve - HeightFloorSubzoneAve) > 0.1) { + state.dataRoomAir->AvgTempGrad(ZoneNum) = + (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightMixedSubzoneAve - HeightFloorSubzoneAve); } else { - ShowFatalError(state, format("Displacement ventilation comfort height is above ceiling or below floor in Zone: {}", zone.Name)); + state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999; } - } - - // Temperature at the thermostat/temperature control sensor - - if (MIXFLAG) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; - } else { - if (HeightThermostat >= 0.0 && HeightThermostat < HeightFloorSubzoneAve) { - ShowWarningError(state, format("Displacement thermostat is in floor subzone in Zone: {}", zone.Name)); - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - } else if (HeightThermostat >= HeightFloorSubzoneAve && HeightThermostat < HeightOccupiedSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAirMod->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) + - state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) / - (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); - //! TempTstatAir(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) & - //! + ZTMX(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) & - //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) - } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightMixedSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightThermostat) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / - (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightThermostat >= HeightMixedSubzoneAve && HeightThermostat <= CeilingHeight) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + if ((HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) > 0.1) { + state.dataRoomAir->MaxTempGrad(ZoneNum) = + (state.dataRoomAir->ZTOC(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); } else { - ShowFatalError(state, format("Displacement ventilation thermostat height is above ceiling or below floor in Zone: {}", zone.Name)); + state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999; + } + if ((HeightMixedSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { + MTGAUX = (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) / (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); + } else { + MTGAUX = -9.999; } - } - - // Temperature gradients - - if ((HeightMixedSubzoneAve - HeightFloorSubzoneAve) > 0.1) { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = - (state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTFloor(ZoneNum)) / (HeightMixedSubzoneAve - HeightFloorSubzoneAve); - } else { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = -9.999; - } - if ((HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) > 0.1) { - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = - (state.dataRoomAirMod->ZTOC(ZoneNum) - state.dataRoomAirMod->ZTFloor(ZoneNum)) / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve); - } else { - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = -9.999; - } - if ((HeightMixedSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { - MTGAUX = (state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) / (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve); - } else { - MTGAUX = -9.999; - } - if (MTGAUX > state.dataRoomAirMod->MaxTempGrad(ZoneNum)) { - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = MTGAUX; - } + if (MTGAUX > state.dataRoomAir->MaxTempGrad(ZoneNum)) { + state.dataRoomAir->MaxTempGrad(ZoneNum) = MTGAUX; + } - if (MIXFLAG) { - state.dataRoomAirMod->ZoneDVMixedFlag(ZoneNum) = 1; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - } else { - state.dataRoomAirMod->ZoneDVMixedFlag(ZoneNum) = 0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - } + if (MIXFLAG) { + state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 1; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + } else { + state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + } - if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) { - int ZoneNodeNum = zone.SystemZoneNodeNumber; - state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAirMod->ZTMX(ZoneNum); - } + if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) { + int ZoneNodeNum = zone.SystemZoneNodeNumber; + state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAir->ZTMX(ZoneNum); + } - // Mixed for reporting purposes - if ((MIXFLAG) || ((state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) < TempDiffCritRep)) { - state.dataRoomAirMod->ZoneDVMixedFlagRep(ZoneNum) = 1.0; - state.dataRoomAirMod->FracMinFlow(ZoneNum) = -1.0; - state.dataRoomAirMod->HeightTransition(ZoneNum) = -9.999; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = -9.999; - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = -9.999; - } else { - state.dataRoomAirMod->ZoneDVMixedFlagRep(ZoneNum) = 0.0; + // Mixed for reporting purposes + if ((MIXFLAG) || ((state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) < TempDiffCritRep)) { + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 1.0; + state.dataRoomAir->FracMinFlow(ZoneNum) = -1.0; + state.dataRoomAir->HeightTransition(ZoneNum) = -9.999; + state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999; + state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999; + } else { + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 0.0; + } } -} -} // namespace EnergyPlus::DisplacementVentMgr +} // namespace RoomAir +} // namespace EnergyPlus diff --git a/src/EnergyPlus/DisplacementVentMgr.hh b/src/EnergyPlus/DisplacementVentMgr.hh index cbbdcab0b9c..a750cc76407 100644 --- a/src/EnergyPlus/DisplacementVentMgr.hh +++ b/src/EnergyPlus/DisplacementVentMgr.hh @@ -58,13 +58,13 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace DisplacementVentMgr { +namespace RoomAir { - void ManageUCSDDVModel(EnergyPlusData &state, int ZoneNum); // index number for the specified zone + void ManageDispVent3Node(EnergyPlusData &state, int ZoneNum); // index number for the specified zone - void InitUCSDDV(EnergyPlusData &state, int ZoneNum); + void InitDispVent3Node(EnergyPlusData &state, int ZoneNum); - void HcUCSDDV(EnergyPlusData &state, int ZoneNum, Real64 FractionHeight); + void HcDispVent3Node(EnergyPlusData &state, int ZoneNum, Real64 FractionHeight); Real64 calculateThirdOrderFloorTemperature(Real64 temperatureHistoryTerm, Real64 HAT_floor, @@ -76,7 +76,7 @@ namespace DisplacementVentMgr { Real64 zoneMultiplier, Real64 airCap); - void CalcUCSDDV(EnergyPlusData &state, int ZoneNum); // Which Zonenum + void CalcDispVent3Node(EnergyPlusData &state, int ZoneNum); // Which Zonenum static constexpr std::array IntGainTypesOccupied = { DataHeatBalance::IntGainType::People, @@ -113,7 +113,7 @@ namespace DisplacementVentMgr { static constexpr std::array IntGainTypesMixedSubzone = {DataHeatBalance::IntGainType::DaylightingDeviceTubular, DataHeatBalance::IntGainType::Lights}; -} // namespace DisplacementVentMgr +} // namespace RoomAir struct DisplacementVentMgrData : BaseGlobalStruct { diff --git a/src/EnergyPlus/DualDuct.cc b/src/EnergyPlus/DualDuct.cc index 1be5639e5d5..67aa57ce4a1 100644 --- a/src/EnergyPlus/DualDuct.cc +++ b/src/EnergyPlus/DualDuct.cc @@ -606,7 +606,7 @@ namespace DualDuct { state, CurrentModuleObject + ":RecirculatedAir", thisDD.Name, AlphArray(5), AlphArray(3), "Air Nodes"); } - thisDD.OAPerPersonMode = static_cast(getEnumerationValue(modeStrings, AlphArray(7))); + thisDD.OAPerPersonMode = static_cast(getEnumValue(modeStrings, AlphArray(7))); if (thisDD.OAPerPersonMode == PerPersonMode::Invalid) { thisDD.OAPerPersonMode = PerPersonMode::ModeNotSet; } diff --git a/src/EnergyPlus/EMSManager.cc b/src/EnergyPlus/EMSManager.cc index 06fb2cfb9a3..c89233ef4ec 100644 --- a/src/EnergyPlus/EMSManager.cc +++ b/src/EnergyPlus/EMSManager.cc @@ -856,7 +856,7 @@ namespace EMSManager { state.dataRuntimeLang->EMSProgramCallManager(CallManagerNum).Name = cAlphaArgs(1); state.dataRuntimeLang->EMSProgramCallManager(CallManagerNum).CallingPoint = - static_cast(getEnumerationValue(EMSCallFromNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(2)))); + static_cast(getEnumValue(EMSCallFromNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(2)))); ErrorsFound = ErrorsFound || (state.dataRuntimeLang->EMSProgramCallManager(CallManagerNum).CallingPoint == EMSCallFrom::Invalid); int NumErlProgramsThisManager = NumAlphas - 2; // temporary size of Erl programs in EMSProgramCallManager @@ -2100,9 +2100,9 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(UtilityRoutines::MakeUPPERCase(cComponentTypeName)); - std::string const UpperCaseObjectName(UtilityRoutines::MakeUPPERCase(cUniqueIDName)); - std::string const UpperCaseActuatorName(UtilityRoutines::MakeUPPERCase(cControlTypeName)); + std::string const UpperCaseObjectType(UtilityRoutines::makeUPPER(cComponentTypeName)); + std::string const UpperCaseObjectName(UtilityRoutines::makeUPPER(cUniqueIDName)); + std::string const UpperCaseActuatorName(UtilityRoutines::makeUPPER(cControlTypeName)); DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); @@ -2151,9 +2151,9 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(UtilityRoutines::MakeUPPERCase(cComponentTypeName)); - std::string const UpperCaseObjectName(UtilityRoutines::MakeUPPERCase(cUniqueIDName)); - std::string const UpperCaseActuatorName(UtilityRoutines::MakeUPPERCase(cControlTypeName)); + std::string const UpperCaseObjectType(UtilityRoutines::makeUPPER(cComponentTypeName)); + std::string const UpperCaseObjectName(UtilityRoutines::makeUPPER(cUniqueIDName)); + std::string const UpperCaseActuatorName(UtilityRoutines::makeUPPER(cControlTypeName)); DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); @@ -2202,9 +2202,9 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(UtilityRoutines::MakeUPPERCase(cComponentTypeName)); - std::string const UpperCaseObjectName(UtilityRoutines::MakeUPPERCase(cUniqueIDName)); - std::string const UpperCaseActuatorName(UtilityRoutines::MakeUPPERCase(cControlTypeName)); + std::string const UpperCaseObjectType(UtilityRoutines::makeUPPER(cComponentTypeName)); + std::string const UpperCaseObjectName(UtilityRoutines::makeUPPER(cUniqueIDName)); + std::string const UpperCaseActuatorName(UtilityRoutines::makeUPPER(cControlTypeName)); DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); diff --git a/src/EnergyPlus/EarthTube.cc b/src/EnergyPlus/EarthTube.cc index b3da1a74d05..e7d3ef62e98 100644 --- a/src/EnergyPlus/EarthTube.cc +++ b/src/EnergyPlus/EarthTube.cc @@ -83,7 +83,7 @@ namespace EnergyPlus::EarthTube { // Cambridge Massachusetts, MIT Press, 1989, pp 206-212 // This is an interesting one. The actual members of the enum are never explicitly used -// The enum is used in a getEnumerationValue call to determine what was found in GetInput +// The enum is used in a getEnumValue call to determine what was found in GetInput // The value is then used as an array index to lookup thermal conductivity and such from some std::arrays // So the IDE thinks these are unused, and I'm not sure the best way to hint that they sorta aren't enum class SoilType @@ -238,7 +238,7 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i if (state.dataIPShortCut->cAlphaArgs(3).empty()) { thisEarthTube.FanType = Ventilation::Natural; } else { - thisEarthTube.FanType = static_cast(getEnumerationValue(ventilationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + thisEarthTube.FanType = static_cast(getEnumValue(ventilationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); if (thisEarthTube.FanType == Ventilation::Invalid) { ShowSevereError(state, format("{}: {}={}, {} invalid={}", @@ -350,7 +350,7 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i ErrorsFound = true; } - SoilType soilType = static_cast(getEnumerationValue(soilTypeNamesUC, state.dataIPShortCut->cAlphaArgs(4))); + SoilType soilType = static_cast(getEnumValue(soilTypeNamesUC, state.dataIPShortCut->cAlphaArgs(4))); constexpr std::array(SoilType::Num)> thermalDiffusivity = {0.0781056, 0.055728, 0.0445824, 0.024192}; constexpr std::array(SoilType::Num)> thermalConductivity = {2.42, 1.3, 0.865, 0.346}; if (soilType == SoilType::Invalid) { diff --git a/src/EnergyPlus/EconomicLifeCycleCost.cc b/src/EnergyPlus/EconomicLifeCycleCost.cc index 253ef0910a3..6eeff1a5ea9 100644 --- a/src/EnergyPlus/EconomicLifeCycleCost.cc +++ b/src/EnergyPlus/EconomicLifeCycleCost.cc @@ -210,7 +210,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) // \key MidYear // \key BeginningOfYear // \default EndOfYear - elcc->discountConvention = static_cast(getEnumerationValue(DiscConvNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(2)))); + elcc->discountConvention = static_cast(getEnumValue(DiscConvNamesUC, UtilityRoutines::makeUPPER(AlphaArray(2)))); if (elcc->discountConvention == DiscConv::Invalid) { elcc->discountConvention = DiscConv::EndOfYear; ShowWarningError( @@ -223,7 +223,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) // \key ConstantDollar // \key CurrentDollar // \default ConstantDollar - elcc->inflationApproach = static_cast(getEnumerationValue(InflApprNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(3)))); + elcc->inflationApproach = static_cast(getEnumValue(InflApprNamesUC, UtilityRoutines::makeUPPER(AlphaArray(3)))); if (elcc->inflationApproach == InflAppr::Invalid) { elcc->inflationApproach = InflAppr::ConstantDollar; ShowWarningError(state, @@ -295,7 +295,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) // \key November // \key December // \default January - elcc->baseDateMonth = getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(4))); + elcc->baseDateMonth = getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER(AlphaArray(4))); if (elcc->baseDateMonth == -1) { elcc->baseDateMonth = 0; ShowWarningError(state, @@ -336,7 +336,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) // \key November // \key December // \default January - elcc->serviceDateMonth = getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(5))); + elcc->serviceDateMonth = getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER(AlphaArray(5))); if (elcc->serviceDateMonth == -1) { elcc->serviceDateMonth = 0; ShowWarningError(state, @@ -404,7 +404,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) // \key StraightLine-40year // \key None // \default None - elcc->depreciationMethod = static_cast(getEnumerationValue(DeprMethodNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(6)))); + elcc->depreciationMethod = static_cast(getEnumValue(DeprMethodNamesUC, UtilityRoutines::makeUPPER(AlphaArray(6)))); if (elcc->depreciationMethod == DeprMethod::Invalid) { elcc->depreciationMethod = DeprMethod::None; if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { @@ -497,7 +497,7 @@ void GetInputLifeCycleCostRecurringCosts(EnergyPlusData &state) // \key OtherOperational // \default Maintenance elcc->RecurringCosts[iInObj].category = - static_cast(getEnumerationValue(CostCategoryNamesUCNoSpace, UtilityRoutines::MakeUPPERCase(AlphaArray(2)))); + static_cast(getEnumValue(CostCategoryNamesUCNoSpace, UtilityRoutines::makeUPPER(AlphaArray(2)))); bool isNotRecurringCost = (elcc->RecurringCosts[iInObj].category != CostCategory::Maintenance && elcc->RecurringCosts[iInObj].category != CostCategory::Repair && elcc->RecurringCosts[iInObj].category != CostCategory::Operation && elcc->RecurringCosts[iInObj].category != CostCategory::Replacement && @@ -521,7 +521,7 @@ void GetInputLifeCycleCostRecurringCosts(EnergyPlusData &state) // \key BasePeriod // \default ServicePeriod elcc->RecurringCosts[iInObj].startOfCosts = - static_cast(getEnumerationValue(StartCostNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(3)))); + static_cast(getEnumValue(StartCostNamesUC, UtilityRoutines::makeUPPER(AlphaArray(3)))); if (elcc->RecurringCosts[iInObj].startOfCosts == StartCosts::Invalid) { elcc->RecurringCosts[iInObj].startOfCosts = StartCosts::ServicePeriod; ShowWarningError(state, @@ -708,7 +708,7 @@ void GetInputLifeCycleCostNonrecurringCost(EnergyPlusData &state) // \key OtherCapital // \default Construction elcc->NonrecurringCost[iInObj].category = - static_cast(getEnumerationValue(CostCategoryNamesUCNoSpace, UtilityRoutines::MakeUPPERCase(AlphaArray(2)))); + static_cast(getEnumValue(CostCategoryNamesUCNoSpace, UtilityRoutines::makeUPPER(AlphaArray(2)))); bool isNotNonRecurringCost = (elcc->NonrecurringCost[iInObj].category != CostCategory::Construction && elcc->NonrecurringCost[iInObj].category != CostCategory::Salvage && elcc->NonrecurringCost[iInObj].category != CostCategory::OtherCapital); @@ -729,7 +729,7 @@ void GetInputLifeCycleCostNonrecurringCost(EnergyPlusData &state) // \key BasePeriod // \default ServicePeriod elcc->NonrecurringCost[iInObj].startOfCosts = - static_cast(getEnumerationValue(StartCostNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(3)))); + static_cast(getEnumValue(StartCostNamesUC, UtilityRoutines::makeUPPER(AlphaArray(3)))); if (elcc->NonrecurringCost[iInObj].startOfCosts == StartCosts::Invalid) { elcc->NonrecurringCost[iInObj].startOfCosts = StartCosts::ServicePeriod; ShowWarningError(state, @@ -857,8 +857,7 @@ void GetInputLifeCycleCostUsePriceEscalation(EnergyPlusData &state) // \key Water // \key OtherFuel1 // \key OtherFuel2 - elcc->UsePriceEscalation(iInObj).resource = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, AlphaArray(2))); + elcc->UsePriceEscalation(iInObj).resource = static_cast(getEnumValue(Constant::eResourceNamesUC, AlphaArray(2))); if (NumAlphas > 3) { ShowWarningError(state, format("In {} contains more alpha fields than expected.", CurrentModuleObject)); } @@ -895,7 +894,7 @@ void GetInputLifeCycleCostUsePriceEscalation(EnergyPlusData &state) // \key December // \default January elcc->UsePriceEscalation(iInObj).escalationStartMonth = - getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase(AlphaArray(3))); + getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER(AlphaArray(3))); if (elcc->UsePriceEscalation(iInObj).escalationStartMonth == -1) { elcc->UsePriceEscalation(iInObj).escalationStartMonth = 0; ShowWarningError(state, @@ -1008,7 +1007,7 @@ void GetInputLifeCycleCostUseAdjustment(EnergyPlusData &state) // \key Water // \key OtherFuel1 // \key OtherFuel2 - elcc->UseAdjustment(iInObj).resource = static_cast(getEnumerationValue(Constant::eResourceNamesUC, AlphaArray(2))); + elcc->UseAdjustment(iInObj).resource = static_cast(getEnumValue(Constant::eResourceNamesUC, AlphaArray(2))); if (NumAlphas > 2) { ShowWarningError(state, format("In {} contains more alpha fields than expected.", CurrentModuleObject)); } diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index c12c086258d..c301cb288e8 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -227,7 +227,7 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i if (tariff(iInObj).reportMeterIndx != 0) { std::string const &SELECT_CASE_var( - UtilityRoutines::MakeUPPERCase(state.dataOutputProcessor->EnergyMeters(tariff(iInObj).reportMeterIndx).ResourceType)); + UtilityRoutines::makeUPPER(state.dataOutputProcessor->EnergyMeters(tariff(iInObj).reportMeterIndx).ResourceType)); // Various types of electricity meters if (SELECT_CASE_var == "ELECTRICITY") { @@ -664,9 +664,9 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i } // associate the resource number with each tariff if (tariff(iInObj).reportMeterIndx >= 1) { - tariff(iInObj).resource = static_cast(getEnumerationValue( - Constant::eResourceNamesUC, - UtilityRoutines::MakeUPPERCase(state.dataOutputProcessor->EnergyMeters(tariff(iInObj).reportMeterIndx).ResourceType))); + tariff(iInObj).resource = static_cast( + getEnumValue(Constant::eResourceNamesUC, + UtilityRoutines::makeUPPER(state.dataOutputProcessor->EnergyMeters(tariff(iInObj).reportMeterIndx).ResourceType))); } } } diff --git a/src/EnergyPlus/ElectricBaseboardRadiator.cc b/src/EnergyPlus/ElectricBaseboardRadiator.cc index 17ad4c62a36..47302cda1e6 100644 --- a/src/EnergyPlus/ElectricBaseboardRadiator.cc +++ b/src/EnergyPlus/ElectricBaseboardRadiator.cc @@ -386,7 +386,7 @@ namespace ElectricBaseboardRadiator { elecBaseboard.FracDistribToSurf = 0.0; elecBaseboard.ZonePtr = - DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquip::BBElectric, elecBaseboard.EquipName); + DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::BaseboardElectric, elecBaseboard.EquipName); AllFracsSummed = elecBaseboard.FracDistribPerson; for (int SurfNum = 1; SurfNum <= elecBaseboard.TotSurfToDistrib; ++SurfNum) { diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index 484193018e6..e08eb43e928 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -779,7 +779,7 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje errorsFound = true; } - demandMeterName_ = UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)); + demandMeterName_ = UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)); // meters may not be "loaded" yet, defered check to later subroutine if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(6), "AlternatingCurrent")) { @@ -2182,7 +2182,7 @@ GeneratorController::GeneratorController(EnergyPlusData &state, name = objectName; - generatorType = static_cast(getEnumerationValue(GeneratorTypeNamesUC, UtilityRoutines::MakeUPPERCase(objectType))); + generatorType = static_cast(getEnumValue(GeneratorTypeNamesUC, UtilityRoutines::makeUPPER(objectType))); switch (generatorType) { case GeneratorType::ICEngine: { compPlantType = DataPlant::PlantEquipmentType::Generator_ICEngine; @@ -2207,8 +2207,7 @@ GeneratorController::GeneratorController(EnergyPlusData &state, case GeneratorType::PVWatts: { compPlantType = DataPlant::PlantEquipmentType::Invalid; - int ObjNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Generator:PVWatts", UtilityRoutines::MakeUPPERCase(objectName)); + int ObjNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "Generator:PVWatts", UtilityRoutines::makeUPPER(objectName)); assert(ObjNum >= 0); if (ObjNum == 0) { ShowFatalError(state, format("Cannot find Generator:PVWatts {}", objectName)); @@ -2263,8 +2262,7 @@ GeneratorController::GeneratorController(EnergyPlusData &state, // Except you need GetPVInput to have run already etc // Note: you can't use state.dataIPShortCut->cAlphaArgs etc or it'll override what will still need to be processed in // ElectPowerLoadCenter::ElectPowerLoadCenter after this function is called - int PVNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, objectType, UtilityRoutines::MakeUPPERCase(objectName)); + int PVNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, objectType, UtilityRoutines::makeUPPER(objectName)); int NumAlphas; // Number of PV Array parameter alpha names being passed int NumNums; // Number of PV Array numeric parameters are being passed int IOStat; @@ -4814,7 +4812,7 @@ ElectricTransformer::ElectricTransformer(EnergyPlusData &state, std::string cons // Meter check deferred because they may have not been "loaded" yet, for (int loopCount = 0; loopCount < numWiredMeters; ++loopCount) { - wiredMeterNames_[loopCount] = UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(loopCount + numAlphaBeforeMeter + 1)); + wiredMeterNames_[loopCount] = UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(loopCount + numAlphaBeforeMeter + 1)); // Assign SpecialMeter as TRUE if the meter name is Electricity:Facility or Electricity:HVAC if (UtilityRoutines::SameString(wiredMeterNames_[loopCount], "Electricity:Facility") || UtilityRoutines::SameString(wiredMeterNames_[loopCount], "Electricity:HVAC")) { diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index c2933789aae..5679aa44559 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -3521,7 +3521,7 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) thisZoneEvapUnit.DesignAirVolumeFlowRate = Numbers(1); constexpr std::array(FanPlacement::Num)> fanPlacementNamesUC = {"BLOWTHROUGH", "DRAWTHROUGH"}; - thisZoneEvapUnit.FanLocation = static_cast(getEnumerationValue(fanPlacementNamesUC, Alphas(9))); + thisZoneEvapUnit.FanLocation = static_cast(getEnumValue(fanPlacementNamesUC, Alphas(9))); if (thisZoneEvapUnit.FanLocation == FanPlacement::Invalid) { ShowSevereError(state, format("{}=\"{}\" invalid data.", CurrentModuleObject, thisZoneEvapUnit.Name)); ShowContinueError(state, format("invalid choice found {}=\"{}\".", cAlphaFields(9), Alphas(9))); @@ -3541,7 +3541,7 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) constexpr std::array(ControlType::Num)> controlTypeNamesUC = { "ZONETEMPERATUREDEADBANDONOFFCYCLING", "ZONECOOLINGLOADONOFFCYCLING", "ZONECOOLINGLOADVARIABLESPEEDFAN"}; - thisZoneEvapUnit.ControlSchemeType = static_cast(getEnumerationValue(controlTypeNamesUC, Alphas(10))); + thisZoneEvapUnit.ControlSchemeType = static_cast(getEnumValue(controlTypeNamesUC, Alphas(10))); if (thisZoneEvapUnit.ControlSchemeType == ControlType::Invalid) { ShowSevereError(state, format("{}=\"{}\" invalid data.", CurrentModuleObject, thisZoneEvapUnit.Name)); ShowContinueError(state, format("invalid choice found {}=\"{}\".", cAlphaFields(10), Alphas(10))); @@ -3551,7 +3551,7 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) thisZoneEvapUnit.ThrottlingRange = Numbers(2); thisZoneEvapUnit.ThresholdCoolingLoad = Numbers(3); - thisZoneEvapUnit.EvapCooler_1_Type_Num = static_cast(getEnumerationValue(evapCoolerTypeNamesUC, Alphas(11))); + thisZoneEvapUnit.EvapCooler_1_Type_Num = static_cast(getEnumValue(evapCoolerTypeNamesUC, Alphas(11))); if (thisZoneEvapUnit.EvapCooler_1_Type_Num != EvapCoolerType::Invalid) { thisZoneEvapUnit.EvapCooler_1_ObjectClassName = evapCoolerTypeNames[static_cast(thisZoneEvapUnit.EvapCooler_1_Type_Num)]; } else { @@ -3569,7 +3569,7 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) } if (!lAlphaBlanks(13)) { - thisZoneEvapUnit.EvapCooler_2_Type_Num = static_cast(getEnumerationValue(evapCoolerTypeNamesUC, Alphas(13))); + thisZoneEvapUnit.EvapCooler_2_Type_Num = static_cast(getEnumValue(evapCoolerTypeNamesUC, Alphas(13))); if (thisZoneEvapUnit.EvapCooler_2_Type_Num != EvapCoolerType::Invalid) { thisZoneEvapUnit.EvapCooler_2_ObjectClassName = evapCoolerTypeNames[static_cast(thisZoneEvapUnit.EvapCooler_2_Type_Num)]; } else { @@ -3775,13 +3775,13 @@ void InitZoneEvaporativeCoolerUnit(EnergyPlusData &state, if (allocated(state.dataHVACGlobal->ZoneComp)) { if (zoneEvapUnit.MyZoneEq) { // initialize the name of each availability manager list and zone number - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ZoneEvaporativeCoolerUnit).ZoneCompAvailMgrs(UnitNum).AvailManagerListName = + state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::EvaporativeCooler).ZoneCompAvailMgrs(UnitNum).AvailManagerListName = zoneEvapUnit.AvailManagerListName; - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ZoneEvaporativeCoolerUnit).ZoneCompAvailMgrs(UnitNum).ZoneNum = ZoneNum; + state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::EvaporativeCooler).ZoneCompAvailMgrs(UnitNum).ZoneNum = ZoneNum; zoneEvapUnit.MyZoneEq = false; } zoneEvapUnit.FanAvailStatus = - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ZoneEvaporativeCoolerUnit).ZoneCompAvailMgrs(UnitNum).AvailStatus; + state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::EvaporativeCooler).ZoneCompAvailMgrs(UnitNum).AvailStatus; } if (!state.dataEvapCoolers->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { diff --git a/src/EnergyPlus/EvaporativeFluidCoolers.cc b/src/EnergyPlus/EvaporativeFluidCoolers.cc index ef8d38a096f..a65e1fe157b 100644 --- a/src/EnergyPlus/EvaporativeFluidCoolers.cc +++ b/src/EnergyPlus/EvaporativeFluidCoolers.cc @@ -276,8 +276,7 @@ namespace EvaporativeFluidCoolers { if (state.dataIPShortCut->lAlphaFieldBlanks(6) || AlphArray(6).empty()) { thisEFC.capacityControl = CapacityControl::FanCycling; // FanCycling } else { - thisEFC.capacityControl = - static_cast(getEnumerationValue(controlNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(6)))); + thisEFC.capacityControl = static_cast(getEnumValue(controlNamesUC, UtilityRoutines::makeUPPER(AlphArray(6)))); if (thisEFC.capacityControl == CapacityControl::Invalid) { thisEFC.capacityControl = CapacityControl::FanCycling; ShowWarningError(state, @@ -293,7 +292,7 @@ namespace EvaporativeFluidCoolers { if (AlphArray(7).empty()) { thisEFC.EvapLossMode = EvapLoss::ByMoistTheory; } else { - thisEFC.EvapLossMode = static_cast(getEnumerationValue(evapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(7)))); + thisEFC.EvapLossMode = static_cast(getEnumValue(evapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(7)))); if (thisEFC.EvapLossMode == EvapLoss::Invalid) { ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(7), AlphArray(7))); ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); @@ -328,7 +327,7 @@ namespace EvaporativeFluidCoolers { thisEFC.ConcentrationRatio = 3.0; } } else { - thisEFC.BlowdownMode = static_cast(getEnumerationValue(blowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(8)))); + thisEFC.BlowdownMode = static_cast(getEnumValue(blowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(8)))); if (thisEFC.BlowdownMode == Blowdown::Invalid) { ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); ShowContinueError(state, format("Entered in {} ={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); @@ -634,7 +633,7 @@ namespace EvaporativeFluidCoolers { if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { thisEFC.EvapLossMode = EvapLoss::ByMoistTheory; } else { - thisEFC.EvapLossMode = static_cast(getEnumerationValue(evapLossNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(6)))); + thisEFC.EvapLossMode = static_cast(getEnumValue(evapLossNamesUC, UtilityRoutines::makeUPPER(AlphArray(6)))); if (thisEFC.EvapLossMode == EvapLoss::Invalid) { ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), AlphArray(6))); ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); @@ -668,7 +667,7 @@ namespace EvaporativeFluidCoolers { thisEFC.ConcentrationRatio = 3.0; } } else { - thisEFC.BlowdownMode = static_cast(getEnumerationValue(blowDownNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(7)))); + thisEFC.BlowdownMode = static_cast(getEnumValue(blowDownNamesUC, UtilityRoutines::makeUPPER(AlphArray(7)))); if (thisEFC.BlowdownMode == Blowdown::Invalid) { ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(7), AlphArray(7))); ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index befb9c49b39..5f53f8ffbf5 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -124,7 +124,7 @@ namespace ExhaustAirSystemManager { ++exhSysNum; auto const &objectFields = instance.value(); auto &thisExhSys = state.dataZoneEquip->ExhaustAirSystem(exhSysNum); - thisExhSys.Name = UtilityRoutines::MakeUPPERCase(instance.key()); + thisExhSys.Name = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); std::string zoneMixerName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "zone_mixer_name"); @@ -156,7 +156,7 @@ namespace ExhaustAirSystemManager { std::string centralFanType = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "fan_object_type"); int centralFanTypeNum = 0; - // getEnumerationValue()? + // getEnumValue()? if (UtilityRoutines::SameString(centralFanType, "Fan:SystemModel")) { centralFanTypeNum = DataHVACGlobals::FanType_SystemModelObject; @@ -474,7 +474,7 @@ namespace ExhaustAirSystemManager { ++exhCtrlNum; auto const &objectFields = instance.value(); auto &thisExhCtrl = state.dataZoneEquip->ZoneExhaustControlSystem(exhCtrlNum); - thisExhCtrl.Name = UtilityRoutines::MakeUPPERCase(instance.key()); + thisExhCtrl.Name = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); std::string availSchName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "availability_schedule_name"); @@ -533,10 +533,10 @@ namespace ExhaustAirSystemManager { thisExhCtrl.DesignExhaustFlowRate = designExhaustFlowRate; std::string flowControlTypeName = - UtilityRoutines::MakeUPPERCase(ip->getAlphaFieldValue(objectFields, objectSchemaProps, "flow_control_type")); - // std::string flowControlTypeName = UtilityRoutines::MakeUPPERCase(fields.at("flow_control_type").get()); + UtilityRoutines::makeUPPER(ip->getAlphaFieldValue(objectFields, objectSchemaProps, "flow_control_type")); + // std::string flowControlTypeName = UtilityRoutines::makeUPPER(fields.at("flow_control_type").get()); thisExhCtrl.FlowControlOption = - static_cast(getEnumerationValue(flowControlTypeNamesUC, flowControlTypeName)); + static_cast(getEnumValue(flowControlTypeNamesUC, flowControlTypeName)); std::string exhaustFlowFractionScheduleName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "exhaust_flow_fraction_schedule_name"); diff --git a/src/EnergyPlus/ExternalInterface.cc b/src/EnergyPlus/ExternalInterface.cc index be79ade2339..af16e54fde7 100644 --- a/src/EnergyPlus/ExternalInterface.cc +++ b/src/EnergyPlus/ExternalInterface.cc @@ -363,7 +363,7 @@ void ParseString(std::string const &str, // The string, with all elements separa } else { // Use rest of string iEnd = lenStr; } - ele(i) = UtilityRoutines::MakeUPPERCase(str.substr(iSta, iEnd - iSta - 1)); + ele(i) = UtilityRoutines::makeUPPER(str.substr(iSta, iEnd - iSta - 1)); } } diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index b138dbad863..31245c64a5b 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -288,7 +288,7 @@ namespace FanCoilUnits { "MULTISPEEDFAN", "ASHRAE90VARIABLEFAN"}; std::string capCtrlMeth = Alphas(3); - fanCoil.CapCtrlMeth_Num = static_cast(getEnumerationValue(CapCtrlMethUC, capCtrlMeth)); + fanCoil.CapCtrlMeth_Num = static_cast(getEnumValue(CapCtrlMethUC, capCtrlMeth)); if (fanCoil.CapCtrlMeth_Num == CCM::ASHRAE) { fanCoil.DesZoneCoolingLoad = DataSizing::AutoSize; fanCoil.DesZoneHeatingLoad = DataSizing::AutoSize; @@ -630,7 +630,7 @@ namespace FanCoilUnits { state.dataFanCoilUnits->ATMixerOutNode, fanCoil.AirOutNode); fanCoil.ControlZoneNum = - DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquip::FanCoil4Pipe, fanCoil.Name); + DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::FourPipeFanCoil, fanCoil.Name); if (fanCoil.ControlZoneNum == 0) { ErrorsFound = true; } @@ -1032,14 +1032,13 @@ namespace FanCoilUnits { } if (allocated(state.dataHVACGlobal->ZoneComp)) { + auto &availMgr = state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::FourPipeFanCoil).ZoneCompAvailMgrs(FanCoilNum); if (state.dataFanCoilUnits->MyZoneEqFlag(FanCoilNum)) { // initialize the name of each availability manager list and zone number - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::FanCoil4Pipe).ZoneCompAvailMgrs(FanCoilNum).AvailManagerListName = - fanCoil.AvailManagerListName; - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::FanCoil4Pipe).ZoneCompAvailMgrs(FanCoilNum).ZoneNum = ControlledZoneNum; + availMgr.AvailManagerListName = fanCoil.AvailManagerListName; + availMgr.ZoneNum = ControlledZoneNum; state.dataFanCoilUnits->MyZoneEqFlag(FanCoilNum) = false; } - fanCoil.AvailStatus = - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::FanCoil4Pipe).ZoneCompAvailMgrs(FanCoilNum).AvailStatus; + fanCoil.AvailStatus = availMgr.AvailStatus; } if (state.dataFanCoilUnits->MyPlantScanFlag(FanCoilNum) && allocated(state.dataPlnt->PlantLoop)) { diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index 2bfbbd25c8d..678a02be6ec 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -570,7 +570,7 @@ void GetFanInput(EnergyPlusData &state) } if (NumAlphas > 6 && !lAlphaFieldBlanks(7)) { - thisFan.AvailManagerMode = static_cast(getEnumerationValue(couplingsUC, cAlphaArgs(7))); + thisFan.AvailManagerMode = static_cast(getEnumValue(couplingsUC, cAlphaArgs(7))); if (thisFan.AvailManagerMode == AvailabilityManagerCoupling::Invalid) { ShowSevereError(state, format("{}{}: invalid {} entered ={} for {}={}", diff --git a/src/EnergyPlus/FaultsManager.cc b/src/EnergyPlus/FaultsManager.cc index 97f0e75dea2..c2fec6464c3 100644 --- a/src/EnergyPlus/FaultsManager.cc +++ b/src/EnergyPlus/FaultsManager.cc @@ -485,7 +485,7 @@ namespace FaultsManager { // Chiller check int ChillerNum; ChillerType ChillerTypeCheck = - static_cast(getEnumerationValue(ChillerTypeNamesUC, UtilityRoutines::MakeUPPERCase(faultsChillerFouling.ChillerType))); + static_cast(getEnumValue(ChillerTypeNamesUC, UtilityRoutines::makeUPPER(faultsChillerFouling.ChillerType))); switch (ChillerTypeCheck) { case ChillerType::ChillerElectric: { // Check whether the chiller name and chiller type match each other @@ -854,8 +854,7 @@ namespace FaultsManager { } // Coil check and link - CoilType CoilTypeCheck = - static_cast(getEnumerationValue(CoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(faultsCoilSATFouling.CoilType))); + CoilType CoilTypeCheck = static_cast(getEnumValue(CoilTypeNamesUC, UtilityRoutines::makeUPPER(faultsCoilSATFouling.CoilType))); switch (CoilTypeCheck) { case CoilType::CoilHeatingElectric: case CoilType::CoilHeatingFuel: @@ -1316,7 +1315,7 @@ namespace FaultsManager { // Chiller check int ChillerNum; ChillerType ChillerTypeCheck = - static_cast(getEnumerationValue(ChillerTypeNamesUC, UtilityRoutines::MakeUPPERCase(faultsChillerSWT.ChillerType))); + static_cast(getEnumValue(ChillerTypeNamesUC, UtilityRoutines::makeUPPER(faultsChillerSWT.ChillerType))); switch (ChillerTypeCheck) { case ChillerType::ChillerElectric: { // Check whether the chiller name and chiller type match each other @@ -1772,8 +1771,7 @@ namespace FaultsManager { } } - faultsFoulCoil.FoulingInputMethod = - static_cast(getEnumerationValue(FouledCoilNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(5)))); + faultsFoulCoil.FoulingInputMethod = static_cast(getEnumValue(FouledCoilNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(5)))); if (faultsFoulCoil.FoulingInputMethod == FouledCoil::Invalid) { faultsFoulCoil.FoulingInputMethod = FouledCoil::UARated; } @@ -1958,7 +1956,7 @@ namespace FaultsManager { format("{} = \"{}\" invalid {} = \"{}\" blank.", cFaultCurrentObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); state.dataFaultsMgr->ErrorsFound = true; } else { - if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == "CONTROLLER:OUTDOORAIR") { + if (UtilityRoutines::makeUPPER(cAlphaArgs(4)) == "CONTROLLER:OUTDOORAIR") { state.dataFaultsMgr->FaultsEconomizer(j).ControllerTypeEnum = iController_AirEconomizer; // CASE ... diff --git a/src/EnergyPlus/FileSystem.cc b/src/EnergyPlus/FileSystem.cc index 7e145bf9c48..00228fff45e 100644 --- a/src/EnergyPlus/FileSystem.cc +++ b/src/EnergyPlus/FileSystem.cc @@ -235,7 +235,7 @@ namespace FileSystem { extension.remove_prefix(extension.find_last_of('.') + 1); std::string stringExtension = std::string(extension); - return static_cast(getEnumerationValue(FileTypesExtUC, UtilityRoutines::MakeUPPERCase(stringExtension))); + return static_cast(getEnumValue(FileTypesExtUC, UtilityRoutines::makeUPPER(stringExtension))); } // TODO: remove for fs::path::replace_extension directly? Note that replace_extension mutates the object diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index 58074db984c..dda61c497d1 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -7746,7 +7746,7 @@ namespace FluidProperties { } // Check to see if this glycol shows up in the glycol data - int Found = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase(Refrigerant), state.dataFluidProps->RefrigData); + int Found = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER(Refrigerant), state.dataFluidProps->RefrigData); if (Found > 0) { FindRefrigerant = Found; @@ -7788,7 +7788,7 @@ namespace FluidProperties { } // Check to see if this glycol shows up in the glycol data - int Found = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase(Glycol), + int Found = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER(Glycol), state.dataFluidProps->GlycolData, state.dataFluidProps->NumOfGlycols); // GlycolData is allocated to NumOfGlyConcs @@ -8232,7 +8232,7 @@ namespace FluidProperties { GlycolAPI::GlycolAPI(EnergyPlusData &state, std::string const &glycolName) { - this->glycolName = EnergyPlus::UtilityRoutines::MakeUPPERCase(glycolName); + this->glycolName = EnergyPlus::UtilityRoutines::makeUPPER(glycolName); this->glycolIndex = 0; this->cf = "GlycolAPI:Instance"; if (this->glycolName != "WATER") { @@ -8258,7 +8258,7 @@ namespace FluidProperties { RefrigerantAPI::RefrigerantAPI(EnergyPlusData &state, std::string const &refrigName) { - this->rName = EnergyPlus::UtilityRoutines::MakeUPPERCase(refrigName); + this->rName = EnergyPlus::UtilityRoutines::makeUPPER(refrigName); this->rIndex = 0; this->cf = "RefrigerantAPI:Instance"; if (this->rName != "STEAM") { diff --git a/src/EnergyPlus/FuelCellElectricGenerator.cc b/src/EnergyPlus/FuelCellElectricGenerator.cc index c4d4cddf73a..d0fecd04c3b 100644 --- a/src/EnergyPlus/FuelCellElectricGenerator.cc +++ b/src/EnergyPlus/FuelCellElectricGenerator.cc @@ -127,7 +127,7 @@ namespace FuelCellElectricGenerator { // Now look for this object for (auto &thisFC : state.dataFuelCellElectGen->FuelCell) { - if (UtilityRoutines::MakeUPPERCase(thisFC.NameExhaustHX) == UtilityRoutines::MakeUPPERCase(objectName)) { + if (UtilityRoutines::makeUPPER(thisFC.NameExhaustHX) == UtilityRoutines::makeUPPER(objectName)) { return &thisFC; } } diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 170cf152994..aada86ee9af 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -1133,7 +1133,7 @@ void ScanForReports(EnergyPlusData &state, state.dataIPShortCut->cNumericFieldNames); ReportType checkReportType = - static_cast(getEnumerationValue(ReportTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(1)))); + static_cast(getEnumValue(ReportTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(1)))); switch (checkReportType) { case ReportType::DXF: { @@ -1232,17 +1232,16 @@ void ScanForReports(EnergyPlusData &state, state.dataGeneral->EMSoutput = true; AvailRpt CheckAvailRpt = - static_cast(getEnumerationValue(AvailRptNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(1)))); + static_cast(getEnumValue(AvailRptNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(1)))); state.dataRuntimeLang->OutputEMSActuatorAvailSmall = (CheckAvailRpt == AvailRpt::NotByUniqueKeyNames); state.dataRuntimeLang->OutputEMSActuatorAvailFull = (CheckAvailRpt == AvailRpt::Verbose); - CheckAvailRpt = - static_cast(getEnumerationValue(AvailRptNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)))); + CheckAvailRpt = static_cast(getEnumValue(AvailRptNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); state.dataRuntimeLang->OutputEMSInternalVarsSmall = (CheckAvailRpt == AvailRpt::NotByUniqueKeyNames); state.dataRuntimeLang->OutputEMSInternalVarsFull = (CheckAvailRpt == AvailRpt::Verbose); ERLdebugOutputLevel CheckERLlevel = static_cast( - getEnumerationValue(ERLdebugOutputLevelNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(3)))); + getEnumValue(ERLdebugOutputLevelNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(3)))); state.dataRuntimeLang->OutputEMSErrors = (CheckERLlevel == ERLdebugOutputLevel::ErrorsOnly || CheckERLlevel == ERLdebugOutputLevel::Verbose); state.dataRuntimeLang->OutputFullEMSTrace = (CheckERLlevel == ERLdebugOutputLevel::Verbose); @@ -1254,8 +1253,7 @@ void ScanForReports(EnergyPlusData &state, // Process the Scan Request DoReport = false; - ReportName rptName = - static_cast(getEnumerationValue(ReportNamesUC, UtilityRoutines::MakeUPPERCase(UtilityRoutines::MakeUPPERCase(reportName)))); + ReportName rptName = static_cast(getEnumValue(ReportNamesUC, UtilityRoutines::makeUPPER(UtilityRoutines::makeUPPER(reportName)))); switch (rptName) { case ReportName::Constructions: { if (present(ReportKey)) { @@ -1276,7 +1274,7 @@ void ScanForReports(EnergyPlusData &state, // IF (PRESENT(Option1)) Option1=SchRptOption } break; case ReportName::Surfaces: { - RptKey rptKey = static_cast(getEnumerationValue(RptKeyNamesUC, UtilityRoutines::MakeUPPERCase(ReportKey()))); + RptKey rptKey = static_cast(getEnumValue(RptKeyNamesUC, UtilityRoutines::makeUPPER(ReportKey()))); switch (rptKey) { // Autodesk:OPTIONAL ReportKey used without PRESENT check case RptKey::Costinfo: { DoReport = state.dataGeneral->CostInfo; diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index 86bebd5b5a2..5b77b80f20e 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -968,8 +968,8 @@ void TestSupplyAirPathIntegrity(EnergyPlusData &state, bool &ErrFound) state.dataZoneEquip->SupplyAirPath(BCount).ComponentName(Count), PrimaryAirLoopName); - AirLoopHVACCompType CompType = static_cast(getEnumerationValue( - AirLoopHVACCompTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataZoneEquip->SupplyAirPath(BCount).ComponentType(Count)))); + AirLoopHVACCompType CompType = static_cast(getEnumValue( + AirLoopHVACCompTypeNamesUC, UtilityRoutines::makeUPPER(state.dataZoneEquip->SupplyAirPath(BCount).ComponentType(Count)))); switch (CompType) { case AirLoopHVACCompType::SupplyPlenum: { @@ -1277,8 +1277,8 @@ void TestReturnAirPathIntegrity(EnergyPlusData &state, bool &ErrFound, Array2S_i if (NumComp > 0) { - AirLoopHVACCompType CompType = static_cast(getEnumerationValue( - AirLoopHVACCompTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataZoneEquip->ReturnAirPath(BCount).ComponentType(NumComp)))); + AirLoopHVACCompType CompType = static_cast(getEnumValue( + AirLoopHVACCompTypeNamesUC, UtilityRoutines::makeUPPER(state.dataZoneEquip->ReturnAirPath(BCount).ComponentType(NumComp)))); switch (CompType) { case AirLoopHVACCompType::ZoneMixer: { @@ -1364,8 +1364,8 @@ void TestReturnAirPathIntegrity(EnergyPlusData &state, bool &ErrFound, Array2S_i if (NumComp > 1) { for (int Count3 = 1; Count3 <= NumComp - 1; ++Count3) { - AirLoopHVACCompType CompType = static_cast(getEnumerationValue( - AirLoopHVACCompTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataZoneEquip->ReturnAirPath(BCount).ComponentType(Count3)))); + AirLoopHVACCompType CompType = static_cast(getEnumValue( + AirLoopHVACCompTypeNamesUC, UtilityRoutines::makeUPPER(state.dataZoneEquip->ReturnAirPath(BCount).ComponentType(Count3)))); switch (CompType) { case AirLoopHVACCompType::ZoneMixer: { diff --git a/src/EnergyPlus/GlobalNames.cc b/src/EnergyPlus/GlobalNames.cc index 97d56f79407..2ffae0d2c81 100644 --- a/src/EnergyPlus/GlobalNames.cc +++ b/src/EnergyPlus/GlobalNames.cc @@ -155,7 +155,7 @@ void VerifyUniqueChillerName( ShowContinueError(state, format("...Current entry is Chiller Type=\"{}\".", TypeToVerify)); ErrorsFound = true; } else { - state.dataGlobalNames->ChillerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->ChillerNames.emplace(NameToVerify, UtilityRoutines::makeUPPER(TypeToVerify)); state.dataGlobalNames->NumChillers = static_cast(state.dataGlobalNames->ChillerNames.size()); } } @@ -183,7 +183,7 @@ void VerifyUniqueBaseboardName(EnergyPlusData &state, ShowContinueError(state, format("...Current entry is Baseboard Type=\"{}\".", TypeToVerify)); ErrorsFound = true; } else { - state.dataGlobalNames->BaseboardNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->BaseboardNames.emplace(NameToVerify, UtilityRoutines::makeUPPER(TypeToVerify)); state.dataGlobalNames->NumBaseboards = static_cast(state.dataGlobalNames->BaseboardNames.size()); } } @@ -208,7 +208,7 @@ void VerifyUniqueBoilerName( ShowContinueError(state, format("...Current entry is Boiler Type=\"{}\".", TypeToVerify)); ErrorsFound = true; } else { - state.dataGlobalNames->BoilerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->BoilerNames.emplace(NameToVerify, UtilityRoutines::makeUPPER(TypeToVerify)); state.dataGlobalNames->NumBoilers = static_cast(state.dataGlobalNames->BoilerNames.size()); } } @@ -240,7 +240,7 @@ void VerifyUniqueCoilName( ShowContinueError(state, format("...Current entry is Coil Type=\"{}\".", TypeToVerify)); ErrorsFound = true; } else { - state.dataGlobalNames->CoilNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->CoilNames.emplace(NameToVerify, UtilityRoutines::makeUPPER(TypeToVerify)); state.dataGlobalNames->NumCoils = static_cast(state.dataGlobalNames->CoilNames.size()); } } @@ -254,7 +254,7 @@ void VerifyUniqueADUName( ShowContinueError(state, format("...Current entry is Air Distribution Unit Type=\"{}\".", TypeToVerify)); ErrorsFound = true; } else { - state.dataGlobalNames->aDUNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify)); + state.dataGlobalNames->aDUNames.emplace(NameToVerify, UtilityRoutines::makeUPPER(TypeToVerify)); state.dataGlobalNames->numAirDistUnits = static_cast(state.dataGlobalNames->aDUNames.size()); } } diff --git a/src/EnergyPlus/GroundHeatExchangers.cc b/src/EnergyPlus/GroundHeatExchangers.cc index f220b001320..db600f9d129 100644 --- a/src/EnergyPlus/GroundHeatExchangers.cc +++ b/src/EnergyPlus/GroundHeatExchangers.cc @@ -134,8 +134,8 @@ GLHESlinky::GLHESlinky(EnergyPlusData &state, std::string const &objName, nlohma this->name = objName; - std::string inletNodeName = UtilityRoutines::MakeUPPERCase(j["inlet_node_name"].get()); - std::string outletNodeName = UtilityRoutines::MakeUPPERCase(j["outlet_node_name"].get()); + std::string inletNodeName = UtilityRoutines::makeUPPER(j["inlet_node_name"].get()); + std::string outletNodeName = UtilityRoutines::makeUPPER(j["outlet_node_name"].get()); // get inlet node num this->inletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -179,7 +179,7 @@ GLHESlinky::GLHESlinky(EnergyPlusData &state, std::string const &objName, nlohma this->pipe.outRadius = this->pipe.outDia / 2.0; this->pipe.thickness = j["pipe_thickness"].get(); - std::string const hxConfig = UtilityRoutines::MakeUPPERCase(j["heat_exchanger_configuration"].get()); + std::string const hxConfig = UtilityRoutines::makeUPPER(j["heat_exchanger_configuration"].get()); if (UtilityRoutines::SameString(hxConfig, "VERTICAL")) { this->verticalConfig = true; } else if (UtilityRoutines::SameString(hxConfig, "HORIZONTAL")) { @@ -246,8 +246,8 @@ GLHESlinky::GLHESlinky(EnergyPlusData &state, std::string const &objName, nlohma } // Initialize ground temperature model and get pointer reference - std::string const gtmType = UtilityRoutines::MakeUPPERCase(j["undisturbed_ground_temperature_model_type"].get()); - std::string const gtmName = UtilityRoutines::MakeUPPERCase(j["undisturbed_ground_temperature_model_name"].get()); + std::string const gtmType = UtilityRoutines::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()); + std::string const gtmName = UtilityRoutines::makeUPPER(j["undisturbed_ground_temperature_model_name"].get()); this->groundTempModel = GetGroundTempModelAndInit(state, gtmType, gtmName); // Check for Errors @@ -272,7 +272,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: this->name = objName; // get inlet node num - std::string const inletNodeName = UtilityRoutines::MakeUPPERCase(j["inlet_node_name"].get()); + std::string const inletNodeName = UtilityRoutines::makeUPPER(j["inlet_node_name"].get()); this->inletNodeNum = NodeInputManager::GetOnlySingleNode(state, inletNodeName, errorsFound, @@ -284,7 +284,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: DataLoopNode::ObjectIsNotParent); // get outlet node num - std::string const outletNodeName = UtilityRoutines::MakeUPPERCase(j["outlet_node_name"].get()); + std::string const outletNodeName = UtilityRoutines::makeUPPER(j["outlet_node_name"].get()); this->outletNodeNum = NodeInputManager::GetOnlySingleNode(state, outletNodeName, errorsFound, @@ -307,8 +307,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: if (j.find("ghe_vertical_responsefactors_object_name") != j.end()) { // Response factors come from IDF object - this->myRespFactors = - GetResponseFactor(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_responsefactors_object_name"].get())); + this->myRespFactors = GetResponseFactor(state, UtilityRoutines::makeUPPER(j["ghe_vertical_responsefactors_object_name"].get())); this->gFunctionsExist = true; } @@ -317,7 +316,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: // g-function calculation method if (j.find("g_function_calculation_method") != j.end()) { - std::string gFunctionMethodStr = UtilityRoutines::MakeUPPERCase(j["g_function_calculation_method"].get()); + std::string gFunctionMethodStr = UtilityRoutines::makeUPPER(j["g_function_calculation_method"].get()); if (gFunctionMethodStr == "UHFCALC") { this->gFuncCalcMethod = GFuncCalcMethod::UniformHeatFlux; } else if (gFunctionMethodStr == "UBHWTCALC") { @@ -332,7 +331,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: if (j.find("ghe_vertical_array_object_name") != j.end()) { // Response factors come from array object this->myRespFactors = BuildAndGetResponseFactorObjectFromArray( - state, GetVertArray(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_array_object_name"].get()))); + state, GetVertArray(state, UtilityRoutines::makeUPPER(j["ghe_vertical_array_object_name"].get()))); } else { if (j.find("vertical_well_locations") == j.end()) { // No ResponseFactors, GHEArray, or SingleBH object are referenced @@ -348,7 +347,7 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: for (auto const &var : vars) { if (!var.at("ghe_vertical_single_object_name").empty()) { std::shared_ptr tempBHptr = - GetSingleBH(state, UtilityRoutines::MakeUPPERCase(var.at("ghe_vertical_single_object_name").get())); + GetSingleBH(state, UtilityRoutines::makeUPPER(var.at("ghe_vertical_single_object_name").get())); tempVectOfBHObjects.push_back(tempBHptr); } else { break; @@ -411,10 +410,9 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: state.dataGroundHeatExchanger->prevTimeSteps = 0.0; // Initialize ground temperature model and get pointer reference - this->groundTempModel = - GetGroundTempModelAndInit(state, - UtilityRoutines::MakeUPPERCase(j["undisturbed_ground_temperature_model_type"].get()), - UtilityRoutines::MakeUPPERCase(j["undisturbed_ground_temperature_model_name"].get())); + this->groundTempModel = GetGroundTempModelAndInit(state, + UtilityRoutines::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()), + UtilityRoutines::makeUPPER(j["undisturbed_ground_temperature_model_name"].get())); // Check for Errors if (errorsFound) { @@ -434,7 +432,7 @@ GLHEVertSingle::GLHEVertSingle(EnergyPlusData &state, std::string const &objName } this->name = objName; - this->props = GetVertProps(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_properties_object_name"].get())); + this->props = GetVertProps(state, UtilityRoutines::makeUPPER(j["ghe_vertical_properties_object_name"].get())); this->xLoc = j["x_location"].get(); this->yLoc = j["y_location"].get(); this->dl_i = 0.0; @@ -454,7 +452,7 @@ GLHEVertArray::GLHEVertArray(EnergyPlusData &state, std::string const &objName, } this->name = objName; - this->props = GetVertProps(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_properties_object_name"].get())); + this->props = GetVertProps(state, UtilityRoutines::makeUPPER(j["ghe_vertical_properties_object_name"].get())); this->numBHinXDirection = j["number_of_boreholes_in_x_direction"].get(); this->numBHinYDirection = j["number_of_boreholes_in_y_direction"].get(); this->bhSpacing = j["borehole_spacing"].get(); @@ -473,7 +471,7 @@ GLHEResponseFactors::GLHEResponseFactors(EnergyPlusData &state, std::string cons } this->name = objName; - this->props = GetVertProps(state, UtilityRoutines::MakeUPPERCase(j["ghe_vertical_properties_object_name"].get())); + this->props = GetVertProps(state, UtilityRoutines::makeUPPER(j["ghe_vertical_properties_object_name"].get())); this->numBoreholes = j["number_of_boreholes"].get(); this->gRefRatio = j["g_function_reference_ratio"].get(); this->maxSimYears = state.dataEnvrn->MaxNumberSimYears; @@ -2405,7 +2403,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); std::shared_ptr thisObj(new GLHEVertProps(state, objNameUC, instance)); state.dataGroundHeatExchanger->vertPropsVector.push_back(thisObj); @@ -2425,7 +2423,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); std::shared_ptr thisObj(new GLHEResponseFactors(state, objNameUC, instance)); state.dataGroundHeatExchanger->responseFactorsVector.push_back(thisObj); @@ -2445,7 +2443,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); std::shared_ptr thisObj(new GLHEVertArray(state, objNameUC, instance)); state.dataGroundHeatExchanger->vertArraysVector.push_back(thisObj); @@ -2465,7 +2463,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); std::shared_ptr thisObj(new GLHEVertSingle(state, objNameUC, instance)); state.dataGroundHeatExchanger->singleBoreholesVector.push_back(thisObj); @@ -2485,7 +2483,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); state.dataGroundHeatExchanger->verticalGLHE.emplace_back(state, objNameUC, instance); } @@ -2505,7 +2503,7 @@ void GetGroundHeatExchangerInput(EnergyPlusData &state) for (auto it = instancesValue.begin(); it != instancesValue.end(); ++it) { auto const &instance = it.value(); std::string const &objName = it.key(); - std::string const &objNameUC = UtilityRoutines::MakeUPPERCase(objName); + std::string const &objNameUC = UtilityRoutines::makeUPPER(objName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(currObj, objName); state.dataGroundHeatExchanger->slinkyGLHE.emplace_back(state, objNameUC, instance); } diff --git a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc index 1bea8c6026b..2d349746751 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc @@ -97,7 +97,7 @@ namespace GroundTemperatureManager { // Set object type GroundTempObjType objectType = - static_cast(getEnumerationValue(groundTempModelNamesUC, UtilityRoutines::MakeUPPERCase(objectType_str))); + static_cast(getEnumValue(groundTempModelNamesUC, UtilityRoutines::makeUPPER(objectType_str))); assert(objectType != GroundTempObjType::Invalid); diff --git a/src/EnergyPlus/HVACControllers.cc b/src/EnergyPlus/HVACControllers.cc index 7a454da8e63..299e64cb6a1 100644 --- a/src/EnergyPlus/HVACControllers.cc +++ b/src/EnergyPlus/HVACControllers.cc @@ -479,7 +479,7 @@ void GetControllerInput(EnergyPlusData &state) controllerProps.ControllerName = AlphArray(1); controllerProps.ControllerType = CurrentModuleObject; - controllerProps.ControlVar = static_cast(getEnumerationValue(ctrlVarNamesUC, AlphArray(2))); + controllerProps.ControlVar = static_cast(getEnumValue(ctrlVarNamesUC, AlphArray(2))); if (controllerProps.ControlVar == HVACControllers::CtrlVarType::Invalid) { ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, AlphArray(1))); ShowSevereError(state, @@ -489,7 +489,7 @@ void GetControllerInput(EnergyPlusData &state) ErrorsFound = true; } - controllerProps.Action = static_cast(getEnumerationValue(actionNamesUC, AlphArray(3))); + controllerProps.Action = static_cast(getEnumValue(actionNamesUC, AlphArray(3))); if (controllerProps.Action == ControllerAction::Invalid) { ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, AlphArray(1))); ShowSevereError(state, format("...Invalid {}=\"{}{}", cAlphaFields(3), AlphArray(3), R"(", must be "Normal", "Reverse" or blank.)")); diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index 2072ff5a642..2d150dda352 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1139,14 +1139,14 @@ void InitStandAloneERV(EnergyPlusData &state, } if (allocated(state.dataHVACGlobal->ZoneComp)) { + auto &availMgr = + state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator).ZoneCompAvailMgrs(StandAloneERVNum); if (state.dataHVACStandAloneERV->MyZoneEqFlag(StandAloneERVNum)) { // initialize the name of each availability manager list and zone number - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ERVStandAlone).ZoneCompAvailMgrs(StandAloneERVNum).AvailManagerListName = - state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AvailManagerListName; - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ERVStandAlone).ZoneCompAvailMgrs(StandAloneERVNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataHVACStandAloneERV->MyZoneEqFlag(StandAloneERVNum) = false; } - state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AvailStatus = - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::ERVStandAlone).ZoneCompAvailMgrs(StandAloneERVNum).AvailStatus; + state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AvailStatus = availMgr.AvailStatus; } // need to check all units to see if they are on Zone Equipment List or issue warning diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 9c870c3fd63..70728a84104 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -602,7 +602,7 @@ namespace HVACUnitaryBypassVAV { // required field must be Key=Fan:ConstantVolume, Fan:OnOff or Fan:SystemModel and read in as upper case std::string fanTypeString = Alphas(10); - thisCBVAV.FanType = static_cast(getEnumerationValue(DataHVACGlobals::fanTypeNamesUC, fanTypeString)); + thisCBVAV.FanType = static_cast(getEnumValue(DataHVACGlobals::fanTypeNamesUC, fanTypeString)); thisCBVAV.FanName = Alphas(11); int fanOutletNode(0); @@ -630,7 +630,7 @@ namespace HVACUnitaryBypassVAV { } // required field must be Key=BlowThrough or DrawThrough and read in as BLOWTHROUGH or DRAWTHROUGH - thisCBVAV.FanPlace = static_cast(getEnumerationValue(DataHVACGlobals::fanLocNamesUC, Alphas(12))); + thisCBVAV.FanPlace = static_cast(getEnumValue(DataHVACGlobals::fanLocNamesUC, Alphas(12))); if (thisCBVAV.FanPlace == DataHVACGlobals::FanLoc::DrawThrough) { if (thisCBVAV.SplitterOutletAirNode != fanOutletNode) { @@ -693,7 +693,7 @@ namespace HVACUnitaryBypassVAV { } std::string thisCoolCoilType = Alphas(14); - thisCBVAV.CoolCoilType = static_cast(getEnumerationValue(DataHVACGlobals::coilTypeNamesUC, thisCoolCoilType)); + thisCBVAV.CoolCoilType = static_cast(getEnumValue(DataHVACGlobals::coilTypeNamesUC, thisCoolCoilType)); thisCBVAV.DXCoolCoilName = Alphas(15); if (thisCBVAV.CoolCoilType == DataHVACGlobals::CoilType::DXCoolingSingleSpeed) { @@ -850,7 +850,7 @@ namespace HVACUnitaryBypassVAV { } std::string thisHeatCoilType = Alphas(16); - thisCBVAV.HeatCoilType = static_cast(getEnumerationValue(DataHVACGlobals::coilTypeNamesUC, thisHeatCoilType)); + thisCBVAV.HeatCoilType = static_cast(getEnumValue(DataHVACGlobals::coilTypeNamesUC, thisHeatCoilType)); thisCBVAV.HeatCoilName = Alphas(17); DXCoilErrFlag = false; diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 0ce61b6a7b1..21409d3efee 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -2037,7 +2037,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.MasterZonePtr = UtilityRoutines::FindItemInList(cAlphaArgs(24), state.dataHeatBal->Zone); - thisVrfSys.ThermostatPriority = static_cast(getEnumerationValue(ThermostatCtrlTypeUC, cAlphaArgs(25))); + thisVrfSys.ThermostatPriority = static_cast(getEnumValue(ThermostatCtrlTypeUC, cAlphaArgs(25))); if (thisVrfSys.ThermostatPriority == ThermostatCtrlType::MasterThermostatPriority) { if (thisVrfSys.MasterZonePtr == 0) { @@ -2117,8 +2117,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.MaxOATCCHeater = rNumericArgs(19); if (!lAlphaFieldBlanks(31)) { - thisVrfSys.DefrostStrategy = - static_cast(getEnumerationValue(StandardRatings::DefrostStratUC, cAlphaArgs(31))); + thisVrfSys.DefrostStrategy = static_cast(getEnumValue(StandardRatings::DefrostStratUC, cAlphaArgs(31))); if (thisVrfSys.DefrostStrategy == StandardRatings::DefrostStrat::Invalid) { ShowSevereError(state, format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(31), cAlphaArgs(31))); @@ -2130,7 +2129,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (!lAlphaFieldBlanks(32)) { thisVrfSys.DefrostControl = - static_cast(getEnumerationValue(StandardRatings::HPdefrostControlUC, cAlphaArgs(32))); + static_cast(getEnumValue(StandardRatings::HPdefrostControlUC, cAlphaArgs(32))); if (thisVrfSys.DefrostControl == StandardRatings::HPdefrostControl::Invalid) { ShowSevereError(state, @@ -2323,7 +2322,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (!lAlphaFieldBlanks(39)) { // A39; \field Fuel type, Validate fuel type input - thisVrfSys.fuel = static_cast(getEnumerationValue(Constant::eFuelNamesUC, cAlphaArgs(39))); + thisVrfSys.fuel = static_cast(getEnumValue(Constant::eFuelNamesUC, cAlphaArgs(39))); if (thisVrfSys.fuel == Constant::eFuel::Invalid) { ShowSevereError( state, @@ -5775,14 +5774,14 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } if (allocated(state.dataHVACGlobal->ZoneComp)) { + auto &availMgr = + state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal).ZoneCompAvailMgrs(VRFTUNum); if (state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum)) { // initialize the name of each availability manager list and zone number - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::VRFTerminalUnit).ZoneCompAvailMgrs(VRFTUNum).AvailManagerListName = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName; - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::VRFTerminalUnit).ZoneCompAvailMgrs(VRFTUNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataHVACVarRefFlow->MyZoneEqFlag(VRFTUNum) = false; } - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailStatus = - state.dataHVACGlobal->ZoneComp(DataZoneEquipment::ZoneEquip::VRFTerminalUnit).ZoneCompAvailMgrs(VRFTUNum).AvailStatus; + state.dataHVACVarRefFlow->VRFTU(VRFTUNum).AvailStatus = availMgr.AvailStatus; } if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MySuppCoilPlantScanFlag && allocated(state.dataPlnt->PlantLoop)) { @@ -5883,7 +5882,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool for (ELLoop = 1; ELLoop <= state.dataGlobal->NumOfZones; ++ELLoop) { // NumOfZoneEquipLists if (state.dataZoneEquip->ZoneEquipList(ELLoop).Name == "") continue; // dimensioned by NumOfZones. Only valid ones have names. for (ListLoop = 1; ListLoop <= state.dataZoneEquip->ZoneEquipList(ELLoop).NumOfEquipTypes; ++ListLoop) { - if (!UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipType(ListLoop), + if (!UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipTypeName(ListLoop), DataHVACGlobals::cVRFTUTypes(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUType_Num))) continue; if (!UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(ELLoop).EquipName(ListLoop), @@ -6032,7 +6031,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool EquipList_exit:; if (ctrlZoneNum > 0) { int inletNodeADUNum = 0; - DataZoneEquipment::ZoneEquip sysType_Num = DataZoneEquipment::ZoneEquip::Invalid; + DataZoneEquipment::ZoneEquipType sysType_Num = DataZoneEquipment::ZoneEquipType::Invalid; std::string sysName = ""; for (int inletNode = 1; inletNode <= state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).NumInletNodes; inletNode++) { if (state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeAirLoopNum(inletNode) != @@ -6040,7 +6039,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool continue; inletNodeADUNum = state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).InletNodeADUNum(inletNode); if (inletNodeADUNum > 0 && inletNodeADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size()) { - sysType_Num = DataZoneEquipment::ZoneEquip::AirDistUnit; + sysType_Num = DataZoneEquipment::ZoneEquipType::AirDistributionUnit; sysName = state.dataDefineEquipment->AirDistUnit(inletNodeADUNum).Name; break; } @@ -6052,7 +6051,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex).NumOfEquipTypes; ++EquipNum) { if ((state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex) - .EquipTypeEnum(EquipNum) != sysType_Num) || + .EquipType(EquipNum) != sysType_Num) || state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ctrlZoneNum).EquipListIndex) .EquipName(EquipNum) != sysName) continue; diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index 8f3eb40103d..ce8be22e9b1 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -304,7 +304,7 @@ namespace HWBaseboardRadiator { // Determine HW radiant baseboard heating design capacity sizing method thisHWBaseboardDesign.HeatingCapMethod = static_cast( - getEnumerationValue(DataSizing::DesignSizingTypeNamesUC, state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + getEnumValue(DataSizing::DesignSizingTypeNamesUC, state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); if (thisHWBaseboardDesign.HeatingCapMethod == DataSizing::DesignSizingType::CapacityPerFloorArea) { if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { thisHWBaseboardDesign.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); @@ -631,7 +631,7 @@ namespace HWBaseboardRadiator { thisHWBaseboard.FracDistribToSurf = 0.0; thisHWBaseboard.ZonePtr = - DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquip::BBWater, thisHWBaseboard.Name); + DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::BaseboardWater, thisHWBaseboard.Name); AllFracsSummed = HWBaseboardDesignDataObject.FracDistribPerson; for (SurfNum = 1; SurfNum <= thisHWBaseboard.TotSurfToDistrib; ++SurfNum) { diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.cc b/src/EnergyPlus/HeatBalFiniteDiffManager.cc index defd2c66776..febe9c5657d 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.cc +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.cc @@ -172,7 +172,7 @@ namespace HeatBalFiniteDiffManager { if (!state.dataIPShortCut->lAlphaFieldBlanks(1)) { { state.dataHeatBalFiniteDiffMgr->CondFDSchemeType = static_cast( - getEnumerationValue(CondFDSchemeTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(1)))); + getEnumValue(CondFDSchemeTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(1)))); if (state.dataHeatBalFiniteDiffMgr->CondFDSchemeType == CondFDScheme::Invalid) { ShowSevereError(state, format("{}: invalid {} entered={}, must match CrankNicholsonSecondOrder or FullyImplicitFirstOrder.", diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 980ffe85dc7..7bd174b595f 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -129,17 +129,16 @@ constexpr std::array(AirflowSpecAlt::Num)> ai constexpr std::array(DataHeatBalance::VentilationType::Num)> ventilationTypeNamesUC = { "NATURAL", "INTAKE", "EXHAUST", "BALANCED"}; -constexpr std::array(DataRoomAirModel::RoomAirModel::Num)> roomAirModelNamesUC = { - "USERDEFINED", - "MIXING", - "ONENODEDISPLACEMENTVENTILATION", - "THREENODEDISPLACEMENTVENTILATION", - "CROSSVENTILATION", - "UNDERFLOORAIRDISTRIBUTIONINTERIOR", - "UNDERFLOORAIRDISTRIBUTIONEXTERIOR", - "AIRFLOWNETWORK"}; - -constexpr std::array(DataRoomAirModel::CouplingScheme::Num)> couplingSchemeNamesUC = {"DIRECT", "INDIRECT"}; +constexpr std::array(RoomAir::RoomAirModel::Num)> roomAirModelNamesUC = {"USERDEFINED", + "MIXING", + "ONENODEDISPLACEMENTVENTILATION", + "THREENODEDISPLACEMENTVENTILATION", + "CROSSVENTILATION", + "UNDERFLOORAIRDISTRIBUTIONINTERIOR", + "UNDERFLOORAIRDISTRIBUTIONEXTERIOR", + "AIRFLOWNETWORK"}; + +constexpr std::array(RoomAir::CouplingScheme::Num)> couplingSchemeNamesUC = {"DIRECT", "INDIRECT"}; void ManageAirHeatBalance(EnergyPlusData &state) { @@ -485,8 +484,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err { thisZoneAirBalance.BalanceMethod = static_cast( - getEnumerationValue(DataHeatBalance::AirBalanceTypeNamesUC, - UtilityRoutines::MakeUPPERCase(cAlphaArgs(3)))); // Air balance method type character input-->convert to enum + getEnumValue(DataHeatBalance::AirBalanceTypeNamesUC, + UtilityRoutines::makeUPPER(cAlphaArgs(3)))); // Air balance method type character input-->convert to enum if (thisZoneAirBalance.BalanceMethod == DataHeatBalance::AirBalance::Invalid) { thisZoneAirBalance.BalanceMethod = DataHeatBalance::AirBalance::None; ShowWarningError(state, @@ -746,8 +745,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err // Set space flow fractions // Infiltration equipment design level calculation method. - AirflowSpecAlt flow = - static_cast(getEnumerationValue(airflowAltNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpecAlt flow = static_cast(getEnumValue(airflowAltNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { case AirflowSpecAlt::Flow: case AirflowSpecAlt::FlowPerZone: @@ -1399,7 +1397,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Ventilation equipment design level calculation method - AirflowSpec flow = static_cast(getEnumerationValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: @@ -1529,8 +1527,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err if (cAlphaArgs(5).empty()) { thisVentilation.FanType = DataHeatBalance::VentilationType::Natural; } else { - thisVentilation.FanType = - static_cast(getEnumerationValue(ventilationTypeNamesUC, cAlphaArgs(5))); + thisVentilation.FanType = static_cast(getEnumValue(ventilationTypeNamesUC, cAlphaArgs(5))); if (thisVentilation.FanType == DataHeatBalance::VentilationType::Invalid) { ShowSevereError(state, format(R"({}{}="{}". invalid {}="{}".)", @@ -2579,7 +2576,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Mixing equipment design level calculation method - AirflowSpec flow = static_cast(getEnumerationValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: @@ -3198,7 +3195,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // Mixing equipment design level calculation method. - AirflowSpec flow = static_cast(getEnumerationValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) switch (flow) { case AirflowSpec::Flow: case AirflowSpec::FlowPerZone: @@ -4563,7 +4560,7 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if bool IsNotOK; // Initialize default values for air model parameters - state.dataRoomAirMod->AirModel.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->AirModel.allocate(state.dataGlobal->NumOfZones); bool ErrorsFound = false; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; @@ -4575,9 +4572,9 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if ErrorsFound = true; } if (NumOfAirModels > 0) { - state.dataRoomAirMod->IsZoneDV.dimension(state.dataGlobal->NumOfZones, false); - state.dataRoomAirMod->IsZoneCV.dimension(state.dataGlobal->NumOfZones, false); - state.dataRoomAirMod->IsZoneUI.dimension(state.dataGlobal->NumOfZones, false); + state.dataRoomAir->IsZoneDispVent3Node.dimension(state.dataGlobal->NumOfZones, false); + state.dataRoomAir->IsZoneCrossVent.dimension(state.dataGlobal->NumOfZones, false); + state.dataRoomAir->IsZoneUFAD.dimension(state.dataGlobal->NumOfZones, false); } for (AirModelNum = 1; AirModelNum <= NumOfAirModels; ++AirModelNum) { @@ -4595,7 +4592,7 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if state.dataIPShortCut->cNumericFieldNames); ZoneNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); if (ZoneNum != 0) { - if (!state.dataRoomAirMod->AirModel(ZoneNum).AirModelName.empty()) { + if (!state.dataRoomAir->AirModel(ZoneNum).Name.empty()) { ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, "Duplicate zone name, only one type of roomair model is allowed per zone"); @@ -4603,26 +4600,26 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if format("Zone {} was already assigned a roomair model by {} = {}", state.dataIPShortCut->cAlphaArgs(2), cCurrentModuleObject, - state.dataRoomAirMod->AirModel(ZoneNum).AirModelName)); - ShowContinueError(state, - format("Air Model Type for zone already set to {}", - DataRoomAirModel::ChAirModel[static_cast(state.dataRoomAirMod->AirModel(ZoneNum).AirModelType)])); + roomAirModelNamesUC[(int)state.dataRoomAir->AirModel(ZoneNum).AirModel])); + ShowContinueError( + state, + format("Air Model Type for zone already set to {}", roomAirModelNamesUC[(int)state.dataRoomAir->AirModel(ZoneNum).AirModel])); ShowContinueError(state, format("Trying to overwrite with model type = {}", state.dataIPShortCut->cAlphaArgs(3))); ErrorsFound = true; } - state.dataRoomAirMod->AirModel(ZoneNum).AirModelName = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->AirModel(ZoneNum).ZoneName = state.dataIPShortCut->cAlphaArgs(2); + state.dataRoomAir->AirModel(ZoneNum).ZoneName = state.dataIPShortCut->cAlphaArgs(2); - state.dataRoomAirMod->AirModel(ZoneNum).AirModelType = - static_cast(getEnumerationValue(roomAirModelNamesUC, state.dataIPShortCut->cAlphaArgs(3))); - switch (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType) { - case DataRoomAirModel::RoomAirModel::Mixing: + // state.dataRoomAir->AirModel(ZoneNum).AirModelName = state.dataIPShortCut->cAlphaArgs(1); + state.dataRoomAir->AirModel(ZoneNum).AirModel = + static_cast(getEnumValue(roomAirModelNamesUC, state.dataIPShortCut->cAlphaArgs(3))); // is this arg1 or arg3? + switch (state.dataRoomAir->AirModel(ZoneNum).AirModel) { + case RoomAir::RoomAirModel::Mixing: // nothing to do here actually break; - case DataRoomAirModel::RoomAirModel::Mundt: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->MundtModelUsed = true; + case RoomAir::RoomAirModel::DispVent1Node: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->DispVent1NodeModelUsed = true; IsNotOK = false; ValidateComponent(state, "RoomAirSettings:OneNodeDisplacementVentilation", @@ -4636,9 +4633,9 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if } break; - case DataRoomAirModel::RoomAirModel::UCSDDV: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->UCSDModelUsed = true; + case RoomAir::RoomAirModel::DispVent3Node: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->UCSDModelUsed = true; IsNotOK = false; ValidateComponent(state, "RoomAirSettings:ThreeNodeDisplacementVentilation", @@ -4652,9 +4649,9 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if } break; - case DataRoomAirModel::RoomAirModel::UCSDCV: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->UCSDModelUsed = true; + case RoomAir::RoomAirModel::CrossVent: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->UCSDModelUsed = true; IsNotOK = false; ValidateComponent(state, "RoomAirSettings:CrossVentilation", @@ -4668,9 +4665,9 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if } break; - case DataRoomAirModel::RoomAirModel::UCSDUFI: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->UCSDModelUsed = true; + case RoomAir::RoomAirModel::UFADInt: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->UCSDModelUsed = true; ValidateComponent(state, "RoomAirSettings:UnderFloorAirDistributionInterior", "zone_name", @@ -4683,9 +4680,9 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if } break; - case DataRoomAirModel::RoomAirModel::UCSDUFE: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->UCSDModelUsed = true; + case RoomAir::RoomAirModel::UFADExt: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->UCSDModelUsed = true; ValidateComponent(state, "RoomAirSettings:UnderFloorAirDistributionExterior", "zone_name", @@ -4698,13 +4695,13 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if } break; - case DataRoomAirModel::RoomAirModel::UserDefined: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->UserDefinedUsed = true; + case RoomAir::RoomAirModel::UserDefined: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->UserDefinedUsed = true; break; - case DataRoomAirModel::RoomAirModel::AirflowNetwork: - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; + case RoomAir::RoomAirModel::AirflowNetwork: + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; if (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirflowNetwork:SimulationControl") == 0) { ShowSevereError(state, format("In {} = {}: {} = AIRFLOWNETWORK.", @@ -4723,16 +4720,16 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if ShowWarningError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, format("The mixing air model will be used for Zone ={}", state.dataIPShortCut->cAlphaArgs(2))); - state.dataRoomAirMod->AirModel(ZoneNum).AirModelType = DataRoomAirModel::RoomAirModel::Mixing; + state.dataRoomAir->AirModel(ZoneNum).AirModel = RoomAir::RoomAirModel::Mixing; } - state.dataRoomAirMod->AirModel(ZoneNum).TempCoupleScheme = - static_cast(getEnumerationValue(couplingSchemeNamesUC, state.dataIPShortCut->cAlphaArgs(4))); - if (state.dataRoomAirMod->AirModel(ZoneNum).TempCoupleScheme == DataRoomAirModel::CouplingScheme::Invalid) { + state.dataRoomAir->AirModel(ZoneNum).TempCoupleScheme = + static_cast(getEnumValue(couplingSchemeNamesUC, state.dataIPShortCut->cAlphaArgs(4))); + if (state.dataRoomAir->AirModel(ZoneNum).TempCoupleScheme == RoomAir::CouplingScheme::Invalid) { ShowWarningError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, format("The direct coupling scheme will be used for Zone ={}", state.dataIPShortCut->cAlphaArgs(2))); - state.dataRoomAirMod->AirModel(ZoneNum).TempCoupleScheme = DataRoomAirModel::CouplingScheme::Direct; + state.dataRoomAir->AirModel(ZoneNum).TempCoupleScheme = RoomAir::CouplingScheme::Direct; } } else { // Zone Not Found @@ -4744,15 +4741,15 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { // this used to be an if (NumOfAirModels == 0) block, but both the IF and the ELSE had the same content, these two lines: - state.dataRoomAirMod->AirModel(ZoneNum).AirModelName = "MIXING AIR MODEL FOR " + state.dataHeatBal->Zone(ZoneNum).Name; - state.dataRoomAirMod->AirModel(ZoneNum).ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; + state.dataRoomAir->AirModel(ZoneNum).Name = "MIXING AIR MODEL FOR " + state.dataHeatBal->Zone(ZoneNum).Name; + state.dataRoomAir->AirModel(ZoneNum).ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; // set global flag for non-mixing model - if (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType != DataRoomAirModel::RoomAirModel::Mixing) { - state.dataRoomAirMod->anyNonMixingRoomAirModel = true; + if (state.dataRoomAir->AirModel(ZoneNum).AirModel != RoomAir::RoomAirModel::Mixing) { + state.dataRoomAir->anyNonMixingRoomAirModel = true; } } - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->anyNonMixingRoomAirModel) { if (state.dataHeatBal->doSpaceHeatBalanceSimulation || state.dataHeatBal->doSpaceHeatBalanceSizing) { ShowSevereError(state, "Non-Mixing RoomAirModelType is not supported with ZoneAirHeatBalanceAlgorithm Space Heat Balance."); ErrorsFound = true; @@ -4763,38 +4760,19 @@ void GetRoomAirModelParameters(EnergyPlusData &state, bool &errFlag) // True if static constexpr std::string_view RoomAirHeader("! , Zone Name, Mixing/Mundt/UCSDDV/UCSDCV/UCSDUFI/UCSDUFE/User Defined\n"); print(state.files.eio, RoomAirHeader); for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - { - static constexpr std::string_view RoomAirZoneFmt("RoomAir Model,{},{}\n"); - - switch (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType) { - case DataRoomAirModel::RoomAirModel::Mixing: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "Mixing/Well-Stirred"); - } break; - case DataRoomAirModel::RoomAirModel::Mundt: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "OneNodeDisplacementVentilation"); - } break; - case DataRoomAirModel::RoomAirModel::UCSDDV: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "ThreeNodeDisplacementVentilation"); - } break; - case DataRoomAirModel::RoomAirModel::UCSDCV: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "CrossVentilation"); - } break; - case DataRoomAirModel::RoomAirModel::UCSDUFI: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "UnderFloorAirDistributionInterior"); - } break; - case DataRoomAirModel::RoomAirModel::UCSDUFE: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "UnderFloorAirDistributionExterior"); - } break; - case DataRoomAirModel::RoomAirModel::UserDefined: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "UserDefined"); - } break; - case DataRoomAirModel::RoomAirModel::AirflowNetwork: { - print(state.files.eio, RoomAirZoneFmt, state.dataHeatBal->Zone(ZoneNum).Name, "AirflowNetwork"); - } break; - default: - break; - } - } + static constexpr std::array roomAirModelStrings = {"UserDefined", + "Mixing/Well-Stirred", + "OneNodeDisplacementVentilation", + "ThreeNodeDisplacementVentilation", + "CrossVentilation", + "UnderFloorAirDistributionInterior", + "UnderFloorAirDistributionExterior", + "AirflowNetwork"}; + + print(state.files.eio, + "RoomAir Model,{},{}\n", + state.dataHeatBal->Zone(ZoneNum).Name, + roomAirModelStrings[(int)state.dataRoomAir->AirModel(ZoneNum).AirModel]); } if (ErrorsFound) { diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index 84eed19b153..4a75eb6d29f 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -1121,7 +1121,7 @@ namespace HeatBalanceIntRadExchange { for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); std::string const thisSpaceOrSpaceListName = - UtilityRoutines::MakeUPPERCase(fields.at("zone_or_zonelist_or_space_or_spacelist_name").get()); + UtilityRoutines::makeUPPER(fields.at("zone_or_zonelist_or_space_or_spacelist_name").get()); // do not mark object as used here - let GetInputViewFactorsbyName do that // Look for matching radiant enclosure name (solar enclosures have the same names) diff --git a/src/EnergyPlus/HeatBalanceInternalHeatGains.cc b/src/EnergyPlus/HeatBalanceInternalHeatGains.cc index e9339c6e036..8c0a41d9d7b 100644 --- a/src/EnergyPlus/HeatBalanceInternalHeatGains.cc +++ b/src/EnergyPlus/HeatBalanceInternalHeatGains.cc @@ -122,7 +122,7 @@ void SetupSpaceInternalGain(EnergyPlusData &state, int constexpr DeviceAllocInc(100); bool FoundDuplicate = false; - std::string UpperCaseObjectName = UtilityRoutines::MakeUPPERCase(cComponentName); + std::string UpperCaseObjectName = UtilityRoutines::makeUPPER(cComponentName); auto &thisIntGain = state.dataHeatBal->spaceIntGainDevices(spaceNum); for (int IntGainsNum = 1; IntGainsNum <= thisIntGain.numberOfDevices; ++IntGainsNum) { diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index ef9d2e59370..be91359f2d6 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -502,7 +502,7 @@ void KivaManager::readWeatherData(EnergyPlusData &state) } if (Pos != std::string::npos) LineResult.data.erase(0, Pos + 1); - if (UtilityRoutines::MakeUPPERCase(Header(HdLine)) == "DATA PERIODS") { + if (UtilityRoutines::makeUPPER(Header(HdLine)) == "DATA PERIODS") { bool IOStatus; uppercase(LineResult.data); int NumHdArgs = 2; diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index d9ff207b760..3f9ffd3d51c 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -730,7 +730,7 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - Convect::HcInt hcIn = static_cast(getEnumerationValue(Convect::HcIntNamesUC, AlphaName(1))); + Convect::HcInt hcIn = static_cast(getEnumValue(Convect::HcIntNamesUC, AlphaName(1))); if (hcIn == Convect::HcInt::TrombeWall) { ShowSevereError(state, @@ -770,7 +770,7 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - Convect::HcExt hcOut = static_cast(getEnumerationValue(Convect::HcExtNamesUC, AlphaName(1))); + Convect::HcExt hcOut = static_cast(getEnumValue(Convect::HcExtNamesUC, AlphaName(1))); if (hcOut != Convect::HcExt::ASHRAESimple && hcOut != Convect::HcExt::ASHRAETARP && hcOut != Convect::HcExt::MoWiTTHcOutside && hcOut != Convect::HcExt::DOE2HcOutside && hcOut != Convect::HcExt::AdaptiveConvectionAlgorithm) { @@ -1110,7 +1110,7 @@ namespace HeatBalanceManager { state.dataIPShortCut->cNumericFieldNames); if (NumAlpha > 0) { { - int FlowTypeNum = getEnumerationValue(DataHeatBalance::AdjustmentTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphaName(1))); + int FlowTypeNum = getEnumValue(DataHeatBalance::AdjustmentTypeNamesUC, UtilityRoutines::makeUPPER(AlphaName(1))); state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment = static_cast(FlowTypeNum); AlphaName(1) = DataHeatBalance::AdjustmentTypeNamesCC[FlowTypeNum]; DataHeatBalance::AdjustmentType ZoneFlowAdjustment = state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment; @@ -1134,7 +1134,7 @@ namespace HeatBalanceManager { } if (NumAlpha > 1) { { - int FlowTypeNum = getEnumerationValue(DataHeatBalance::InfiltrationFlowTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphaName(2))); + int FlowTypeNum = getEnumValue(DataHeatBalance::InfiltrationFlowTypeNamesUC, UtilityRoutines::makeUPPER(AlphaName(2))); state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment = static_cast(FlowTypeNum); AlphaName(2) = DataHeatBalance::InfiltrationFlowTypeNamesCC[FlowTypeNum]; if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Add || @@ -1162,8 +1162,7 @@ namespace HeatBalanceManager { } else { if (NumAlpha > 2) { { - int FlowTypeNum = - getEnumerationValue(DataHeatBalance::InfiltrationZoneTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphaName(3))); + int FlowTypeNum = getEnumValue(DataHeatBalance::InfiltrationZoneTypeNamesUC, UtilityRoutines::makeUPPER(AlphaName(3))); state.dataHeatBal->ZoneAirMassFlow.InfiltrationForZones = static_cast(FlowTypeNum); AlphaName(3) = DataHeatBalance::InfiltrationZoneTypeNamesCC[FlowTypeNum]; if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationForZones == DataHeatBalance::InfiltrationZoneType::Invalid) { @@ -1703,9 +1702,9 @@ namespace HeatBalanceManager { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - std::string const thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const thisObjectName = UtilityRoutines::makeUPPER(instance.key()); - std::string construction_name = UtilityRoutines::MakeUPPERCase(fields.at("construction_name").get()); + std::string construction_name = UtilityRoutines::makeUPPER(fields.at("construction_name").get()); int source_after_layer_number = fields.at("thermal_source_present_after_layer_number").get(); int calculation_after_layer_number = fields.at("temperature_calculation_requested_after_layer_number").get(); int ctf_dimensions = fields.at("dimensions_for_the_ctf_calculation").get(); @@ -2469,7 +2468,7 @@ namespace HeatBalanceManager { if (NumNumbers >= 9) state.dataHeatBal->Zone(ZoneLoop).UserEnteredFloorArea = rNumericArgs(9); if (NumAlphas > 1 && !state.dataIPShortCut->lAlphaFieldBlanks(2)) { - Convect::HcInt hcIn = static_cast(getEnumerationValue(Convect::HcIntNamesUC, cAlphaArgs(2))); + Convect::HcInt hcIn = static_cast(getEnumValue(Convect::HcIntNamesUC, cAlphaArgs(2))); if (hcIn != Convect::HcInt::ASHRAESimple && hcIn != Convect::HcInt::ASHRAETARP && hcIn != Convect::HcInt::CeilingDiffuser && hcIn != Convect::HcInt::TrombeWall && hcIn != Convect::HcInt::AdaptiveConvectionAlgorithm && hcIn != Convect::HcInt::ASTMC1340) { @@ -2486,7 +2485,7 @@ namespace HeatBalanceManager { if (NumAlphas > 2 && !state.dataIPShortCut->lAlphaFieldBlanks(3)) { - Convect::HcExt hcOut = static_cast(getEnumerationValue(Convect::HcExtNamesUC, cAlphaArgs(3))); + Convect::HcExt hcOut = static_cast(getEnumValue(Convect::HcExtNamesUC, cAlphaArgs(3))); if (hcOut != Convect::HcExt::ASHRAESimple && hcOut != Convect::HcExt::ASHRAETARP && hcOut != Convect::HcExt::MoWiTTHcOutside && hcOut != Convect::HcExt::DOE2HcOutside && hcOut != Convect::HcExt::AdaptiveConvectionAlgorithm) { @@ -2567,7 +2566,7 @@ namespace HeatBalanceManager { ++spaceNum; auto const &objectFields = instance.value(); auto &thisSpace = state.dataHeatBal->space(spaceNum); - thisSpace.Name = UtilityRoutines::MakeUPPERCase(instance.key()); + thisSpace.Name = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); std::string zoneName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "zone_name"); thisSpace.CeilingHeight = ip->getRealFieldValue(objectFields, objectSchemaProps, "ceiling_height"); @@ -2626,7 +2625,7 @@ namespace HeatBalanceManager { ++spaceListNum; auto const &objectFields = instance.value(); auto &thisSpaceList = state.dataHeatBal->spaceList(spaceListNum); - thisSpaceList.Name = UtilityRoutines::MakeUPPERCase(instance.key()); + thisSpaceList.Name = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); if (UtilityRoutines::FindItemInList(thisSpaceList.Name, state.dataHeatBal->Zone) > 0) { @@ -3647,7 +3646,7 @@ namespace HeatBalanceManager { frameDivider.FrameEmis = FrameDividerProps(8); DataSurfaces::FrameDividerType currentDividerType = - DataSurfaces::FrameDividerType(getEnumerationValue(FrameDividerTypeNamesUC, FrameDividerAlphas(2))); + DataSurfaces::FrameDividerType(getEnumValue(FrameDividerTypeNamesUC, FrameDividerAlphas(2))); if (currentDividerType == DataSurfaces::FrameDividerType::Invalid) { ShowWarningError(state, fmt::format("{}={}, Invalid {}", @@ -3678,7 +3677,7 @@ namespace HeatBalanceManager { frameDivider.DividerEmis = FrameDividerProps(18); // look up the NFRC Product Type for Assembly Calculations using the DataSurfaces::NfrcProductName - frameDivider.NfrcProductType = DataSurfaces::NfrcProductOptions(getEnumerationValue(NfrcProductNamesUC, FrameDividerAlphas(3))); + frameDivider.NfrcProductType = DataSurfaces::NfrcProductOptions(getEnumValue(NfrcProductNamesUC, FrameDividerAlphas(3))); if (frameDivider.NfrcProductType == DataSurfaces::NfrcProductOptions::Invalid) { frameDivider.NfrcProductType = DataSurfaces::NfrcProductOptions::CurtainWall; } @@ -3902,7 +3901,7 @@ namespace HeatBalanceManager { // Get window name and check for match W5Name = std::string{DataLine(4).substr(19)}; - WindowNameInW5DataFile = UtilityRoutines::MakeUPPERCase(W5Name); + WindowNameInW5DataFile = UtilityRoutines::makeUPPER(W5Name); if (DesiredConstructionName != WindowNameInW5DataFile) { // Doesn't match; read through file until next window entry is found Label20:; @@ -4988,7 +4987,7 @@ namespace HeatBalanceManager { ++constrNum; auto &thisConstruct = state.dataConstruction->Construct(constrNum); - thisConstruct.Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisConstruct.Name = UtilityRoutines::makeUPPER(thisObjectName); thisConstruct.TypeIsAirBoundary = true; thisConstruct.IsUsedCTF = false; @@ -5009,7 +5008,7 @@ namespace HeatBalanceManager { } if (fields.find("simple_mixing_schedule_name") != fields.end()) { const std::string &schedName = fields.at("simple_mixing_schedule_name").get(); - thisConstruct.AirBoundaryMixingSched = ScheduleManager::GetScheduleIndex(state, UtilityRoutines::MakeUPPERCase(schedName)); + thisConstruct.AirBoundaryMixingSched = ScheduleManager::GetScheduleIndex(state, UtilityRoutines::makeUPPER(schedName)); if (thisConstruct.AirBoundaryMixingSched == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid (not found) Simple Mixing Schedule Name=\"{}\".", diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 40d0c76f286..325b0777f10 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -298,7 +298,7 @@ namespace HeatRecovery { constexpr std::array(HXConfiguration::Num)> hxConfigurationNamesUC = { "COUNTERFLOW", "PARALLELFLOW", "CROSSFLOWBOTHUNMIXED", "CROSS_FLOW_OTHER_NOT_USED"}; - thisExchanger.FlowArr = static_cast(getEnumerationValue(hxConfigurationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + thisExchanger.FlowArr = static_cast(getEnumValue(hxConfigurationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); if (thisExchanger.FlowArr == HXConfiguration::Invalid) { ShowSevereError(state, format("{}: incorrect flow arrangement: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(3))); ErrorsFound = true; @@ -509,8 +509,7 @@ namespace HeatRecovery { } // Added additional inputs for frost control - thisExchanger.FrostControlType = - static_cast(getEnumerationValue(frostControlNamesUC, state.dataIPShortCut->cAlphaArgs(9))); + thisExchanger.FrostControlType = static_cast(getEnumValue(frostControlNamesUC, state.dataIPShortCut->cAlphaArgs(9))); if (thisExchanger.FrostControlType == FrostControlOption::Invalid) { ShowSevereError(state, format("Invalid Frost Control method for {} = {}", thisExchanger.Name, state.dataIPShortCut->cAlphaArgs(9))); ErrorsFound = true; diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index c199a9bf08b..f621d3fcb6c 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -642,7 +642,7 @@ namespace HeatingCoils { heatingCoil.HeatingCoilModel = "Fuel"; heatingCoil.HCoilType_Num = DataHVACGlobals::Coil_HeatingGasOrOtherFuel; - heatingCoil.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, Alphas(3))); + heatingCoil.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, Alphas(3))); if (!(heatingCoil.FuelType == Constant::eFuel::NaturalGas || heatingCoil.FuelType == Constant::eFuel::Propane || heatingCoil.FuelType == Constant::eFuel::Diesel || heatingCoil.FuelType == Constant::eFuel::Gasoline || heatingCoil.FuelType == Constant::eFuel::FuelOilNo1 || heatingCoil.FuelType == Constant::eFuel::FuelOilNo2 || diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 6bf5ff056d8..5f2b60e1eed 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -287,7 +287,7 @@ namespace HighTempRadiantSystem { // Determine High Temp Radiant heating design capacity sizing method highTempRadSys.HeatingCapMethod = static_cast( - getEnumerationValue(DataSizing::DesignSizingTypeNamesUC, state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + getEnumValue(DataSizing::DesignSizingTypeNamesUC, state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); if (highTempRadSys.HeatingCapMethod == DataSizing::DesignSizingType::HeatingDesignCapacity) { if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { highTempRadSys.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum); @@ -369,7 +369,7 @@ namespace HighTempRadiantSystem { } highTempRadSys.HeaterType = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, state.dataIPShortCut->cAlphaArgs(5))); + static_cast(getEnumValue(Constant::eResourceNamesUC, state.dataIPShortCut->cAlphaArgs(5))); if (highTempRadSys.HeaterType == Constant::eResource::NaturalGas) { highTempRadSys.CombustionEffic = state.dataIPShortCut->rNumericArgs(4); @@ -447,7 +447,7 @@ namespace HighTempRadiantSystem { } // Process the temperature control type - highTempRadSys.ControlType = static_cast(getEnumerationValue(radControlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(6))); + highTempRadSys.ControlType = static_cast(getEnumValue(radControlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(6))); highTempRadSys.ThrottlRange = state.dataIPShortCut->rNumericArgs(8); if (highTempRadSys.ThrottlRange < MinThrottlingRange) { diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index bd2dac2322a..14c9ff4a727 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -78,7 +78,6 @@ namespace HybridModel { // Using/Aliasing using namespace DataHeatBalance; - using namespace DataRoomAirModel; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -495,8 +494,8 @@ namespace HybridModel { for (ZonePtr = 1; ZonePtr <= state.dataGlobal->NumOfZones; ZonePtr++) { if ((state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T || state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T) && - (state.dataRoomAirMod->AirModel(ZonePtr).AirModelType != DataRoomAirModel::RoomAirModel::Mixing)) { - state.dataRoomAirMod->AirModel(ZonePtr).AirModelType = DataRoomAirModel::RoomAirModel::Mixing; + (state.dataRoomAir->AirModel(ZonePtr).AirModel != RoomAir::RoomAirModel::Mixing)) { + state.dataRoomAir->AirModel(ZonePtr).AirModel = RoomAir::RoomAirModel::Mixing; ShowWarningError(state, "Room Air Model Type should be Mixing if Hybrid Modeling is performed for the zone."); } } diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index a26aa8caaf6..b67a249ad3e 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -220,14 +220,13 @@ void InitZoneHybridUnitaryAirConditioners(EnergyPlusData &state, // set the availability status based on the availability manager list name if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler).ZoneCompAvailMgrs(UnitNum); if (state.dataHybridUnitaryAC->MyZoneEqFlag(UnitNum)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::ZoneHybridEvaporativeCooler).ZoneCompAvailMgrs(UnitNum).AvailManagerListName = - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::ZoneHybridEvaporativeCooler).ZoneCompAvailMgrs(UnitNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataHybridUnitaryAC->MyZoneEqFlag(UnitNum) = false; } - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).AvailStatus = - ZoneComp(DataZoneEquipment::ZoneEquip::ZoneHybridEvaporativeCooler).ZoneCompAvailMgrs(UnitNum).AvailStatus; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).AvailStatus = availMgr.AvailStatus; } // need to check all zone outdoor air control units to see if they are on Zone Equipment List or issue warning diff --git a/src/EnergyPlus/ICEngineElectricGenerator.cc b/src/EnergyPlus/ICEngineElectricGenerator.cc index b9d16a866bb..0afb251f2a8 100644 --- a/src/EnergyPlus/ICEngineElectricGenerator.cc +++ b/src/EnergyPlus/ICEngineElectricGenerator.cc @@ -292,7 +292,7 @@ namespace ICEngineElectricGenerator { // Validate fuel type input state.dataICEngElectGen->ICEngineGenerator(genNum).FuelType = - static_cast(getEnumerationValue(Constant::eFuelNamesUC, AlphArray(10))); + static_cast(getEnumValue(Constant::eFuelNamesUC, AlphArray(10))); if (state.dataICEngElectGen->ICEngineGenerator(genNum).FuelType == Constant::eFuel::Invalid) { ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), AlphArray(10))); ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); diff --git a/src/EnergyPlus/IOFiles.cc b/src/EnergyPlus/IOFiles.cc index d3e1de0ca97..8c3c149a838 100644 --- a/src/EnergyPlus/IOFiles.cc +++ b/src/EnergyPlus/IOFiles.cc @@ -326,7 +326,7 @@ void IOFiles::OutputControl::getInput(EnergyPlusData &state) auto found = fields.find(field_name); if (found != fields.end()) { input = found.value().get(); - input = UtilityRoutines::MakeUPPERCase(input); + input = UtilityRoutines::makeUPPER(input); } else { state.dataInputProcessing->inputProcessor->getDefaultValue(state, "OutputControl:Files", field_name, input); } diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index de2efa8a203..d6b437768eb 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -144,7 +144,7 @@ json const &InputProcessor::getFields(EnergyPlusData &state, std::string const & if (it2 == objs.end()) { // HACK: this is not ideal and should be removed once everything is case sensitive internally for (auto it3 = objs.begin(); it3 != objs.end(); ++it3) { - if (UtilityRoutines::MakeUPPERCase(it3.key()) == objectName) { + if (UtilityRoutines::makeUPPER(it3.key()) == objectName) { return it3.value(); } } @@ -556,7 +556,7 @@ bool InputProcessor::findDefault(std::string &default_value, json const &schema_ default_value = s; } if (schema_field_obj.find("retaincase") == schema_field_obj.end()) { - default_value = UtilityRoutines::MakeUPPERCase(default_value); + default_value = UtilityRoutines::makeUPPER(default_value); } return true; } @@ -736,7 +736,7 @@ std::pair InputProcessor::getObjectItemValue(std::string cons output.second = false; } if (schema_field_obj.find("retaincase") == schema_field_obj.end()) { - output.first = UtilityRoutines::MakeUPPERCase(output.first); + output.first = UtilityRoutines::makeUPPER(output.first); } return output; } @@ -1041,7 +1041,7 @@ void InputProcessor::getObjectItem(EnergyPlusData &state, if (name_iter.find("retaincase") != name_iter.end()) { Alphas(alpha_index) = objectInfo.objectName; } else { - Alphas(alpha_index) = UtilityRoutines::MakeUPPERCase(objectInfo.objectName); + Alphas(alpha_index) = UtilityRoutines::makeUPPER(objectInfo.objectName); } if (is_AlphaBlank) AlphaBlank()(alpha_index) = objectInfo.objectName.empty(); if (is_AlphaFieldNames) { @@ -1224,9 +1224,9 @@ int InputProcessor::getObjectItemNum(EnergyPlusData &state, int object_item_num = 1; bool found = false; - std::string const upperObjName = UtilityRoutines::MakeUPPERCase(ObjName); + std::string const upperObjName = UtilityRoutines::makeUPPER(ObjName); for (auto it = obj->begin(); it != obj->end(); ++it) { - if (UtilityRoutines::MakeUPPERCase(it.key()) == upperObjName) { + if (UtilityRoutines::makeUPPER(it.key()) == upperObjName) { found = true; break; } @@ -1262,11 +1262,11 @@ int InputProcessor::getObjectItemNum(EnergyPlusData &state, int object_item_num = 1; bool found = false; - std::string const upperObjName = UtilityRoutines::MakeUPPERCase(ObjName); + std::string const upperObjName = UtilityRoutines::makeUPPER(ObjName); for (auto it = obj->begin(); it != obj->end(); ++it) { auto it2 = it.value().find(NameTypeVal); - if ((it2 != it.value().end()) && (UtilityRoutines::MakeUPPERCase(it2.value().get()) == upperObjName)) { + if ((it2 != it.value().end()) && (UtilityRoutines::makeUPPER(it2.value().get()) == upperObjName)) { found = true; break; } @@ -2115,7 +2115,7 @@ void InputProcessor::preScanReportingVariables(EnergyPlusData &state) json const &fields = obj.value(); for (auto const &extensions : fields[extension_key]) { try { - std::string const report_name = UtilityRoutines::MakeUPPERCase(extensions.at("report_name").get()); + std::string const report_name = UtilityRoutines::makeUPPER(extensions.at("report_name").get()); if (report_name == "ALLMONTHLY" || report_name == "ALLSUMMARYANDMONTHLY") { for (int i = 1; i <= DataOutputs::NumMonthlyReports; ++i) { addVariablesForMonthlyReport(state, DataOutputs::MonthlyNamedReports(i)); diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index 4d8da8c14bb..51c3d227097 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -878,7 +878,7 @@ namespace InternalHeatGains { } if (!IHGAlphaFieldBlanks(10) || !IHGAlphas(10).empty()) { - thisPeople.clothingType = static_cast(getEnumerationValue(clothingTypeNamesUC, IHGAlphas(10))); + thisPeople.clothingType = static_cast(getEnumValue(clothingTypeNamesUC, IHGAlphas(10))); if (thisPeople.clothingType == ClothingType::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", invalid {}, value ={}", @@ -3196,13 +3196,12 @@ namespace InternalHeatGains { } // Environmental class - thisZoneITEq.Class = - static_cast(getEnumerationValue(ITEClassNamesUC, UtilityRoutines::MakeUPPERCase(IHGAlphas(10)))); + thisZoneITEq.Class = static_cast(getEnumValue(ITEClassNamesUC, UtilityRoutines::makeUPPER(IHGAlphas(10)))); ErrorsFound = ErrorsFound || (thisZoneITEq.Class == ITEClass::Invalid); // Air and supply inlet connections - thisZoneITEq.AirConnectionType = static_cast( - getEnumerationValue(ITEInletConnectionNamesUC, UtilityRoutines::MakeUPPERCase(IHGAlphas(11)))); + thisZoneITEq.AirConnectionType = + static_cast(getEnumValue(ITEInletConnectionNamesUC, UtilityRoutines::makeUPPER(IHGAlphas(11)))); if (thisZoneITEq.AirConnectionType == ITEInletConnection::RoomAirModel) { // ZoneITEq(Loop).AirConnectionType = ITEInletConnection::RoomAirModel; ShowWarningError(state, @@ -4161,7 +4160,7 @@ namespace InternalHeatGains { int counter = 0; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &objectFields = instance.value(); - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(objectType, instance.key()); // For incoming idf, maintain object order @@ -7341,9 +7340,9 @@ namespace InternalHeatGains { // if the user did not specify a sensible fraction, calculate the sensible heat gain if (state.dataHeatBal->People(Loop).UserSpecSensFrac == Constant::AutoCalculate) { Real64 airTemp = thisZoneHB.MAT; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(NZ) || state.dataRoomAirMod->IsZoneUI(NZ)) { - airTemp = state.dataRoomAirMod->TCMF(NZ); + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(NZ) || state.dataRoomAir->IsZoneUFAD(NZ)) { + airTemp = state.dataRoomAir->TCMF(NZ); } } SensiblePeopleGain = diff --git a/src/EnergyPlus/Material.cc b/src/EnergyPlus/Material.cc index 7a310ed25fb..fed2f8430b3 100644 --- a/src/EnergyPlus/Material.cc +++ b/src/EnergyPlus/Material.cc @@ -245,7 +245,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &objectFields = instance.value(); - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(state.dataHeatBalMgr->CurrentModuleObject, instance.key()); std::string materialName = thisObjectName; @@ -268,8 +268,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->Name = materialName; std::string roughness = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "roughness"); - thisMaterial->Roughness = - static_cast(getEnumerationValue(SurfaceRoughnessUC, UtilityRoutines::MakeUPPERCase(roughness))); + thisMaterial->Roughness = static_cast(getEnumValue(SurfaceRoughnessUC, UtilityRoutines::makeUPPER(roughness))); thisMaterial->Thickness = ip->getRealFieldValue(objectFields, objectSchemaProps, "thickness"); thisMaterial->Conductivity = ip->getRealFieldValue(objectFields, objectSchemaProps, "conductivity"); @@ -346,8 +345,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->group = Group::Regular; thisMaterial->Name = MaterialNames(1); - thisMaterial->Roughness = - static_cast(getEnumerationValue(SurfaceRoughnessUC, UtilityRoutines::MakeUPPERCase(MaterialNames(2)))); + thisMaterial->Roughness = static_cast(getEnumValue(SurfaceRoughnessUC, UtilityRoutines::makeUPPER(MaterialNames(2)))); thisMaterial->Resistance = MaterialProps(1); thisMaterial->ROnly = true; @@ -1173,7 +1171,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->Name = MaterialNames(1); thisMaterial->NumberOfGasesInMixture = 1; - thisMaterial->gasTypes(1) = static_cast(getEnumerationValue(GasTypeUC, UtilityRoutines::MakeUPPERCase(MaterialNames(2)))); + thisMaterial->gasTypes(1) = static_cast(getEnumValue(GasTypeUC, UtilityRoutines::makeUPPER(MaterialNames(2)))); thisMaterial->Roughness = SurfaceRoughness::MediumRough; @@ -1280,7 +1278,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->Name = MaterialNames(1); thisMaterial->NumberOfGasesInMixture = 1; - thisMaterial->gasTypes(1) = static_cast(getEnumerationValue(GasTypeUC, UtilityRoutines::MakeUPPERCase(MaterialNames(2)))); + thisMaterial->gasTypes(1) = static_cast(getEnumValue(GasTypeUC, UtilityRoutines::makeUPPER(MaterialNames(2)))); thisMaterial->Roughness = SurfaceRoughness::MediumRough; @@ -1300,8 +1298,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { // Get gap vent type - thisMaterial->gapVentType = - static_cast(getEnumerationValue(GapVentTypeUC, UtilityRoutines::MakeUPPERCase(MaterialNames(3)))); + thisMaterial->gapVentType = static_cast(getEnumValue(GapVentTypeUC, UtilityRoutines::makeUPPER(MaterialNames(3)))); } if (gasType == GasType::Custom) { @@ -1385,7 +1382,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->NumberOfGasesInMixture = NumGases; for (NumGas = 1; NumGas <= NumGases; ++NumGas) { thisMaterial->gasTypes(NumGas) = - static_cast(getEnumerationValue(GasTypeUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(1 + NumGas)))); + static_cast(getEnumValue(GasTypeUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(1 + NumGas)))); } thisMaterial->Roughness = SurfaceRoughness::MediumRough; // Unused @@ -2394,8 +2391,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // MaximizeSolar or BlockBeamSolar thisMaterial->slatAngleType = SlatAngleType::FixedSlatAngle; if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisMaterial->slatAngleType = - static_cast(getEnumerationValue(SlatAngleTypeUC, UtilityRoutines::MakeUPPERCase(MaterialNames(3)))); + thisMaterial->slatAngleType = static_cast(getEnumValue(SlatAngleTypeUC, UtilityRoutines::makeUPPER(MaterialNames(3)))); } if (thisMaterial->SlatWidth < thisMaterial->SlatSeparation) { ShowWarningError(state, format("{}=\"{}\", Slat Seperation/Width", state.dataHeatBalMgr->CurrentModuleObject, MaterialNames(1))); @@ -2524,8 +2520,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if thisMaterial->Name = MaterialNames(1); // need to treat the A2 with is just the name of the soil(it is // not important) - thisMaterial->Roughness = - static_cast(getEnumerationValue(SurfaceRoughnessUC, UtilityRoutines::MakeUPPERCase(MaterialNames(3)))); + thisMaterial->Roughness = static_cast(getEnumValue(SurfaceRoughnessUC, UtilityRoutines::makeUPPER(MaterialNames(3)))); if (UtilityRoutines::SameString(MaterialNames(4), "Simple")) { thisMaterial->EcoRoofCalculationMethod = 1; } else if (UtilityRoutines::SameString(MaterialNames(4), "Advanced") || state.dataIPShortCut->lAlphaFieldBlanks(4)) { @@ -2844,7 +2839,7 @@ void GetVariableAbsorptanceInput(EnergyPlusData &state, bool &errorsFound) thisMaterial->absorpVarCtrlSignal = VariableAbsCtrlSignal::SurfaceTemperature; // default value thisMaterial->absorpVarCtrlSignal = - static_cast(getEnumerationValue(VariableAbsCtrlSignalUC, UtilityRoutines::MakeUPPERCase(alphas(3)))); + static_cast(getEnumValue(VariableAbsCtrlSignalUC, UtilityRoutines::makeUPPER(alphas(3)))); // init to 0 as GetScheduleIndex returns 0 for not-found schedule thisMaterial->absorpThermalVarFuncIdx = Curve::GetCurveIndex(state, alphas(4)); thisMaterial->absorpThermalVarSchedIdx = ScheduleManager::GetScheduleIndex(state, alphas(5)); diff --git a/src/EnergyPlus/MicroturbineElectricGenerator.cc b/src/EnergyPlus/MicroturbineElectricGenerator.cc index dba119c5f74..2aeff6fd7f6 100644 --- a/src/EnergyPlus/MicroturbineElectricGenerator.cc +++ b/src/EnergyPlus/MicroturbineElectricGenerator.cc @@ -348,7 +348,7 @@ void GetMTGeneratorInput(EnergyPlusData &state) // Validate fuel type input state.dataMircoturbElectGen->MTGenerator(GeneratorNum).FuelType = - static_cast(getEnumerationValue(Constant::eFuelNamesUC, AlphArray(5))); + static_cast(getEnumValue(Constant::eFuelNamesUC, AlphArray(5))); if (state.dataMircoturbElectGen->MTGenerator(GeneratorNum).FuelType == Constant::eFuel::Invalid) { ShowSevereError( state, format("{} \"{}\"", state.dataIPShortCut->cCurrentModuleObject, state.dataMircoturbElectGen->MTGenerator(GeneratorNum).Name)); diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 25dfb0a480b..18e8d96b765 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -898,7 +898,7 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) for (int CompNum = 1; CompNum <= thisControllerList.NumControllers; ++CompNum) { // Json will catch any object types that are not the correct key choice of Controller:OutdoorAir or Controller:WaterCoil thisControllerList.ControllerType(CompNum) = - static_cast(getEnumerationValue(ControllerKindNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(AlphaNum)))); + static_cast(getEnumValue(ControllerKindNamesUC, UtilityRoutines::makeUPPER(AlphArray(AlphaNum)))); thisControllerList.ControllerName(CompNum) = AlphArray(AlphaNum + 1); // loop over all previous controller lists to check if this controllers is also present on previous controllers for (int previousListNum = 1; previousListNum < Item; ++previousListNum) { @@ -1010,7 +1010,7 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) OASys.ControllerName(InListNum) = AlphArray(InListNum * 2 + 1); OASys.ControllerType(InListNum) = AlphArray(InListNum * 2); OASys.controllerTypeEnum(InListNum) = - static_cast(getEnumerationValue(ControllerKindNamesUC, OASys.ControllerType(InListNum))); + static_cast(getEnumValue(ControllerKindNamesUC, OASys.ControllerType(InListNum))); // only count Controller:OutdoorAir types as valid simple controllers if (OASys.controllerTypeEnum(InListNum) != DataAirLoop::ControllerKind::OutdoorAir) { ++NumSimpControllers; @@ -1041,8 +1041,7 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) { auto &OASys = state.dataAirLoop->OutsideAirSys(OASysNum); for (int CompNum = 1; CompNum <= OASys.NumComponents; ++CompNum) { - OASys.ComponentTypeEnum(CompNum) = - static_cast(getEnumerationValue(CompTypeNamesUC, OASys.ComponentType(CompNum))); + OASys.ComponentTypeEnum(CompNum) = static_cast(getEnumValue(CompTypeNamesUC, OASys.ComponentType(CompNum))); if (OASys.ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::Fan_System_Object) { // construct fan object state.dataHVACFan->fanObjs.emplace_back(new HVACFan::FanSystem(state, OASys.ComponentName(CompNum))); @@ -1289,7 +1288,7 @@ void GetOAControllerInputs(EnergyPlusData &state) // System outdoor air method thisVentilationMechanical.SystemOAMethod = - static_cast(getEnumerationValue(SOAMNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(4)))); + static_cast(getEnumValue(SOAMNamesUC, UtilityRoutines::makeUPPER(AlphArray(4)))); if (thisVentilationMechanical.SystemOAMethod == DataSizing::SysOAMethod::IAQP || thisVentilationMechanical.SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlSchOcc || @@ -1633,7 +1632,7 @@ void GetOAControllerInputs(EnergyPlusData &state) for (int EquipListNum = 1; EquipListNum <= state.dataZoneEquip->NumOfZoneEquipLists; ++EquipListNum) { if (EquipListNum == EquipListIndex) { for (int EquipNum = 1; EquipNum <= state.dataZoneEquip->ZoneEquipList(EquipListNum).NumOfEquipTypes; ++EquipNum) { - if (UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(EquipListNum).EquipType(EquipNum), + if (UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(EquipListNum).EquipTypeName(EquipNum), "ZONEHVAC:AIRDISTRIBUTIONUNIT")) { for (int ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { if (UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(EquipListNum).EquipName(EquipNum), diff --git a/src/EnergyPlus/MundtSimMgr.cc b/src/EnergyPlus/MundtSimMgr.cc index 4362926eb1a..901859e3561 100644 --- a/src/EnergyPlus/MundtSimMgr.cc +++ b/src/EnergyPlus/MundtSimMgr.cc @@ -68,7 +68,7 @@ namespace EnergyPlus { -namespace MundtSimMgr { +namespace RoomAir { // MODULE INFORMATION: // AUTHOR Brent Griffith @@ -101,7 +101,7 @@ namespace MundtSimMgr { // MODULE VARIABLE DECLARATIONS: - void ManageMundtModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + void ManageDispVent1Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: @@ -117,7 +117,7 @@ namespace MundtSimMgr { // initialize Mundt model data if (state.dataHeatBal->MundtFirstTimeFlag) { - InitMundtModel(state); + InitDispVent1Node(state); state.dataHeatBal->MundtFirstTimeFlag = false; } @@ -125,27 +125,27 @@ namespace MundtSimMgr { state.dataMundtSimMgr->MundtZoneNum = state.dataMundtSimMgr->ZoneData(ZoneNum).MundtZoneIndex; // transfer data from surface domain to air domain for the specified zone - GetSurfHBDataForMundtModel(state, ZoneNum); + GetSurfHBDataForDispVent1Node(state, ZoneNum); // use the Mundt model only for cooling case if ((state.dataMundtSimMgr->SupplyAirVolumeRate > 0.0001) && (state.dataMundtSimMgr->QsysCoolTot > 0.0001)) { // setup Mundt model ErrorsFound = false; - SetupMundtModel(state, ZoneNum, ErrorsFound); + SetupDispVent1Node(state, ZoneNum, ErrorsFound); if (ErrorsFound) ShowFatalError(state, "ManageMundtModel: Errors in setting up Mundt Model. Preceding condition(s) cause termination."); // perform Mundt model calculations - CalcMundtModel(state, ZoneNum); + CalcDispVent1Node(state, ZoneNum); } // transfer data from air domain back to surface domain for the specified zone - SetSurfHBDataForMundtModel(state, ZoneNum); + SetSurfHBDataForDispVent1Node(state, ZoneNum); } //***************************************************************************************** - void InitMundtModel(EnergyPlusData &state) + void InitDispVent1Node(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -190,7 +190,7 @@ namespace MundtSimMgr { ErrorsFound = false; for (ZoneIndex = 1; ZoneIndex <= state.dataGlobal->NumOfZones; ++ZoneIndex) { auto &thisZone = state.dataHeatBal->Zone(ZoneIndex); - if (state.dataRoomAirMod->AirModel(ZoneIndex).AirModelType == DataRoomAirModel::RoomAirModel::Mundt) { + if (state.dataRoomAir->AirModel(ZoneIndex).AirModel == RoomAir::RoomAirModel::DispVent1Node) { // find number of zones using the Mundt model ++NumOfMundtZones; // find maximum number of surfaces in zones using the Mundt model @@ -203,7 +203,7 @@ namespace MundtSimMgr { } MaxNumOfSurfs = max(MaxNumOfSurfs, NumOfSurfs); // find maximum number of air nodes in zones using the Mundt model - NumOfAirNodes = state.dataRoomAirMod->TotNumOfZoneAirNodes(ZoneIndex); + NumOfAirNodes = state.dataRoomAir->TotNumOfZoneAirNodes(ZoneIndex); MaxNumOfAirNodes = max(MaxNumOfAirNodes, NumOfAirNodes); // assign zone data state.dataMundtSimMgr->ZoneData(ZoneIndex).NumOfSurfs = NumOfSurfs; @@ -227,7 +227,7 @@ namespace MundtSimMgr { } for (auto &e : state.dataMundtSimMgr->LineNode) { e.AirNodeName.clear(); - e.ClassType = DataRoomAirModel::AirNodeType::Invalid; + e.ClassType = RoomAir::AirNodeType::Invalid; e.Height = 0.0; e.Temp = 25.0; } @@ -246,7 +246,7 @@ namespace MundtSimMgr { // get air node data RoomNodesCount = 0; FloorSurfCount = 0; - for (NodeNum = 1; NodeNum <= state.dataRoomAirMod->TotNumOfZoneAirNodes(ZoneIndex); ++NodeNum) { + for (NodeNum = 1; NodeNum <= state.dataRoomAir->TotNumOfZoneAirNodes(ZoneIndex); ++NodeNum) { state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex) .SurfMask.allocate(state.dataMundtSimMgr->ZoneData(ZoneIndex).NumOfSurfs); @@ -256,19 +256,17 @@ namespace MundtSimMgr { } // error check for debugging - if (AirNodeBeginNum > state.dataRoomAirMod->TotNumOfAirNodes) { + if (AirNodeBeginNum > state.dataRoomAir->TotNumOfAirNodes) { ShowFatalError(state, "An array bound exceeded. Error in InitMundtModel subroutine of MundtSimMgr."); } AirNodeFoundFlag = false; - for (AirNodeNum = AirNodeBeginNum; AirNodeNum <= state.dataRoomAirMod->TotNumOfAirNodes; ++AirNodeNum) { - if (UtilityRoutines::SameString(state.dataRoomAirMod->AirNode(AirNodeNum).ZoneName, thisZone.Name)) { - state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType = - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType; - state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).AirNodeName = state.dataRoomAirMod->AirNode(AirNodeNum).Name; - state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).Height = state.dataRoomAirMod->AirNode(AirNodeNum).Height; - state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).SurfMask = - state.dataRoomAirMod->AirNode(AirNodeNum).SurfMask; + for (AirNodeNum = AirNodeBeginNum; AirNodeNum <= state.dataRoomAir->TotNumOfAirNodes; ++AirNodeNum) { + if (UtilityRoutines::SameString(state.dataRoomAir->AirNode(AirNodeNum).ZoneName, thisZone.Name)) { + state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType = state.dataRoomAir->AirNode(AirNodeNum).ClassType; + state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).AirNodeName = state.dataRoomAir->AirNode(AirNodeNum).Name; + state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).Height = state.dataRoomAir->AirNode(AirNodeNum).Height; + state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).SurfMask = state.dataRoomAir->AirNode(AirNodeNum).SurfMask; SetupOutputVariable(state, "Room Air Node Air Temperature", OutputProcessor::Unit::C, @@ -292,12 +290,12 @@ namespace MundtSimMgr { } // count air nodes connected to walls in each zone - if (state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType == DataRoomAirModel::AirNodeType::MundtRoomAir) { + if (state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType == RoomAir::AirNodeType::Mundt) { ++RoomNodesCount; } // count floors in each zone - if (state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType == DataRoomAirModel::AirNodeType::FloorAir) { + if (state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).ClassType == RoomAir::AirNodeType::Floor) { FloorSurfCount += count(state.dataMundtSimMgr->LineNode(NodeNum, MundtZoneIndex).SurfMask); } } @@ -320,7 +318,7 @@ namespace MundtSimMgr { //***************************************************************************************** - void GetSurfHBDataForMundtModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + void GetSurfHBDataForDispVent1Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: @@ -426,9 +424,9 @@ namespace MundtSimMgr { //***************************************************************************************** - void SetupMundtModel(EnergyPlusData &state, - int const ZoneNum, // index number for the specified zone - bool &ErrorsFound // true if problems setting up model + void SetupDispVent1Node(EnergyPlusData &state, + int const ZoneNum, // index number for the specified zone + bool &ErrorsFound // true if problems setting up model ) { @@ -449,9 +447,6 @@ namespace MundtSimMgr { // REFERENCES: // na - // Using/Aliasing - using namespace DataRoomAirModel; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -470,25 +465,25 @@ namespace MundtSimMgr { // set up air node ID state.dataMundtSimMgr->NumRoomNodes = 0; - for (NodeNum = 1; NodeNum <= state.dataRoomAirMod->TotNumOfZoneAirNodes(ZoneNum); ++NodeNum) { + for (NodeNum = 1; NodeNum <= state.dataRoomAir->TotNumOfZoneAirNodes(ZoneNum); ++NodeNum) { switch (state.dataMundtSimMgr->LineNode(NodeNum, state.dataMundtSimMgr->MundtZoneNum).ClassType) { - case AirNodeType::InletAir: { // inlet + case RoomAir::AirNodeType::Inlet: { // inlet state.dataMundtSimMgr->SupplyNodeID = NodeNum; } break; - case AirNodeType::FloorAir: { // floor + case RoomAir::AirNodeType::Floor: { // floor state.dataMundtSimMgr->MundtFootAirID = NodeNum; } break; - case AirNodeType::ControlAir: { // thermostat + case RoomAir::AirNodeType::Control: { // thermostat state.dataMundtSimMgr->TstatNodeID = NodeNum; } break; - case AirNodeType::CeilingAir: { // ceiling + case RoomAir::AirNodeType::Ceiling: { // ceiling state.dataMundtSimMgr->MundtCeilAirID = NodeNum; } break; - case AirNodeType::MundtRoomAir: { // wall + case RoomAir::AirNodeType::Mundt: { // wall ++state.dataMundtSimMgr->NumRoomNodes; state.dataMundtSimMgr->RoomNodeIDs(state.dataMundtSimMgr->NumRoomNodes) = NodeNum; } break; - case AirNodeType::ReturnAir: { // return + case RoomAir::AirNodeType::Return: { // return state.dataMundtSimMgr->ReturnNodeID = NodeNum; } break; default: { @@ -528,7 +523,7 @@ namespace MundtSimMgr { //***************************************************************************************** - void CalcMundtModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + void CalcDispVent1Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: @@ -562,8 +557,8 @@ namespace MundtSimMgr { int SurfCounted; // number of surfaces assciated with an air node // apply floor splits - QequipConvFloor = state.dataRoomAirMod->ConvectiveFloorSplit(ZoneNum) * state.dataMundtSimMgr->ConvIntGain; - QSensInfilFloor = -state.dataRoomAirMod->InfiltratFloorSplit(ZoneNum) * state.dataMundtSimMgr->QventCool; + QequipConvFloor = state.dataRoomAir->ConvectiveFloorSplit(ZoneNum) * state.dataMundtSimMgr->ConvIntGain; + QSensInfilFloor = -state.dataRoomAir->InfiltratFloorSplit(ZoneNum) * state.dataMundtSimMgr->QventCool; // Begin computations for Mundt model @@ -720,7 +715,7 @@ namespace MundtSimMgr { //***************************************************************************************** - void SetSurfHBDataForMundtModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + void SetSurfHBDataForDispVent1Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: @@ -742,7 +737,7 @@ namespace MundtSimMgr { if ((state.dataMundtSimMgr->SupplyAirVolumeRate > 0.0001) && (state.dataMundtSimMgr->QsysCoolTot > 0.0001)) { // Controlled zone when the system is on - if (state.dataRoomAirMod->AirModel(ZoneNum).TempCoupleScheme == DataRoomAirModel::CouplingScheme::Direct) { + if (state.dataRoomAir->AirModel(ZoneNum).TempCoupleScheme == RoomAir::CouplingScheme::Direct) { // Use direct coupling scheme to report air temperatures back to surface/system domains // a) Bulk air temperatures -> TempEffBulkAir(SurfNum) for (int SurfNum = 1; SurfNum <= NumOfSurfs; ++SurfNum) { @@ -791,7 +786,7 @@ namespace MundtSimMgr { .ZT; // for indirect coupling, control air temp is equal to mean air temp? } // set flag to indicate that Mundt model is used for this zone at the present time - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; } else { // Controlled zone when the system is off --> Use the mixing model instead of the Mundt model // Bulk air temperatures -> TempEffBulkAir(SurfNum) for (int SurfNum = 1; SurfNum <= NumOfSurfs; ++SurfNum) { @@ -802,12 +797,12 @@ namespace MundtSimMgr { state.dataSurface->SurfTAirRefRpt(hbSurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(hbSurfNum)]; } // set flag to indicate that Mundt model is NOT used for this zone at the present time - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; } } //***************************************************************************************** -} // namespace MundtSimMgr +} // namespace RoomAir } // namespace EnergyPlus diff --git a/src/EnergyPlus/MundtSimMgr.hh b/src/EnergyPlus/MundtSimMgr.hh index 1e57764f492..d8c8007de31 100644 --- a/src/EnergyPlus/MundtSimMgr.hh +++ b/src/EnergyPlus/MundtSimMgr.hh @@ -62,37 +62,27 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace MundtSimMgr { +namespace RoomAir { // Types struct DefineLinearModelNode { // Members - std::string AirNodeName; // Name of air nodes - DataRoomAirModel::AirNodeType ClassType; // Type of air nodes - Real64 Height; // Z coordinates [m] node's Control Vol. center - Real64 Temp; // Surface temperature BC - Array1D_bool SurfMask; // Limit of 60 surfaces at current sizing - - // Default Constructor - DefineLinearModelNode() : ClassType(DataRoomAirModel::AirNodeType::Invalid), Height(0.0), Temp(0.0) - { - } + std::string AirNodeName = ""; // Name of air nodes + RoomAir::AirNodeType ClassType = RoomAir::AirNodeType::Invalid; // Type of air nodes + Real64 Height = 0.0; // Z coordinates [m] node's Control Vol. center + Real64 Temp = 0.0; // Surface temperature BC + Array1D_bool SurfMask; // Limit of 60 surfaces at current sizing }; struct DefineSurfaceSettings { // Members - Real64 Area; // m2 - Real64 Temp; // surface temperature BC - Real64 Hc; // convective film coeff BC - Real64 TMeanAir; // effective near-surface air temp from air model solution - - // Default Constructor - DefineSurfaceSettings() : Area(0.0), Temp(0.0), Hc(0.0), TMeanAir(0.0) - { - } + Real64 Area = 0.0; // m2 + Real64 Temp = 0.0; // surface temperature BC + Real64 Hc = 0.0; // convective film coeff BC + Real64 TMeanAir = 0.0; // effective near-surface air temp from air model solution }; struct DefineZoneData @@ -105,26 +95,26 @@ namespace MundtSimMgr { // Functions - void ManageMundtModel(EnergyPlusData &state, int ZoneNum); // index number for the specified zone + void ManageDispVent1Node(EnergyPlusData &state, int ZoneNum); // index number for the specified zone //***************************************************************************************** - void InitMundtModel(EnergyPlusData &state); + void InitDispVent1Node(EnergyPlusData &state); //***************************************************************************************** - void GetSurfHBDataForMundtModel(EnergyPlusData &state, int ZoneNum); // index number for the specified zone + void GetSurfHBDataForDispVent1Node(EnergyPlusData &state, int ZoneNum); // index number for the specified zone //***************************************************************************************** - void SetupMundtModel(EnergyPlusData &state, - int ZoneNum, // index number for the specified zone - bool &ErrorsFound // true if problems setting up model + void SetupDispVent1Node(EnergyPlusData &state, + int ZoneNum, // index number for the specified zone + bool &ErrorsFound // true if problems setting up model ); //***************************************************************************************** - void CalcMundtModel(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone + void CalcDispVent1Node(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone //***************************************************************************************** @@ -142,11 +132,11 @@ namespace MundtSimMgr { //***************************************************************************************** - void SetSurfHBDataForMundtModel(EnergyPlusData &state, int ZoneNum); // index number for the specified zone + void SetSurfHBDataForDispVent1Node(EnergyPlusData &state, int ZoneNum); // index number for the specified zone //***************************************************************************************** -} // namespace MundtSimMgr +} // namespace RoomAir struct MundtSimMgrData : BaseGlobalStruct { @@ -173,10 +163,10 @@ struct MundtSimMgrData : BaseGlobalStruct Real64 QsysCoolTot = 0.0; // zone sensible cooling load // Object Data - Array1D ZoneData; // zone data - Array2D LineNode; // air nodes - Array2D MundtAirSurf; // surfaces - Array1D FloorSurf; // floor + Array1D ZoneData; // zone data + Array2D LineNode; // air nodes + Array2D MundtAirSurf; // surfaces + Array1D FloorSurf; // floor void clear_state() override { diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index b907d41c7a2..1d0c1ed71f4 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -510,8 +510,7 @@ namespace OutdoorAirUnit { if (!lAlphaBlanks(9)) { constexpr std::array(OAUnitCtrlType::Num)> ctrlTypeNamesUC = { "NEUTRALCONTROL", "INVALID-UNCONDITIONED", "TEMPERATURECONTROL"}; - OAUnitCtrlType const tmpCtrlType = - static_cast(getEnumerationValue(ctrlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); + OAUnitCtrlType const tmpCtrlType = static_cast(getEnumValue(ctrlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); switch (tmpCtrlType) { case OAUnitCtrlType::Neutral: case OAUnitCtrlType::Temperature: @@ -664,7 +663,7 @@ namespace OutdoorAirUnit { thisOutAirUnit.OAEquip(InListNum).ComponentName = AlphArray(InListNum * 2 + 1); thisOutAirUnit.OAEquip(InListNum).Type = - static_cast(getEnumerationValue(CompTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(InListNum * 2)))); + static_cast(getEnumValue(CompTypeNamesUC, UtilityRoutines::makeUPPER(AlphArray(InListNum * 2)))); int const CompNum = InListNum; @@ -1190,13 +1189,13 @@ namespace OutdoorAirUnit { } if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::OutdoorAirUnit).ZoneCompAvailMgrs(OAUnitNum); if (state.dataOutdoorAirUnit->MyZoneEqFlag(OAUnitNum)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::OutdoorAirUnit).ZoneCompAvailMgrs(OAUnitNum).AvailManagerListName = - thisOutAirUnit.AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::OutdoorAirUnit).ZoneCompAvailMgrs(OAUnitNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = thisOutAirUnit.AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataOutdoorAirUnit->MyZoneEqFlag(OAUnitNum) = false; } - thisOutAirUnit.AvailStatus = ZoneComp(DataZoneEquipment::ZoneEquip::OutdoorAirUnit).ZoneCompAvailMgrs(OAUnitNum).AvailStatus; + thisOutAirUnit.AvailStatus = availMgr.AvailStatus; } if (state.dataOutdoorAirUnit->MyPlantScanFlag(OAUnitNum) && allocated(state.dataPlnt->PlantLoop)) { diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index 4c1c225f196..0af70d89a6e 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -462,7 +462,7 @@ namespace OutputProcessor { ReportingFrequency ReportFreq(ReportingFrequency::Hourly); // Default // TODO: I think it's supposed to be upper case already, but tests aren't doing that at least... - const std::string FreqStringUpper = UtilityRoutines::MakeUPPERCase(FreqString); + const std::string FreqStringUpper = UtilityRoutines::makeUPPER(FreqString); std::string::size_type const LenString = min(len(FreqString), static_cast(4u)); if (LenString < 4u) { @@ -914,7 +914,7 @@ namespace OutputProcessor { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - namesOfMeterCustom.emplace(UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(1))); + namesOfMeterCustom.emplace(UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(1))); } for (Loop = 1; Loop <= NumCustomMeters; ++Loop) { @@ -949,7 +949,7 @@ namespace OutputProcessor { // check if any fields reference another Meter:Custom int found = 0; for (fldIndex = 4; fldIndex <= NumAlpha; fldIndex += 2) { - if (namesOfMeterCustom.find(UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(fldIndex))) != namesOfMeterCustom.end()) { + if (namesOfMeterCustom.find(UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(fldIndex))) != namesOfMeterCustom.end()) { found = fldIndex; break; } @@ -1006,7 +1006,7 @@ namespace OutputProcessor { // Can't use resource type in AddMeter cause it will confuse it with other meters. So, now: GetStandardMeterResourceType(state, op->EnergyMeters(op->NumEnergyMeters).ResourceType, - UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)), + UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)), errFlag); if (errFlag) { ShowContinueError(state, format("..on {}=\"{}\".", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -1261,7 +1261,7 @@ namespace OutputProcessor { // Can't use resource type in AddMeter cause it will confuse it with other meters. So, now: GetStandardMeterResourceType(state, op->EnergyMeters(op->NumEnergyMeters).ResourceType, - UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)), + UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)), errFlag); if (errFlag) { ShowContinueError(state, format("..on {}=\"{}\".", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -1445,9 +1445,9 @@ namespace OutputProcessor { // the standard resource type. ErrorsFound = false; - std::string const meterType = UtilityRoutines::MakeUPPERCase(UserInputResourceType); + std::string const meterType = UtilityRoutines::makeUPPER(UserInputResourceType); - int eMeterResource = getEnumerationValue(Constant::eResourceNamesUC, meterType); + int eMeterResource = getEnumValue(Constant::eResourceNamesUC, meterType); if (eMeterResource == static_cast(Constant::eResource::Invalid)) { ShowSevereError(state, format("GetStandardMeterResourceType: Illegal OutResourceType (for Meters) Entered={}", UserInputResourceType)); @@ -1753,7 +1753,7 @@ namespace OutputProcessor { auto &op = state.dataOutputProcessor; // Basic ResourceType Meters - GetStandardMeterResourceType(state, ResourceType, UtilityRoutines::MakeUPPERCase(ResourceType), LocalErrorsFound); + GetStandardMeterResourceType(state, ResourceType, UtilityRoutines::makeUPPER(ResourceType), LocalErrorsFound); if (!LocalErrorsFound) { if (op->NumEnergyMeters > 0) { @@ -2068,7 +2068,7 @@ namespace OutputProcessor { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: ErrorsFound = false; - std::string UC_ResourceType = UtilityRoutines::MakeUPPERCase(ResourceType); + std::string UC_ResourceType = UtilityRoutines::makeUPPER(ResourceType); CodeForIPUnits = RT_IPUnits::OtherJ; if (has(UC_ResourceType, "ELEC")) { @@ -4234,7 +4234,7 @@ namespace OutputProcessor { OutputProcessor::Unit unitStringToEnum(std::string const &unitIn) { // J.Glazer - August/September 2017 - std::string unitUpper = UtilityRoutines::MakeUPPERCase(unitIn); + std::string unitUpper = UtilityRoutines::makeUPPER(unitIn); if (unitUpper == "J") { return OutputProcessor::Unit::J; } else if (unitUpper == "DELTAC") { @@ -4438,7 +4438,7 @@ void SetupOutputVariable(EnergyPlusData &state, } else { EndUseSub = ""; if (!EndUseKey.empty()) { - if (std::find(endUseCategoryNames.begin(), endUseCategoryNames.end(), UtilityRoutines::MakeUPPERCase(std::string{EndUseKey})) != + if (std::find(endUseCategoryNames.begin(), endUseCategoryNames.end(), UtilityRoutines::makeUPPER(std::string{EndUseKey})) != endUseCategoryNames.end()) { EndUseSub = "General"; } @@ -4488,9 +4488,9 @@ void SetupOutputVariable(EnergyPlusData &state, thisRvar.storeType = VariableType; thisRvar.VarName = fmt::format("{}:{}", KeyedValue, VarName); thisRvar.VarNameOnly = VarName; - thisRvar.VarNameOnlyUC = UtilityRoutines::MakeUPPERCase(VarName); - thisRvar.VarNameUC = UtilityRoutines::MakeUPPERCase(thisRvar.VarName); - thisRvar.KeyNameOnlyUC = UtilityRoutines::MakeUPPERCase(KeyedValue); + thisRvar.VarNameOnlyUC = UtilityRoutines::makeUPPER(VarName); + thisRvar.VarNameUC = UtilityRoutines::makeUPPER(thisRvar.VarName); + thisRvar.KeyNameOnlyUC = UtilityRoutines::makeUPPER(KeyedValue); thisRvar.units = VariableUnit; if (VariableUnit == OutputProcessor::Unit::customEMS) { thisRvar.unitNameCustomEMS = customUnitName; @@ -4667,9 +4667,9 @@ void SetupOutputVariable(EnergyPlusData &state, thisIVar.storeType = VariableType; thisIVar.VarName = fmt::format("{}:{}", KeyedValue, VarName); thisIVar.VarNameOnly = VarName; - thisIVar.VarNameOnlyUC = UtilityRoutines::MakeUPPERCase(VarName); - thisIVar.VarNameUC = UtilityRoutines::MakeUPPERCase(thisIVar.VarName); - thisIVar.KeyNameOnlyUC = UtilityRoutines::MakeUPPERCase(KeyedValue); + thisIVar.VarNameOnlyUC = UtilityRoutines::makeUPPER(VarName); + thisIVar.VarNameUC = UtilityRoutines::makeUPPER(thisIVar.VarName); + thisIVar.KeyNameOnlyUC = UtilityRoutines::makeUPPER(KeyedValue); thisIVar.units = VariableUnit; AssignReportNumber(state, op->CurrentReportNumber); std::string const IDOut = fmt::to_string(op->CurrentReportNumber); @@ -6202,7 +6202,7 @@ int GetMeterIndex(EnergyPlusData &state, std::string const &MeterName) state.dataOutputProcessor->NumValidMeters = op->NumEnergyMeters; state.dataOutputProcessor->ValidMeterNames.allocate(state.dataOutputProcessor->NumValidMeters); for (Found = 1; Found <= state.dataOutputProcessor->NumValidMeters; ++Found) { - state.dataOutputProcessor->ValidMeterNames(Found) = UtilityRoutines::MakeUPPERCase(op->EnergyMeters(Found).Name); + state.dataOutputProcessor->ValidMeterNames(Found) = UtilityRoutines::makeUPPER(op->EnergyMeters(Found).Name); } state.dataOutputProcessor->iValidMeterNames.allocate(state.dataOutputProcessor->NumValidMeters); SetupAndSort(state.dataOutputProcessor->ValidMeterNames, state.dataOutputProcessor->iValidMeterNames); @@ -6753,14 +6753,14 @@ void GetMeteredVariables(EnergyPlusData &state, unitsForVar(NumVariables) = op->RVariableTypes(Loop).units; ResourceTypes(NumVariables) = static_cast( - getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).ResourceType))); + getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).ResourceType))); Names(NumVariables) = op->RVariableTypes(Loop).VarNameUC; for (MeterNum = 1; MeterNum <= NumOnMeterPtr; ++MeterNum) { MeterPtr = op->VarMeterArrays(rVar.MeterArrayPtr).OnMeters(MeterNum); if (!op->EnergyMeters(MeterPtr).EndUse.empty()) { - EndUses(NumVariables) = UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).EndUse); + EndUses(NumVariables) = UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).EndUse); break; } } @@ -6768,7 +6768,7 @@ void GetMeteredVariables(EnergyPlusData &state, for (MeterNum = 1; MeterNum <= NumOnMeterPtr; ++MeterNum) { MeterPtr = op->VarMeterArrays(rVar.MeterArrayPtr).OnMeters(MeterNum); if (!op->EnergyMeters(MeterPtr).Group.empty()) { - Groups(NumVariables) = UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).Group); + Groups(NumVariables) = UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).Group); break; } } @@ -6836,13 +6836,13 @@ void GetMeteredVariables(EnergyPlusData &state, unitsForVar(NumVariables) = op->RVariableTypes(Loop).units; ResourceTypes(NumVariables) = static_cast( - getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).ResourceType))); + getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).ResourceType))); Names(NumVariables) = op->RVariableTypes(Loop).VarNameUC; for (MeterNum = 1; MeterNum <= NumOnMeterPtr; ++MeterNum) { MeterPtr = op->VarMeterArrays(rVar.MeterArrayPtr).OnMeters(MeterNum); if (!op->EnergyMeters(MeterPtr).EndUse.empty()) { - EndUses(NumVariables) = UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).EndUse); + EndUses(NumVariables) = UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).EndUse); break; } } @@ -6850,7 +6850,7 @@ void GetMeteredVariables(EnergyPlusData &state, for (MeterNum = 1; MeterNum <= NumOnMeterPtr; ++MeterNum) { MeterPtr = op->VarMeterArrays(rVar.MeterArrayPtr).OnMeters(MeterNum); if (!op->EnergyMeters(MeterPtr).Group.empty()) { - Groups(NumVariables) = UtilityRoutines::MakeUPPERCase(op->EnergyMeters(MeterPtr).Group); + Groups(NumVariables) = UtilityRoutines::makeUPPER(op->EnergyMeters(MeterPtr).Group); break; } } @@ -6935,7 +6935,7 @@ void GetVariableKeyCountandType(EnergyPlusData &state, op->numVarNames = op->NumVariablesForOutput; op->varNames.allocate(op->numVarNames); for (Loop = 1; Loop <= op->NumVariablesForOutput; ++Loop) { - op->varNames(Loop) = UtilityRoutines::MakeUPPERCase(op->DDVariableTypes(Loop).VarNameOnly); + op->varNames(Loop) = UtilityRoutines::makeUPPER(op->DDVariableTypes(Loop).VarNameOnly); } op->ivarNames.allocate(op->numVarNames); SetupAndSort(op->varNames, op->ivarNames); @@ -6946,7 +6946,7 @@ void GetVariableKeyCountandType(EnergyPlusData &state, op->numVarNames = op->NumVariablesForOutput; op->varNames.allocate(op->numVarNames); for (Loop = 1; Loop <= op->NumVariablesForOutput; ++Loop) { - op->varNames(Loop) = UtilityRoutines::MakeUPPERCase(op->DDVariableTypes(Loop).VarNameOnly); + op->varNames(Loop) = UtilityRoutines::makeUPPER(op->DDVariableTypes(Loop).VarNameOnly); } op->ivarNames.allocate(op->numVarNames); SetupAndSort(op->varNames, op->ivarNames); @@ -7105,7 +7105,7 @@ void GetVariableKeys(EnergyPlusData &state, Duplicate = false; maxKeyNames = size(keyNames); maxkeyVarIndexes = size(keyVarIndexes); - varNameUpper = UtilityRoutines::MakeUPPERCase(varName); + varNameUpper = UtilityRoutines::makeUPPER(varName); auto &op = state.dataOutputProcessor; // Select based on variable type: integer, real, or meter diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 0d3c2ede721..016353b4647 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -613,7 +613,7 @@ void InitializeTabularMonthly(EnergyPlusData &state) // #ifdef ITM_KEYCACHE // Noel comment: First time in this TabNum/ColNum loop, let's save the results // of GetVariableKeyCountandType & GetVariableKeys. - std::string const &curVariMeter = UtilityRoutines::MakeUPPERCase(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter); + std::string const &curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter); // call the key count function but only need count during this pass int KeyCount = 0; GetVariableKeyCountandType(state, curVariMeter, KeyCount, TypeVar, AvgSumVar, StepTypeVar, UnitsVar); @@ -650,7 +650,7 @@ void InitializeTabularMonthly(EnergyPlusData &state) // MonthlyFieldSetInput(FirstColumn + ColNum - 1)%IndexesForKeyVar(iKey) = IndexesForKeyVar(iKey) !noel // ENDDO // #else - // curVariMeter = UtilityRoutines::MakeUPPERCase(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) + // curVariMeter = UtilityRoutines::makeUPPER(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) // ! call the key count function but only need count during this pass // CALL GetVariableKeyCountandType(state, curVariMeter,KeyCount,TypeVar,AvgSumVar,StepTypeVar,UnitsVar) // ALLOCATE(NamesOfKeys(KeyCount)) @@ -743,7 +743,7 @@ void InitializeTabularMonthly(EnergyPlusData &state) // IndexesForKeyVar(iKey) = MonthlyFieldSetInput(FirstColumn + ColNum - 1)%IndexesForKeyVar(iKey) !noel // ENDDO // #else - // curVariMeter = UtilityRoutines::MakeUPPERCase(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) + // curVariMeter = UtilityRoutines::makeUPPER(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) // ! call the key count function but only need count during this pass // CALL GetVariableKeyCountandType(state, curVariMeter,KeyCount,TypeVar,AvgSumVar,StepTypeVar,UnitsVar) // ALLOCATE(NamesOfKeys(KeyCount)) @@ -839,7 +839,7 @@ void InitializeTabularMonthly(EnergyPlusData &state) // IndexesForKeyVar(iKey) = MonthlyFieldSetInput(FirstColumn + ColNum - 1)%IndexesForKeyVar(iKey) !noel // ENDDO // #else - // curVariMeter = UtilityRoutines::MakeUPPERCase(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) + // curVariMeter = UtilityRoutines::makeUPPER(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) // ! call the key count function but only need count during this pass // CALL GetVariableKeyCountandType(state, curVariMeter,KeyCount,TypeVar,AvgSumVar,StepTypeVar,UnitsVar) // ALLOCATE(NamesOfKeys(KeyCount)) @@ -18575,7 +18575,7 @@ void LookupSItoIP(EnergyPlusData &state, std::string const &stringInWithSI, int int constexpr misParen(2); int constexpr misBrce(3); int constexpr misNoHint(4); - std::string const stringInUpper(UtilityRoutines::MakeUPPERCase(stringInWithSI)); + std::string const stringInUpper(UtilityRoutines::makeUPPER(stringInWithSI)); auto &ort = state.dataOutRptTab; stringOutWithIP = ""; diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.cc b/src/EnergyPlus/PackagedThermalStorageCoil.cc index 8220ae14b3c..8a09ba1f885 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.cc +++ b/src/EnergyPlus/PackagedThermalStorageCoil.cc @@ -256,7 +256,7 @@ void GetTESCoilInput(EnergyPlusData &state) ErrorsFound = true; } } - thisTESCoil.ModeControlType = static_cast(getEnumerationValue(modeControlStrings, state.dataIPShortCut->cAlphaArgs(3))); + thisTESCoil.ModeControlType = static_cast(getEnumValue(modeControlStrings, state.dataIPShortCut->cAlphaArgs(3))); if (thisTESCoil.ModeControlType == PTSCCtrlType::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); ShowContinueError(state, format("...{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); @@ -278,7 +278,7 @@ void GetTESCoilInput(EnergyPlusData &state) } } - thisTESCoil.StorageMedia = static_cast(getEnumerationValue(mediaStrings, state.dataIPShortCut->cAlphaArgs(5))); + thisTESCoil.StorageMedia = static_cast(getEnumValue(mediaStrings, state.dataIPShortCut->cAlphaArgs(5))); switch (thisTESCoil.StorageMedia) { case MediaType::Ice: case MediaType::UserDefindFluid: @@ -1449,7 +1449,7 @@ void GetTESCoilInput(EnergyPlusData &state) thisTESCoil.CondenserAirVolumeFlow = state.dataIPShortCut->rNumericArgs(34); thisTESCoil.CondenserAirFlowSizingFactor = state.dataIPShortCut->rNumericArgs(35); - thisTESCoil.CondenserType = static_cast(getEnumerationValue(condenserTypesUC, state.dataIPShortCut->cAlphaArgs(58))); + thisTESCoil.CondenserType = static_cast(getEnumValue(condenserTypesUC, state.dataIPShortCut->cAlphaArgs(58))); if (thisTESCoil.CondenserType == TESCondenserType::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(58), state.dataIPShortCut->cAlphaArgs(58))); diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index f00fb5b4949..d02795b869b 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -208,8 +208,8 @@ namespace PhotovoltaicThermalCollectors { state.dataIPShortCut->cNumericFieldNames); auto &thisTmpSimplePVTperf = tmpSimplePVTperf(Item); thisTmpSimplePVTperf.Name = state.dataIPShortCut->cAlphaArgs(1); - thisTmpSimplePVTperf.ThermEfficMode = static_cast( - getEnumerationValue(ThermEfficTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)))); + thisTmpSimplePVTperf.ThermEfficMode = + static_cast(getEnumValue(ThermEfficTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); thisTmpSimplePVTperf.ThermalActiveFract = state.dataIPShortCut->rNumericArgs(1); thisTmpSimplePVTperf.ThermEffic = state.dataIPShortCut->rNumericArgs(2); thisTmpSimplePVTperf.ThermEffSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index 2c2c7f50fc2..9af113f4042 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -327,7 +327,7 @@ void GetPipesHeatTransfer(EnergyPlusData &state) if (state.dataIPShortCut->lAlphaFieldBlanks(5)) state.dataIPShortCut->cAlphaArgs(5) = "ZONE"; PipeIndoorBoundaryType indoorType = - static_cast(getEnumerationValue(pipeIndoorBoundaryTypeNamesUC, state.dataIPShortCut->cAlphaArgs(5))); + static_cast(getEnumValue(pipeIndoorBoundaryTypeNamesUC, state.dataIPShortCut->cAlphaArgs(5))); switch (indoorType) { case PipeIndoorBoundaryType::Zone: state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::ZoneEnv; diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index 13009b2c158..df6af1ff71c 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -597,8 +597,8 @@ void GetPlantLoopData(EnergyPlusData &state) if (NumAlphas >= PressSimAlphaIndex) { MatchedPressureString = false; - this_loop.PressureSimType = static_cast( - getEnumerationValue(PressureSimTypeNamesUC, UtilityRoutines::MakeUPPERCase(Alpha(PressSimAlphaIndex)))); + this_loop.PressureSimType = + static_cast(getEnumValue(PressureSimTypeNamesUC, UtilityRoutines::makeUPPER(Alpha(PressSimAlphaIndex)))); switch (this_loop.PressureSimType) { // Check all types case DataPlant::PressSimType::NoPressure: @@ -875,8 +875,7 @@ void GetPlantInput(EnergyPlusData &state) this_comp.TypeOf = this_comp_type; this_comp.location = EnergyPlus::PlantLocation(LoopNum, LoopSideNum, BranchNum, CompNum); - this_comp.Type = - static_cast(getEnumerationValue(PlantEquipTypeNamesUC, UtilityRoutines::MakeUPPERCase(this_comp_type))); + this_comp.Type = static_cast(getEnumValue(PlantEquipTypeNamesUC, UtilityRoutines::makeUPPER(this_comp_type))); switch (this_comp.Type) { case PlantEquipmentType::Pipe: { diff --git a/src/EnergyPlus/PlantChillers.cc b/src/EnergyPlus/PlantChillers.cc index a4820864d1f..65549cb997d 100644 --- a/src/EnergyPlus/PlantChillers.cc +++ b/src/EnergyPlus/PlantChillers.cc @@ -150,7 +150,7 @@ namespace PlantChillers { state.dataPlantChillers->GetElectricInput = false; } for (auto &thisChiller : state.dataPlantChillers->ElectricChiller) { - if (UtilityRoutines::MakeUPPERCase(thisChiller.Name) == chillerName) { + if (UtilityRoutines::makeUPPER(thisChiller.Name) == chillerName) { return &thisChiller; } } @@ -218,7 +218,7 @@ namespace PlantChillers { thisChiller.ChillerType = DataPlant::PlantEquipmentType::Chiller_Electric; thisChiller.CondenserType = static_cast( - getEnumerationValue(DataPlant::CondenserTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)))); + getEnumValue(DataPlant::CondenserTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); switch (thisChiller.CondenserType) { case DataPlant::CondenserType::AirCooled: case DataPlant::CondenserType::WaterCooled: @@ -432,8 +432,7 @@ namespace PlantChillers { thisChiller.SizFac = state.dataIPShortCut->rNumericArgs(22); if (thisChiller.SizFac <= 0.0) thisChiller.SizFac = 1.0; - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(7))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(7))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -2072,7 +2071,7 @@ namespace PlantChillers { state.dataPlantChillers->GetEngineDrivenInput = false; } for (auto &thisChiller : state.dataPlantChillers->EngineDrivenChiller) { - if (UtilityRoutines::MakeUPPERCase(thisChiller.Name) == chillerName) { + if (UtilityRoutines::makeUPPER(thisChiller.Name) == chillerName) { return &thisChiller; } } @@ -2430,7 +2429,7 @@ namespace PlantChillers { thisChiller.DesignMinExitGasTemp = state.dataIPShortCut->rNumericArgs(24); // Validate fuel type input - thisChiller.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(12))); + thisChiller.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(12))); thisChiller.FuelHeatingValue = state.dataIPShortCut->rNumericArgs(25); @@ -2514,8 +2513,7 @@ namespace PlantChillers { } } - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(15))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(15))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -4075,7 +4073,7 @@ namespace PlantChillers { state.dataPlantChillers->GetGasTurbineInput = false; } for (auto &thisChiller : state.dataPlantChillers->GTChiller) { - if (UtilityRoutines::MakeUPPERCase(thisChiller.Name) == chillerName) { + if (UtilityRoutines::makeUPPER(thisChiller.Name) == chillerName) { return &thisChiller; } } @@ -4471,8 +4469,7 @@ namespace PlantChillers { } } - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -4483,7 +4480,7 @@ namespace PlantChillers { } // Fuel Type Case Statement - thisChiller.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + thisChiller.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(10))); if (thisChiller.FuelType == Constant::eFuel::Invalid) { ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); @@ -6002,7 +5999,7 @@ namespace PlantChillers { state.dataPlantChillers->GetConstCOPInput = false; } for (auto &thisChiller : state.dataPlantChillers->ConstCOPChiller) { - if (UtilityRoutines::MakeUPPERCase(thisChiller.Name) == chillerName) { + if (UtilityRoutines::makeUPPER(thisChiller.Name) == chillerName) { return &thisChiller; } } @@ -6292,8 +6289,7 @@ namespace PlantChillers { } } - thisChiller.FlowMode = - static_cast(getEnumerationValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(7))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(7))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 31000a22606..6492aac3700 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1395,7 +1395,7 @@ void FindCompSPInput(EnergyPlusData &state, SchemeNameFound = true; DataLoopNode::ConnectionObjectType objType = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(CurrentModuleObject))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(CurrentModuleObject))); if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) { LoopOpSchemeObj = "PlantEquipmentOperationSchemes"; @@ -2064,7 +2064,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) for (int EquipNum = 1, EquipNum_end = this_equip_list.NumComps; EquipNum <= EquipNum_end; ++EquipNum) { auto &this_equip = this_equip_list.Comp(EquipNum); Type = static_cast( - getEnumerationValue(PlantEquipTypeNamesUC, UtilityRoutines::MakeUPPERCase(this_equip.TypeOf))); + getEnumValue(PlantEquipTypeNamesUC, UtilityRoutines::makeUPPER(this_equip.TypeOf))); errFlag1 = false; PlantUtilities::ScanPlantLoopsForObject(state, this_equip.Name, Type, plantLoc, errFlag1, _, _, NumSearchResults, _, LoopNum); diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index f088262fdee..520b2628540 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -816,7 +816,7 @@ PlantComponent *EIRPlantLoopHeatPump::factory(EnergyPlusData &state, DataPlant:: } for (auto &plhp : state.dataEIRPlantLoopHeatPump->heatPumps) { - if (plhp.name == UtilityRoutines::MakeUPPERCase(hp_name) && plhp.EIRHPType == hp_type) { + if (plhp.name == UtilityRoutines::makeUPPER(hp_name) && plhp.EIRHPType == hp_type) { return &plhp; } } @@ -829,12 +829,12 @@ void EIRPlantLoopHeatPump::pairUpCompanionCoils(EnergyPlusData &state) { for (auto &thisHP : state.dataEIRPlantLoopHeatPump->heatPumps) { if (!thisHP.companionCoilName.empty()) { - std::string const thisCoilName = UtilityRoutines::MakeUPPERCase(thisHP.name); + std::string const thisCoilName = UtilityRoutines::makeUPPER(thisHP.name); DataPlant::PlantEquipmentType thisCoilType = thisHP.EIRHPType; - std::string const targetCompanionName = UtilityRoutines::MakeUPPERCase(thisHP.companionCoilName); + std::string const targetCompanionName = UtilityRoutines::makeUPPER(thisHP.companionCoilName); for (auto &potentialCompanionCoil : state.dataEIRPlantLoopHeatPump->heatPumps) { DataPlant::PlantEquipmentType potentialCompanionType = potentialCompanionCoil.EIRHPType; - std::string potentialCompanionName = UtilityRoutines::MakeUPPERCase(potentialCompanionCoil.name); + std::string potentialCompanionName = UtilityRoutines::makeUPPER(potentialCompanionCoil.name); if (potentialCompanionName == thisCoilName) { // skip the current coil continue; @@ -896,7 +896,7 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) for (auto const &classToInput : classesToInput) { cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(cCurrentModuleObject))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(cCurrentModuleObject))); auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); if (instances == state.dataInputProcessing->inputProcessor->epJSON.end()) continue; auto &instancesValue = instances.value(); @@ -907,16 +907,16 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) EIRPlantLoopHeatPump thisPLHP; thisPLHP.EIRHPType = classToInput.thisType; - thisPLHP.name = UtilityRoutines::MakeUPPERCase(thisObjectName); - std::string loadSideInletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("load_side_inlet_node_name").get()); - std::string loadSideOutletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("load_side_outlet_node_name").get()); - std::string condenserType = UtilityRoutines::MakeUPPERCase(fields.at("condenser_type").get()); - std::string sourceSideInletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("source_side_inlet_node_name").get()); - std::string sourceSideOutletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("source_side_outlet_node_name").get()); + thisPLHP.name = UtilityRoutines::makeUPPER(thisObjectName); + std::string loadSideInletNodeName = UtilityRoutines::makeUPPER(fields.at("load_side_inlet_node_name").get()); + std::string loadSideOutletNodeName = UtilityRoutines::makeUPPER(fields.at("load_side_outlet_node_name").get()); + std::string condenserType = UtilityRoutines::makeUPPER(fields.at("condenser_type").get()); + std::string sourceSideInletNodeName = UtilityRoutines::makeUPPER(fields.at("source_side_inlet_node_name").get()); + std::string sourceSideOutletNodeName = UtilityRoutines::makeUPPER(fields.at("source_side_outlet_node_name").get()); auto compHPFound = fields.find("companion_heat_pump_name"); if (compHPFound != fields.end()) { // optional field - thisPLHP.companionCoilName = UtilityRoutines::MakeUPPERCase(compHPFound.value().get()); + thisPLHP.companionCoilName = UtilityRoutines::makeUPPER(compHPFound.value().get()); } auto &tmpFlowRate = fields.at("load_side_reference_flow_rate"); if (tmpFlowRate == "Autosize") { @@ -978,14 +978,14 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) } std::string const &capFtName = - UtilityRoutines::MakeUPPERCase(fields.at("capacity_modifier_function_of_temperature_curve_name").get()); + UtilityRoutines::makeUPPER(fields.at("capacity_modifier_function_of_temperature_curve_name").get()); thisPLHP.capFuncTempCurveIndex = Curve::GetCurveIndex(state, capFtName); if (thisPLHP.capFuncTempCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR PLHP (name={}; entered curve name: {}", thisPLHP.name, capFtName)); errorsFound = true; } - std::string const &eirFtName = UtilityRoutines::MakeUPPERCase( + std::string const &eirFtName = UtilityRoutines::makeUPPER( fields.at("electric_input_to_output_ratio_modifier_function_of_temperature_curve_name").get()); thisPLHP.powerRatioFuncTempCurveIndex = Curve::GetCurveIndex(state, eirFtName); if (thisPLHP.capFuncTempCurveIndex == 0) { @@ -993,7 +993,7 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state) errorsFound = true; } - std::string const &eirFplrName = UtilityRoutines::MakeUPPERCase( + std::string const &eirFplrName = UtilityRoutines::makeUPPER( fields.at("electric_input_to_output_ratio_modifier_function_of_part_load_ratio_curve_name").get()); thisPLHP.powerRatioFuncPLRCurveIndex = Curve::GetCurveIndex(state, eirFplrName); if (thisPLHP.capFuncTempCurveIndex == 0) { @@ -1818,7 +1818,7 @@ PlantComponent *EIRFuelFiredHeatPump::factory(EnergyPlusData &state, DataPlant:: } for (auto &plhp : state.dataEIRFuelFiredHeatPump->heatPumps) { - if (plhp.name == UtilityRoutines::MakeUPPERCase(hp_name) && plhp.EIRHPType == hp_type) { + if (plhp.name == UtilityRoutines::makeUPPER(hp_name) && plhp.EIRHPType == hp_type) { return &plhp; } } @@ -1831,12 +1831,12 @@ void EIRFuelFiredHeatPump::pairUpCompanionCoils(EnergyPlusData &state) { for (auto &thisHP : state.dataEIRFuelFiredHeatPump->heatPumps) { if (!thisHP.companionCoilName.empty()) { - std::string thisCoilName = UtilityRoutines::MakeUPPERCase(thisHP.name); + std::string thisCoilName = UtilityRoutines::makeUPPER(thisHP.name); DataPlant::PlantEquipmentType thisCoilType = thisHP.EIRHPType; - std::string targetCompanionName = UtilityRoutines::MakeUPPERCase(thisHP.companionCoilName); + std::string targetCompanionName = UtilityRoutines::makeUPPER(thisHP.companionCoilName); for (auto &potentialCompanionCoil : state.dataEIRFuelFiredHeatPump->heatPumps) { DataPlant::PlantEquipmentType potentialCompanionType = potentialCompanionCoil.EIRHPType; - std::string potentialCompanionName = UtilityRoutines::MakeUPPERCase(potentialCompanionCoil.name); + std::string potentialCompanionName = UtilityRoutines::makeUPPER(potentialCompanionCoil.name); if (potentialCompanionName == thisCoilName) { // skip the current coil continue; @@ -1901,7 +1901,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) cCurrentModuleObject = DataPlant::PlantEquipTypeNames[static_cast(classToInput.thisType)]; DataLoopNode::ConnectionObjectType objType = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(cCurrentModuleObject))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(cCurrentModuleObject))); auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); if (instances == state.dataInputProcessing->inputProcessor->epJSON.end()) continue; @@ -1922,28 +1922,28 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) } // A1-A3 - thisPLHP.name = UtilityRoutines::MakeUPPERCase(thisObjectName); - std::string loadSideInletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("water_inlet_node_name").get()); - std::string loadSideOutletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("water_outlet_node_name").get()); + thisPLHP.name = UtilityRoutines::makeUPPER(thisObjectName); + std::string loadSideInletNodeName = UtilityRoutines::makeUPPER(fields.at("water_inlet_node_name").get()); + std::string loadSideOutletNodeName = UtilityRoutines::makeUPPER(fields.at("water_outlet_node_name").get()); // Implicit - // std::string condenserType = "AIRSOURCE"; // UtilityRoutines::MakeUPPERCase(fields.at("condenser_type").get()); + // std::string condenserType = "AIRSOURCE"; // UtilityRoutines::makeUPPER(fields.at("condenser_type").get()); thisPLHP.airSource = true; thisPLHP.waterSource = false; // A4 - std::string sourceSideInletNodeName = UtilityRoutines::MakeUPPERCase(fields.at("air_source_node_name").get()); - // UtilityRoutines::MakeUPPERCase(fields.at("source_side_outlet_node_name").get()); + std::string sourceSideInletNodeName = UtilityRoutines::makeUPPER(fields.at("air_source_node_name").get()); + // UtilityRoutines::makeUPPER(fields.at("source_side_outlet_node_name").get()); std::string sourceSideOutletNodeName = format("{}_SOURCE_SIDE_OUTLET_NODE", thisPLHP.name); // A5 auto compCoilFound = fields.find(companionCoilFieldTag); if (compCoilFound != fields.end()) { // optional field - thisPLHP.companionCoilName = UtilityRoutines::MakeUPPERCase(compCoilFound.value().get()); + thisPLHP.companionCoilName = UtilityRoutines::makeUPPER(compCoilFound.value().get()); } // A6 Fuel Type - std::string tempRsrStr = UtilityRoutines::MakeUPPERCase(fields.at("fuel_type").get()); - thisPLHP.fuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, tempRsrStr)); + std::string tempRsrStr = UtilityRoutines::makeUPPER(fields.at("fuel_type").get()); + thisPLHP.fuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, tempRsrStr)); // Validate fuel type input static constexpr std::string_view RoutineName("processInputForEIRPLHP: "); if (thisPLHP.fuelType == Constant::eFuel::Invalid) { @@ -1955,7 +1955,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) } // A7 End use category - thisPLHP.endUseSubcat = UtilityRoutines::MakeUPPERCase(fields.at("end_use_subcategory").get()); + thisPLHP.endUseSubcat = UtilityRoutines::makeUPPER(fields.at("end_use_subcategory").get()); if (thisPLHP.endUseSubcat == "") { thisPLHP.endUseSubcat = "Heat Pump Fuel Fired"; // or "General"? } @@ -2021,21 +2021,20 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) // A8 flow mode thisPLHP.flowMode = static_cast( - getEnumerationValue(DataPlant::FlowModeNamesUC, UtilityRoutines::MakeUPPERCase(fields.at("flow_mode").get()))); + getEnumValue(DataPlant::FlowModeNamesUC, UtilityRoutines::makeUPPER(fields.at("flow_mode").get()))); // A9 outdoor_air_temperature_curve_input_variable std::string oaTempCurveInputVar = - UtilityRoutines::MakeUPPERCase(fields.at("outdoor_air_temperature_curve_input_variable").get()); - thisPLHP.oaTempCurveInputVar = static_cast(getEnumerationValue(OATempCurveVarNamesUC, oaTempCurveInputVar)); + UtilityRoutines::makeUPPER(fields.at("outdoor_air_temperature_curve_input_variable").get()); + thisPLHP.oaTempCurveInputVar = static_cast(getEnumValue(OATempCurveVarNamesUC, oaTempCurveInputVar)); // A10 water_temperature_curve_input_variable - std::string waterTempCurveInputVar = - UtilityRoutines::MakeUPPERCase(fields.at("water_temperature_curve_input_variable").get()); - thisPLHP.waterTempCurveInputVar = static_cast(getEnumerationValue(WaterTempCurveVarNamesUC, waterTempCurveInputVar)); + std::string waterTempCurveInputVar = UtilityRoutines::makeUPPER(fields.at("water_temperature_curve_input_variable").get()); + thisPLHP.waterTempCurveInputVar = static_cast(getEnumValue(WaterTempCurveVarNamesUC, waterTempCurveInputVar)); // A11 normalized_capacity_function_of_temperature_curve_name std::string const &capFtName = - UtilityRoutines::MakeUPPERCase(fields.at("normalized_capacity_function_of_temperature_curve_name").get()); + UtilityRoutines::makeUPPER(fields.at("normalized_capacity_function_of_temperature_curve_name").get()); thisPLHP.capFuncTempCurveIndex = Curve::GetCurveIndex(state, capFtName); if (thisPLHP.capFuncTempCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR PLFFHP (name={}; entered curve name: {}", thisPLHP.name, capFtName)); @@ -2044,7 +2043,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) // A12 fuel_energy_input_ratio_function_of_temperature_curve_name std::string const &eirFtName = - UtilityRoutines::MakeUPPERCase(fields.at("fuel_energy_input_ratio_function_of_temperature_curve_name").get()); + UtilityRoutines::makeUPPER(fields.at("fuel_energy_input_ratio_function_of_temperature_curve_name").get()); thisPLHP.powerRatioFuncTempCurveIndex = Curve::GetCurveIndex(state, eirFtName); if (thisPLHP.capFuncTempCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR PLFFHP (name={}; entered curve name: {}", thisPLHP.name, eirFtName)); @@ -2052,7 +2051,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) } // A13 fuel_energy_input_ratio_function_of_plr_curve_name std::string const &eirFplrName = - UtilityRoutines::MakeUPPERCase(fields.at("fuel_energy_input_ratio_function_of_plr_curve_name").get()); + UtilityRoutines::makeUPPER(fields.at("fuel_energy_input_ratio_function_of_plr_curve_name").get()); thisPLHP.powerRatioFuncPLRCurveIndex = Curve::GetCurveIndex(state, eirFplrName); if (thisPLHP.capFuncTempCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR PLFFHP (name={}; entered curve name: {}", thisPLHP.name, eirFplrName)); @@ -2093,7 +2092,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) } else { auto eirDefrostCurveFound = fields.find("fuel_energy_input_ratio_defrost_adjustment_curve_name"); if (eirDefrostCurveFound != fields.end()) { - std::string const eirDefrostCurveName = UtilityRoutines::MakeUPPERCase(eirDefrostCurveFound.value().get()); + std::string const eirDefrostCurveName = UtilityRoutines::makeUPPER(eirDefrostCurveFound.value().get()); thisPLHP.defrostEIRCurveIndex = Curve::GetCurveIndex(state, eirDefrostCurveName); if (thisPLHP.defrostEIRCurveIndex == 0) { ShowSevereError( @@ -2110,7 +2109,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) thisPLHP.defrostType = DefrostType::Invalid; } else { thisPLHP.defrostType = static_cast( - getEnumerationValue(DefrostTypeNamesUC, UtilityRoutines::MakeUPPERCase(fields.at("defrost_control_type").get()))); + getEnumValue(DefrostTypeNamesUC, UtilityRoutines::makeUPPER(fields.at("defrost_control_type").get()))); if (thisPLHP.defrostType == DefrostType::Invalid) { thisPLHP.defrostType = DefrostType::OnDemand; // set to default thisPLHP.defrostOpTimeFrac = 0.0; @@ -2180,7 +2179,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) // A16 cycling_ratio_factor_curve_name auto crfCurveFound = fields.find("cycling_ratio_factor_curve_name"); if (crfCurveFound != fields.end()) { - std::string const cycRatioCurveName = UtilityRoutines::MakeUPPERCase(crfCurveFound.value().get()); + std::string const cycRatioCurveName = UtilityRoutines::makeUPPER(crfCurveFound.value().get()); thisPLHP.cycRatioCurveIndex = Curve::GetCurveIndex(state, cycRatioCurveName); if (thisPLHP.cycRatioCurveIndex == 0) { ShowSevereError(state, @@ -2209,7 +2208,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) // A17 auxiliary_electric_energy_input_ratio_function_of_temperature_curve_name auto auxElecEIRFTCurveFound = fields.find("auxiliary_electric_energy_input_ratio_function_of_temperature_curve_name"); if (auxElecEIRFTCurveFound != fields.end()) { - std::string const &auxEIRFTName = UtilityRoutines::MakeUPPERCase(auxElecEIRFTCurveFound.value().get()); + std::string const &auxEIRFTName = UtilityRoutines::makeUPPER(auxElecEIRFTCurveFound.value().get()); thisPLHP.auxElecEIRFoTempCurveIndex = Curve::GetCurveIndex(state, auxEIRFTName); if (thisPLHP.auxElecEIRFoTempCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR FFHP (name={}; entered curve name: {}", thisPLHP.name, auxEIRFTName)); @@ -2222,7 +2221,7 @@ void EIRFuelFiredHeatPump::processInputForEIRPLHP(EnergyPlusData &state) // A18 auxiliary_electric_energy_input_ratio_function_of_plr_curve_name auto auxElecEIRFPLRCurveFound = fields.find("auxiliary_electric_energy_input_ratio_function_of_plr_curve_name"); if (auxElecEIRFPLRCurveFound != fields.end()) { - std::string const &auxEIRFPLRName = UtilityRoutines::MakeUPPERCase(auxElecEIRFPLRCurveFound.value().get()); + std::string const &auxEIRFPLRName = UtilityRoutines::makeUPPER(auxElecEIRFPLRCurveFound.value().get()); thisPLHP.auxElecEIRFoPLRCurveIndex = Curve::GetCurveIndex(state, auxEIRFPLRName); if (thisPLHP.auxElecEIRFoPLRCurveIndex == 0) { ShowSevereError(state, format("Invalid curve name for EIR FFHP (name={}; entered curve name: {}", thisPLHP.name, auxEIRFPLRName)); diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index 4e2490e11fd..7e9e1359905 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -1773,8 +1773,7 @@ namespace PlantPipingSystemsManager { thisSegment.PipeLocation = PointF(state.dataIPShortCut->rNumericArgs(1), state.dataIPShortCut->rNumericArgs(2)); // Read in the flow direction - thisSegment.FlowDirection = - static_cast(getEnumerationValue(flowDirectionNamesUC, stripped(state.dataIPShortCut->cAlphaArgs(2)))); + thisSegment.FlowDirection = static_cast(getEnumValue(flowDirectionNamesUC, stripped(state.dataIPShortCut->cAlphaArgs(2)))); if (thisSegment.FlowDirection == SegmentFlow::Invalid) { CurIndex = 2; IssueSevereInputFieldError(state, diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index 31df3dd96e5..c83bceb2693 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -143,12 +143,12 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); - std::string const objNameUC = UtilityRoutines::MakeUPPERCase(thisObjectName); + std::string const objNameUC = UtilityRoutines::makeUPPER(thisObjectName); // no need to validate name, the JSON will validate that. state.dataInputProcessing->inputProcessor->markObjectAsUsed(sOutputVariable, thisObjectName); std::string varName = fields.at("python_plugin_variable_name").get(); - std::string avgOrSum = UtilityRoutines::MakeUPPERCase(fields.at("type_of_data_in_variable").get()); - std::string updateFreq = UtilityRoutines::MakeUPPERCase(fields.at("update_frequency").get()); + std::string avgOrSum = UtilityRoutines::makeUPPER(fields.at("type_of_data_in_variable").get()); + std::string updateFreq = UtilityRoutines::makeUPPER(fields.at("update_frequency").get()); std::string units; if (fields.find("units") != fields.end()) { units = fields.at("units").get(); @@ -221,7 +221,7 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) "For metered variables, the resource type, group type, and end use category must be defined"); EnergyPlus::ShowFatalError(state, "Input error on PythonPlugin:OutputVariable causes program termination"); } - std::string const resourceType = EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("resource_type").get()); + std::string const resourceType = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("resource_type").get()); std::string sResourceType; if (resourceType == "ELECTRICITY") { sResourceType = "Electricity"; @@ -282,7 +282,7 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) "For metered variables, the resource type, group type, and end use category must be defined"); EnergyPlus::ShowFatalError(state, "Input error on PythonPlugin:OutputVariable causes program termination"); } - std::string const groupType = EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("group_type").get()); + std::string const groupType = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("group_type").get()); std::string sGroupType; if (groupType == "BUILDING") { sGroupType = "Building"; @@ -305,7 +305,7 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) "For metered variables, the resource type, group type, and end use category must be defined"); EnergyPlus::ShowFatalError(state, "Input error on PythonPlugin:OutputVariable causes program termination"); } - std::string const endUse = EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("end_use_category").get()); + std::string const endUse = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("end_use_category").get()); std::string sEndUse; if (endUse == "HEATING") { sEndUse = "Heating"; @@ -489,7 +489,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s std::string workingDirFlagUC = "YES"; try { workingDirFlagUC = - EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("add_current_working_directory_to_search_path").get()); + EnergyPlus::UtilityRoutines::makeUPPER(fields.at("add_current_working_directory_to_search_path").get()); } catch (nlohmann::json::out_of_range &e) { // defaulted to YES } @@ -498,8 +498,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s } std::string inputFileDirFlagUC = "YES"; try { - inputFileDirFlagUC = - EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("add_input_file_directory_to_search_path").get()); + inputFileDirFlagUC = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("add_input_file_directory_to_search_path").get()); } catch (nlohmann::json::out_of_range &e) { // defaulted to YES } @@ -510,8 +509,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s std::string epInDirFlagUC = "YES"; try { - epInDirFlagUC = - EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("add_epin_environment_variable_to_search_path").get()); + epInDirFlagUC = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("add_epin_environment_variable_to_search_path").get()); } catch (nlohmann::json::out_of_range &e) { // defaulted to YES } @@ -582,7 +580,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s state.dataInputProcessing->inputProcessor->markObjectAsUsed(sPlugins, thisObjectName); fs::path modulePath(fields.at("python_module_name").get()); std::string className = fields.at("plugin_class_name").get(); - std::string sWarmup = EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("run_during_warmup_days").get()); + std::string sWarmup = EnergyPlus::UtilityRoutines::makeUPPER(fields.at("run_during_warmup_days").get()); bool warmup = false; if (sWarmup == "YES") { warmup = true; @@ -647,7 +645,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - std::string const &thisObjectName = EnergyPlus::UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = EnergyPlus::UtilityRoutines::makeUPPER(instance.key()); state.dataInputProcessing->inputProcessor->markObjectAsUsed(sGlobals, thisObjectName); std::string variableName = fields.at("name_of_a_python_plugin_variable").get(); int variableIndex = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(state, variableName); @@ -1181,7 +1179,7 @@ void PluginManager::addToPythonPath([[maybe_unused]] EnergyPlusData &state, #if LINK_WITH_PYTHON void PluginManager::addGlobalVariable(EnergyPlusData &state, const std::string &name) { - std::string const varNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(name); + std::string const varNameUC = EnergyPlus::UtilityRoutines::makeUPPER(name); state.dataPluginManager->globalVariableNames.push_back(varNameUC); state.dataPluginManager->globalVariableValues.push_back(Real64()); this->maxGlobalVariableIndex++; @@ -1195,7 +1193,7 @@ void PluginManager::addGlobalVariable([[maybe_unused]] EnergyPlusData &state, [[ #if LINK_WITH_PYTHON int PluginManager::getGlobalVariableHandle(EnergyPlusData &state, const std::string &name, bool const suppress_warning) { // note zero is a valid handle - std::string const varNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(name); + std::string const varNameUC = EnergyPlus::UtilityRoutines::makeUPPER(name); auto const it = std::find(state.dataPluginManager->globalVariableNames.begin(), state.dataPluginManager->globalVariableNames.end(), varNameUC); if (it != state.dataPluginManager->globalVariableNames.end()) { return std::distance(state.dataPluginManager->globalVariableNames.begin(), it); @@ -1225,7 +1223,7 @@ int PluginManager::getGlobalVariableHandle([[maybe_unused]] EnergyPlusData &stat #if LINK_WITH_PYTHON int PluginManager::getTrendVariableHandle(EnergyPlusData &state, const std::string &name) { - std::string const varNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(name); + std::string const varNameUC = EnergyPlus::UtilityRoutines::makeUPPER(name); for (size_t i = 0; i < state.dataPluginManager->trends.size(); i++) { auto &thisTrend = state.dataPluginManager->trends[i]; if (thisTrend.name == varNameUC) { @@ -1422,7 +1420,7 @@ int PluginManager::getLocationOfUserDefinedPlugin(EnergyPlusData &state, std::st { for (size_t handle = 0; handle < state.dataPluginManager->plugins.size(); handle++) { auto const &thisPlugin = state.dataPluginManager->plugins[handle]; - if (UtilityRoutines::MakeUPPERCase(thisPlugin.emsAlias) == UtilityRoutines::MakeUPPERCase(_programName)) { + if (UtilityRoutines::makeUPPER(thisPlugin.emsAlias) == UtilityRoutines::makeUPPER(_programName)) { return handle; } } diff --git a/src/EnergyPlus/PoweredInductionUnits.cc b/src/EnergyPlus/PoweredInductionUnits.cc index 58b94cd8500..537827e7551 100644 --- a/src/EnergyPlus/PoweredInductionUnits.cc +++ b/src/EnergyPlus/PoweredInductionUnits.cc @@ -317,8 +317,7 @@ void GetPIUs(EnergyPlusData &state) thisPIU.MaxPriAirVolFlow = state.dataIPShortCut->rNumericArgs(2); thisPIU.MinPriAirFlowFrac = state.dataIPShortCut->rNumericArgs(3); - thisPIU.HCoilType = - static_cast(getEnumerationValue(HCoilNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(9)))); + thisPIU.HCoilType = static_cast(getEnumValue(HCoilNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(9)))); switch (thisPIU.HCoilType) { case HtgCoilType::SimpleHeating: { thisPIU.HCoil_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; diff --git a/src/EnergyPlus/Pumps.cc b/src/EnergyPlus/Pumps.cc index 3274a60052a..440331f1b81 100644 --- a/src/EnergyPlus/Pumps.cc +++ b/src/EnergyPlus/Pumps.cc @@ -319,8 +319,8 @@ void GetPumpInput(EnergyPlusData &state) ObjectIsNotParent); TestCompSet(state, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaArgs(2), thisInput->cAlphaArgs(3), "Water Nodes"); - thisPump.PumpControl = static_cast( - getEnumerationValue(pumpCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(4)))); + thisPump.PumpControl = + static_cast(getEnumValue(pumpCtrlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(4)))); if (thisPump.PumpControl == PumpControlType::Invalid) { ShowWarningError(state, format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(4))); @@ -407,8 +407,8 @@ void GetPumpInput(EnergyPlusData &state) thisPump.HasVFD = false; } else { thisPump.HasVFD = true; - thisPump.VFD.VFDControlType = static_cast( - getEnumerationValue(controlTypeVFDNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(7)))); + thisPump.VFD.VFDControlType = + static_cast(getEnumValue(controlTypeVFDNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(7)))); switch (thisPump.VFD.VFDControlType) { case ControlTypeVFD::VFDManual: { thisPump.VFD.ManualRPMSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(8)); @@ -487,7 +487,7 @@ void GetPumpInput(EnergyPlusData &state) if (!thisInput->lAlphaFieldBlanks(14)) { thisPump.powerSizingMethod = static_cast( - getEnumerationValue(powerSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(14)))); + getEnumValue(powerSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(14)))); if (thisPump.powerSizingMethod == PowerSizingMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", sizing method type entered is invalid. Use one of the key choice entries.", @@ -587,8 +587,8 @@ void GetPumpInput(EnergyPlusData &state) thisPump.Energy = 0.0; thisPump.Power = 0.0; - thisPump.PumpControl = static_cast( - getEnumerationValue(pumpCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(4)))); + thisPump.PumpControl = + static_cast(getEnumValue(pumpCtrlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(4)))); if (thisPump.PumpControl == PumpControlType::Invalid) { ShowWarningError(state, format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(4))); @@ -656,7 +656,7 @@ void GetPumpInput(EnergyPlusData &state) if (!thisInput->lAlphaFieldBlanks(8)) { thisPump.powerSizingMethod = static_cast( - getEnumerationValue(powerSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + getEnumValue(powerSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); if (thisPump.powerSizingMethod == PowerSizingMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", sizing method type entered is invalid. Use one of the key choice entries.", @@ -789,7 +789,7 @@ void GetPumpInput(EnergyPlusData &state) if (!thisInput->lAlphaFieldBlanks(6)) { thisPump.powerSizingMethod = static_cast( - getEnumerationValue(powerSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(6)))); + getEnumValue(powerSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(6)))); if (thisPump.powerSizingMethod == PowerSizingMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", sizing method type entered is invalid. Use one of the key choice entries.", @@ -875,8 +875,8 @@ void GetPumpInput(EnergyPlusData &state) thisPump.SequencingScheme = PumpBankControlSeq::SequentialScheme; } - thisPump.PumpControl = static_cast( - getEnumerationValue(pumpCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)))); + thisPump.PumpControl = + static_cast(getEnumValue(pumpCtrlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); if (thisPump.PumpControl == PumpControlType::Invalid) { ShowWarningError(state, format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(5))); @@ -935,7 +935,7 @@ void GetPumpInput(EnergyPlusData &state) if (!thisInput->lAlphaFieldBlanks(8)) { thisPump.powerSizingMethod = static_cast( - getEnumerationValue(powerSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + getEnumValue(powerSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); if (thisPump.powerSizingMethod == PowerSizingMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", sizing method type entered is invalid. Use one of the key choice entries.", @@ -1021,8 +1021,8 @@ void GetPumpInput(EnergyPlusData &state) thisPump.SequencingScheme = PumpBankControlSeq::SequentialScheme; } - thisPump.PumpControl = static_cast( - getEnumerationValue(pumpCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)))); + thisPump.PumpControl = + static_cast(getEnumValue(pumpCtrlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); if (thisPump.PumpControl == PumpControlType::Invalid) { ShowWarningError(state, @@ -1079,7 +1079,7 @@ void GetPumpInput(EnergyPlusData &state) } if (!thisInput->lAlphaFieldBlanks(8)) { thisPump.powerSizingMethod = static_cast( - getEnumerationValue(powerSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + getEnumValue(powerSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); if (thisPump.powerSizingMethod == PowerSizingMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", sizing method type entered is invalid. Use one of the key choice entries.", diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 83db6ad5cd2..5ad52758b7f 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -2156,8 +2156,9 @@ void CalcPurchAirLoads(EnergyPlusData &state, QZnCoolSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToCoolSP; if (allocated(ZoneComp)) { - ZoneComp(DataZoneEquipment::ZoneEquip::PurchasedAir).ZoneCompAvailMgrs(PurchAirNum).ZoneNum = ControlledZoneNum; - PurchAir(PurchAirNum).AvailStatus = ZoneComp(DataZoneEquipment::ZoneEquip::PurchasedAir).ZoneCompAvailMgrs(PurchAirNum).AvailStatus; + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::PurchasedAir).ZoneCompAvailMgrs(PurchAirNum); + availMgr.ZoneNum = ControlledZoneNum; + PurchAir(PurchAirNum).AvailStatus = availMgr.AvailStatus; // Check if the hybrid ventilation availability manager is turning the unit off if (PurchAir(PurchAirNum).AvailStatus == ForceOff) { UnitOn = false; diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index fe3fae6ed43..6d827781c4a 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -600,42 +600,35 @@ void ReportCoilSelection::doZoneEqSetup(EnergyPlusData &state, int const coilVec c->userNameforHVACsystem = "Unknown"; // now search equiment if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes == 1) { // this must be it, fill strings for type and name - c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(1); + c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(1); c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(1); c->coilLocation = "Zone Equipment"; - c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(1); + c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(1); c->zoneHVACIndex = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipIndex(1); } else if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes > 1) { bool foundOne(false); for (int equipLoop = 1; equipLoop <= state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes; ++equipLoop) { // go with the first ZoneHVAC device in the list - if ((state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_VariableRefrigerantFlow) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_EnergyRecoveryVentilator) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_FourPipeFanCoil) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_OutdoorAirUnit) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalAirConditioner) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalHeatPump) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_UnitHeater) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_UnitVentilator) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_VentilatedSlab) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_WaterToAirHeatPump) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_WindowAirConditioner) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_DehumidifierDX)) { + DataZoneEquipment::ZoneEquipType equipType = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); + if (equipType == DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal || + equipType == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator || + equipType == DataZoneEquipment::ZoneEquipType::FourPipeFanCoil || equipType == DataZoneEquipment::ZoneEquipType::OutdoorAirUnit || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump || + equipType == DataZoneEquipment::ZoneEquipType::UnitHeater || equipType == DataZoneEquipment::ZoneEquipType::UnitVentilator || + equipType == DataZoneEquipment::ZoneEquipType::VentilatedSlab || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir || + equipType == DataZoneEquipment::ZoneEquipType::WindowAirConditioner || + equipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) { if (!foundOne) { - c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); + c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(equipLoop); c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop); foundOne = true; c->coilLocation = "Zone Equipment"; - c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop); + c->zoneHVACTypeNum = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); c->zoneHVACIndex = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipIndex(equipLoop); } else { // or may have found another - c->typeHVACname += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); + c->typeHVACname += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeName(equipLoop); c->userNameforHVACsystem += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop); } } @@ -655,51 +648,41 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) c->coilLocation = "Unknown"; c->typeHVACname = "Unknown"; c->userNameforHVACsystem = "Unknown"; - // now search equiment - if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes == 1) { // this must be it, fill strings for type and name - c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(1); - c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(1); + // now search equipment + auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum); + if (zoneEquipList.NumOfEquipTypes == 1) { // this must be it, fill strings for type and name + c->typeHVACname = zoneEquipList.EquipType(1); + c->userNameforHVACsystem = zoneEquipList.EquipName(1); c->coilLocation = "Zone Equipment"; - } else if (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes > 1) { + } else if (zoneEquipList.NumOfEquipTypes > 1) { bool foundOne(false); - for (int equipLoop = 1; equipLoop <= state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).NumOfEquipTypes; ++equipLoop) { + for (int equipLoop = 1; equipLoop <= zoneEquipList.NumOfEquipTypes; ++equipLoop) { // go with the first ZoneHVAC device in the list - if ((state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_VariableRefrigerantFlow) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_EnergyRecoveryVentilator) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_FourPipeFanCoil) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_OutdoorAirUnit) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalAirConditioner) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalHeatPump) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == DataHVACGlobals::ZoneEquipTypeOf_UnitHeater) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_UnitVentilator) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_VentilatedSlab) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_WaterToAirHeatPump) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_WindowAirConditioner) || - (state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipTypeEnum(equipLoop) == - DataHVACGlobals::ZoneEquipTypeOf_DehumidifierDX)) { + DataZoneEquipment::ZoneEquipType equipType = zoneEquipList.EquipType(equipLoop); + if (equipType == DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal || + equipType == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator || + equipType == DataZoneEquipment::ZoneEquipType::FourPipeFanCoil || + equipType == DataZoneEquipment::ZoneEquipType::OutdoorAirUnit || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump || + equipType == DataZoneEquipment::ZoneEquipType::UnitHeater || equipType == DataZoneEquipment::ZoneEquipType::UnitVentilator || + equipType == DataZoneEquipment::ZoneEquipType::VentilatedSlab || + equipType == DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir || + equipType == DataZoneEquipment::ZoneEquipType::WindowAirConditioner || + equipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) { if (!foundOne) { - c->typeHVACname = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); - c->userNameforHVACsystem = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop); + c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop); + c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop); foundOne = true; c->coilLocation = "Zone Equipment"; } else { // or may have found another - c->typeHVACname += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipType(equipLoop); - c->userNameforHVACsystem += " or " + state.dataZoneEquip->ZoneEquipList(c->zoneEqNum).EquipName(equipLoop); + c->typeHVACname += " or " + zoneEquipList.EquipTypeName(equipLoop); + c->userNameforHVACsystem += " or " + zoneEquipList.EquipName(equipLoop); } } - } - } - } + } // for (equipLoop) + } // if (zoneEquipList.numOfEquipTypes > 0) + } // if (c->ZoneEqNum > 0) if (c->airloopNum > 0 && c->zoneEqNum == 0) { c->coilLocation = "AirLoop"; diff --git a/src/EnergyPlus/ReturnAirPathManager.cc b/src/EnergyPlus/ReturnAirPathManager.cc index e06cdab1cd4..1687ca7d4cb 100644 --- a/src/EnergyPlus/ReturnAirPathManager.cc +++ b/src/EnergyPlus/ReturnAirPathManager.cc @@ -189,7 +189,7 @@ namespace ReturnAirPathManager { ErrorsFound = true; } state.dataZoneEquip->ReturnAirPath(PathNum).ComponentTypeEnum(CompNum) = static_cast( - getEnumerationValue(DataZoneEquipment::AirLoopHVACTypeNamesCC, state.dataIPShortCut->cAlphaArgs(Counter))); + getEnumValue(DataZoneEquipment::AirLoopHVACTypeNamesCC, state.dataIPShortCut->cAlphaArgs(Counter))); } else { ShowSevereError( diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index 08f552608ed..e482cb1b0d0 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -91,13 +91,12 @@ namespace EnergyPlus { -namespace RoomAirModelAirflowNetwork { +namespace RoomAir { // MODULE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN November 2009 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // contains the RoomAir model portions of RoomAirflowNetwork modeling @@ -107,126 +106,64 @@ namespace RoomAirModelAirflowNetwork { // Do heat and moisture balance calculations on roomair nodes. // Using/Aliasing - using namespace DataRoomAirModel; using namespace DataHeatBalSurface; using namespace DataSurfaces; using namespace DataHeatBalance; - // Object Data - - // Functions - - void SimRoomAirModelAirflowNetwork(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + void SimRoomAirModelAFN(EnergyPlusData &state, int const zoneNum) // index number for the specified zone { // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN January 2004/Aug 2005 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine manages RoomAirflowNetwork model simulation // METHODOLOGY EMPLOYED: - // calls subroutines - - // REFERENCES: - // na + // calls subroutines (LOL) - // USE STATEMENTS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ThisRoomAirNode; - int RAFNNum; - - RAFNNum = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).RAFNNum; - - if (RAFNNum == 0) { - ShowFatalError(state, - format("SimRoomAirModelAirflowNetwork: Zone is not defined in the RoomAirModelAirflowNetwork model ={}", - state.dataHeatBal->Zone(ZoneNum).Name)); - } - - auto &thisRAFN(state.dataRoomAirflowNetModel->RAFN(RAFNNum)); - thisRAFN.ZoneNum = ZoneNum; + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); // model control volume for each roomAir:node in the zone. - for (ThisRoomAirNode = 1; ThisRoomAirNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++ThisRoomAirNode) { - - thisRAFN.RoomAirNode = ThisRoomAirNode; - - thisRAFN.InitRoomAirModelAirflowNetwork(state, ThisRoomAirNode); - - thisRAFN.CalcRoomAirModelAirflowNetwork(state, ThisRoomAirNode); + for (int roomAirNodeNum = 1; roomAirNodeNum <= afnZoneInfo.NumOfAirNodes; ++roomAirNodeNum) { + InitRoomAirModelAFN(state, zoneNum, roomAirNodeNum); + CalcRoomAirModelAFN(state, zoneNum, roomAirNodeNum); } - thisRAFN.UpdateRoomAirModelAirflowNetwork(state); + UpdateRoomAirModelAFN(state, zoneNum); } // SimRoomAirModelAirflowNetwork //**************************************************** - void LoadPredictionRoomAirModelAirflowNetwork(EnergyPlusData &state, - int const ZoneNum, - int const RoomAirNode) // index number for the specified zone and node + void LoadPredictionRoomAirModelAFN(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum) // index number for the specified zone and node { // SUBROUTINE INFORMATION: // AUTHOR Lixing Gu // DATE WRITTEN June, 2015 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Predict zone loads at a controlled node - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - //////////// hoisted into namespace //////////////////////////////////////////////// - // static bool OneTimeFlag_FindFirstLastPtr( true ); // one time setup flag // - // state.dataRoomAirflowNetModel->LoadPredictionRoomAirModelAirflowNetworkOneTimeFlag - //////////////////////////////////////////////////////////////////////////////////// - int RAFNNum; - - if (state.dataRoomAirflowNetModel->LoadPredictionRoomAirModelAirflowNetworkOneTimeFlag) { - state.dataRoomAirflowNetModel->RAFN.allocate(state.dataRoomAirMod->NumOfRoomAirflowNetControl); - state.dataRoomAirflowNetModel->LoadPredictionRoomAirModelAirflowNetworkOneTimeFlag = false; - } - - RAFNNum = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).RAFNNum; - - if (RAFNNum == 0) { - ShowFatalError(state, - format("LoadPredictionRoomAirModelAirflowNetwork: Zone is not defined in the RoomAirModelAirflowNetwork model ={}", - state.dataHeatBal->Zone(ZoneNum).Name)); - } - auto &thisRAFN(state.dataRoomAirflowNetModel->RAFN(RAFNNum)); - thisRAFN.ZoneNum = ZoneNum; - - thisRAFN.InitRoomAirModelAirflowNetwork(state, RoomAirNode); + InitRoomAirModelAFN(state, zoneNum, roomAirNodeNum); } // LoadPredictionRoomAirModelAirflowNetwork //**************************************************** - void RAFNData::InitRoomAirModelAirflowNetwork(EnergyPlusData &state, int const RoomAirNode) // index number for the specified zone + void InitRoomAirModelAFN(EnergyPlusData &state, int const zoneNum, + int const roomAirNodeNum) // index number for the specified zone { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN November 2009 - // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na + // MODIFIED Lixing Gu, Aug. 2015 for v8.4 release // PURPOSE OF THIS SUBROUTINE: // Perform one-time checking and term calculations @@ -235,98 +172,70 @@ namespace RoomAirModelAirflowNetwork { using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyRhoAirFnPbTdbW; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - //////////// hoisted into namespace //////////////////////////////////////////////// - // static bool MyOneTimeFlag( true ); // one time setup flag // InitRoomAirModelAirflowNetworkOneTimeFlag - // static bool MyOneTimeFlagConf( true ); // one time setup flag for zone configuration // InitRoomAirModelAirflowNetworkOneTimeFlagConf - // static bool MyEnvrnFlag( true ); // one time setup flag for zone configuration // InitRoomAirModelAirflowNetworkEnvrnFlag - //////////////////////////////////////////////////////////////////////////////////// - Real64 SumLinkMCp; - Real64 SumLinkMCpT; - int linkNum; - Real64 LinkInTemp; - Real64 CpAir; - Real64 LinkInHumRat; - Real64 LinkInMdot; - Real64 SumLinkM; - Real64 SumLinkMW; - int LoopZone; - int LoopAirNode; - int NodeNum; - int NodeIn; - int Link; - int IdNode; - int EquipLoop; - int MaxNodeNum; Array1D_bool NodeFound; // True if a node is found. - int MaxEquipNum; Array1D_bool EquipFound; - int ISum; - bool ErrorsFound; - int I; + bool ErrorsFound = false; Array1D SupplyFrac; Array1D ReturnFrac; - if (state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlag) { // then do one - time setup inits + if (state.dataRoomAirflowNetModel->OneTimeFlag) { // then do one - time setup inits // loop over all zones with RoomAirflowNetwork model - for (LoopZone = 1; LoopZone <= state.dataGlobal->NumOfZones; ++LoopZone) { - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).IsUsed) continue; + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (!afnZoneInfo.IsUsed) continue; int NumSurfs = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); NumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } - for (LoopAirNode = 1; LoopAirNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).NumOfAirNodes; - ++LoopAirNode) { // loop over all the modeled room air nodes + for (auto &afnNode : afnZoneInfo.Node) { // calculate volume of air in node's control volume - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirVolume = - state.dataHeatBal->Zone(LoopZone).Volume * - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).ZoneVolumeFraction; + afnNode.AirVolume = state.dataHeatBal->Zone(iZone).Volume * afnNode.ZoneVolumeFraction; SetupOutputVariable(state, "RoomAirflowNetwork Node NonAirSystemResponse", OutputProcessor::Unit::W, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).NonAirSystemResponse, + afnNode.NonAirSystemResponse, OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).Name); + afnNode.Name); SetupOutputVariable(state, "RoomAirflowNetwork Node SysDepZoneLoadsLagged", OutputProcessor::Unit::W, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).SysDepZoneLoadsLagged, + afnNode.SysDepZoneLoadsLagged, OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).Name); + afnNode.Name); SetupOutputVariable(state, "RoomAirflowNetwork Node SumIntSensibleGain", OutputProcessor::Unit::W, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).SumIntSensibleGain, + afnNode.SumIntSensibleGain, OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).Name); + afnNode.Name); SetupOutputVariable(state, "RoomAirflowNetwork Node SumIntLatentGain", OutputProcessor::Unit::W, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).SumIntLatentGain, + afnNode.SumIntLatentGain, OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).Name); + afnNode.Name); } } - state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlag = false; + state.dataRoomAirflowNetModel->OneTimeFlag = false; } - if (state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlagConf) { // then do one - time setup inits + if (state.dataRoomAirflowNetModel->OneTimeFlagConf) { // then do one - time setup inits if (allocated(state.dataZoneEquip->ZoneEquipConfig) && allocated(state.dataZoneEquip->ZoneEquipList)) { - MaxNodeNum = 0; - MaxEquipNum = 0; + int MaxNodeNum = 0; + int MaxEquipNum = 0; ErrorsFound = false; - for (LoopZone = 1; LoopZone <= state.dataGlobal->NumOfZones; ++LoopZone) { - if (!state.dataHeatBal->Zone(LoopZone).IsControlled) continue; - MaxEquipNum = max(MaxEquipNum, state.dataZoneEquip->ZoneEquipList(LoopZone).NumOfEquipTypes); - MaxNodeNum = max(MaxNodeNum, state.dataZoneEquip->ZoneEquipConfig(LoopZone).NumInletNodes); + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (!state.dataHeatBal->Zone(iZone).IsControlled) continue; + MaxEquipNum = max(MaxEquipNum, state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes); + MaxNodeNum = max(MaxNodeNum, state.dataZoneEquip->ZoneEquipConfig(iZone).NumInletNodes); } if (MaxNodeNum > 0) { NodeFound.allocate(MaxNodeNum); @@ -342,23 +251,26 @@ namespace RoomAirModelAirflowNetwork { } // loop over all zones with RoomAirflowNetwork model - for (LoopZone = 1; LoopZone <= state.dataGlobal->NumOfZones; ++LoopZone) { - if (!state.dataHeatBal->Zone(LoopZone).IsControlled) continue; - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).IsUsed) continue; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).ActualZoneID = LoopZone; + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto const &zone = state.dataHeatBal->Zone(iZone); + if (!zone.IsControlled) continue; + + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (!afnZoneInfo.IsUsed) continue; + afnZoneInfo.ActualZoneID = iZone; SupplyFrac = 0.0; ReturnFrac = 0.0; NodeFound = false; int numAirDistUnits = 0; + auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(iZone); + auto const &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(iZone); + // find supply air node number - for (LoopAirNode = 1; LoopAirNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).NumOfAirNodes; - ++LoopAirNode) { // loop over all the modeled room air nodes - for (EquipLoop = 1; EquipLoop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).NumHVACs; - ++EquipLoop) { // loop over all the equip for a single room air node - // Check zone equipment name - for (I = 1; I <= state.dataZoneEquip->ZoneEquipList(LoopZone).NumOfEquipTypes; ++I) { // loop over all equip types - if (state.dataZoneEquip->ZoneEquipList(LoopZone).EquipTypeEnum(I) == DataZoneEquipment::ZoneEquip::AirDistUnit) { + for (auto &afnNode : afnZoneInfo.Node) { + for (auto &afnHVAC : afnNode.HVAC) { + for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types + if (zoneEquipList.EquipType(I) == DataZoneEquipment::ZoneEquipType::AirDistributionUnit) { if (numAirDistUnits == 0) numAirDistUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:AirDistributionUnit"); @@ -366,168 +278,121 @@ namespace RoomAirModelAirflowNetwork { ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); state.dataZoneAirLoopEquipmentManager->GetAirDistUnitsFlag = false; } + for (int AirDistUnitNum = 1; AirDistUnitNum <= numAirDistUnits; ++AirDistUnitNum) { - if (state.dataZoneEquip->ZoneEquipList(LoopZone).EquipName(I) == - state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).Name) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).Name == - state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).EquipName(1)) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .EquipConfigIndex == 0) - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .EquipConfigIndex = I; - if (!EquipFound(I)) EquipFound(I) = true; - SupplyFrac(I) = SupplyFrac(I) + state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .SupplyFraction; - ReturnFrac(I) = ReturnFrac(I) + state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .ReturnFraction; + if (zoneEquipList.EquipName(I) == state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).Name) { + if (afnHVAC.Name == state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).EquipName(1)) { + if (afnHVAC.EquipConfigIndex == 0) { + afnHVAC.EquipConfigIndex = I; + } + EquipFound(I) = true; + SupplyFrac(I) += afnHVAC.SupplyFraction; + ReturnFrac(I) += afnHVAC.ReturnFraction; } } } - } else { - if (UtilityRoutines::SameString( - state.dataZoneEquip->ZoneEquipList(LoopZone).EquipName(I), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).Name)) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .EquipConfigIndex == 0) - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .EquipConfigIndex = I; - EquipFound(I) = true; - SupplyFrac(I) = SupplyFrac(I) + state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .SupplyFraction; - ReturnFrac(I) = ReturnFrac(I) + state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .ReturnFraction; + } else if (UtilityRoutines::SameString(zoneEquipList.EquipName(I), afnHVAC.Name)) { + if (afnHVAC.EquipConfigIndex == 0) { + afnHVAC.EquipConfigIndex = I; } + EquipFound(I) = true; + SupplyFrac(I) += afnHVAC.SupplyFraction; + ReturnFrac(I) += afnHVAC.ReturnFraction; } } - for (IdNode = 1; IdNode <= state.dataLoopNodes->NumOfNodes; ++IdNode) { // loop over all nodes to find supply node ID - if (UtilityRoutines::SameString(state.dataLoopNodes->NodeID(IdNode), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .SupplyNodeName)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).SupNodeNum = IdNode; + + for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { // loop over all nodes to find supply node ID + if (UtilityRoutines::SameString(state.dataLoopNodes->NodeID(iNode), afnHVAC.SupplyNodeName)) { + afnHVAC.SupNodeNum = iNode; break; } } // Verify inlet nodes int inletNodeIndex = 0; - for (NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(LoopZone).NumInletNodes; - ++NodeNum) { // loop over all supply inlet nodes in a single zone + for (int iNode = 1; iNode <= zoneEquipConfig.NumInletNodes; + ++iNode) { // loop over all supply inlet nodes in a single zone // !Get node conditions - if (state.dataZoneEquip->ZoneEquipConfig(LoopZone).InletNode(NodeNum) == IdNode) { - NodeFound(NodeNum) = true; - inletNodeIndex = NodeNum; + if (zoneEquipConfig.InletNode(iNode) == afnHVAC.SupNodeNum) { + NodeFound(iNode) = true; + inletNodeIndex = iNode; break; } } - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).SupNodeNum > 0 && - UtilityRoutines::SameString( - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).ReturnNodeName, - "")) { + if (afnHVAC.SupNodeNum > 0 && afnHVAC.ReturnNodeName.empty()) { // Find matching return node - for (int retNode = 1; retNode <= state.dataZoneEquip->ZoneEquipConfig(LoopZone).NumReturnNodes; ++retNode) { - if ((state.dataZoneEquip->ZoneEquipConfig(LoopZone).ReturnNodeInletNum(retNode) == inletNodeIndex) && - (state.dataZoneEquip->ZoneEquipConfig(LoopZone).ReturnNode(retNode) > 0)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).RetNodeNum = - state.dataZoneEquip->ZoneEquipConfig(LoopZone).ReturnNode(retNode); // Zone return node + for (int retNode = 1; retNode <= zoneEquipConfig.NumReturnNodes; ++retNode) { + if ((zoneEquipConfig.ReturnNodeInletNum(retNode) == inletNodeIndex) && + (zoneEquipConfig.ReturnNode(retNode) > 0)) { + afnHVAC.RetNodeNum = zoneEquipConfig.ReturnNode(retNode); // Zone return node break; } } } - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).RetNodeNum == 0) { - for (IdNode = 1; IdNode <= state.dataLoopNodes->NumOfNodes; ++IdNode) { // loop over all nodes to find return node ID - if (UtilityRoutines::SameString(state.dataLoopNodes->NodeID(IdNode), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone) - .Node(LoopAirNode) - .HVAC(EquipLoop) - .ReturnNodeName)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).RetNodeNum = - IdNode; + if (afnHVAC.RetNodeNum == 0) { + for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { // loop over all nodes to find return node ID + if (UtilityRoutines::SameString(state.dataLoopNodes->NodeID(iNode), afnHVAC.ReturnNodeName)) { + afnHVAC.RetNodeNum = iNode; break; } } } - SetupOutputVariable( - state, - "RoomAirflowNetwork Node HVAC Supply Fraction", - OutputProcessor::Unit::None, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).SupplyFraction, - OutputProcessor::SOVTimeStepType::HVAC, - OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).Name); - SetupOutputVariable( - state, - "RoomAirflowNetwork Node HVAC Return Fraction", - OutputProcessor::Unit::None, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).ReturnFraction, - OutputProcessor::SOVTimeStepType::HVAC, - OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HVAC(EquipLoop).Name); + SetupOutputVariable(state, + "RoomAirflowNetwork Node HVAC Supply Fraction", + OutputProcessor::Unit::None, + afnHVAC.SupplyFraction, + OutputProcessor::SOVTimeStepType::HVAC, + OutputProcessor::SOVStoreType::Average, + afnHVAC.Name); + SetupOutputVariable(state, + "RoomAirflowNetwork Node HVAC Return Fraction", + OutputProcessor::Unit::None, + afnHVAC.ReturnFraction, + OutputProcessor::SOVTimeStepType::HVAC, + OutputProcessor::SOVStoreType::Average, + afnHVAC.Name); } } // Count node with.TRUE. - ISum = 0; - for (NodeNum = 1; NodeNum <= MaxNodeNum; ++NodeNum) { // loop over all supply inlet nodes in a single zone - if (NodeFound(NodeNum)) ISum = ISum + 1; + int ISum = 0; + for (int iNode = 1; iNode <= MaxNodeNum; ++iNode) { // loop over all supply inlet nodes in a single zone + if (NodeFound(iNode)) ++ISum; } // Provide error messages with incorrect supplu node inputs - if (ISum != state.dataZoneEquip->ZoneEquipConfig(LoopZone).NumInletNodes) { - if (ISum > state.dataZoneEquip->ZoneEquipConfig(LoopZone).NumInletNodes) { + if (ISum != zoneEquipConfig.NumInletNodes) { + if (ISum > zoneEquipConfig.NumInletNodes) { ShowSevereError( state, "GetRoomAirflowNetworkData: The number of equipment listed in RoomAirflowNetwork:Node:HVACEquipment objects"); - ShowContinueError( - state, - format("is greater than the number of zone configuration inlet nodes in {}", state.dataHeatBal->Zone(LoopZone).Name)); + ShowContinueError(state, format("is greater than the number of zone configuration inlet nodes in {}", zone.Name)); ShowContinueError(state, "Please check inputs of both objects."); ErrorsFound = true; } else { ShowSevereError( state, "GetRoomAirflowNetworkData: The number of equipment listed in RoomAirflowNetwork:Node:HVACEquipment objects"); - ShowContinueError( - state, - format("is less than the number of zone configuration inlet nodes in {}", state.dataHeatBal->Zone(LoopZone).Name)); + ShowContinueError(state, format("is less than the number of zone configuration inlet nodes in {}", zone.Name)); ShowContinueError(state, "Please check inputs of both objects."); ErrorsFound = true; } } // Check equipment names to ensure they are used in RoomAirflowNetwork : Node : HVACEquipment objects - for (I = 1; I <= state.dataZoneEquip->ZoneEquipList(LoopZone).NumOfEquipTypes; ++I) { // loop over all equip types + for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types if (!EquipFound(I)) { ShowSevereError(state, "GetRoomAirflowNetworkData: The equipment listed in ZoneEquipList is not found in the lsit of " "RoomAir:Node:AirflowNetwork:HVACEquipment objects ="); - ShowContinueError( - state, format("{}. Please check inputs of both objects.", state.dataZoneEquip->ZoneEquipList(LoopZone).EquipName(I))); + ShowContinueError(state, format("{}. Please check inputs of both objects.", zoneEquipList.EquipName(I))); ErrorsFound = true; } } // Check fraction to ensure sum = 1.0 for every equipment - for (I = 1; I <= state.dataZoneEquip->ZoneEquipList(LoopZone).NumOfEquipTypes; ++I) { // loop over all equip types + for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types if (std::abs(SupplyFrac(I) - 1.0) > 0.001) { ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone supply fractions do not sum to 1.0"); - ShowContinueError(state, - format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", - state.dataZoneEquip->ZoneEquipList(LoopZone).EquipName(I))); + ShowContinueError( + state, format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", zoneEquipList.EquipName(I))); ShowContinueError(state, "The Fraction of supply fraction values across all the roomair nodes in a zone needs to sum to 1.0."); ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SupplyFrac(I))); @@ -535,9 +400,8 @@ namespace RoomAirModelAirflowNetwork { } if (std::abs(ReturnFrac(I) - 1.0) > 0.001) { ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone return fractions do not sum to 1.0"); - ShowContinueError(state, - format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", - state.dataZoneEquip->ZoneEquipList(LoopZone).EquipName(I))); + ShowContinueError( + state, format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", zoneEquipList.EquipName(I))); ShowContinueError(state, "The Fraction of return fraction values across all the roomair nodes in a zone needs to sum to 1.0."); ShowContinueError(state, format("The sum of fractions entered = {:.3R}", ReturnFrac(I))); @@ -545,126 +409,112 @@ namespace RoomAirModelAirflowNetwork { } } } - state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlagConf = false; + state.dataRoomAirflowNetModel->OneTimeFlagConf = false; if (allocated(NodeFound)) NodeFound.deallocate(); if (ErrorsFound) { ShowFatalError(state, "GetRoomAirflowNetworkData: Errors found getting air model input. Program terminates."); } - } - } // End of InitRoomAirModelAirflowNetworkOneTimeFlagConf - - if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkEnvrnFlag) { - for (LoopZone = 1; LoopZone <= state.dataGlobal->NumOfZones; ++LoopZone) { - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).IsUsed) continue; - for (LoopAirNode = 1; LoopAirNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).NumOfAirNodes; - ++LoopAirNode) { // loop over all the modeled room air nodes - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTemp = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempX1 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempX2 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempX3 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempX4 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempDSX1 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempDSX2 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempDSX3 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempDSX4 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempT1 = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempTMX = 23.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).AirTempTM2 = 23.0; - - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRat = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatX1 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatX2 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatX3 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatX4 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatDSX1 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatDSX2 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatDSX3 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatDSX4 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatW1 = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatWMX = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).HumRatWM2 = 0.0; - - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).SysDepZoneLoadsLagged = 0.0; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(LoopZone).Node(LoopAirNode).SysDepZoneLoadsLaggedOld = 0.0; + } // if (allocated) + } // if (OneTimeFlagConf) + + if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAirflowNetModel->EnvrnFlag) { + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (!afnZoneInfo.IsUsed) continue; + for (auto &afnNode : afnZoneInfo.Node) { + afnNode.AirTemp = 23.0; + afnNode.AirTempX = {23.0, 23.0, 23.0, 23.0}; + afnNode.AirTempDSX = {23.0, 23.0, 23.0, 23.0}; + afnNode.AirTempT1 = 23.0; + afnNode.AirTempTX = 23.0; + afnNode.AirTempT2 = 23.0; + + afnNode.HumRat = 0.0; + afnNode.HumRatX = {0.0, 0.0, 0.0, 0.0}; + afnNode.HumRatDSX = {0.0, 0.0, 0.0, 0.0}; + afnNode.HumRatT1 = 0.0; + afnNode.HumRatTX = 0.0; + afnNode.HumRatT2 = 0.0; + + afnNode.SysDepZoneLoadsLagged = 0.0; + afnNode.SysDepZoneLoadsLaggedOld = 0.0; } } - state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkEnvrnFlag = false; + state.dataRoomAirflowNetModel->EnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkEnvrnFlag = true; + state.dataRoomAirflowNetModel->EnvrnFlag = true; } // reuse code in ZoneTempPredictorCorrector for sensible components. - CalcNodeSums(state, RoomAirNode); + CalcNodeSums(state, zoneNum, roomAirNodeNum); - SumNonAirSystemResponseForNode(state, RoomAirNode); + SumNonAirSystemResponseForNode(state, zoneNum, roomAirNodeNum); // latent gains. - auto &ThisRAFNNode(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode)); + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto &afnNode = afnZoneInfo.Node(roomAirNodeNum); - if (allocated(ThisRAFNNode.SurfMask)) { - CalcSurfaceMoistureSums(state, RoomAirNode, ThisRAFNNode.SumHmAW, ThisRAFNNode.SumHmARa, ThisRAFNNode.SumHmARaW, ThisRAFNNode.SurfMask); + if (allocated(afnNode.SurfMask)) { + CalcSurfaceMoistureSums(state, zoneNum, roomAirNodeNum, afnNode.SumHmAW, afnNode.SumHmARa, afnNode.SumHmARaW, afnNode.SurfMask); } // prepare AirflowNetwor flow rates and temperatures - SumLinkMCp = 0.0; - SumLinkMCpT = 0.0; - SumLinkM = 0.0; - SumLinkMW = 0.0; - - NodeNum = ThisRAFNNode.AirflowNetworkNodeID; - if (NodeNum > 0) { - for (linkNum = 1; linkNum <= ThisRAFNNode.NumOfAirflowLinks; ++linkNum) { - Link = ThisRAFNNode.Link(linkNum).AirflowNetworkLinkSimuID; - if (state.afn->AirflowNetworkLinkageData(Link).NodeNums[0] == NodeNum) { // incoming flow - NodeIn = state.afn->AirflowNetworkLinkageData(Link).NodeNums[1]; - ThisRAFNNode.Link(linkNum).TempIn = state.afn->AirflowNetworkNodeSimu(NodeIn).TZ; - ThisRAFNNode.Link(linkNum).HumRatIn = state.afn->AirflowNetworkNodeSimu(NodeIn).WZ; - ThisRAFNNode.Link(linkNum).MdotIn = state.afn->AirflowNetworkLinkSimu(Link).FLOW2; + Real64 SumLinkMCp = 0.0; + Real64 SumLinkMCpT = 0.0; + Real64 SumLinkM = 0.0; + Real64 SumLinkMW = 0.0; + + if (afnNode.AFNNodeID > 0) { + for (int iLink = 1; iLink <= afnNode.NumOfAirflowLinks; ++iLink) { + auto &afnLink = afnNode.Link(iLink); + int linkNum = afnLink.AFNSimuID; + if (state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[0] == afnNode.AFNNodeID) { // incoming flow + int nodeInNum = state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[1]; + afnLink.TempIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).TZ; + afnLink.HumRatIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).WZ; + afnLink.MdotIn = state.afn->AirflowNetworkLinkSimu(linkNum).FLOW2; } - if (state.afn->AirflowNetworkLinkageData(Link).NodeNums[1] == NodeNum) { // outgoing flow - NodeIn = state.afn->AirflowNetworkLinkageData(Link).NodeNums[0]; - ThisRAFNNode.Link(linkNum).TempIn = state.afn->AirflowNetworkNodeSimu(NodeIn).TZ; - ThisRAFNNode.Link(linkNum).HumRatIn = state.afn->AirflowNetworkNodeSimu(NodeIn).WZ; - ThisRAFNNode.Link(linkNum).MdotIn = state.afn->AirflowNetworkLinkSimu(Link).FLOW; + if (state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[1] == afnNode.AFNNodeID) { // outgoing flow + int nodeInNum = state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[0]; + afnLink.TempIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).TZ; + afnLink.HumRatIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).WZ; + afnLink.MdotIn = state.afn->AirflowNetworkLinkSimu(linkNum).FLOW; } } - for (linkNum = 1; linkNum <= ThisRAFNNode.NumOfAirflowLinks; ++linkNum) { - LinkInTemp = ThisRAFNNode.Link(linkNum).TempIn; - LinkInHumRat = ThisRAFNNode.Link(linkNum).HumRatIn; - LinkInMdot = ThisRAFNNode.Link(linkNum).MdotIn; - CpAir = PsyCpAirFnW(LinkInHumRat); - SumLinkMCp = SumLinkMCp + CpAir * LinkInMdot; - SumLinkMCpT = SumLinkMCpT + CpAir * LinkInMdot * LinkInTemp; - SumLinkM = SumLinkM + LinkInMdot; - SumLinkMW = SumLinkMW + LinkInMdot * LinkInHumRat; + for (int iLink = 1; iLink <= afnNode.NumOfAirflowLinks; ++iLink) { + auto &afnLink = afnNode.Link(iLink); + Real64 CpAir = PsyCpAirFnW(afnLink.HumRatIn); + SumLinkMCp += CpAir * afnLink.MdotIn; + SumLinkMCpT += CpAir * afnLink.MdotIn * afnLink.TempIn; + SumLinkM += afnLink.MdotIn; + SumLinkMW += afnLink.MdotIn * afnLink.HumRatIn; } } - ThisRAFNNode.SumLinkMCp = SumLinkMCp; - ThisRAFNNode.SumLinkMCpT = SumLinkMCpT; - ThisRAFNNode.SumLinkM = SumLinkM; - ThisRAFNNode.SumLinkMW = SumLinkMW; - ThisRAFNNode.SysDepZoneLoadsLagged = ThisRAFNNode.SysDepZoneLoadsLaggedOld; + afnNode.SumLinkMCp = SumLinkMCp; + afnNode.SumLinkMCpT = SumLinkMCpT; + afnNode.SumLinkM = SumLinkM; + afnNode.SumLinkMW = SumLinkMW; + afnNode.SysDepZoneLoadsLagged = afnNode.SysDepZoneLoadsLaggedOld; - ThisRAFNNode.RhoAir = - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, ThisRAFNNode.AirTemp, ThisRAFNNode.HumRat, "InitRoomAirModelAirflowNetwork"); + afnNode.RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, afnNode.AirTemp, afnNode.HumRat, "InitRoomAirModelAirflowNetwork"); - ThisRAFNNode.CpAir = PsyCpAirFnW(ThisRAFNNode.HumRat); + afnNode.CpAir = PsyCpAirFnW(afnNode.HumRat); } // InitRoomAirModelAirflowNetwork //***************************************************************************************** - void RAFNData::CalcRoomAirModelAirflowNetwork(EnergyPlusData &state, int const RoomAirNode) // index number for the specified zone and node + void CalcRoomAirModelAFN(EnergyPlusData &state, int const zoneNum, + int const roomAirNodeNum) // index number for the specified zone and node { // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN November 2009 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: // calculate new values for temperature and humidity ratio for room air node @@ -673,162 +523,118 @@ namespace RoomAirModelAirflowNetwork { // take terms(updated in init routine) and use classic air balance equations // solved for state variables. Store results in structure. - // REFERENCES: - // na - // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; using Psychrometrics::PsyHgAirFnWTdb; using Psychrometrics::PsyRhFnTdbWPb; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 H2OHtOfVap; - Real64 HumRatTmp; - Real64 NodeTempX1; - Real64 NodeTempX2; - Real64 NodeTempX3; - Real64 NodeHumRatX1; - Real64 NodeHumRatX2; - Real64 NodeHumRatX3; - Real64 TempDepCoef; - Real64 TempIndCoef; - Real64 AirCap; - Real64 TempTmp; - Real64 A; - Real64 B; - Real64 C; + std::array NodeTempX; + std::array NodeHumRatX; Real64 AirTempT1; - Real64 HumRatW1; + Real64 HumRatT1; - auto &ThisRAFNNode(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode)); + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto &afnNode = afnZoneInfo.Node(roomAirNodeNum); if (state.dataHVACGlobal->UseZoneTimeStepHistory) { - NodeTempX1 = ThisRAFNNode.AirTempX1; - NodeTempX2 = ThisRAFNNode.AirTempX2; - NodeTempX3 = ThisRAFNNode.AirTempX3; + NodeTempX[0] = afnNode.AirTempX[0]; + NodeTempX[1] = afnNode.AirTempX[1]; + NodeTempX[2] = afnNode.AirTempX[2]; - NodeHumRatX1 = ThisRAFNNode.HumRatX1; - NodeHumRatX2 = ThisRAFNNode.HumRatX2; - NodeHumRatX3 = ThisRAFNNode.HumRatX3; + NodeHumRatX[0] = afnNode.HumRatX[0]; + NodeHumRatX[1] = afnNode.HumRatX[1]; + NodeHumRatX[2] = afnNode.HumRatX[2]; } else { // use down - stepped history - NodeTempX1 = ThisRAFNNode.AirTempDSX1; - NodeTempX2 = ThisRAFNNode.AirTempDSX2; - NodeTempX3 = ThisRAFNNode.AirTempDSX3; + NodeTempX[0] = afnNode.AirTempDSX[0]; + NodeTempX[1] = afnNode.AirTempDSX[1]; + NodeTempX[2] = afnNode.AirTempDSX[2]; - NodeHumRatX1 = ThisRAFNNode.HumRatDSX1; - NodeHumRatX2 = ThisRAFNNode.HumRatDSX2; - NodeHumRatX3 = ThisRAFNNode.HumRatDSX3; + NodeHumRatX[0] = afnNode.HumRatDSX[0]; + NodeHumRatX[1] = afnNode.HumRatDSX[1]; + NodeHumRatX[2] = afnNode.HumRatDSX[2]; } if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - AirTempT1 = ThisRAFNNode.AirTempT1; - HumRatW1 = ThisRAFNNode.HumRatW1; + AirTempT1 = afnNode.AirTempT1; + HumRatT1 = afnNode.HumRatT1; } // solve for node drybulb temperature - TempDepCoef = ThisRAFNNode.SumHA + ThisRAFNNode.SumLinkMCp + ThisRAFNNode.SumSysMCp; - TempIndCoef = ThisRAFNNode.SumIntSensibleGain + ThisRAFNNode.SumHATsurf - ThisRAFNNode.SumHATref + ThisRAFNNode.SumLinkMCpT + - ThisRAFNNode.SumSysMCpT + ThisRAFNNode.NonAirSystemResponse + ThisRAFNNode.SysDepZoneLoadsLagged; - AirCap = - ThisRAFNNode.AirVolume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * ThisRAFNNode.RhoAir * ThisRAFNNode.CpAir / TimeStepSysSec; + Real64 TempDepCoef = afnNode.SumHA + afnNode.SumLinkMCp + afnNode.SumSysMCp; + Real64 TempIndCoef = afnNode.SumIntSensibleGain + afnNode.SumHATsurf - afnNode.SumHATref + afnNode.SumLinkMCpT + afnNode.SumSysMCpT + + afnNode.NonAirSystemResponse + afnNode.SysDepZoneLoadsLagged; + Real64 AirCap = afnNode.AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * afnNode.RhoAir * afnNode.CpAir / TimeStepSysSec; if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) { if (TempDepCoef == 0.0) { // B=0 - TempTmp = AirTempT1 + TempIndCoef / AirCap; + afnNode.AirTemp = AirTempT1 + TempIndCoef / AirCap; } else { - TempTmp = (AirTempT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + afnNode.AirTemp = (AirTempT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; } } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) { - TempTmp = (AirCap * AirTempT1 + TempIndCoef) / (AirCap + TempDepCoef); + afnNode.AirTemp = (AirCap * AirTempT1 + TempIndCoef) / (AirCap + TempDepCoef); } else { - TempTmp = (TempIndCoef + AirCap * (3.0 * NodeTempX1 - (3.0 / 2.0) * NodeTempX2 + (1.0 / 3.0) * NodeTempX3)) / - ((11.0 / 6.0) * AirCap + TempDepCoef); + afnNode.AirTemp = (TempIndCoef + AirCap * (3.0 * NodeTempX[0] - (3.0 / 2.0) * NodeTempX[1] + (1.0 / 3.0) * NodeTempX[2])) / + ((11.0 / 6.0) * AirCap + TempDepCoef); } - ThisRAFNNode.AirTemp = TempTmp; - // solve for node humidity ratio using 3 algorithms - H2OHtOfVap = PsyHgAirFnWTdb(ThisRAFNNode.HumRat, ThisRAFNNode.AirTemp); - A = ThisRAFNNode.SumLinkM + ThisRAFNNode.SumHmARa + ThisRAFNNode.SumSysM; - B = (ThisRAFNNode.SumIntLatentGain / H2OHtOfVap) + ThisRAFNNode.SumSysMW + ThisRAFNNode.SumLinkMW + ThisRAFNNode.SumHmARaW; - C = ThisRAFNNode.RhoAir * ThisRAFNNode.AirVolume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpMoist / TimeStepSysSec; + Real64 H2OHtOfVap = PsyHgAirFnWTdb(afnNode.HumRat, afnNode.AirTemp); + Real64 A = afnNode.SumLinkM + afnNode.SumHmARa + afnNode.SumSysM; + Real64 B = (afnNode.SumIntLatentGain / H2OHtOfVap) + afnNode.SumSysMW + afnNode.SumLinkMW + afnNode.SumHmARaW; + Real64 C = afnNode.RhoAir * afnNode.AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpMoist / TimeStepSysSec; // Exact solution if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) { if (A == 0.0) { // B=0 - HumRatTmp = HumRatW1 + B / C; + afnNode.HumRat = HumRatT1 + B / C; } else { - HumRatTmp = (HumRatW1 - B / A) * std::exp(min(700., -A / C)) + B / A; + afnNode.HumRat = (HumRatT1 - B / A) * std::exp(min(700., -A / C)) + B / A; } } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) { - HumRatTmp = (C * HumRatW1 + B) / (C + A); + afnNode.HumRat = (C * HumRatT1 + B) / (C + A); } else { - HumRatTmp = (B + C * (3.0 * NodeHumRatX1 - (3.0 / 2.0) * NodeHumRatX2 + (1.0 / 3.0) * NodeHumRatX3)) / ((11.0 / 6.0) * C + A); + afnNode.HumRat = (B + C * (3.0 * NodeHumRatX[0] - (3.0 / 2.0) * NodeHumRatX[1] + (1.0 / 3.0) * NodeHumRatX[2])) / ((11.0 / 6.0) * C + A); } - ThisRAFNNode.HumRat = HumRatTmp; - - ThisRAFNNode.AirCap = AirCap; - ThisRAFNNode.AirHumRat = C; + afnNode.AirCap = AirCap; + afnNode.AirHumRat = C; - ThisRAFNNode.RelHumidity = PsyRhFnTdbWPb(state, TempTmp, HumRatTmp, state.dataEnvrn->OutBaroPress, "CalcRoomAirModelAirflowNetwork") * 100.0; + afnNode.RelHumidity = + PsyRhFnTdbWPb(state, afnNode.AirTemp, afnNode.HumRat, state.dataEnvrn->OutBaroPress, "CalcRoomAirModelAirflowNetwork") * 100.0; } // CalcRoomAirModelAirflowNetwork - void RAFNData::UpdateRoomAirModelAirflowNetwork(EnergyPlusData &state) + void UpdateRoomAirModelAFN(EnergyPlusData &state, int const zoneNum) { // SUBROUTINE INFORMATION: // AUTHOR B Griffith // DATE WRITTEN November 2009 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // update variables + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); - // METHODOLOGY EMPLOYED: - // na + if (!afnZoneInfo.IsUsed) return; - // REFERENCES: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirNodeNum; // nested node structure index - int I; - int LoopAirNode; - int EquipLoop; - Real64 NodeMass; - Real64 SumMass; - Real64 SumMassT; - Real64 SumMassW; - int RetNodeNum; - - auto &ThisRAFNZone(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum)); - - if (!ThisRAFNZone.IsUsed) return; - - if (!state.dataGlobal->ZoneSizingCalc) SumSystemDepResponseForNode(state); - - AirNodeNum = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ControlAirNodeID; + if (!state.dataGlobal->ZoneSizingCalc) SumSystemDepResponseForNode(state, zoneNum); // Update return node conditions - for (I = 1; I <= state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++I) { // loop over all equip types - SumMass = 0.0; - SumMassT = 0.0; - SumMassW = 0.0; - for (LoopAirNode = 1; LoopAirNode <= ThisRAFNZone.NumOfAirNodes; ++LoopAirNode) { // loop over all the modeled room air nodes - for (EquipLoop = 1; EquipLoop <= ThisRAFNZone.Node(LoopAirNode).NumHVACs; - ++EquipLoop) { // loop over all the equip for a single room air node - if (ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).EquipConfigIndex == I) { - if (ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).SupNodeNum > 0 && - ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).RetNodeNum > 0) { - NodeMass = state.dataLoopNodes->Node(ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).SupNodeNum).MassFlowRate * - ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).ReturnFraction; - SumMass += NodeMass; - SumMassT += NodeMass * ThisRAFNZone.Node(LoopAirNode).AirTemp; - SumMassW += NodeMass * ThisRAFNZone.Node(LoopAirNode).HumRat; - RetNodeNum = ThisRAFNZone.Node(LoopAirNode).HVAC(EquipLoop).RetNodeNum; - } + for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(zoneNum).NumOfEquipTypes; ++I) { // loop over all equip types + Real64 SumMass = 0.0; + Real64 SumMassT = 0.0; + Real64 SumMassW = 0.0; + int RetNodeNum = 0; + for (auto const &afnNode : afnZoneInfo.Node) { + for (auto const &afnHVAC : afnNode.HVAC) { + if (afnHVAC.EquipConfigIndex == I && afnHVAC.SupNodeNum > 0 && afnHVAC.RetNodeNum > 0) { + Real64 NodeMass = state.dataLoopNodes->Node(afnHVAC.SupNodeNum).MassFlowRate * afnHVAC.ReturnFraction; + SumMass += NodeMass; + SumMassT += NodeMass * afnNode.AirTemp; + SumMassW += NodeMass * afnNode.HumRat; + RetNodeNum = afnHVAC.RetNodeNum; } } } @@ -839,7 +645,7 @@ namespace RoomAirModelAirflowNetwork { } } // UpdateRoomAirModelAirflowNetwork - void RAFNData::CalcNodeSums(EnergyPlusData &state, int const RoomAirNodeNum) + void CalcNodeSums(EnergyPlusData &state, int const zoneNum, int const roomAirNodeNum) { // SUBROUTINE INFORMATION: @@ -871,179 +677,126 @@ namespace RoomAirModelAirflowNetwork { using Psychrometrics::PsyRhoAirFnPbTdbW; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NodeNum; // System node number - Real64 NodeTemp; // System node temperature - Real64 NodeW; // System node humidity ratio - Real64 MassFlowRate; // System node mass flow rate - int ZoneRetPlenumNum; - int ZoneSupPlenumNum; - bool ZoneRetPlenumAirFlag; - bool ZoneSupPlenumAirFlag; - Real64 CpAir; // Specific heat of air Real64 HA; // !Hc*Area Real64 Area; // !Effective surface area Real64 RefAirTemp; // !Reference air temperature for surface convection calculations - Real64 ZoneMult; - int ADUListIndex; - int ADUNum; - int ADUInNode; - int ADUOutNode; - Real64 SumIntGain; // !node sum of convective internal gains - Real64 SumHA; // Zone sum of Hc*Area - Real64 SumHATsurf; // !Zone sum of Hc*Area*Tsurf - Real64 SumHATref; // !Zone sum of Hc*Area*Tref, for ceiling diffuser convection correlation - Real64 SumMCp; // !Zone sum of MassFlowRate*Cp - Real64 SumMCpT; // !Zone sum of MassFlowRate*Cp*T - Real64 SumSysMCp; // !Zone sum of air system MassFlowRate*Cp - Real64 SumSysMCpT; // !Zone sum of air system MassFlowRate*Cp*T - Real64 SumSysM; // !Zone sum of air system MassFlowRate - Real64 SumSysMW; // !Zone sum of air system MassFlowRate*W - int EquipLoop; // !Index of equipment loop - int Loop; // !Index of RAFN node bool Found; // - Real64 SumLinkM; // !Zone sum of MassFlowRate from the AirflowNetwork model - Real64 SumLinkMW; // !Zone sum of MassFlowRate*W from the AirflowNetwork model - - SumIntGain = 0.0; - SumHA = 0.0; - SumHATsurf = 0.0; - SumHATref = 0.0; - SumMCp = 0.0; - SumMCpT = 0.0; - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - SumSysM = 0.0; - SumSysMW = 0.0; - SumLinkM = 0.0; - SumLinkMW = 0.0; + Real64 SumIntGain = 0.0; // node sum of convective internal gains + Real64 SumHA = 0.0; // Zone sum of Hc*Area + Real64 SumHATsurf = 0.0; // Zone sum of Hc*Area*Tsurf + Real64 SumHATref = 0.0; // Zone sum of Hc*Area*Tref, for ceiling diffuser convection correlation + Real64 SumSysMCp = 0.0; // Zone sum of air system MassFlowRate*Cp + Real64 SumSysMCpT = 0.0; // Zone sum of air system MassFlowRate*Cp*T + Real64 SumSysM = 0.0; // Zone sum of air system MassFlowRate + Real64 SumSysMW = 0.0; // Zone sum of air system MassFlowRate*W + + auto const &zone = state.dataHeatBal->Zone(zoneNum); + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto &afnNode = afnZoneInfo.Node(roomAirNodeNum); // Sum all convective internal gains: SumIntGain - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumIntSensibleGain = - SumInternalConvectionGainsByIndices(state, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).NumIntGains, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).intGainsDeviceSpaces, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsDeviceIndices, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsFractions); - - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumIntLatentGain = - SumInternalLatentGainsByIndices(state, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).NumIntGains, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).intGainsDeviceSpaces, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsDeviceIndices, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsFractions); + afnNode.SumIntSensibleGain = SumInternalConvectionGainsByIndices( + state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions); + + afnNode.SumIntLatentGain = SumInternalLatentGainsByIndices( + state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions); // Add heat to return air if zonal system(no return air) or cycling system(return air frequently very low or zero) - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + if (state.dataHeatBal->Zone(zoneNum).NoHeatToReturnAir) { // ******************************************* SumIntGain = SumReturnAirConvectionGainsByIndices( - state, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).NumIntGains, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).intGainsDeviceSpaces, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsDeviceIndices, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).IntGainsFractions); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumIntSensibleGain += SumIntGain; + state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions); + afnNode.SumIntSensibleGain += SumIntGain; } // Check to see if this is a controlled zone - - bool ControlledZoneAirFlag = state.dataHeatBal->Zone(ZoneNum).IsControlled; - // Check to see if this is a plenum zone - ZoneRetPlenumAirFlag = false; - for (ZoneRetPlenumNum = 1; ZoneRetPlenumNum <= state.dataZonePlenum->NumZoneReturnPlenums; ++ZoneRetPlenumNum) { - if (state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).ActualZoneNum != ZoneNum) continue; - ZoneRetPlenumAirFlag = true; + int zoneRetPlenumNum = 0; + for (int iPlenum = 1; iPlenum <= state.dataZonePlenum->NumZoneReturnPlenums; ++iPlenum) { + if (state.dataZonePlenum->ZoneRetPlenCond(iPlenum).ActualZoneNum != zoneNum) continue; + zoneRetPlenumNum = iPlenum; break; - } // ZoneRetPlenumNum - ZoneSupPlenumAirFlag = false; - for (ZoneSupPlenumNum = 1; ZoneSupPlenumNum <= state.dataZonePlenum->NumZoneSupplyPlenums; ++ZoneSupPlenumNum) { - if (state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).ActualZoneNum != ZoneNum) continue; - ZoneSupPlenumAirFlag = true; + } + bool zoneSupPlenumNum = false; + for (int iPlenum = 1; iPlenum <= state.dataZonePlenum->NumZoneSupplyPlenums; ++iPlenum) { + if (state.dataZonePlenum->ZoneSupPlenCond(iPlenum).ActualZoneNum != zoneNum) continue; + zoneSupPlenumNum = iPlenum; break; - } // ZoneSupPlenumNum + } // Plenum and controlled zones have a different set of inlet nodes which must be calculated. - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - if (ControlledZoneAirFlag) { - auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneNum); - for (NodeNum = 1; NodeNum <= thisZoneEquipConfig.NumInletNodes; ++NodeNum) { + auto &zoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + if (zone.IsControlled) { + auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); + for (int iNode = 1; iNode <= zoneEquipConfig.NumInletNodes; ++iNode) { // Get node conditions // this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call ? // how can we tell ? predict step must be lagged ? correct step, systems have run. - for (EquipLoop = 1; EquipLoop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).NumHVACs; - ++EquipLoop) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).HVAC(EquipLoop).SupNodeNum == - thisZoneEquipConfig.InletNode(NodeNum)) { - NodeTemp = state.dataLoopNodes->Node(thisZoneEquipConfig.InletNode(NodeNum)).Temp; - NodeW = state.dataLoopNodes->Node(thisZoneEquipConfig.InletNode(NodeNum)).HumRat; - MassFlowRate = state.dataLoopNodes->Node(thisZoneEquipConfig.InletNode(NodeNum)).MassFlowRate * - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).HVAC(EquipLoop).SupplyFraction; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + auto const &inletNode = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(iNode)); + for (auto const &afnHVAC : afnNode.HVAC) { + if (afnHVAC.SupNodeNum == zoneEquipConfig.InletNode(iNode)) { + Real64 MassFlowRate = inletNode.MassFlowRate * afnHVAC.SupplyFraction; + Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + SumSysMCpT += MassFlowRate * CpAir * inletNode.Temp; SumSysM += MassFlowRate; - SumSysMW += MassFlowRate * NodeW; + SumSysMW += MassFlowRate * inletNode.HumRat; } } // EquipLoop } // NodeNum - } else if (ZoneRetPlenumAirFlag) { - for (NodeNum = 1; NodeNum <= state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).NumInletNodes; ++NodeNum) { + } else if (zoneRetPlenumNum != 0) { + auto const &zoneRetPlenum = state.dataZonePlenum->ZoneRetPlenCond(zoneRetPlenumNum); + for (int iNode = 1; iNode <= zoneRetPlenum.NumInletNodes; ++iNode) { // Get node conditions - NodeTemp = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).InletNode(NodeNum)).Temp; - MassFlowRate = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).InletNode(NodeNum)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + auto const &zoneRetPlenumNode = state.dataLoopNodes->Node(zoneRetPlenum.InletNode(iNode)); + Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + SumSysMCp += zoneRetPlenumNode.MassFlowRate * CpAir; + SumSysMCpT += zoneRetPlenumNode.MassFlowRate * CpAir * zoneRetPlenumNode.Temp; } // NodeNum // add in the leaks - for (ADUListIndex = 1; ADUListIndex <= state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).NumADUs; ++ADUListIndex) { - ADUNum = state.dataZonePlenum->ZoneRetPlenCond(ZoneRetPlenumNum).ADUIndex(ADUListIndex); - if (state.dataDefineEquipment->AirDistUnit(ADUNum).UpStreamLeak) { - ADUInNode = state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum; - NodeTemp = state.dataLoopNodes->Node(ADUInNode).Temp; - MassFlowRate = state.dataDefineEquipment->AirDistUnit(ADUNum).MassFlowRateUpStrLk; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + for (int iADU = 1; iADU <= zoneRetPlenum.NumADUs; ++iADU) { + int ADUNum = zoneRetPlenum.ADUIndex(iADU); + auto const &adu = state.dataDefineEquipment->AirDistUnit(ADUNum); + if (adu.UpStreamLeak) { + Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + SumSysMCp += adu.MassFlowRateUpStrLk * CpAir; + SumSysMCpT += adu.MassFlowRateUpStrLk * CpAir * state.dataLoopNodes->Node(adu.InletNodeNum).Temp; } - if (state.dataDefineEquipment->AirDistUnit(ADUNum).DownStreamLeak) { - ADUOutNode = state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum; - NodeTemp = state.dataLoopNodes->Node(ADUOutNode).Temp; - MassFlowRate = state.dataDefineEquipment->AirDistUnit(ADUNum).MassFlowRateDnStrLk; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + if (adu.DownStreamLeak) { + Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + SumSysMCp += adu.MassFlowRateDnStrLk * CpAir; + SumSysMCpT += adu.MassFlowRateDnStrLk * CpAir * state.dataLoopNodes->Node(adu.OutletNodeNum).Temp; } } // ADUListIndex - } else if (ZoneSupPlenumAirFlag) { + } else if (zoneSupPlenumNum != 0) { // Get node conditions - NodeTemp = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).Temp; - MassFlowRate = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(ZoneSupPlenumNum).InletNode).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + auto const &zoneSupPlenum = state.dataZonePlenum->ZoneSupPlenCond(zoneSupPlenumNum); + auto const &inletNode = state.dataLoopNodes->Node(zoneSupPlenum.InletNode); + Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + SumSysMCp += inletNode.MassFlowRate * CpAir; + SumSysMCpT += inletNode.MassFlowRate * CpAir * inletNode.Temp; } - ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; + int ZoneMult = zone.Multiplier * zone.ListMultiplier; - SumSysMCp = SumSysMCp / ZoneMult; - SumSysMCpT = SumSysMCpT / ZoneMult; - SumSysM = SumSysM / ZoneMult; - SumSysMW = SumSysMW / ZoneMult; + SumSysMCp /= ZoneMult; + SumSysMCpT /= ZoneMult; + SumSysM /= ZoneMult; + SumSysMW /= ZoneMult; // Sum all surface convection : SumHA, SumHATsurf, SumHATref(and additional contributions to SumIntGain) // Modified by Gu to include assigned surfaces only shown in the surface lsit - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).HasSurfacesAssigned) return; + if (!afnNode.HasSurfacesAssigned) return; int surfCount = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { ++surfCount; - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ControlAirNodeID == RoomAirNodeNum) { + if (afnZoneInfo.ControlAirNodeID == roomAirNodeNum) { Found = false; - for (Loop = 1; Loop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++Loop) { - if (Loop != RoomAirNodeNum) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).SurfMask(surfCount)) { + for (int Loop = 1; Loop <= afnZoneInfo.NumOfAirNodes; ++Loop) { + if (Loop != roomAirNodeNum) { + if (afnZoneInfo.Node(Loop).SurfMask(surfCount)) { Found = true; break; } @@ -1051,7 +804,7 @@ namespace RoomAirModelAirflowNetwork { } if (Found) continue; } else { - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SurfMask(surfCount)) continue; + if (!afnNode.SurfMask(surfCount)) continue; } HA = 0.0; @@ -1073,7 +826,7 @@ namespace RoomAirModelAirflowNetwork { // Convective heat gain from airflow window if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) { SumIntGain += state.dataSurface->SurfWinConvHeatGainToZoneAir(SurfNum); - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + if (zone.NoHeatToReturnAir) { SumIntGain += state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum); state.dataSurface->SurfWinHeatGain(SurfNum) += state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum); if (state.dataSurface->SurfWinHeatGain(SurfNum) >= 0.0) { @@ -1111,51 +864,51 @@ namespace RoomAirModelAirflowNetwork { } // End of check if window - HA = HA + state.dataHeatBalSurf->SurfHConvInt(SurfNum) * Area; + HA += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * Area; SumHATsurf += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * Area * state.dataHeatBalSurf->SurfTempInTmp(SurfNum); if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::ZoneMeanAirTemp) { // The zone air is the reference temperature(which is to be solved for in CorrectZoneAirTemp). - RefAirTemp = thisZoneHB.MAT; + RefAirTemp = zoneHB.MAT; SumHA += HA; } else if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::AdjacentAirTemp) { RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); SumHATref += HA * RefAirTemp; } else if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::ZoneSupplyAirTemp) { // check whether this zone is a controlled zone or not - if (!ControlledZoneAirFlag) { + if (!zone.IsControlled) { ShowFatalError(state, - format("Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone {}", - state.dataHeatBal->Zone(ZoneNum).Name)); + format("Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone {}", zone.Name)); return; } // determine supply air temperature as a weighted average of the inlet temperatures. RefAirTemp = SumSysMCpT / SumSysMCp; SumHATref += HA * RefAirTemp; } else { - RefAirTemp = thisZoneHB.MAT; - SumHA = SumHA + HA; + RefAirTemp = zoneHB.MAT; + SumHA += HA; } } // SurfNum } // Assemble values - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumHA = SumHA; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumHATsurf = SumHATsurf; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumHATref = SumHATref; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumSysMCp = SumSysMCp; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumSysMCpT = SumSysMCpT; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumSysM = SumSysM; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNodeNum).SumSysMW = SumSysMW; + afnNode.SumHA = SumHA; + afnNode.SumHATsurf = SumHATsurf; + afnNode.SumHATref = SumHATref; + afnNode.SumSysMCp = SumSysMCp; + afnNode.SumSysMCpT = SumSysMCpT; + afnNode.SumSysM = SumSysM; + afnNode.SumSysMW = SumSysMW; } // CalcNodeSums - void RAFNData::CalcSurfaceMoistureSums(EnergyPlusData &state, - int const RoomAirNode, - Real64 &SumHmAW, - Real64 &SumHmARa, - Real64 &SumHmARaW, - [[maybe_unused]] Array1D const &SurfMask) + void CalcSurfaceMoistureSums(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum, + Real64 &SumHmAW, + Real64 &SumHmARa, + Real64 &SumHmARaW, + [[maybe_unused]] Array1D const &SurfMask) { // SUBROUTINE INFORMATION: @@ -1163,7 +916,6 @@ namespace RoomAirModelAirflowNetwork { // derived from P. Biddulph-- HAMT, L. Gu -- EPMD, // DATE WRITTEN November 2009 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Breakout summation of surface moisture interaction terms @@ -1177,119 +929,93 @@ namespace RoomAirModelAirflowNetwork { using Psychrometrics::PsyRhoAirFnPbTdbW; using Psychrometrics::PsyWFnTdbRhPb; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Loop; - Real64 RhoAirZone; - Real64 Wsurf; - bool Found; - SumHmAW = 0.0; SumHmARa = 0.0; SumHmARaW = 0.0; - int surfCount = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + + int surfCount = 1; + for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - ++surfCount; - if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) continue; + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum, ++surfCount) { + auto const &surf = state.dataSurface->Surface(SurfNum); + if (surf.Class == SurfaceClass::Window) continue; - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ControlAirNodeID == RoomAirNode) { - Found = false; - for (Loop = 1; Loop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++Loop) { + if (afnZoneInfo.ControlAirNodeID == roomAirNodeNum) { + bool Found = false; + for (int Loop = 1; Loop <= afnZoneInfo.NumOfAirNodes && !Found; ++Loop) { // None - assigned surfaces belong to the zone node - if (Loop != RoomAirNode) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).SurfMask(surfCount)) { - Found = true; - break; - } - } + Found = (Loop != roomAirNodeNum) && afnZoneInfo.Node(Loop).SurfMask(surfCount); } if (Found) continue; } else { - if (!state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SurfMask(surfCount)) continue; + if (!afnZoneInfo.Node(roomAirNodeNum).SurfMask(surfCount)) continue; } auto &HMassConvInFD = state.dataMstBal->HMassConvInFD; auto &RhoVaporSurfIn = state.dataMstBal->RhoVaporSurfIn; auto &RhoVaporAirIn = state.dataMstBal->RhoVaporAirIn; - if (state.dataSurface->Surface(SurfNum).HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::HAMT) { + if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::HAMT) { UpdateHeatBalHAMT(state, SurfNum); - SumHmAW += HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); + SumHmAW += HMassConvInFD(SurfNum) * surf.Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); - RhoAirZone = PsyRhoAirFnPbTdbW( + Real64 RhoAirZone = PsyRhoAirFnPbTdbW( state, state.dataEnvrn->OutBaroPress, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(SurfNum).Zone).MAT, + state.dataZoneTempPredictorCorrector->zoneHeatBalance(surf.Zone).MAT, PsyRhFnTdbRhov(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(SurfNum).Zone).MAT, RhoVaporAirIn(SurfNum), "RhoAirZone")); - Wsurf = PsyWFnTdbRhPb(state, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyRhFnTdbRhov(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporSurfIn(SurfNum), "Wsurf"), - state.dataEnvrn->OutBaroPress); - - SumHmARa = SumHmARa + HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * RhoAirZone; + Real64 Wsurf = + PsyWFnTdbRhPb(state, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyRhFnTdbRhov(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporSurfIn(SurfNum), "Wsurf"), + state.dataEnvrn->OutBaroPress); - SumHmARaW = SumHmARaW + HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * RhoAirZone * Wsurf; + SumHmARa += HMassConvInFD(SurfNum) * surf.Area * RhoAirZone; + SumHmARaW += HMassConvInFD(SurfNum) * surf.Area * RhoAirZone * Wsurf; } - if (state.dataSurface->Surface(SurfNum).HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::EMPD) { + else if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::EMPD) { UpdateMoistureBalanceEMPD(state, SurfNum); RhoVaporSurfIn(SurfNum) = state.dataMstBalEMPD->RVSurface(SurfNum); - SumHmAW = SumHmAW + - HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); - SumHmARa = - SumHmARa + - HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * - PsyRhoAirFnPbTdbW( - state, - state.dataEnvrn->OutBaroPress, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyWFnTdbRhPb(state, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyRhFnTdbRhovLBnd0C(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporAirIn(SurfNum)), - state.dataEnvrn->OutBaroPress)); - SumHmARaW = SumHmARaW + HMassConvInFD(SurfNum) * state.dataSurface->Surface(SurfNum).Area * RhoVaporSurfIn(SurfNum); + SumHmAW += HMassConvInFD(SurfNum) * surf.Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); + SumHmARa += HMassConvInFD(SurfNum) * surf.Area * + PsyRhoAirFnPbTdbW( + state, + state.dataEnvrn->OutBaroPress, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyWFnTdbRhPb(state, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyRhFnTdbRhovLBnd0C(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporAirIn(SurfNum)), + state.dataEnvrn->OutBaroPress)); + SumHmARaW += HMassConvInFD(SurfNum) * surf.Area * RhoVaporSurfIn(SurfNum); } - } - } + } // for (SurfNum) + } // for (spaceNum) } // CalcSurfaceMoistureSums - void RAFNData::SumNonAirSystemResponseForNode(EnergyPlusData &state, int const RAFNNodeNum) + void SumNonAirSystemResponseForNode(EnergyPlusData &state, int const zoneNum, int const roomAirNodeNum) { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN June 2012 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Sum system response from none air systems - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // USE STATEMENTS: using BaseboardElectric::SimElectricBaseboard; using BaseboardRadiator::SimBaseboard; - using DataHVACGlobals::ZoneEquipTypeOf_BaseboardConvectiveElectric; - using DataHVACGlobals::ZoneEquipTypeOf_BaseboardConvectiveWater; - using DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveElectric; - using DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveSteam; - using DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveWater; - using DataHVACGlobals::ZoneEquipTypeOf_HighTemperatureRadiant; - using DataHVACGlobals::ZoneEquipTypeOf_RefrigerationChillerSet; using ElectricBaseboardRadiator::SimElecBaseboard; using HighTempRadiantSystem::SimHighTempRadiantSystem; using HWBaseboardRadiator::SimHWBaseboard; @@ -1297,68 +1023,72 @@ namespace RoomAirModelAirflowNetwork { using SteamBaseboardRadiator::SimSteamBaseboard; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int I; Real64 SysOutputProvided; Real64 LatOutputProvided; // TODO - auto &ThisRAFNNode(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum)); + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto &afnNode = afnZoneInfo.Node(roomAirNodeNum); - ThisRAFNNode.NonAirSystemResponse = 0.0; + afnNode.NonAirSystemResponse = 0.0; if (!allocated(state.dataZoneEquip->ZoneEquipConfig)) return; - for (I = 1; I <= ThisRAFNNode.NumHVACs; ++I) { + for (auto &afnHVAC : afnNode.HVAC) { + switch (afnHVAC.zoneEquipType) { - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_BaseboardRadiantConvectiveWater) { + case DataZoneEquipment::ZoneEquipType::BaseboardWater: { //'ZoneHVAC:Baseboard:RadiantConvective:Water' 13 - SimHWBaseboard(state, ThisRAFNNode.HVAC(I).Name, ZoneNum, false, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + SimHWBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_BaseboardRadiantConvectiveSteam) { + case DataZoneEquipment::ZoneEquipType::BaseboardSteam: { // CASE(BBSteam_Num) !'ZoneHVAC:Baseboard:RadiantConvective:Steam' 14 - SimSteamBaseboard(state, ThisRAFNNode.HVAC(I).Name, ZoneNum, false, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); + SimSteamBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_BaseboardConvectiveWater) { + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: { // CASE(BBWaterConvective_Num) !'ZoneHVAC:Baseboard:Convective:Water' 16 - SimBaseboard(state, ThisRAFNNode.HVAC(I).Name, ZoneNum, false, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + SimBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_BaseboardConvectiveElectric) { + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: { // CASE(BBElectricConvective_Num) !'ZoneHVAC:Baseboard:Convective:Electric' 15 - SimElectricBaseboard(state, ThisRAFNNode.HVAC(I).Name, ZoneNum, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + SimElectricBaseboard(state, afnHVAC.Name, zoneNum, SysOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_RefrigerationChillerSet) { + case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: { // CASE(RefrigerationAirChillerSet_Num) !'ZoneHVAC:RefrigerationChillerSet' 20 - SimAirChillerSet( - state, ThisRAFNNode.HVAC(I).Name, ZoneNum, false, SysOutputProvided, LatOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; - } + SimAirChillerSet(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, LatOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_BaseboardRadiantConvectiveElectric) { + case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // CASE(BBElectric_Num) !'ZoneHVAC:Baseboard:RadiantConvective:Electric' 12 - SimElecBaseboard(state, ThisRAFNNode.HVAC(I).Name, ZoneNum, false, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + SimElecBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; - if (ThisRAFNNode.HVAC(I).TypeOfNum == ZoneEquipTypeOf_HighTemperatureRadiant) { + case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: { // CASE(BBElectric_Num) !'ZoneHVAC:HighTemperatureRadiant' 17 - SimHighTempRadiantSystem(state, ThisRAFNNode.HVAC(I).Name, false, SysOutputProvided, ThisRAFNNode.HVAC(I).CompIndex); - ThisRAFNNode.NonAirSystemResponse += ThisRAFNNode.HVAC(I).SupplyFraction * SysOutputProvided; + SimHighTempRadiantSystem(state, afnHVAC.Name, false, SysOutputProvided, afnHVAC.CompIndex); + afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided; // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat - } + } break; + + default: { + } break; + } // switch // Zone sum of system convective gains, collected via NonAirSystemResponse } @@ -1367,65 +1097,44 @@ namespace RoomAirModelAirflowNetwork { //***************************************************************************************** - void RAFNData::SumSystemDepResponseForNode(EnergyPlusData &state) + void SumSystemDepResponseForNode(EnergyPlusData &state, int const zoneNum) { // SUBROUTINE INFORMATION: // AUTHOR B.Griffith // DATE WRITTEN aug 2005, Jan2004 // MODIFIED Lixing Gu, Aug. 2015 for v8.4 replease - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Sum system sensible loads used at the next time step - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // USE STATEMENTS: - using DataHVACGlobals::ZoneEquipTypeOf_DehumidifierDX; using ZoneDehumidifier::SimZoneDehumidifier; - // Return value - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int I; - Real64 SysOutputProvided; Real64 LatOutputProvided; - int RoomAirNode; // TODO - auto &ThisRAFNZone(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum)); + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); // SysDepZoneLoads saved to be added to zone heat balance next - SysOutputProvided = 0.0; - for (RoomAirNode = 1; RoomAirNode <= ThisRAFNZone.NumOfAirNodes; ++RoomAirNode) { - ThisRAFNZone.Node(RoomAirNode).SysDepZoneLoadsLaggedOld = 0.0; - for (I = 1; I <= ThisRAFNZone.Node(RoomAirNode).NumHVACs; ++I) { - if (ThisRAFNZone.Node(RoomAirNode).HVAC(I).TypeOfNum == ZoneEquipTypeOf_DehumidifierDX) { + Real64 SysOutputProvided = 0.0; + for (auto &afnNode : afnZoneInfo.Node) { + afnNode.SysDepZoneLoadsLaggedOld = 0.0; + for (auto &afnHVAC : afnNode.HVAC) { + if (afnHVAC.zoneEquipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) { if (SysOutputProvided == 0.0) - SimZoneDehumidifier(state, - ThisRAFNZone.Node(RoomAirNode).HVAC(I).Name, - ZoneNum, - false, - SysOutputProvided, - LatOutputProvided, - ThisRAFNZone.Node(RoomAirNode).HVAC(I).CompIndex); + SimZoneDehumidifier(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, LatOutputProvided, afnHVAC.CompIndex); if (SysOutputProvided > 0.0) break; } } } if (SysOutputProvided > 0.0) { - for (RoomAirNode = 1; RoomAirNode <= ThisRAFNZone.NumOfAirNodes; ++RoomAirNode) { - for (I = 1; I <= ThisRAFNZone.Node(RoomAirNode).NumHVACs; ++I) { - if (ThisRAFNZone.Node(RoomAirNode).HVAC(I).TypeOfNum == ZoneEquipTypeOf_DehumidifierDX) { - ThisRAFNZone.Node(RoomAirNode).SysDepZoneLoadsLaggedOld += - ThisRAFNZone.Node(RoomAirNode).HVAC(I).SupplyFraction * SysOutputProvided; + for (auto &afnNode : afnZoneInfo.Node) { + for (auto const &afnHVAC : afnNode.HVAC) { + if (afnHVAC.zoneEquipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) { + afnNode.SysDepZoneLoadsLaggedOld += afnHVAC.SupplyFraction * SysOutputProvided; } } } @@ -1435,6 +1144,6 @@ namespace RoomAirModelAirflowNetwork { //***************************************************************************************** -} // namespace RoomAirModelAirflowNetwork +} // namespace RoomAir } // namespace EnergyPlus diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.hh b/src/EnergyPlus/RoomAirModelAirflowNetwork.hh index 7d1262ab51f..3e4db9ce82f 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.hh +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.hh @@ -57,75 +57,59 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace RoomAirModelAirflowNetwork { +namespace RoomAir { // Data - class RAFNData - { - - private: - public: - int ZoneNum; - int RoomAirNode; - - // constructor - RAFNData() : ZoneNum(0), RoomAirNode(0) - { - } - - // functions - - //***************************************************************************************** - void InitRoomAirModelAirflowNetwork(EnergyPlusData &state, int const RoomAirNode); // index number for the specified zone and room air node - - //***************************************************************************************** - void CalcRoomAirModelAirflowNetwork(EnergyPlusData &state, - int const ThisRoomAirNode); // index number for the specified zone and room air node + void InitRoomAirModelAFN(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum); // index number for the specified zone and room air node - //***************************************************************************************** - void UpdateRoomAirModelAirflowNetwork(EnergyPlusData &state); // index number for the specified zone + void CalcRoomAirModelAFN(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum); // index number for the specified zone and room air node - //***************************************************************************************** - void CalcNodeSums(EnergyPlusData &state, int const RoomAirNode); // index number for the specified zone and room air node + void UpdateRoomAirModelAFN(EnergyPlusData &state, + int const zoneNum); // index number for the specified zone - //***************************************************************************************** - void SumNonAirSystemResponseForNode(EnergyPlusData &state, int const RoomAirNode); // index number for the specified zone and room air node - //***************************************************************************************** - void SumSystemDepResponseForNode(EnergyPlusData &state); // index number for the specified zone and room air node + void CalcNodeSums(EnergyPlusData &state, int const zoneNum, + int const roomAirNodeNum); // index number for the specified zone and room air node - //***************************************************************************************** + void SumNonAirSystemResponseForNode(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum); // index number for the specified zone and room air node - void CalcSurfaceMoistureSums( - EnergyPlusData &state, int const RoomAirNode, Real64 &SumHmAW, Real64 &SumHmARa, Real64 &SumHmARaW, Array1D const &SurfMask); - }; + void SumSystemDepResponseForNode(EnergyPlusData &state, + int const zoneNum); // index number for the specified zone and room air node - // Object data + void CalcSurfaceMoistureSums(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum, + Real64 &SumHmAW, + Real64 &SumHmARa, + Real64 &SumHmARaW, + Array1D const &SurfMask); - void SimRoomAirModelAirflowNetwork(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone + void SimRoomAirModelAFN(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone - void LoadPredictionRoomAirModelAirflowNetwork(EnergyPlusData &state, - int const ZoneNum, - int const RoomAirNode); // index number for the specified zone and node + void LoadPredictionRoomAirModelAFN(EnergyPlusData &state, + int const zoneNum, + int const roomAirNodeNum); // index number for the specified zone and node //***************************************************************************************** -} // namespace RoomAirModelAirflowNetwork +} // namespace RoomAir struct RoomAirModelAirflowNetworkData : BaseGlobalStruct { - bool InitRoomAirModelAirflowNetworkOneTimeFlag = true; - bool InitRoomAirModelAirflowNetworkOneTimeFlagConf = true; - bool InitRoomAirModelAirflowNetworkEnvrnFlag = true; - bool LoadPredictionRoomAirModelAirflowNetworkOneTimeFlag = true; - Array1D RAFN; + bool OneTimeFlag = true; + bool OneTimeFlagConf = true; + bool EnvrnFlag = true; void clear_state() override { - this->InitRoomAirModelAirflowNetworkOneTimeFlag = true; - this->InitRoomAirModelAirflowNetworkOneTimeFlagConf = true; - this->InitRoomAirModelAirflowNetworkEnvrnFlag = true; - this->LoadPredictionRoomAirModelAirflowNetworkOneTimeFlag = true; - this->RAFN.clear(); + this->OneTimeFlag = true; + this->OneTimeFlagConf = true; + this->EnvrnFlag = true; } }; diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 36c7fba9112..5f3369b7a75 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -69,7 +69,6 @@ #include #include #include -#include #include #include #include @@ -89,20 +88,30 @@ namespace EnergyPlus { -namespace RoomAirModelManager { +namespace RoomAir { // MODULE INFORMATION // AUTHOR Weixiu Kong // DATE WRITTEN March 2003 // MODIFIED July 2003, CC // Aug, 2005, BG - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // Contains subroutines for managing the room air models - // Using/Aliasing - using namespace DataRoomAirModel; + constexpr std::array roomAirModelNamesUC = { + "USERDEFINED", "MIXING", "MUNDT", "UCSD_DV", "UCSD_CV", "UCSD_UFI", "UCSD_UFE", "AIRFLOWNETWORK"}; + + constexpr std::array airNodeTypeNamesUC = { + "INLET", "FLOOR", "CONTROL", "CEILING", "MUNDTROOM", "RETURN", "AIRFLOWNETWORK", "PLUME", "REESROOM"}; + + constexpr std::array comfortNamesUC = {"JET", "RECIRCULATION"}; + + constexpr std::array diffuserNamesUC = { + "SWIRL", "VARIABLEAREA", "HORIZONTALSWIRL", "LINEARBARGRILLE", "CUSTOM"}; + + constexpr std::array userDefinedPatternModeNamesUC = { + "OUTDOORDRYBULBTEMPERATURE", "SENSIBLECOOLINGLOAD", "SENSIBLEHEATINGLOAD", "ZONEDRYBULBTEMPERATURE", "ZONEANDOUTDOORTEMPERATUREDIFFERENCE"}; void ManageAirModel(EnergyPlusData &state, int const ZoneNum) { @@ -112,58 +121,57 @@ namespace RoomAirModelManager { // DATE WRITTEN April 2003 // MODIFIED July 2003, CC // Jan 2004, CC - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // manage room air models. - if (state.dataRoomAirModelMgr->GetAirModelData) { + if (state.dataRoomAir->GetAirModelData) { GetAirModelDatas(state); - state.dataRoomAirModelMgr->GetAirModelData = false; + state.dataRoomAir->GetAirModelData = false; } - if (!state.dataRoomAirMod->anyNonMixingRoomAirModel) return; + if (!state.dataRoomAir->anyNonMixingRoomAirModel) return; - if (state.dataRoomAirMod->UCSDModelUsed) { + if (state.dataRoomAir->UCSDModelUsed) { SharedDVCVUFDataInit(state, ZoneNum); } - switch (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType) { - case DataRoomAirModel::RoomAirModel::UserDefined: - RoomAirModelUserTempPattern::ManageUserDefinedPatterns(state, ZoneNum); + switch (state.dataRoomAir->AirModel(ZoneNum).AirModel) { + case RoomAirModel::UserDefined: + ManageUserDefinedPatterns(state, ZoneNum); break; - case DataRoomAirModel::RoomAirModel::Mixing: // Mixing air model - break; // do nothing + case RoomAirModel::Mixing: // Mixing air model + break; // do nothing - case DataRoomAirModel::RoomAirModel::Mundt: // Mundt air model + case RoomAirModel::DispVent1Node: // Mundt air model // simulate room airflow using Mundt model - MundtSimMgr::ManageMundtModel(state, ZoneNum); + ManageDispVent1Node(state, ZoneNum); break; - case DataRoomAirModel::RoomAirModel::UCSDDV: // UCDV Displacement Ventilation model + case RoomAirModel::DispVent3Node: // UCDV Displacement Ventilation model // simulate room airflow using UCSDDV model - DisplacementVentMgr::ManageUCSDDVModel(state, ZoneNum); + ManageDispVent3Node(state, ZoneNum); break; - case DataRoomAirModel::RoomAirModel::UCSDCV: // UCSD Cross Ventilation model + case RoomAirModel::CrossVent: // UCSD Cross Ventilation model // simulate room airflow using UCSDDV model - CrossVentMgr::ManageUCSDCVModel(state, ZoneNum); + ManageCrossVent(state, ZoneNum); break; - case DataRoomAirModel::RoomAirModel::UCSDUFI: // UCSD UFAD interior zone model + case RoomAirModel::UFADInt: // UCSD UFAD interior zone model // simulate room airflow using the UCSDUFI model - UFADManager::ManageUCSDUFModels(state, ZoneNum, DataRoomAirModel::RoomAirModel::UCSDUFI); + ManageUFAD(state, ZoneNum, RoomAirModel::UFADInt); break; - case DataRoomAirModel::RoomAirModel::UCSDUFE: // UCSD UFAD exterior zone model + case RoomAirModel::UFADExt: // UCSD UFAD exterior zone model // simulate room airflow using the UCSDUFE model - UFADManager::ManageUCSDUFModels(state, ZoneNum, DataRoomAirModel::RoomAirModel::UCSDUFE); + ManageUFAD(state, ZoneNum, RoomAirModel::UFADExt); break; - case DataRoomAirModel::RoomAirModel::AirflowNetwork: // RoomAirflowNetwork zone model + case RoomAirModel::AirflowNetwork: // RoomAirflowNetwork zone model // simulate room airflow using the AirflowNetwork - based model - RoomAirModelAirflowNetwork::SimRoomAirModelAirflowNetwork(state, ZoneNum); + SimRoomAirModelAFN(state, ZoneNum); break; default: // mixing air model @@ -236,364 +244,328 @@ namespace RoomAirModelManager { // Using/Aliasing using DataZoneEquipment::EquipConfiguration; - using RoomAirModelUserTempPattern::FigureNDheightInZone; using ScheduleManager::GetScheduleIndex; // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("GetUserDefinedPatternData: "); + static constexpr std::string_view routineName = "GetUserDefinedPatternData: "; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // number of alphas int NumNumbers; // Number of numbers encountered int Status; // Notes if there was an error in processing the input - int thisSurfinZone; // working variable for indexing surfaces within a ZoneRadiantInfo structure - int thisPattern; - - int i; // do loop indexer - int NumPairs; // number of zeta/deltaTai pairs - int ObjNum; // loop indexer of input objects if the same type - int ZoneNum; // zone number in heat balance domain - int found; // test for UtilityRoutines::FindItemInList( + auto &ipsc = state.dataIPShortCut; // access input file and setup - state.dataRoomAirMod->numTempDistContrldZones = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cUserDefinedControlObject); + state.dataRoomAir->numTempDistContrldZones = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cUserDefinedControlObject); - state.dataRoomAirMod->NumConstantGradient = + state.dataRoomAir->NumConstantGradient = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternConstGradientObject); - state.dataRoomAirMod->NumTwoGradientInterp = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternTwoGradientObject); - state.dataRoomAirMod->NumNonDimensionalHeight = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternNDHeightObject); - state.dataRoomAirMod->NumSurfaceMapping = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternSurfMapObject); - - state.dataRoomAirMod->NumAirTempPatterns = state.dataRoomAirMod->NumConstantGradient + state.dataRoomAirMod->NumTwoGradientInterp + - state.dataRoomAirMod->NumNonDimensionalHeight + state.dataRoomAirMod->NumSurfaceMapping; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = cUserDefinedControlObject; - if (state.dataRoomAirMod->numTempDistContrldZones == 0) { - if (state.dataRoomAirMod->NumAirTempPatterns != 0) { // user may have missed control object - ShowWarningError(state, format("Missing {} object needed to use roomair temperature patterns", cCurrentModuleObject)); + state.dataRoomAir->NumTwoGradientInterp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternTwoGradientObject); + state.dataRoomAir->NumNonDimensionalHeight = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternNDHeightObject); + state.dataRoomAir->NumSurfaceMapping = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cTempPatternSurfMapObject); + + state.dataRoomAir->NumAirTempPatterns = state.dataRoomAir->NumConstantGradient + state.dataRoomAir->NumTwoGradientInterp + + state.dataRoomAir->NumNonDimensionalHeight + state.dataRoomAir->NumSurfaceMapping; + ipsc->cCurrentModuleObject = cUserDefinedControlObject; + if (state.dataRoomAir->numTempDistContrldZones == 0) { + if (state.dataRoomAir->NumAirTempPatterns != 0) { // user may have missed control object + ShowWarningError(state, format("Missing {} object needed to use roomair temperature patterns", ipsc->cCurrentModuleObject)); // ErrorsFound = .TRUE. } return; } // now allocate AirPatternZoneInfo to length of all zones for easy indexing - if (!allocated(state.dataRoomAirMod->AirPatternZoneInfo)) { - state.dataRoomAirMod->AirPatternZoneInfo.allocate(state.dataGlobal->NumOfZones); + if (!allocated(state.dataRoomAir->AirPatternZoneInfo)) { + state.dataRoomAir->AirPatternZoneInfo.allocate(state.dataGlobal->NumOfZones); } - for (ObjNum = 1; ObjNum <= state.dataRoomAirMod->numTempDistContrldZones; ++ObjNum) { + for (int ObjNum = 1; ObjNum <= state.dataRoomAir->numTempDistContrldZones; ++ObjNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ObjNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; // first get zone ID - ZoneNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); + int ZoneNum = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); if (ZoneNum == 0) { // throw error - ShowSevereError(state, format("{}{}=\"{}\", invalid data.", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; return; // halt to avoid hard crash } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).IsUsed = true; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Name of this Control Object - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneName = state.dataIPShortCut->cAlphaArgs(2); // Zone Name - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).AvailSched = state.dataIPShortCut->cAlphaArgs(3); - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).AvailSchedID = ScheduleManager::ScheduleAlwaysOn; + auto &airPatternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + airPatternZoneInfo.IsUsed = true; + airPatternZoneInfo.Name = ipsc->cAlphaArgs(1); // Name of this Control Object + airPatternZoneInfo.ZoneName = ipsc->cAlphaArgs(2); // Zone Name + + airPatternZoneInfo.AvailSched = ipsc->cAlphaArgs(3); + if (ipsc->lAlphaFieldBlanks(3)) { + airPatternZoneInfo.AvailSchedID = ScheduleManager::ScheduleAlwaysOn; } else { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).AvailSchedID = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).AvailSchedID == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid data.", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + airPatternZoneInfo.AvailSchedID = GetScheduleIndex(state, ipsc->cAlphaArgs(3)); + if (airPatternZoneInfo.AvailSchedID == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; } } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).PatternCntrlSched = - state.dataIPShortCut->cAlphaArgs(4); // Schedule Name for Leading Pattern Control for this Zone - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).PatternSchedID = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).PatternSchedID == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid data.", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + airPatternZoneInfo.PatternCntrlSched = ipsc->cAlphaArgs(4); // Schedule Name for Leading Pattern Control for this Zone + airPatternZoneInfo.PatternSchedID = GetScheduleIndex(state, ipsc->cAlphaArgs(4)); + if (airPatternZoneInfo.PatternSchedID == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4)); ErrorsFound = true; } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneID = ZoneNum; + airPatternZoneInfo.ZoneID = ZoneNum; // figure number of surfaces for this zone - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs = 0; + airPatternZoneInfo.totNumSurfs = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; + airPatternZoneInfo.totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } // allocate nested derived type for surface info - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf.allocate(state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs); + airPatternZoneInfo.Surf.allocate(airPatternZoneInfo.totNumSurfs); // Fill in what we know for nested structure for surfaces - thisSurfinZone = 0; + int thisSurfinZone = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int thisHBsurfID = thisSpace.HTSurfaceFirst; thisHBsurfID <= thisSpace.HTSurfaceLast; ++thisHBsurfID) { ++thisSurfinZone; if (state.dataSurface->Surface(thisHBsurfID).Class == DataSurfaces::SurfaceClass::IntMass) { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(thisSurfinZone).SurfID = thisHBsurfID; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(thisSurfinZone).Zeta = 0.5; + airPatternZoneInfo.Surf(thisSurfinZone).SurfID = thisHBsurfID; + airPatternZoneInfo.Surf(thisSurfinZone).Zeta = 0.5; continue; } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(thisSurfinZone).SurfID = thisHBsurfID; + airPatternZoneInfo.Surf(thisSurfinZone).SurfID = thisHBsurfID; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(thisSurfinZone).Zeta = FigureNDheightInZone(state, thisHBsurfID); + airPatternZoneInfo.Surf(thisSurfinZone).Zeta = FigureNDheightInZone(state, thisHBsurfID); } } // loop through surfaces in this zone } // loop through number of 'RoomAir:TemperaturePattern:UserDefined' objects // Check against AirModel. Make sure there is a match here. - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - if (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType != DataRoomAirModel::RoomAirModel::UserDefined) continue; - if (state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).IsUsed) continue; // There is a Room Air Temperatures object for this zone + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::UserDefined) continue; + if (state.dataRoomAir->AirPatternZoneInfo(iZone).IsUsed) continue; // There is a Room Air Temperatures object for this zone ShowSevereError(state, - format("{}AirModel for Zone=[{}] is indicated as \"User Defined\".", RoutineName, state.dataHeatBal->Zone(ZoneNum).Name)); - ShowContinueError(state, format("...but missing a {} object for control.", cCurrentModuleObject)); + format("{}AirModel for Zone=[{}] is indicated as \"User Defined\".", routineName, state.dataHeatBal->Zone(iZone).Name)); + ShowContinueError(state, format("...but missing a {} object for control.", ipsc->cCurrentModuleObject)); ErrorsFound = true; } // now get user defined temperature patterns - if (!allocated(state.dataRoomAirMod->RoomAirPattern)) { - state.dataRoomAirMod->RoomAirPattern.allocate(state.dataRoomAirMod->NumAirTempPatterns); + if (!allocated(state.dataRoomAir->AirPattern)) { + state.dataRoomAir->AirPattern.allocate(state.dataRoomAir->NumAirTempPatterns); } // Four different objects to get - cCurrentModuleObject = cTempPatternConstGradientObject; - for (ObjNum = 1; ObjNum <= state.dataRoomAirMod->NumConstantGradient; ++ObjNum) { - thisPattern = ObjNum; + ipsc->cCurrentModuleObject = cTempPatternConstGradientObject; + for (int ObjNum = 1; ObjNum <= state.dataRoomAir->NumConstantGradient; ++ObjNum) { + int thisPattern = ObjNum; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ObjNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - state.dataRoomAirMod->RoomAirPattern(thisPattern).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatrnID = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatternMode = DataRoomAirModel::UserDefinedPatternType::ConstGradTemp; - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTstat = state.dataIPShortCut->rNumericArgs(2); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTleaving = state.dataIPShortCut->rNumericArgs(3); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTexhaust = state.dataIPShortCut->rNumericArgs(4); - state.dataRoomAirMod->RoomAirPattern(thisPattern).GradPatrn.Gradient = state.dataIPShortCut->rNumericArgs(5); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &roomAirPattern = state.dataRoomAir->AirPattern(thisPattern); + roomAirPattern.Name = ipsc->cAlphaArgs(1); + roomAirPattern.PatrnID = ipsc->rNumericArgs(1); + roomAirPattern.PatternMode = UserDefinedPatternType::ConstGradTemp; + roomAirPattern.DeltaTstat = ipsc->rNumericArgs(2); + roomAirPattern.DeltaTleaving = ipsc->rNumericArgs(3); + roomAirPattern.DeltaTexhaust = ipsc->rNumericArgs(4); + roomAirPattern.GradPatrn.Gradient = ipsc->rNumericArgs(5); } - cCurrentModuleObject = cTempPatternTwoGradientObject; - for (ObjNum = 1; ObjNum <= state.dataRoomAirMod->NumTwoGradientInterp; ++ObjNum) { - thisPattern = state.dataRoomAirMod->NumConstantGradient + ObjNum; + ipsc->cCurrentModuleObject = cTempPatternTwoGradientObject; + for (int ObjNum = 1; ObjNum <= state.dataRoomAir->NumTwoGradientInterp; ++ObjNum) { + int thisPattern = state.dataRoomAir->NumConstantGradient + ObjNum; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ObjNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatternMode = DataRoomAirModel::UserDefinedPatternType::TwoGradInterp; - state.dataRoomAirMod->RoomAirPattern(thisPattern).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatrnID = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.TstatHeight = state.dataIPShortCut->rNumericArgs(2); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.TleavingHeight = state.dataIPShortCut->rNumericArgs(3); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.TexhaustHeight = state.dataIPShortCut->rNumericArgs(4); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowGradient = state.dataIPShortCut->rNumericArgs(5); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.HiGradient = state.dataIPShortCut->rNumericArgs(6); - - if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "OutdoorDryBulbTemperature")) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode = - DataRoomAirModel::UserDefinedPatternMode::OutdoorDryBulb; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "ZoneDryBulbTemperature")) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode = - DataRoomAirModel::UserDefinedPatternMode::ZoneAirTemp; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "ZoneAndOutdoorTemperatureDifference")) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode = - DataRoomAirModel::UserDefinedPatternMode::DeltaOutdoorZone; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "SensibleCoolingLoad")) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode = - DataRoomAirModel::UserDefinedPatternMode::SensibleCooling; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "SensibleHeatingLoad")) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode = - DataRoomAirModel::UserDefinedPatternMode::SensibleHeating; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &roomAirPattern = state.dataRoomAir->AirPattern(thisPattern); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + roomAirPattern.PatternMode = UserDefinedPatternType::TwoGradInterp; + roomAirPattern.Name = ipsc->cAlphaArgs(1); + roomAirPattern.PatrnID = ipsc->rNumericArgs(1); + roomAirPattern.TwoGradPatrn.TstatHeight = ipsc->rNumericArgs(2); + roomAirPattern.TwoGradPatrn.TleavingHeight = ipsc->rNumericArgs(3); + roomAirPattern.TwoGradPatrn.TexhaustHeight = ipsc->rNumericArgs(4); + roomAirPattern.TwoGradPatrn.LowGradient = ipsc->rNumericArgs(5); + roomAirPattern.TwoGradPatrn.HiGradient = ipsc->rNumericArgs(6); + + roomAirPattern.TwoGradPatrn.InterpolationMode = + static_cast(getEnumValue(userDefinedPatternModeNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(2)))); + if (roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; } - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.UpperBoundTempScale = state.dataIPShortCut->rNumericArgs(7); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowerBoundTempScale = state.dataIPShortCut->rNumericArgs(8); + roomAirPattern.TwoGradPatrn.UpperBoundTempScale = ipsc->rNumericArgs(7); + roomAirPattern.TwoGradPatrn.LowerBoundTempScale = ipsc->rNumericArgs(8); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.UpperBoundHeatRateScale = state.dataIPShortCut->rNumericArgs(9); - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowerBoundHeatRateScale = state.dataIPShortCut->rNumericArgs(10); + roomAirPattern.TwoGradPatrn.UpperBoundHeatRateScale = ipsc->rNumericArgs(9); + roomAirPattern.TwoGradPatrn.LowerBoundHeatRateScale = ipsc->rNumericArgs(10); // now test the input some - if (state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.HiGradient == - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowGradient) { + if (roomAirPattern.TwoGradPatrn.HiGradient == roomAirPattern.TwoGradPatrn.LowGradient) { ShowWarningError(state, format("Upper and lower gradients equal, use {} instead ", cTempPatternConstGradientObject)); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); } - if ((state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.UpperBoundTempScale == - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowerBoundTempScale) && - ((state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode == - DataRoomAirModel::UserDefinedPatternMode::OutdoorDryBulb) || - (state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode == - DataRoomAirModel::UserDefinedPatternMode::ZoneAirTemp) || - (state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode == - DataRoomAirModel::UserDefinedPatternMode::DeltaOutdoorZone))) { + if ((roomAirPattern.TwoGradPatrn.UpperBoundTempScale == roomAirPattern.TwoGradPatrn.LowerBoundTempScale) && + ((roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::OutdoorDryBulb) || + (roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::ZoneAirTemp) || + (roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::DeltaOutdoorZone))) { // throw error, will cause divide by zero when used for scaling - ShowSevereError(state, format("Error in temperature scale in {}: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Error in temperature scale in {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ErrorsFound = true; } - if ((state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.HiGradient == - state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.LowGradient) && - ((state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode == - DataRoomAirModel::UserDefinedPatternMode::SensibleCooling) || - (state.dataRoomAirMod->RoomAirPattern(thisPattern).TwoGradPatrn.InterpolationMode == - DataRoomAirModel::UserDefinedPatternMode::SensibleHeating))) { + if ((roomAirPattern.TwoGradPatrn.HiGradient == roomAirPattern.TwoGradPatrn.LowGradient) && + ((roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::SensibleCooling) || + (roomAirPattern.TwoGradPatrn.InterpolationMode == UserDefinedPatternMode::SensibleHeating))) { // throw error, will cause divide by zero when used for scaling - ShowSevereError(state, format("Error in load scale in {}: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Error in load scale in {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ErrorsFound = true; } } - cCurrentModuleObject = cTempPatternNDHeightObject; - for (ObjNum = 1; ObjNum <= state.dataRoomAirMod->NumNonDimensionalHeight; ++ObjNum) { - thisPattern = state.dataRoomAirMod->NumConstantGradient + state.dataRoomAirMod->NumTwoGradientInterp + ObjNum; - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatternMode = DataRoomAirModel::UserDefinedPatternType::NonDimenHeight; - + ipsc->cCurrentModuleObject = cTempPatternNDHeightObject; + for (int ObjNum = 1; ObjNum <= state.dataRoomAir->NumNonDimensionalHeight; ++ObjNum) { + int thisPattern = state.dataRoomAir->NumConstantGradient + state.dataRoomAir->NumTwoGradientInterp + ObjNum; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ObjNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - state.dataRoomAirMod->RoomAirPattern(thisPattern).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatrnID = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTstat = state.dataIPShortCut->rNumericArgs(2); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTleaving = state.dataIPShortCut->rNumericArgs(3); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTexhaust = state.dataIPShortCut->rNumericArgs(4); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + auto &roomAirPattern = state.dataRoomAir->AirPattern(thisPattern); + roomAirPattern.PatternMode = UserDefinedPatternType::NonDimenHeight; - NumPairs = std::floor((double(NumNumbers) - 4.0) / 2.0); + roomAirPattern.Name = ipsc->cAlphaArgs(1); + roomAirPattern.PatrnID = ipsc->rNumericArgs(1); + roomAirPattern.DeltaTstat = ipsc->rNumericArgs(2); + roomAirPattern.DeltaTleaving = ipsc->rNumericArgs(3); + roomAirPattern.DeltaTexhaust = ipsc->rNumericArgs(4); + + int NumPairs = std::floor((double(NumNumbers) - 4.0) / 2.0); // TODO error checking - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.ZetaPatrn.allocate(NumPairs); - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.DeltaTaiPatrn.allocate(NumPairs); + roomAirPattern.VertPatrn.ZetaPatrn.allocate(NumPairs); + roomAirPattern.VertPatrn.DeltaTaiPatrn.allocate(NumPairs); // init these since they can't be in derived type - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.ZetaPatrn = 0.0; - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.DeltaTaiPatrn = 0.0; + roomAirPattern.VertPatrn.ZetaPatrn = 0.0; + roomAirPattern.VertPatrn.DeltaTaiPatrn = 0.0; - for (i = 0; i <= NumPairs - 1; ++i) { + for (int i = 0; i <= NumPairs - 1; ++i) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.ZetaPatrn(i + 1) = state.dataIPShortCut->rNumericArgs(2 * i + 5); - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.DeltaTaiPatrn(i + 1) = state.dataIPShortCut->rNumericArgs(2 * i + 6); + roomAirPattern.VertPatrn.ZetaPatrn(i + 1) = ipsc->rNumericArgs(2 * i + 5); + roomAirPattern.VertPatrn.DeltaTaiPatrn(i + 1) = ipsc->rNumericArgs(2 * i + 6); } // TODO check order (TODO sort ? ) - for (i = 2; i <= NumPairs; ++i) { - if (state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.ZetaPatrn(i) < - state.dataRoomAirMod->RoomAirPattern(thisPattern).VertPatrn.ZetaPatrn(i - 1)) { - ShowSevereError( - state, format("Zeta values not in increasing order in {}: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + for (int i = 2; i <= NumPairs; ++i) { + if (roomAirPattern.VertPatrn.ZetaPatrn(i) < roomAirPattern.VertPatrn.ZetaPatrn(i - 1)) { + ShowSevereError(state, format("Zeta values not in increasing order in {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ErrorsFound = true; } } } - cCurrentModuleObject = cTempPatternSurfMapObject; - for (ObjNum = 1; ObjNum <= state.dataRoomAirMod->NumSurfaceMapping; ++ObjNum) { - thisPattern = state.dataRoomAirMod->NumConstantGradient + state.dataRoomAirMod->NumTwoGradientInterp + - state.dataRoomAirMod->NumNonDimensionalHeight + ObjNum; - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatternMode = DataRoomAirModel::UserDefinedPatternType::SurfMapTemp; + ipsc->cCurrentModuleObject = cTempPatternSurfMapObject; + for (int ObjNum = 1; ObjNum <= state.dataRoomAir->NumSurfaceMapping; ++ObjNum) { + int thisPattern = state.dataRoomAir->NumConstantGradient + state.dataRoomAir->NumTwoGradientInterp + + state.dataRoomAir->NumNonDimensionalHeight + ObjNum; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ObjNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - state.dataRoomAirMod->RoomAirPattern(thisPattern).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).PatrnID = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTstat = state.dataIPShortCut->rNumericArgs(2); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTleaving = state.dataIPShortCut->rNumericArgs(3); - state.dataRoomAirMod->RoomAirPattern(thisPattern).DeltaTexhaust = state.dataIPShortCut->rNumericArgs(4); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &roomAirPattern = state.dataRoomAir->AirPattern(thisPattern); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; - NumPairs = NumNumbers - 4; + roomAirPattern.PatternMode = UserDefinedPatternType::SurfMapTemp; + roomAirPattern.Name = ipsc->cAlphaArgs(1); + roomAirPattern.PatrnID = ipsc->rNumericArgs(1); + roomAirPattern.DeltaTstat = ipsc->rNumericArgs(2); + roomAirPattern.DeltaTleaving = ipsc->rNumericArgs(3); + roomAirPattern.DeltaTexhaust = ipsc->rNumericArgs(4); + + int NumPairs = NumNumbers - 4; if (NumPairs != (NumAlphas - 1)) { - ShowSevereError(state, - format("Error in number of entries in {} object: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("Error in number of entries in {} object: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ErrorsFound = true; } - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfName.allocate(NumPairs); - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.DeltaTai.allocate(NumPairs); - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfID.allocate(NumPairs); + roomAirPattern.MapPatrn.SurfName.allocate(NumPairs); + roomAirPattern.MapPatrn.DeltaTai.allocate(NumPairs); + roomAirPattern.MapPatrn.SurfID.allocate(NumPairs); // init just allocated - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfName = ""; - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.DeltaTai = 0.0; - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfID = 0; - - for (i = 1; i <= NumPairs; ++i) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfName(i) = state.dataIPShortCut->cAlphaArgs(i + 1); - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.DeltaTai(i) = state.dataIPShortCut->rNumericArgs(i + 4); - found = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(i + 1), state.dataSurface->Surface); - if (found != 0) { - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.SurfID(i) = found; - } else { - ShowSevereError(state, - format("Surface name not found in {} object: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + roomAirPattern.MapPatrn.SurfName = ""; + roomAirPattern.MapPatrn.DeltaTai = 0.0; + roomAirPattern.MapPatrn.SurfID = 0; + + for (int i = 1; i <= NumPairs; ++i) { + roomAirPattern.MapPatrn.SurfName(i) = ipsc->cAlphaArgs(i + 1); + roomAirPattern.MapPatrn.DeltaTai(i) = ipsc->rNumericArgs(i + 4); + roomAirPattern.MapPatrn.SurfID(i) = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(i + 1), state.dataSurface->Surface); + if (roomAirPattern.MapPatrn.SurfID(i) == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(i + 1), ipsc->cAlphaArgs(i + 1)); ErrorsFound = true; } } - state.dataRoomAirMod->RoomAirPattern(thisPattern).MapPatrn.NumSurfs = NumPairs; + roomAirPattern.MapPatrn.NumSurfs = NumPairs; } if (state.dataErrTracking->TotalRoomAirPatternTooLow > 0) { @@ -617,23 +589,23 @@ namespace RoomAirModelManager { // Find and set return and exhaust node ids - for (i = 1; i <= state.dataGlobal->NumOfZones; ++i) { - if (state.dataRoomAirMod->AirPatternZoneInfo(i).IsUsed) { + for (int i = 1; i <= state.dataGlobal->NumOfZones; ++i) { + if (state.dataRoomAir->AirPatternZoneInfo(i).IsUsed) { // first get return and exhaust air node index - found = UtilityRoutines::FindItemInList( - state.dataRoomAirMod->AirPatternZoneInfo(i).ZoneName, state.dataZoneEquip->ZoneEquipConfig, &EquipConfiguration::ZoneName); + int found = UtilityRoutines::FindItemInList( + state.dataRoomAir->AirPatternZoneInfo(i).ZoneName, state.dataZoneEquip->ZoneEquipConfig, &EquipConfiguration::ZoneName); if (found != 0) { - state.dataRoomAirMod->AirPatternZoneInfo(i).ZoneNodeID = state.dataZoneEquip->ZoneEquipConfig(found).ZoneNode; + state.dataRoomAir->AirPatternZoneInfo(i).ZoneNodeID = state.dataZoneEquip->ZoneEquipConfig(found).ZoneNode; if (allocated(state.dataZoneEquip->ZoneEquipConfig(found).ExhaustNode)) { - state.dataRoomAirMod->AirPatternZoneInfo(i).ExhaustAirNodeID.allocate( + state.dataRoomAir->AirPatternZoneInfo(i).ExhaustAirNodeID.allocate( state.dataZoneEquip->ZoneEquipConfig(found).NumExhaustNodes); - state.dataRoomAirMod->AirPatternZoneInfo(i).ExhaustAirNodeID = state.dataZoneEquip->ZoneEquipConfig(found).ExhaustNode; + state.dataRoomAir->AirPatternZoneInfo(i).ExhaustAirNodeID = state.dataZoneEquip->ZoneEquipConfig(found).ExhaustNode; } // exhaust nodes present } // found ZoneEquipConf // second get zone height values - state.dataRoomAirMod->AirPatternZoneInfo(i).ZoneHeight = state.dataHeatBal->Zone(i).CeilingHeight; + state.dataRoomAir->AirPatternZoneInfo(i).ZoneHeight = state.dataHeatBal->Zone(i).CeilingHeight; } // air pattern is used } @@ -652,215 +624,158 @@ namespace RoomAirModelManager { // PURPOSE OF THIS SUBROUTINE: // Get AirNode data for all zones at once - // METHODOLOGY EMPLOYED: - // Use input processer to get input from idf file - - // Using/Aliasing - + constexpr std::string_view routineName = "GetAirNodeData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // States which alpha value to read from a // "Number" line - int NumNumbers; // Number of numbers encountered - int Status; // Notes if there was an error in processing the input - int AirNodeNum; // Index number for air nodes - int ZoneNum; // Index number for zones - int NumSurfsInvolved; // Number of surfaces involved with air nodes - int SurfCount; // Number of surfaces involved with air nodes - // (used for checking error) - int NumOfSurfs; // Index number for last surface of zones - bool SurfNeeded; + int NumNumbers; // Number of numbers encountered + int Status; // Notes if there was an error in processing the input + + if (!state.dataRoomAir->DispVent1NodeModelUsed) return; - if (!state.dataRoomAirMod->MundtModelUsed) return; + auto &ipsc = state.dataIPShortCut; // Initialize default values for air nodes - state.dataRoomAirMod->TotNumOfZoneAirNodes.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->TotNumOfAirNodes = 0; - state.dataRoomAirMod->TotNumOfZoneAirNodes = 0; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "RoomAir:Node"; - state.dataRoomAirMod->TotNumOfAirNodes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataRoomAirMod->TotNumOfAirNodes <= 0) { + state.dataRoomAir->TotNumOfZoneAirNodes.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->TotNumOfAirNodes = 0; + state.dataRoomAir->TotNumOfZoneAirNodes = 0; + ipsc->cCurrentModuleObject = "RoomAir:Node"; + state.dataRoomAir->TotNumOfAirNodes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + + if (state.dataRoomAir->TotNumOfAirNodes <= 0) { // no air node object is found, terminate the program - ShowSevereError(state, format("No {} objects found in input.", cCurrentModuleObject)); - ShowContinueError(state, format("The OneNodeDisplacementVentilation model requires {} objects", cCurrentModuleObject)); + ShowSevereError(state, format("No {} objects found in input.", ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("The OneNodeDisplacementVentilation model requires {} objects", ipsc->cCurrentModuleObject)); ErrorsFound = true; return; } else { // air node objects are found so allocate airnode variable - state.dataRoomAirMod->AirNode.allocate(state.dataRoomAirMod->TotNumOfAirNodes); + state.dataRoomAir->AirNode.allocate(state.dataRoomAir->TotNumOfAirNodes); } - for (AirNodeNum = 1; AirNodeNum <= state.dataRoomAirMod->TotNumOfAirNodes; ++AirNodeNum) { + for (int AirNodeNum = 1; AirNodeNum <= state.dataRoomAir->TotNumOfAirNodes; ++AirNodeNum) { // get air node objects state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, AirNodeNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - UtilityRoutines::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - - state.dataRoomAirMod->AirNode(AirNodeNum).Name = state.dataIPShortCut->cAlphaArgs(1); - - state.dataRoomAirMod->AirNode(AirNodeNum).ZoneName = state.dataIPShortCut->cAlphaArgs(3); // Zone name - state.dataRoomAirMod->AirNode(AirNodeNum).ZonePtr = - UtilityRoutines::FindItemInList(state.dataRoomAirMod->AirNode(AirNodeNum).ZoneName, state.dataHeatBal->Zone); - if (state.dataRoomAirMod->AirNode(AirNodeNum).ZonePtr == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &airNode = state.dataRoomAir->AirNode(AirNodeNum); + airNode.Name = ipsc->cAlphaArgs(1); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, airNode.Name}; + + airNode.ZoneName = ipsc->cAlphaArgs(3); // Zone name + airNode.ZonePtr = UtilityRoutines::FindItemInList(airNode.ZoneName, state.dataHeatBal->Zone); + if (airNode.ZonePtr == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; } else { - ZoneNum = state.dataRoomAirMod->AirNode(AirNodeNum).ZonePtr; - NumOfSurfs = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + int NumOfSurfs = 0; + for (int spaceNum : state.dataHeatBal->Zone(airNode.ZonePtr).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } - state.dataRoomAirMod->AirNode(AirNodeNum).SurfMask.allocate(NumOfSurfs); + airNode.SurfMask.allocate(NumOfSurfs); } - { - std::string const &nodeType = state.dataIPShortCut->cAlphaArgs(2); - if (nodeType == "INLET") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::InletAir; - } else if (nodeType == "FLOOR") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::FloorAir; - } else if (nodeType == "CONTROL") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::ControlAir; - } else if (nodeType == "CEILING") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::CeilingAir; - } else if (nodeType == "MUNDTROOM") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::MundtRoomAir; - } else if (nodeType == "RETURN") { - state.dataRoomAirMod->AirNode(AirNodeNum).ClassType = AirNodeType::ReturnAir; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + airNode.ClassType = static_cast(getEnumValue(airNodeTypeNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(2)))); + if (airNode.ClassType == AirNodeType::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + ErrorsFound = true; } - state.dataRoomAirMod->AirNode(AirNodeNum).Height = state.dataIPShortCut->rNumericArgs(1); // Air node height - NumSurfsInvolved = NumAlphas - 3; // Number of surfaces involved with air nodes + airNode.Height = ipsc->rNumericArgs(1); // Air node height + int NumSurfsInvolved = NumAlphas - 3; // Number of surfaces involved with air nodes // Initialize - state.dataRoomAirMod->AirNode(AirNodeNum).SurfMask = false; + airNode.SurfMask = false; if (NumSurfsInvolved <= 0) { // report severe error since the following air nodes require surfaces associated with them - { - std::string const &nodeType = state.dataIPShortCut->cAlphaArgs(2); - if (nodeType == "FLOOR" || nodeType == "CEILING" || nodeType == "MUNDTROOM" || nodeType == "PLUME4" || nodeType == "REESROOM1" || - nodeType == "REESROOM2" || nodeType == "REESROOM3" || nodeType == "REESROOM4") { - // terminate the program due to a severe error in the specified input - ShowSevereError(state, - format("GetAirNodeData: {}=\"{}\" invalid air node specification.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Mundt Room Air Model: No surface names specified. Air node=\"{} requires name of surfaces associated with it.", - state.dataRoomAirMod->AirNode(AirNodeNum).Name)); - ErrorsFound = true; - } else { - } - } - - } else { - - // initialize - SurfNeeded = true; - - // report warning error since the following air nodes do not require surfaces associated with them - // and assign .FALSE. to 'SurfNeeded' - { - std::string const &nodeType = state.dataIPShortCut->cAlphaArgs(2); - if (nodeType == "INLET" || nodeType == "CONTROL" || nodeType == "RETURN" || nodeType == "PLUME1" || nodeType == "PLUME2" || - nodeType == "PLUME3") { - ShowWarningError( - state, format("GetAirNodeData: {}=\"{}\" invalid linkage", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Mundt Room Air Model: No surface names needed. Air node=\"{} does not relate to any surfaces.", - state.dataRoomAirMod->AirNode(AirNodeNum).Name)); - SurfNeeded = false; - } else { - } + if (airNode.ClassType == AirNodeType::Floor || airNode.ClassType == AirNodeType::Ceiling || airNode.ClassType == AirNodeType::Mundt || + airNode.ClassType == AirNodeType::Plume || airNode.ClassType == AirNodeType::Rees) { // Are there really Rees 1-4? + // terminate the program due to a severe error in the specified input + ShowSevereError(state, + format("GetAirNodeData: {}=\"{}\" invalid air node specification.", ipsc->cCurrentModuleObject, airNode.Name)); + ShowContinueError(state, + format("Mundt Room Air Model: No surface names specified. Air node=\"{} requires surfaces associated with it.", + airNode.Name)); + ErrorsFound = true; } + continue; + } - if (SurfNeeded) { + // report warning error since the following air nodes do not require surfaces associated with them + // and assign .FALSE. to 'SurfNeeded' + if (airNode.ClassType == AirNodeType::Inlet || airNode.ClassType == AirNodeType::Control || airNode.ClassType == AirNodeType::Return || + airNode.ClassType == AirNodeType::Plume) { + ShowWarningError(state, format("GetAirNodeData: {}=\"{}\" invalid linkage", ipsc->cCurrentModuleObject, airNode.Name)); + ShowContinueError( + state, format("Mundt Room Air Model: No surface names needed. Air node=\"{} does not relate to any surfaces.", airNode.Name)); + continue; + } - // this air node is in this zone; hence, first get name of all surfaces in this zone - ZoneNum = state.dataRoomAirMod->AirNode(AirNodeNum).ZonePtr; - NumOfSurfs = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; - } + // this air node is in this zone; hence, first get name of all surfaces in this zone + auto const &zone = state.dataHeatBal->Zone(airNode.ZonePtr); + int NumOfSurfs = 0; + for (int spaceNum : zone.spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; + } - // terminate the program due to a severe error in the specified input - if ((NumSurfsInvolved) > NumOfSurfs) { - ShowFatalError( - state, - format( - "GetAirNodeData: Mundt Room Air Model: Number of surfaces connected to {} is greater than number of surfaces in {}", - state.dataRoomAirMod->AirNode(AirNodeNum).Name, - state.dataHeatBal->Zone(ZoneNum).Name)); - return; - } + // terminate the program due to a severe error in the specified input + if (NumSurfsInvolved > NumOfSurfs) { + ShowFatalError( + state, + format("GetAirNodeData: Mundt Room Air Model: Number of surfaces connected to {} is greater than number of surfaces in {}", + airNode.Name, + zone.Name)); + return; + } - // relate surfaces to this air node and check to see whether surface names are specified correctly or not - SurfCount = 0; - for (int ListSurfNum = 4; ListSurfNum <= NumAlphas; ++ListSurfNum) { - int thisSurfinZone = 0; - bool surfaceFound = false; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - ++thisSurfinZone; - if (state.dataIPShortCut->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { - ; - state.dataRoomAirMod->AirNode(AirNodeNum).SurfMask(thisSurfinZone) = true; - ++SurfCount; - surfaceFound = true; - break; - } - } - if (surfaceFound) break; + // relate surfaces to this air node and check to see whether surface names are specified correctly or not + int SurfCount = 0; + for (int ListSurfNum = 4; ListSurfNum <= NumAlphas; ++ListSurfNum) { + int thisSurfinZone = 0; + for (int spaceNum : zone.spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { + ++thisSurfinZone; + if (ipsc->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { + airNode.SurfMask(thisSurfinZone) = true; + ++SurfCount; + break; } } - - // report warning error since surface names are specified correctly - if ((NumSurfsInvolved) != SurfCount) { - ShowWarningError(state, - format("GetAirNodeData: Mundt Room Air Model: Some surface names specified for {} are not in {}", - state.dataRoomAirMod->AirNode(AirNodeNum).Name, - state.dataHeatBal->Zone(ZoneNum).Name)); - } + if (SurfCount > 0) break; } } - } - // get number of air nodes in each zone - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + // report warning error since surface names are specified correctly + if ((NumSurfsInvolved) != SurfCount) { + ShowWarningError( + state, + format("GetAirNodeData: Mundt Room Air Model: Some surface names specified for {} are not in {}", airNode.Name, zone.Name)); + } + } // for (AirNodeNum) + // get number of air nodes in each zone + for (int AirNodeNum = 1; AirNodeNum <= state.dataRoomAir->TotNumOfAirNodes; ++AirNodeNum) { + auto const &airNode = state.dataRoomAir->AirNode(AirNodeNum); // this zone uses other air model so skip the rest - if (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType != DataRoomAirModel::RoomAirModel::Mundt) continue; - - // this zone uses a nodal air model so get number of air nodes in each zone - for (AirNodeNum = 1; AirNodeNum <= state.dataRoomAirMod->TotNumOfAirNodes; ++AirNodeNum) { - if (state.dataRoomAirMod->AirNode(AirNodeNum).ZonePtr == ZoneNum) { - ++state.dataRoomAirMod->TotNumOfZoneAirNodes(ZoneNum); - } - } + if (state.dataRoomAir->AirModel(airNode.ZonePtr).AirModel == RoomAirModel::DispVent1Node) + ++state.dataRoomAir->TotNumOfZoneAirNodes(airNode.ZonePtr); } } @@ -883,23 +798,23 @@ namespace RoomAirModelManager { // Use input processer to get input from idf file // Using/Aliasing - + constexpr std::string_view routineName = "GetMundtData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; int NumNumbers; // Number of numbers encountered int Status; // Notes if there was an error in processing the input - int ControlNum; // Index number int NumOfMundtContrl; // Number of Mundt Model Controls - int ZoneNum; // Index number for zones - if (!state.dataRoomAirMod->MundtModelUsed) return; + auto &ipsc = state.dataIPShortCut; + + if (!state.dataRoomAir->DispVent1NodeModelUsed) return; // Initialize default values for Mundt model controls - state.dataRoomAirMod->ConvectiveFloorSplit.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->InfiltratFloorSplit.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ConvectiveFloorSplit = 0.0; - state.dataRoomAirMod->InfiltratFloorSplit = 0.0; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + state.dataRoomAir->ConvectiveFloorSplit.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->InfiltratFloorSplit.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ConvectiveFloorSplit = 0.0; + state.dataRoomAir->InfiltratFloorSplit = 0.0; + auto &cCurrentModuleObject = ipsc->cCurrentModuleObject; cCurrentModuleObject = "RoomAirSettings:OneNodeDisplacementVentilation"; NumOfMundtContrl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (NumOfMundtContrl > state.dataGlobal->NumOfZones) { @@ -916,38 +831,36 @@ namespace RoomAirModelManager { // this zone uses Mundt model so get Mundt Model Control // loop through all 'RoomAirSettings:OneNodeDisplacementVentilation' objects - for (ControlNum = 1; ControlNum <= NumOfMundtContrl; ++ControlNum) { + for (int ControlNum = 1; ControlNum <= NumOfMundtContrl; ++ControlNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, ControlNum, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, Status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - ZoneNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ""}; + int ZoneNum = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), state.dataHeatBal->Zone); if (ZoneNum == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Not a valid zone name."); + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; continue; } - if (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType != DataRoomAirModel::RoomAirModel::Mundt) { - ShowSevereError( - state, - format("Zone specified=\"{}\", Air Model type is not OneNodeDisplacementVentilation.", state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Air Model Type for zone={}", ChAirModel[static_cast(state.dataRoomAirMod->AirModel(ZoneNum).AirModelType)])); + if (state.dataRoomAir->AirModel(ZoneNum).AirModel != RoomAirModel::DispVent1Node) { + ShowSevereError(state, format("Zone specified=\"{}\", Air Model type is not OneNodeDisplacementVentilation.", ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("Air Model Type for zone={}", roomAirModelNamesUC[(int)state.dataRoomAir->AirModel(ZoneNum).AirModel])); ErrorsFound = true; continue; } - state.dataRoomAirMod->ConvectiveFloorSplit(ZoneNum) = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->InfiltratFloorSplit(ZoneNum) = state.dataIPShortCut->rNumericArgs(2); + state.dataRoomAir->ConvectiveFloorSplit(ZoneNum) = ipsc->rNumericArgs(1); + state.dataRoomAir->InfiltratFloorSplit(ZoneNum) = ipsc->rNumericArgs(2); } } @@ -957,8 +870,6 @@ namespace RoomAirModelManager { // SUBROUTINE INFORMATION: // AUTHOR G. Carrilho da Graca // DATE WRITTEN January 2004 - // MODIFIED - // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: // Get UCSD Displacement ventilation model controls for all zones at once @@ -970,66 +881,61 @@ namespace RoomAirModelManager { using namespace ScheduleManager; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + constexpr std::string_view routineName = "GetDisplacementVentData"; int IOStat; int NumAlpha; int NumNumber; - int Loop; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - if (!state.dataRoomAirMod->UCSDModelUsed) return; - cCurrentModuleObject = "RoomAirSettings:ThreeNodeDisplacementVentilation"; - state.dataRoomAirMod->TotUCSDDV = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (state.dataRoomAirMod->TotUCSDDV <= 0) return; + auto &ipsc = state.dataIPShortCut; - state.dataRoomAirMod->ZoneUCSDDV.allocate(state.dataRoomAirMod->TotUCSDDV); + if (!state.dataRoomAir->UCSDModelUsed) return; + ipsc->cCurrentModuleObject = "RoomAirSettings:ThreeNodeDisplacementVentilation"; + state.dataRoomAir->TotDispVent3Node = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); - for (Loop = 1; Loop <= state.dataRoomAirMod->TotUCSDDV; ++Loop) { + if (state.dataRoomAir->TotDispVent3Node <= 0) return; + + state.dataRoomAir->ZoneDispVent3Node.allocate(state.dataRoomAir->TotDispVent3Node); + + for (int Loop = 1; Loop <= state.dataRoomAir->TotDispVent3Node; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumber, IOStat, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &zoneDV3N = state.dataRoomAir->ZoneDispVent3Node(Loop); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; // First is Zone Name - state.dataRoomAirMod->ZoneUCSDDV(Loop).ZoneName = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->ZoneUCSDDV(Loop).ZonePtr = - UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); - if (state.dataRoomAirMod->ZoneUCSDDV(Loop).ZonePtr == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Zone Name not found."); + // zoneUCSDDV.ZoneName = ipsc->cAlphaArgs(1); + zoneDV3N.ZonePtr = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), state.dataHeatBal->Zone); + if (zoneDV3N.ZonePtr == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; } else { - state.dataRoomAirMod->IsZoneDV(state.dataRoomAirMod->ZoneUCSDDV(Loop).ZonePtr) = true; + state.dataRoomAir->IsZoneDispVent3Node(zoneDV3N.ZonePtr) = true; } // Second Alpha is Schedule Name - state.dataRoomAirMod->ZoneUCSDDV(Loop).SchedGainsName = state.dataIPShortCut->cAlphaArgs(2); - state.dataRoomAirMod->ZoneUCSDDV(Loop).SchedGainsPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (state.dataRoomAirMod->ZoneUCSDDV(Loop).SchedGainsPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, " Schedule name must be input."); - ErrorsFound = true; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule name was not found."); - ErrorsFound = true; - } + // zoneUCSDDV.SchedGainsName = ipsc->cAlphaArgs(2); + if (ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((zoneDV3N.SchedGainsPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2))) == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + ErrorsFound = true; } - state.dataRoomAirMod->ZoneUCSDDV(Loop).NumPlumesPerOcc = state.dataIPShortCut->rNumericArgs(1); - state.dataRoomAirMod->ZoneUCSDDV(Loop).ThermostatHeight = state.dataIPShortCut->rNumericArgs(2); - state.dataRoomAirMod->ZoneUCSDDV(Loop).ComfortHeight = state.dataIPShortCut->rNumericArgs(3); - state.dataRoomAirMod->ZoneUCSDDV(Loop).TempTrigger = state.dataIPShortCut->rNumericArgs(4); + zoneDV3N.NumPlumesPerOcc = ipsc->rNumericArgs(1); + zoneDV3N.ThermostatHeight = ipsc->rNumericArgs(2); + zoneDV3N.ComfortHeight = ipsc->rNumericArgs(3); + zoneDV3N.TempTrigger = ipsc->rNumericArgs(4); } } @@ -1039,8 +945,6 @@ namespace RoomAirModelManager { // SUBROUTINE INFORMATION: // AUTHOR G. Carrilho da Graca // DATE WRITTEN October 2004 - // MODIFIED - // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: // Get UCSD Cross ventilation model controls for all zones at once @@ -1052,139 +956,107 @@ namespace RoomAirModelManager { using namespace ScheduleManager; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + constexpr std::string_view routineName = "GetCrossVentData"; + int IOStat; int NumAlpha; int NumNumber; - int Loop; - int Loop2; - int ThisZone; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - if (!state.dataRoomAirMod->UCSDModelUsed) return; - cCurrentModuleObject = "RoomAirSettings:CrossVentilation"; - state.dataRoomAirMod->TotUCSDCV = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (state.dataRoomAirMod->TotUCSDCV <= 0) return; + auto &ipsc = state.dataIPShortCut; + if (!state.dataRoomAir->UCSDModelUsed) return; + ipsc->cCurrentModuleObject = "RoomAirSettings:CrossVentilation"; + state.dataRoomAir->TotCrossVent = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); - state.dataRoomAirMod->ZoneUCSDCV.allocate(state.dataRoomAirMod->TotUCSDCV); + if (state.dataRoomAir->TotCrossVent <= 0) return; - for (Loop = 1; Loop <= state.dataRoomAirMod->TotUCSDCV; ++Loop) { + state.dataRoomAir->ZoneCrossVent.allocate(state.dataRoomAir->TotCrossVent); + + for (int Loop = 1; Loop <= state.dataRoomAir->TotCrossVent; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumber, IOStat, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + auto &zoneCV = state.dataRoomAir->ZoneCrossVent(Loop); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; // First is Zone Name - state.dataRoomAirMod->ZoneUCSDCV(Loop).ZoneName = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr = - UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); - if (state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Zone name was not found."); + // state.dataRoomAir->ZoneUCSDCV(Loop).ZoneName = ipsc->cAlphaArgs(1); + if ((zoneCV.ZonePtr = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), state.dataHeatBal->Zone)) == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; } else { - state.dataRoomAirMod->IsZoneCV(state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr) = true; + state.dataRoomAir->IsZoneCrossVent(zoneCV.ZonePtr) = true; } // Second Alpha is Schedule Name - state.dataRoomAirMod->ZoneUCSDCV(Loop).SchedGainsName = state.dataIPShortCut->cAlphaArgs(2); - state.dataRoomAirMod->ZoneUCSDCV(Loop).SchedGainsPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (state.dataRoomAirMod->ZoneUCSDCV(Loop).SchedGainsPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule name field is blank."); - ErrorsFound = true; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule name was not found."); - ErrorsFound = true; - } + // zoneUCSDCV.SchedGainsName = ipsc->cAlphaArgs(2); + if (ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((zoneCV.SchedGainsPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2))) == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + ErrorsFound = true; } // Third Alpha is a string: JET or RECIRCULATION - if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(3), "Jet")) { - state.dataRoomAirMod->ZoneUCSDCV(Loop).VforComfort = Comfort::Jet; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(3), "Recirculation")) { - state.dataRoomAirMod->ZoneUCSDCV(Loop).VforComfort = Comfort::Recirculation; - } else { - state.dataRoomAirMod->ZoneUCSDCV(Loop).VforComfort = Comfort::Invalid; - } - - for (Loop2 = 1; Loop2 <= state.dataHeatBal->TotPeople; ++Loop2) { - if (state.dataHeatBal->People(Loop2).ZonePtr != state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr) continue; - if (state.dataHeatBal->People(Loop2).Fanger) { - if (state.dataRoomAirMod->ZoneUCSDCV(Loop).VforComfort == Comfort::Invalid) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Airflow region used for thermal comfort evaluation is required for Zone={}", - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Field is blank, please choose Jet or Recirculation."); - ErrorsFound = true; - } else { - ShowSevereError( - state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Airflow region used for thermal comfort evaluation is required for Zone={}", - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Please choose Jet or Recirculation."); - ErrorsFound = true; - } - } + if (ipsc->lAlphaFieldBlanks(3)) { + for (int Loop2 = 1; Loop2 <= state.dataHeatBal->TotPeople; ++Loop2) { + if (state.dataHeatBal->People(Loop2).ZonePtr != zoneCV.ZonePtr) continue; + if (!state.dataHeatBal->People(Loop2).Fanger) continue; + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; } + } else if ((zoneCV.VforComfort = static_cast(getEnumValue(comfortNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(3))))) == + Comfort::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); + ErrorsFound = true; } - ThisZone = state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr; - if (ThisZone == 0) continue; + if (zoneCV.ZonePtr == 0) continue; // Following depend on valid zone - Loop2 = UtilityRoutines::FindItemInList(state.dataHeatBal->Zone(state.dataRoomAirMod->ZoneUCSDCV(Loop).ZonePtr).Name, - state.afn->MultizoneZoneData, - &AirflowNetwork::MultizoneZoneProp::ZoneName); - if (Loop2 == 0) { - ShowSevereError(state, format("Problem with {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (UtilityRoutines::FindItemInList( + state.dataHeatBal->Zone(zoneCV.ZonePtr).Name, state.afn->MultizoneZoneData, &AirflowNetwork::MultizoneZoneProp::ZoneName) == 0) { + ShowSevereError(state, format("Problem with {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ShowContinueError(state, "AirflowNetwork airflow model must be active in this zone"); ErrorsFound = true; } // If a crack is used it must have an air flow coefficient = 0.5 - for (Loop2 = 1; Loop2 <= state.afn->NumOfLinksMultiZone; ++Loop2) { - state.dataRoomAirModelMgr->NodeNum1 = state.afn->MultizoneSurfaceData(Loop2).NodeNums[0]; - state.dataRoomAirModelMgr->NodeNum2 = state.afn->MultizoneSurfaceData(Loop2).NodeNums[1]; - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(Loop2).SurfNum).Zone == ThisZone || - (state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNum2).EPlusZoneNum == ThisZone && - state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNum1).EPlusZoneNum > 0) || - (state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNum2).EPlusZoneNum > 0 && - state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNum1).EPlusZoneNum == ThisZone)) { - state.dataRoomAirModelMgr->CompNum = state.afn->AirflowNetworkLinkageData(Loop2).CompNum; - state.dataRoomAirModelMgr->TypeNum = state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNum).TypeNum; - if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::SCR) { - if (state.afn->MultizoneSurfaceCrackData(state.dataRoomAirModelMgr->TypeNum).exponent != 0.50) { - state.dataRoomAirMod->AirModel(ThisZone).AirModelType = DataRoomAirModel::RoomAirModel::Mixing; - ShowWarningError(state, format("Problem with {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowWarningError(state, format("Roomair model will not be applied for Zone={}.", state.dataIPShortCut->cAlphaArgs(1))); + for (int iLink = 1; iLink <= state.afn->NumOfLinksMultiZone; ++iLink) { + auto const &mzSurfaceData = state.afn->MultizoneSurfaceData(iLink); + int nodeNum1 = mzSurfaceData.NodeNums[0]; + int nodeNum2 = mzSurfaceData.NodeNums[1]; + if (state.dataSurface->Surface(mzSurfaceData.SurfNum).Zone == zoneCV.ZonePtr || + (state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum == zoneCV.ZonePtr && + state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum > 0) || + (state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum > 0 && + state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum == zoneCV.ZonePtr)) { + int compNum = state.afn->AirflowNetworkLinkageData(iLink).CompNum; + int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum; + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::SCR) { + if (state.afn->MultizoneSurfaceCrackData(typeNum).exponent != 0.50) { + state.dataRoomAir->AirModel(zoneCV.ZonePtr).AirModel = RoomAirModel::Mixing; + ShowWarningError(state, format("Problem with {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowWarningError(state, format("Roomair model will not be applied for Zone={}.", ipsc->cAlphaArgs(1))); ShowContinueError( state, format("AirflowNetwrok:Multizone:Surface crack object must have an air flow coefficient = 0.5, value was={:.2R}", - state.afn->MultizoneSurfaceCrackData(state.dataRoomAirModelMgr->TypeNum).exponent)); + state.afn->MultizoneSurfaceCrackData(typeNum).exponent)); } } - } - } - } + } // if + } // for (iLink) + } // for (Loop) } void GetUFADZoneData(EnergyPlusData &state, bool &ErrorsFound) // True if errors found during this get input routine @@ -1193,8 +1065,6 @@ namespace RoomAirModelManager { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN August 2005 - // MODIFIED - // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: // Get UCSD UFAD interior zone model controls for all zones at once @@ -1206,168 +1076,151 @@ namespace RoomAirModelManager { using namespace ScheduleManager; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + constexpr std::string_view routineName = "GetUFADZoneData"; + int IOStat; int NumAlpha; int NumNumber; - int Loop; - if (!state.dataRoomAirMod->UCSDModelUsed) { - state.dataRoomAirMod->TotUCSDUI = 0; - state.dataRoomAirMod->TotUCSDUE = 0; + if (!state.dataRoomAir->UCSDModelUsed) { + state.dataRoomAir->TotUFADInt = 0; + state.dataRoomAir->TotUFADExt = 0; return; } - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionInterior"; - state.dataRoomAirMod->TotUCSDUI = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionExterior"; - state.dataRoomAirMod->TotUCSDUE = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (state.dataRoomAirMod->TotUCSDUI <= 0 && state.dataRoomAirMod->TotUCSDUE <= 0) return; + auto &ipsc = state.dataIPShortCut; + + ipsc->cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionInterior"; + state.dataRoomAir->TotUFADInt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + ipsc->cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionExterior"; + state.dataRoomAir->TotUFADExt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + + if (state.dataRoomAir->TotUFADInt <= 0 && state.dataRoomAir->TotUFADExt <= 0) return; - state.dataRoomAirMod->ZoneUCSDUI.allocate(state.dataRoomAirMod->TotUCSDUI); - state.dataRoomAirMod->ZoneUCSDUE.allocate(state.dataRoomAirMod->TotUCSDUE); - state.dataRoomAirMod->ZoneUFPtr.dimension(state.dataGlobal->NumOfZones, 0); + state.dataRoomAir->ZoneUFAD.allocate(state.dataRoomAir->TotUFADInt + state.dataRoomAir->TotUFADExt); + state.dataRoomAir->ZoneUFADPtr.dimension(state.dataGlobal->NumOfZones, 0); - cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionInterior"; - for (Loop = 1; Loop <= state.dataRoomAirMod->TotUCSDUI; ++Loop) { + ipsc->cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionInterior"; + for (int Loop = 1; Loop <= state.dataRoomAir->TotUFADInt; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumber, IOStat, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); // First is Zone Name - state.dataRoomAirMod->ZoneUCSDUI(Loop).ZoneName = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->ZoneUCSDUI(Loop).ZonePtr = - UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); - state.dataRoomAirMod->ZoneUFPtr(state.dataRoomAirMod->ZoneUCSDUI(Loop).ZonePtr) = Loop; - if (state.dataRoomAirMod->ZoneUCSDUI(Loop).ZonePtr == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Zone name was not found."); + auto &zoneUI = state.dataRoomAir->ZoneUFAD(Loop); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + + zoneUI.ZoneName = ipsc->cAlphaArgs(1); + zoneUI.ZonePtr = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), state.dataHeatBal->Zone); + state.dataRoomAir->ZoneUFADPtr(zoneUI.ZonePtr) = Loop; + if (zoneUI.ZonePtr == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; } else { - state.dataRoomAirMod->IsZoneUI(state.dataRoomAirMod->ZoneUCSDUI(Loop).ZonePtr) = true; + state.dataRoomAir->IsZoneUFAD(zoneUI.ZonePtr) = true; + state.dataRoomAir->ZoneUFADPtr(zoneUI.ZonePtr) = Loop; } + // 2nd alpha is diffuser type - if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "Swirl")) { - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffuserType = Diffuser::Swirl; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "VariableArea")) { - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffuserType = Diffuser::VarArea; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "HorizontalSwirl")) { - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffuserType = Diffuser::DisplVent; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "Custom")) { - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffuserType = Diffuser::Custom; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "LinearBarGrille")) { - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffuserType = Diffuser::LinBarGrille; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + zoneUI.DiffuserType = static_cast(getEnumValue(diffuserNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(2)))); + if (zoneUI.DiffuserType == Diffuser::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; } // 1st number is Number of Diffusers per Zone - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffusersPerZone = state.dataIPShortCut->rNumericArgs(1); + zoneUI.DiffusersPerZone = ipsc->rNumericArgs(1); // 2nd number is Power per Plume - state.dataRoomAirMod->ZoneUCSDUI(Loop).PowerPerPlume = state.dataIPShortCut->rNumericArgs(2); + zoneUI.PowerPerPlume = ipsc->rNumericArgs(2); // 3rd number is Design Effective Area of Diffuser - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffArea = state.dataIPShortCut->rNumericArgs(3); + zoneUI.DiffArea = ipsc->rNumericArgs(3); // 4th number is Diffuser Slot Angle from Vertical - state.dataRoomAirMod->ZoneUCSDUI(Loop).DiffAngle = state.dataIPShortCut->rNumericArgs(4); + zoneUI.DiffAngle = ipsc->rNumericArgs(4); // 5th number is Thermostat Height - state.dataRoomAirMod->ZoneUCSDUI(Loop).ThermostatHeight = state.dataIPShortCut->rNumericArgs(5); + zoneUI.ThermostatHeight = ipsc->rNumericArgs(5); // 6th number is Comfort Height - state.dataRoomAirMod->ZoneUCSDUI(Loop).ComfortHeight = state.dataIPShortCut->rNumericArgs(6); + zoneUI.ComfortHeight = ipsc->rNumericArgs(6); // 7th number is Temperature Difference Threshold for Reporting - state.dataRoomAirMod->ZoneUCSDUI(Loop).TempTrigger = state.dataIPShortCut->rNumericArgs(7); + zoneUI.TempTrigger = ipsc->rNumericArgs(7); // 8th number user-specified transition height - state.dataRoomAirMod->ZoneUCSDUI(Loop).TransHeight = state.dataIPShortCut->rNumericArgs(8); + zoneUI.TransHeight = ipsc->rNumericArgs(8); // 9th number is Coefficient A in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUI(Loop).A_Kc = state.dataIPShortCut->rNumericArgs(9); + zoneUI.A_Kc = ipsc->rNumericArgs(9); // 10th number is Coefficient B in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUI(Loop).B_Kc = state.dataIPShortCut->rNumericArgs(10); + zoneUI.B_Kc = ipsc->rNumericArgs(10); // 11th number is Coefficient C in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUI(Loop).C_Kc = state.dataIPShortCut->rNumericArgs(11); + zoneUI.C_Kc = ipsc->rNumericArgs(11); // 12th number is Coefficient D in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUI(Loop).D_Kc = state.dataIPShortCut->rNumericArgs(12); + zoneUI.D_Kc = ipsc->rNumericArgs(12); // 13th number is Coefficient E in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUI(Loop).E_Kc = state.dataIPShortCut->rNumericArgs(13); + zoneUI.E_Kc = ipsc->rNumericArgs(13); } - cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionExterior"; - for (Loop = 1; Loop <= state.dataRoomAirMod->TotUCSDUE; ++Loop) { + ipsc->cCurrentModuleObject = "RoomAirSettings:UnderFloorAirDistributionExterior"; + for (int Loop = 1; Loop <= state.dataRoomAir->TotUFADExt; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumber, IOStat, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); // First is Zone Name - state.dataRoomAirMod->ZoneUCSDUE(Loop).ZoneName = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->ZoneUCSDUE(Loop).ZonePtr = - UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); - state.dataRoomAirMod->ZoneUFPtr(state.dataRoomAirMod->ZoneUCSDUE(Loop).ZonePtr) = Loop; - if (state.dataRoomAirMod->ZoneUCSDUE(Loop).ZonePtr == 0) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Zone name was not found."); + auto &zoneUE = state.dataRoomAir->ZoneUFAD(Loop + state.dataRoomAir->TotUFADInt); + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + zoneUE.ZoneName = ipsc->cAlphaArgs(1); + zoneUE.ZonePtr = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), state.dataHeatBal->Zone); + if (zoneUE.ZonePtr == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; } else { - state.dataRoomAirMod->IsZoneUI(state.dataRoomAirMod->ZoneUCSDUE(Loop).ZonePtr) = true; + state.dataRoomAir->IsZoneUFAD(zoneUE.ZonePtr) = true; + state.dataRoomAir->ZoneUFADPtr(zoneUE.ZonePtr) = Loop + state.dataRoomAir->TotUFADInt; } - // 2nd alpha is diffuser type - if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "Swirl")) { - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffuserType = Diffuser::Swirl; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "VariableArea")) { - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffuserType = Diffuser::VarArea; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "HorizontalSwirl")) { - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffuserType = Diffuser::DisplVent; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "Custom")) { - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffuserType = Diffuser::Custom; - } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), "LinearBarGrille")) { - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffuserType = Diffuser::LinBarGrille; - } else { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + + zoneUE.DiffuserType = static_cast(getEnumValue(diffuserNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(2)))); + if (zoneUE.DiffuserType == Diffuser::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; } // 1st number is Number of Diffusers per Zone - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffusersPerZone = state.dataIPShortCut->rNumericArgs(1); + zoneUE.DiffusersPerZone = ipsc->rNumericArgs(1); // 2nd number is Power per Plume - state.dataRoomAirMod->ZoneUCSDUE(Loop).PowerPerPlume = state.dataIPShortCut->rNumericArgs(2); + zoneUE.PowerPerPlume = ipsc->rNumericArgs(2); // 3rd number is Design Effective Area of Diffuser - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffArea = state.dataIPShortCut->rNumericArgs(3); + zoneUE.DiffArea = ipsc->rNumericArgs(3); // 4th number is Diffuser Slot Angle from Vertical - state.dataRoomAirMod->ZoneUCSDUE(Loop).DiffAngle = state.dataIPShortCut->rNumericArgs(4); + zoneUE.DiffAngle = ipsc->rNumericArgs(4); // 5th number is Thermostat Height - state.dataRoomAirMod->ZoneUCSDUE(Loop).ThermostatHeight = state.dataIPShortCut->rNumericArgs(5); + zoneUE.ThermostatHeight = ipsc->rNumericArgs(5); // 6th number is Comfort Height - state.dataRoomAirMod->ZoneUCSDUE(Loop).ComfortHeight = state.dataIPShortCut->rNumericArgs(6); + zoneUE.ComfortHeight = ipsc->rNumericArgs(6); // 7th number is Temperature Difference Threshold for Reporting - state.dataRoomAirMod->ZoneUCSDUE(Loop).TempTrigger = state.dataIPShortCut->rNumericArgs(7); + zoneUE.TempTrigger = ipsc->rNumericArgs(7); // 8th number user-specified transition height - state.dataRoomAirMod->ZoneUCSDUE(Loop).TransHeight = state.dataIPShortCut->rNumericArgs(8); + zoneUE.TransHeight = ipsc->rNumericArgs(8); // 9th number is Coefficient A in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUE(Loop).A_Kc = state.dataIPShortCut->rNumericArgs(9); + zoneUE.A_Kc = ipsc->rNumericArgs(9); // 10th number is Coefficient B in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUE(Loop).B_Kc = state.dataIPShortCut->rNumericArgs(10); + zoneUE.B_Kc = ipsc->rNumericArgs(10); // 11th number is Coefficient C in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUE(Loop).C_Kc = state.dataIPShortCut->rNumericArgs(11); + zoneUE.C_Kc = ipsc->rNumericArgs(11); // 12th number is Coefficient D in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUE(Loop).D_Kc = state.dataIPShortCut->rNumericArgs(12); + zoneUE.D_Kc = ipsc->rNumericArgs(12); // 13th number is Coefficient E in formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2 - state.dataRoomAirMod->ZoneUCSDUE(Loop).E_Kc = state.dataIPShortCut->rNumericArgs(13); + zoneUE.E_Kc = ipsc->rNumericArgs(13); } } @@ -1377,8 +1230,6 @@ namespace RoomAirModelManager { // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN November 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get RoomAirflowNetwork data for all zones at once @@ -1387,591 +1238,509 @@ namespace RoomAirModelManager { // Use input processor to get input from idf file // Using/Aliasing - using DataHVACGlobals::NumZoneHVACTerminalTypes; - using DataHVACGlobals::ZoneHVACTerminalTypes; using InternalHeatGains::GetInternalGainDeviceIndex; using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Loop; // local do loop index + constexpr std::string_view routineName = "GetRoomAirflowNetworkData"; int NumAlphas; int NumNumbers; int status; - int ZoneNum; - int thisAirNodeinZone; - int AlphaArgNum; - int AirCntrlNodeNum; int TotNumOfRAFNNodeSurfLists; int TotNumOfRAFNNodeGainsLists; int TotNumOfRAFNNodeHVACLists; - int RAFNNodeNum; - bool foundList; - int NumSurfsThisNode; - int NumOfSurfs; - int gainsLoop; - int TypeNum; - int numEquip; - int EquipLoop; int TotNumEquip; bool IntEquipError; - Real64 SumFraction; - std::string Name; - int GainNum; - int RAFNNum; - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = "RoomAirSettings:AirflowNetwork"; - state.dataRoomAirMod->NumOfRoomAirflowNetControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - if (state.dataRoomAirMod->NumOfRoomAirflowNetControl == 0) return; - if (state.dataRoomAirMod->NumOfRoomAirflowNetControl > state.dataGlobal->NumOfZones) { - ShowSevereError(state, format("Too many {} objects in input file", cCurrentModuleObject)); - ShowContinueError(state, format("There cannot be more {} objects than number of zones.", cCurrentModuleObject)); + + auto &ipsc = state.dataIPShortCut; + ipsc->cCurrentModuleObject = "RoomAirSettings:AirflowNetwork"; + state.dataRoomAir->NumOfRoomAFNControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + if (state.dataRoomAir->NumOfRoomAFNControl == 0) return; + if (state.dataRoomAir->NumOfRoomAFNControl > state.dataGlobal->NumOfZones) { + ShowSevereError(state, format("Too many {} objects in input file", ipsc->cCurrentModuleObject)); + ShowContinueError(state, format("There cannot be more {} objects than number of zones.", ipsc->cCurrentModuleObject)); ErrorsFound = true; } - if (!allocated(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo.allocate(state.dataGlobal->NumOfZones); + if (!allocated(state.dataRoomAir->AFNZoneInfo)) { + state.dataRoomAir->AFNZoneInfo.allocate(state.dataGlobal->NumOfZones); } - - for (Loop = 1; Loop <= state.dataRoomAirMod->NumOfRoomAirflowNetControl; ++Loop) { + for (int Loop = 1; Loop <= state.dataRoomAir->NumOfRoomAFNControl; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, status, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - ZoneNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + int ZoneNum = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (ZoneNum == 0) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, "Not a valid zone name."); + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; continue; } - if (state.dataRoomAirMod->AirModel(ZoneNum).AirModelType != DataRoomAirModel::RoomAirModel::AirflowNetwork) { + if (state.dataRoomAir->AirModel(ZoneNum).AirModel != RoomAirModel::AirflowNetwork) { ShowSevereError(state, - format("GetRoomAirflowNetworkData: Zone specified='{}', Air Model type is not AirflowNetwork.", - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Air Model Type for zone ={}", ChAirModel[static_cast(state.dataRoomAirMod->AirModel(ZoneNum).AirModelType)])); + format("GetRoomAirflowNetworkData: Zone specified='{}', Air Model type is not AirflowNetwork.", ipsc->cAlphaArgs(1))); + ShowContinueError(state, + format("Air Model Type for zone ={}", roomAirModelNamesUC[(int)state.dataRoomAir->AirModel(ZoneNum).AirModel])); ErrorsFound = true; continue; } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ZoneID = ZoneNum; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).RAFNNum = Loop; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).IsUsed = true; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ZoneName = state.dataIPShortCut->cAlphaArgs(2); // Zone Name - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes = (NumAlphas - 3); + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(ZoneNum); + roomAFNZoneInfo.ZoneID = ZoneNum; + roomAFNZoneInfo.IsUsed = true; + roomAFNZoneInfo.Name = ipsc->cAlphaArgs(1); + roomAFNZoneInfo.ZoneName = ipsc->cAlphaArgs(2); // Zone Name + + roomAFNZoneInfo.NumOfAirNodes = (NumAlphas - 3); - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node.allocate( - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); + if (roomAFNZoneInfo.NumOfAirNodes > 0) { + roomAFNZoneInfo.Node.allocate(roomAFNZoneInfo.NumOfAirNodes); } else { - ShowSevereError( - state, - format("GetRoomAirflowNetworkData: Incomplete input in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, + format("GetRoomAirflowNetworkData: Incomplete input in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ErrorsFound = true; } - for (thisAirNodeinZone = 1; thisAirNodeinZone <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; - ++thisAirNodeinZone) { - AlphaArgNum = thisAirNodeinZone + 3; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(thisAirNodeinZone).Name = - state.dataIPShortCut->cAlphaArgs(AlphaArgNum); + for (int iAirNode = 1; iAirNode <= roomAFNZoneInfo.NumOfAirNodes; ++iAirNode) { + roomAFNZoneInfo.Node(iAirNode).Name = ipsc->cAlphaArgs(iAirNode + 3); } // control point node - AirCntrlNodeNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); - if (AirCntrlNodeNum == 0) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Not a valid RoomAir:Node:AirflowNetwork name for this zone."); + + roomAFNZoneInfo.ControlAirNodeID = + UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(3), roomAFNZoneInfo.Node, roomAFNZoneInfo.NumOfAirNodes); + if (roomAFNZoneInfo.ControlAirNodeID == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; continue; - } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ControlAirNodeID = AirCntrlNodeNum; } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).totNumSurfs = 0; + + roomAFNZoneInfo.totNumSurfs = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; + roomAFNZoneInfo.totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } - } // loop thru NumOfRoomAirflowNetControl + } // for (Loop) - cCurrentModuleObject = "RoomAir:Node:AirflowNetwork"; - state.dataRoomAirMod->TotNumOfRoomAFNNodes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - for (Loop = 1; Loop <= state.dataRoomAirMod->TotNumOfRoomAFNNodes; ++Loop) { + ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork"; + state.dataRoomAir->TotNumOfRoomAFNNodes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= state.dataRoomAir->TotNumOfRoomAFNNodes; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, status, _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - ZoneNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + ipsc->lAlphaFieldBlanks, + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + int ZoneNum = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (ZoneNum == 0) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Not a valid zone name."); + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; continue; } - RAFNNodeNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(ZoneNum); + int RAFNNodeNum = UtilityRoutines::FindItemInList(ipsc->cAlphaArgs(1), roomAFNZoneInfo.Node, roomAFNZoneInfo.NumOfAirNodes); if (RAFNNodeNum == 0) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Not a valid RoomAir:Node:AirflowNetwork name."); + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); ErrorsFound = true; continue; } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).ZoneVolumeFraction = state.dataIPShortCut->rNumericArgs(1); - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NodeSurfListName = state.dataIPShortCut->cAlphaArgs(3); + auto &roomAFNZoneNode = roomAFNZoneInfo.Node(RAFNNodeNum); + roomAFNZoneNode.ZoneVolumeFraction = ipsc->rNumericArgs(1); + if (!ipsc->lAlphaFieldBlanks(3)) { + roomAFNZoneNode.NodeSurfListName = ipsc->cAlphaArgs(3); } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasSurfacesAssigned = false; + roomAFNZoneNode.HasSurfacesAssigned = false; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NodeIntGainsListName = - state.dataIPShortCut->cAlphaArgs(4); + if (!ipsc->lAlphaFieldBlanks(4)) { + roomAFNZoneNode.NodeIntGainsListName = ipsc->cAlphaArgs(4); } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasIntGainsAssigned = false; + roomAFNZoneNode.HasIntGainsAssigned = false; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NodeHVACListName = state.dataIPShortCut->cAlphaArgs(5); + if (!ipsc->lAlphaFieldBlanks(5)) { + roomAFNZoneNode.NodeHVACListName = ipsc->cAlphaArgs(5); } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasHVACAssigned = false; + roomAFNZoneNode.HasHVACAssigned = false; } } // loop thru TotNumOfRoomAFNNodes - cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:AdjacentSurfaceList"; - TotNumOfRAFNNodeSurfLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - for (Loop = 1; Loop <= TotNumOfRAFNNodeSurfLists; ++Loop) { - foundList = false; + ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:AdjacentSurfaceList"; + TotNumOfRAFNNodeSurfLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= TotNumOfRAFNNodeSurfLists; ++Loop) { + bool foundList = false; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { // find surface list - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - RAFNNodeNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node, - &RoomAirflowNetworkAirNodeNestedStruct::NodeSurfListName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); - } else { - RAFNNodeNum = 0; + int RAFNNodeNum = 0; + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (roomAFNZoneInfo.NumOfAirNodes > 0) { + RAFNNodeNum = UtilityRoutines::FindItemInList( + ipsc->cAlphaArgs(1), roomAFNZoneInfo.Node, &AFNAirNodeNested::NodeSurfListName, roomAFNZoneInfo.NumOfAirNodes); + } + + if (RAFNNodeNum == 0) continue; + + // found it + foundList = true; + int NumSurfsThisNode = NumAlphas - 1; + int NumOfSurfs = 0; // What is this used for? + for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; + } + + auto &roomAFNZoneNode = roomAFNZoneInfo.Node(RAFNNodeNum); + if (allocated(roomAFNZoneNode.SurfMask)) { + // throw error found twice + ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, "Duplicate RoomAir:Node:AirflowNetwork:AdjacentSurfaceList name."); + ErrorsFound = true; + continue; } - if (RAFNNodeNum > 0) { // found it - foundList = true; - NumSurfsThisNode = NumAlphas - 1; - NumOfSurfs = 0; - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + + roomAFNZoneNode.SurfMask.allocate(roomAFNZoneInfo.totNumSurfs); + roomAFNZoneNode.SurfMask = false; // init + roomAFNZoneNode.HasSurfacesAssigned = true; + // relate surfaces to this air node and check to see whether surface names are specified correctly or not + int SurfCount = 0; + int thisSurfinZone = 0; + for (int ListSurfNum = 2; ListSurfNum <= NumAlphas; ++ListSurfNum) { + for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); - NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; - } - if (allocated(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).SurfMask)) { - // throw error found twice - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Duplicate RoomAir:Node:AirflowNetwork:AdjacentSurfaceList name."); - ErrorsFound = true; - } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum) - .Node(RAFNNodeNum) - .SurfMask.allocate(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).totNumSurfs); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).SurfMask = false; // init - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasSurfacesAssigned = true; - // relate surfaces to this air node and check to see whether surface names are specified correctly or not - int SurfCount = 0; - int thisSurfinZone = 0; - bool surfaceFound = false; - for (int ListSurfNum = 2; ListSurfNum <= NumAlphas; ++ListSurfNum) { - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - ++thisSurfinZone; - if (state.dataIPShortCut->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).SurfMask(thisSurfinZone) = true; - ++SurfCount; - surfaceFound = true; - break; - } - } - if (surfaceFound) break; + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { + ++thisSurfinZone; + if (ipsc->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { + roomAFNZoneNode.SurfMask(thisSurfinZone) = true; + ++SurfCount; + break; } } - if (NumSurfsThisNode != SurfCount) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Some surface names were not found in the zone"); - ErrorsFound = true; - } + if (SurfCount > 0) break; } - break; } - } // loop over zones + if (NumSurfsThisNode != SurfCount) { + ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, "Some surface names were not found in the zone"); + ErrorsFound = true; + } + } // for (iZone) + if (!foundList) { // throw error - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ShowContinueError(state, "Did not find a RoomAir:Node:AirflowNetwork object that references this object"); ErrorsFound = true; } } // loop thru TotNumOfRAFNNodeSurfLists - cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:InternalGains"; - TotNumOfRAFNNodeGainsLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - for (Loop = 1; Loop <= TotNumOfRAFNNodeGainsLists; ++Loop) { - foundList = false; + ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:InternalGains"; + TotNumOfRAFNNodeGainsLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= TotNumOfRAFNNodeGainsLists; ++Loop) { + int foundList = false; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + if (mod((NumAlphas + NumNumbers - 1), 3) != 0) { - ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Extensible field set are not evenly divisable by 3. Number of data entries = {}", - fmt::to_string(NumAlphas + NumNumbers - 1))); + ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError( + state, format("Extensible field set are not evenly divisable by 3. Number of data entries = {}", NumAlphas + NumNumbers - 1)); ErrorsFound = true; break; } - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); // find surface list - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - RAFNNodeNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node, - &RoomAirflowNetworkAirNodeNestedStruct::NodeIntGainsListName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); - } else { - RAFNNodeNum = 0; + int RAFNNodeNum = 0; + if (roomAFNZoneInfo.NumOfAirNodes > 0) { + RAFNNodeNum = UtilityRoutines::FindItemInList( + ipsc->cAlphaArgs(1), roomAFNZoneInfo.Node, &AFNAirNodeNested::NodeIntGainsListName, roomAFNZoneInfo.NumOfAirNodes); } - if (RAFNNodeNum > 0) { // found it - foundList = true; - int numInputGains = (NumAlphas + NumNumbers - 1) / 3; - int numSpacesInZone = state.dataHeatBal->Zone(ZoneNum).numSpaces; - int maxNumGains = numInputGains * numSpacesInZone; - if (allocated(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain)) { + if (RAFNNodeNum == 0) continue; + + // found it + foundList = true; + int numInputGains = (NumAlphas + NumNumbers - 1) / 3; + int numSpacesInZone = state.dataHeatBal->Zone(iZone).numSpaces; + int maxNumGains = numInputGains * numSpacesInZone; + auto &roomAFNZoneNode = roomAFNZoneInfo.Node(RAFNNodeNum); + if (allocated(roomAFNZoneNode.IntGain)) { + ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Duplicate {} name.", ipsc->cCurrentModuleObject)); + ErrorsFound = true; + continue; + } + + roomAFNZoneNode.IntGain.allocate(maxNumGains); + roomAFNZoneNode.IntGainsDeviceIndices.allocate(maxNumGains); + roomAFNZoneNode.intGainsDeviceSpaces.allocate(maxNumGains); + roomAFNZoneNode.IntGainsFractions.allocate(maxNumGains); + roomAFNZoneNode.HasIntGainsAssigned = true; + int numGainsFound = 0; + for (int gainsLoop = 1; gainsLoop <= numInputGains; ++gainsLoop) { + auto &intGain = roomAFNZoneNode.IntGain(gainsLoop); + intGain.type = static_cast( + getEnumValue(DataHeatBalance::IntGainTypeNamesUC, UtilityRoutines::makeUPPER(ipsc->cAlphaArgs(gainsLoop * 2)))); + + if (intGain.type == DataHeatBalance::IntGainType::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(gainsLoop * 2), ipsc->cAlphaArgs(gainsLoop * 2)); + ErrorsFound = true; + continue; + } + intGain.Name = ipsc->cAlphaArgs(gainsLoop * 2 + 1); + + bool gainFound = false; + // check all spaces in this zone for matching gains + for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { + // verify type and name and get pointer to device in internal gains structure array + int intGainIndex = GetInternalGainDeviceIndex(state, spaceNum, intGain.type, intGain.Name); + if (intGainIndex >= 0) { + gainFound = true; + ++numGainsFound; + roomAFNZoneNode.intGainsDeviceSpaces(numGainsFound) = spaceNum; + roomAFNZoneNode.IntGainsDeviceIndices(numGainsFound) = intGainIndex; + roomAFNZoneNode.IntGainsFractions(numGainsFound) = ipsc->rNumericArgs(gainsLoop); + } + } + if (gainFound) { + roomAFNZoneNode.NumIntGains = numGainsFound; + } else { ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Duplicate {} name.", cCurrentModuleObject)); + ipsc->cAlphaFieldNames(gainsLoop * 2 + 1), + ipsc->cAlphaArgs(gainsLoop * 2 + 1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, "Internal gain did not match correctly"); ErrorsFound = true; - } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain.allocate(maxNumGains); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGainsDeviceIndices.allocate(maxNumGains); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).intGainsDeviceSpaces.allocate(maxNumGains); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGainsFractions.allocate(maxNumGains); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasIntGainsAssigned = true; - int numGainsFound = 0; - for (gainsLoop = 1; gainsLoop <= numInputGains; ++gainsLoop) { - TypeNum = getEnumerationValue(DataHeatBalance::IntGainTypeNamesUC, - UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(gainsLoop * 2))); - if (TypeNum >= 0) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Type = - static_cast(TypeNum); - } else { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(gainsLoop * 2), - state.dataIPShortCut->cAlphaArgs(gainsLoop * 2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "incorrect type of internal gain"); - ErrorsFound = true; - continue; - } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Name = - state.dataIPShortCut->cAlphaArgs(gainsLoop * 2 + 1); - - bool gainFound = false; - // check all spaces in this zone for matching gains - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - // verify type and name and get pointer to device in internal gains structure array - int intGainIndex = GetInternalGainDeviceIndex( - state, - spaceNum, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Type, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Name); - if (intGainIndex >= 0) { - gainFound = true; - ++numGainsFound; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).intGainsDeviceSpaces(numGainsFound) = - spaceNum; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGainsDeviceIndices(numGainsFound) = - intGainIndex; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGainsFractions(numGainsFound) = - state.dataIPShortCut->rNumericArgs(gainsLoop); - } - } - if (gainFound) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NumIntGains = numGainsFound; - } else { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(gainsLoop * 2 + 1), - state.dataIPShortCut->cAlphaArgs(gainsLoop * 2 + 1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Internal gain did not match correctly"); - ErrorsFound = true; - } - } } - } - } - } // loop thru TotNumOfRAFNNodeGainsLists + } // for (gainsLoop) + } // for (iZone) + } // loop thru TotNumOfRAFNNodeGainsLists // Get data of HVAC equipment - cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:HVACEquipment"; - TotNumOfRAFNNodeHVACLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - for (Loop = 1; Loop <= TotNumOfRAFNNodeHVACLists; ++Loop) { + ipsc->cCurrentModuleObject = "RoomAir:Node:AirflowNetwork:HVACEquipment"; + TotNumOfRAFNNodeHVACLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= TotNumOfRAFNNodeHVACLists; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + ipsc->rNumericArgs, NumNumbers, status, _, _, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + ipsc->cAlphaFieldNames, + ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + if (mod((NumAlphas + NumNumbers - 1), 4) != 0) { - ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("GetRoomAirflowNetworkData: For {}: {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Extensible field set are not evenly divisable by 4. Number of data entries = {}", fmt::to_string(NumAlphas + NumNumbers - 1))); ErrorsFound = true; break; } - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); // find surface list - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - RAFNNodeNum = UtilityRoutines::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node, - &RoomAirflowNetworkAirNodeNestedStruct::NodeHVACListName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes); - } else { - RAFNNodeNum = 0; + int RAFNNodeNum = 0; + if (roomAFNZoneInfo.NumOfAirNodes > 0) { + RAFNNodeNum = UtilityRoutines::FindItemInList( + ipsc->cAlphaArgs(1), roomAFNZoneInfo.Node, &AFNAirNodeNested::NodeHVACListName, roomAFNZoneInfo.NumOfAirNodes); + } + + if (RAFNNodeNum == 0) continue; + + // found it + auto &roomAFNNode = roomAFNZoneInfo.Node(RAFNNodeNum); + if (allocated(roomAFNNode.HVAC)) { + ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Duplicate {} name.", ipsc->cCurrentModuleObject)); + ErrorsFound = true; + continue; } - if (RAFNNodeNum > 0) { // found it - foundList = true; - numEquip = (NumAlphas + NumNumbers - 1) / 4; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NumHVACs = numEquip; - if (allocated(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC)) { + + roomAFNNode.NumHVACs = (NumAlphas + NumNumbers - 1) / 4; + roomAFNNode.HVAC.allocate(roomAFNNode.NumHVACs); + roomAFNNode.HasHVACAssigned = true; + for (int iEquip = 1; iEquip <= roomAFNNode.NumHVACs; ++iEquip) { + int iEquipArg = 2 + (iEquip - 1) * 2; + auto &roomAFNNodeHVAC = roomAFNNode.HVAC(iEquip); + roomAFNNodeHVAC.zoneEquipType = static_cast( + getEnumValue(DataZoneEquipment::zoneEquipTypeNamesUC, ipsc->cAlphaArgs(iEquipArg))); + if (roomAFNNodeHVAC.zoneEquipType == DataZoneEquipment::ZoneEquipType::Invalid) { + ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(iEquipArg), ipsc->cAlphaArgs(iEquipArg)); + ErrorsFound = true; + } + roomAFNNodeHVAC.Name = ipsc->cAlphaArgs(3 + (iEquip - 1) * 2); + + // verify type and name and get pointer to device in HVAC equipment type and name structure array + TotNumEquip = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cAlphaArgs(iEquipArg)); + if (TotNumEquip == 0) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(iEquipArg), ipsc->cAlphaArgs(iEquipArg)); + ErrorsFound = true; + } + roomAFNNodeHVAC.SupplyFraction = ipsc->rNumericArgs(iEquipArg); + roomAFNNodeHVAC.ReturnFraction = ipsc->rNumericArgs(iEquipArg); + + IntEquipError = CheckEquipName(state, + roomAFNNodeHVAC.Name, + roomAFNNodeHVAC.SupplyNodeName, + roomAFNNodeHVAC.ReturnNodeName, + TotNumEquip, + roomAFNNodeHVAC.zoneEquipType); + + if (!IntEquipError) { ShowSevereError(state, format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Duplicate {} name.", cCurrentModuleObject)); + ipsc->cAlphaFieldNames(3 + (iEquip - 1) * 2), + ipsc->cAlphaArgs(2 + (iEquip - 1) * 2))); + ShowContinueError(state, format("Entered in {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError(state, "Internal gain did not match correctly"); ErrorsFound = true; - } else { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC.allocate(numEquip); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HasHVACAssigned = true; - for (EquipLoop = 1; EquipLoop <= numEquip; ++EquipLoop) { - TypeNum = UtilityRoutines::FindItemInList( - state.dataIPShortCut->cAlphaArgs(2 + (EquipLoop - 1) * 2), ZoneHVACTerminalTypes, NumZoneHVACTerminalTypes); - if (TypeNum > 0) { - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).TypeOfNum = TypeNum; - } else { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(2 + (EquipLoop - 1) * 2), - state.dataIPShortCut->cAlphaArgs(2 + (EquipLoop - 1) * 2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "incorrect type of HVACEquipment"); - ErrorsFound = true; - } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).ObjectTypeName = - state.dataIPShortCut->cAlphaArgs(2 + (EquipLoop - 1) * 2); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).Name = - state.dataIPShortCut->cAlphaArgs(3 + (EquipLoop - 1) * 2); - - // verify type and name and get pointer to device in HVAC equipment type and name structure array - TotNumEquip = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ZoneHVACTerminalTypes(TypeNum)); - if (TotNumEquip == 0) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: No such {} = {}", - state.dataIPShortCut->cAlphaFieldNames(2 + (EquipLoop - 1) * 2), - state.dataIPShortCut->cAlphaArgs(2 + (EquipLoop - 1) * 2))); - ShowContinueError( - state, - format("is available in the input file in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).SupplyFraction = - state.dataIPShortCut->rNumericArgs(1 + (EquipLoop - 1) * 2); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).ReturnFraction = - state.dataIPShortCut->rNumericArgs(2 + (EquipLoop - 1) * 2); - - IntEquipError = CheckEquipName( - state, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).ObjectTypeName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).Name, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).SupplyNodeName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).HVAC(EquipLoop).ReturnNodeName, - TotNumEquip, - TypeNum); - - if (!IntEquipError) { - ShowSevereError(state, - format("GetRoomAirflowNetworkData: Invalid {} = {}", - state.dataIPShortCut->cAlphaFieldNames(3 + (EquipLoop - 1) * 2), - state.dataIPShortCut->cAlphaArgs(2 + (EquipLoop - 1) * 2))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Internal gain did not match correctly"); - ErrorsFound = true; - } - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // TYPE RoomAirflowNetworkHVACStruct - // INTEGER::EquipConfigIndex = 0 - } } - } - } - } // loop thru TotNumOfRAFNNodeHVACLists + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // TYPE RoomAirflowNetworkHVACStruct + // INTEGER::EquipConfigIndex = 0 + } // for (iEquip) + } // for (Zone) + } // loop thru TotNumOfRAFNNodeHVACLists // do some checks on input data - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - // Check zone volume fraction - SumFraction = 0.0; - for (RAFNNodeNum = 1; RAFNNodeNum <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++RAFNNodeNum) { - SumFraction = SumFraction + state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).ZoneVolumeFraction; - } - if (std::abs(SumFraction - 1.0) > 0.001) { - ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone volume fractions do not sum to 1.0"); - ShowContinueError(state, - format("Entered in RoomAir:Node:AirflowNetwork with Zone Name = {}", state.dataHeatBal->Zone(ZoneNum).Name)); - ShowContinueError(state, "The Fraction of Zone Air Volume values across all the nodes needs to sum to 1.0."); - ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SumFraction)); - ErrorsFound = true; - } - // Check internal gain fraction - for (RAFNNodeNum = 1; RAFNNodeNum <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++RAFNNodeNum) { - for (gainsLoop = 1; gainsLoop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).NumIntGains; - ++gainsLoop) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).FractionCheck) continue; - SumFraction = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGainsFractions(gainsLoop); - TypeNum = - static_cast(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Type); - Name = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).Name; - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNodeNum).IntGain(gainsLoop).FractionCheck = true; - for (RAFNNum = 1; RAFNNum <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++RAFNNum) { - for (GainNum = 1; GainNum <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).NumIntGains; - ++GainNum) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).IntGain(GainNum).FractionCheck) continue; - if (TypeNum == static_cast( - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).IntGain(GainNum).Type) && - UtilityRoutines::SameString( - Name, state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).IntGain(GainNum).Name)) { - SumFraction += state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).IntGainsFractions(GainNum); - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RAFNNum).IntGain(GainNum).FractionCheck = true; - } - } - } - if (std::abs(SumFraction - 1.0) > 0.001) { - ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, internal gain fractions do not sum to 1.0"); - ShowContinueError(state, - format("Entered in RoomAir:Node:AirflowNetwork with Zone Name = {}, Intrnal gain name = {}", - state.dataHeatBal->Zone(ZoneNum).Name, - Name)); - ShowContinueError(state, "The Fraction of internal gain across all the nodes needs to sum to 1.0."); - ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SumFraction)); - ErrorsFound = true; - } - } - } + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (roomAFNZoneInfo.NumOfAirNodes == 0) continue; + + // Check zone volume fraction + Real64 SumFraction = 0.0; + for (int iRoomAFNNode = 1; iRoomAFNNode <= roomAFNZoneInfo.NumOfAirNodes; ++iRoomAFNNode) { + SumFraction += roomAFNZoneInfo.Node(iRoomAFNNode).ZoneVolumeFraction; + } + if (std::abs(SumFraction - 1.0) > 0.001) { + ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone volume fractions do not sum to 1.0"); + ShowContinueError(state, format("Entered in RoomAir:Node:AirflowNetwork with Zone Name = {}", state.dataHeatBal->Zone(iZone).Name)); + ShowContinueError(state, "The Fraction of Zone Air Volume values across all the nodes needs to sum to 1.0."); + ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SumFraction)); + ErrorsFound = true; } - } - if (!ErrorsFound) { - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).IsUsed) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes > 0) { - for (Loop = 1; Loop <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes; ++Loop) { - SetupOutputVariable(state, - "RoomAirflowNetwork Node Temperature", - OutputProcessor::Unit::C, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).AirTemp, - OutputProcessor::SOVTimeStepType::HVAC, - OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).Name); - SetupOutputVariable(state, - "RoomAirflowNetwork Node Humidity Ratio", - OutputProcessor::Unit::kgWater_kgDryAir, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).HumRat, - OutputProcessor::SOVTimeStepType::HVAC, - OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).Name); - SetupOutputVariable(state, - "RoomAirflowNetwork Node Relative Humidity", - OutputProcessor::Unit::Perc, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).RelHumidity, - OutputProcessor::SOVTimeStepType::HVAC, - OutputProcessor::SOVStoreType::Average, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(Loop).Name); + // Check internal gain fraction + for (int iRoomAFNNode = 1; iRoomAFNNode <= roomAFNZoneInfo.NumOfAirNodes; ++iRoomAFNNode) { + auto &roomAFNNode = roomAFNZoneInfo.Node(iRoomAFNNode); + for (int iGain = 1; iGain <= roomAFNNode.NumIntGains; ++iGain) { + auto &intGain = roomAFNNode.IntGain(iGain); + if (intGain.FractionCheck) continue; + Real64 SumFraction = roomAFNNode.IntGainsFractions(iGain); + intGain.FractionCheck = true; + + for (int iRoomAFNNode2 = 1; iRoomAFNNode2 <= roomAFNZoneInfo.NumOfAirNodes; ++iRoomAFNNode2) { + auto &roomAFNNode2 = roomAFNZoneInfo.Node(iRoomAFNNode2); + for (int iGain2 = 1; iGain2 <= roomAFNNode2.NumIntGains; ++iGain2) { + auto &intGain2 = roomAFNNode2.IntGain(iGain2); + if (intGain2.FractionCheck) continue; + if (intGain.type == intGain2.type && UtilityRoutines::SameString(intGain.Name, intGain2.Name)) { + SumFraction += roomAFNNode2.IntGainsFractions(iGain2); + intGain2.FractionCheck = true; + } } } - } - } - } + if (std::abs(SumFraction - 1.0) > 0.001) { + ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, internal gain fractions do not sum to 1.0"); + ShowContinueError(state, + format("Entered in RoomAir:Node:AirflowNetwork with Zone Name = {}, Intrnal gain name = {}", + state.dataHeatBal->Zone(iZone).Name, + intGain.Name)); + ShowContinueError(state, "The Fraction of internal gain across all the nodes needs to sum to 1.0."); + ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SumFraction)); + ErrorsFound = true; + } + } // for (iGain) + } // for (iRoomAFNNode) + } // for (iZone) + + if (ErrorsFound) return; + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &roomAFNZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); + if (!roomAFNZoneInfo.IsUsed || roomAFNZoneInfo.NumOfAirNodes == 0) continue; + + for (int iAirNode = 1; iAirNode <= roomAFNZoneInfo.NumOfAirNodes; ++iAirNode) { + auto &roomAFNZoneNode = roomAFNZoneInfo.Node(iAirNode); + SetupOutputVariable(state, + "RoomAirflowNetwork Node Temperature", + OutputProcessor::Unit::C, + roomAFNZoneNode.AirTemp, + OutputProcessor::SOVTimeStepType::HVAC, + OutputProcessor::SOVStoreType::Average, + roomAFNZoneNode.Name); + SetupOutputVariable(state, + "RoomAirflowNetwork Node Humidity Ratio", + OutputProcessor::Unit::kgWater_kgDryAir, + roomAFNZoneNode.HumRat, + OutputProcessor::SOVTimeStepType::HVAC, + OutputProcessor::SOVStoreType::Average, + roomAFNZoneNode.Name); + SetupOutputVariable(state, + "RoomAirflowNetwork Node Relative Humidity", + OutputProcessor::Unit::Perc, + roomAFNZoneNode.RelHumidity, + OutputProcessor::SOVTimeStepType::HVAC, + OutputProcessor::SOVStoreType::Average, + roomAFNZoneNode.Name); + } // for (iAirNodE) + } // for (iZone) } void SharedDVCVUFDataInit(EnergyPlusData &state, int const ZoneNum) @@ -1981,1021 +1750,882 @@ namespace RoomAirModelManager { // AUTHOR Linda Lawrie // DATE WRITTEN March 2005 // MODIFIED Aug, 2013, Sam Brunswick -- for RoomAirCrossCrossVent modifications - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine allocates and initializes(?) the data that is shared between the // UCSD models (DV and CV) - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using namespace DataEnvironment; using namespace DataSurfaces; using Psychrometrics::PsyRhoAirFnPbTdbW; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr BaseDischargeCoef(0.62); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool SetZoneAux; Array1D_int AuxSurf; int MaxSurf; Array2D_int AuxAirflowNetworkSurf; - Real64 WidthFactMax; - Real64 HeightFactMax; - Real64 WidthFact; - Real64 HeightFact; int ZoneEquipConfigNum; // counter - Real64 AinCV; - int AirflowNetworkSurfPtr; - int NSides; // Do the one time initializations - if (state.dataRoomAirModelMgr->MyOneTimeFlag) { - - state.dataRoomAirModelMgr->MyEnvrnFlag.allocate(state.dataGlobal->NumOfZones); - - state.dataUCSDShared->APos_Wall.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->APos_Floor.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->APos_Ceiling.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->PosZ_Wall.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->PosZ_Floor.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->PosZ_Ceiling.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->APos_Window.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->APos_Door.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->APos_Internal.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->PosZ_Window.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->PosZ_Door.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->PosZ_Internal.allocate(state.dataGlobal->NumOfZones * 2); - state.dataUCSDShared->HCeiling.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->HWall.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->HFloor.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->HInternal.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->HWindow.allocate(state.dataSurface->TotSurfaces); - state.dataUCSDShared->HDoor.allocate(state.dataSurface->TotSurfaces); + if (state.dataRoomAir->MyOneTimeFlag) { + + state.dataRoomAir->MyEnvrnFlag.allocate(state.dataGlobal->NumOfZones); + + state.dataRoomAir->APos_Wall.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->APos_Floor.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->APos_Ceiling.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->PosZ_Wall.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->PosZ_Floor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->PosZ_Ceiling.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->APos_Window.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->APos_Door.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->APos_Internal.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->PosZ_Window.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->PosZ_Door.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->PosZ_Internal.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->HCeiling.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->HWall.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->HFloor.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->HInternal.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->HWindow.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->HDoor.allocate(state.dataSurface->TotSurfaces); AuxSurf.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneCeilingHeight.allocate(state.dataGlobal->NumOfZones * 2); - state.dataRoomAirMod->ZoneCeilingHeight = 0.0; + state.dataRoomAir->ZoneCeilingHeight1.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneCeilingHeight2.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneCeilingHeight1 = 0.0; + state.dataRoomAir->ZoneCeilingHeight2 = 0.0; // Arrays initializations - state.dataUCSDShared->APos_Wall = 0; - state.dataUCSDShared->APos_Floor = 0; - state.dataUCSDShared->APos_Ceiling = 0; - state.dataUCSDShared->PosZ_Wall = 0; - state.dataUCSDShared->PosZ_Floor = 0; - state.dataUCSDShared->PosZ_Ceiling = 0; - state.dataUCSDShared->APos_Window = 0; - state.dataUCSDShared->APos_Door = 0; - state.dataUCSDShared->APos_Internal = 0; - state.dataUCSDShared->PosZ_Window = 0; - state.dataUCSDShared->PosZ_Door = 0; - state.dataUCSDShared->PosZ_Internal = 0; - state.dataUCSDShared->HCeiling = 0.0; - state.dataUCSDShared->HWall = 0.0; - state.dataUCSDShared->HFloor = 0.0; - state.dataUCSDShared->HInternal = 0.0; - state.dataUCSDShared->HWindow = 0.0; - state.dataUCSDShared->HDoor = 0.0; + state.dataRoomAir->APos_Wall = 0; + state.dataRoomAir->APos_Floor = 0; + state.dataRoomAir->APos_Ceiling = 0; + std::fill(state.dataRoomAir->PosZ_Wall.begin(), state.dataRoomAir->PosZ_Wall.end(), BegEnd()); + std::fill(state.dataRoomAir->PosZ_Floor.begin(), state.dataRoomAir->PosZ_Floor.end(), BegEnd()); + std::fill(state.dataRoomAir->PosZ_Ceiling.begin(), state.dataRoomAir->PosZ_Ceiling.end(), BegEnd()); + state.dataRoomAir->APos_Window = 0; + state.dataRoomAir->APos_Door = 0; + state.dataRoomAir->APos_Internal = 0; + std::fill(state.dataRoomAir->PosZ_Window.begin(), state.dataRoomAir->PosZ_Window.end(), BegEnd()); + std::fill(state.dataRoomAir->PosZ_Door.begin(), state.dataRoomAir->PosZ_Door.end(), BegEnd()); + std::fill(state.dataRoomAir->PosZ_Internal.begin(), state.dataRoomAir->PosZ_Internal.end(), BegEnd()); + state.dataRoomAir->HCeiling = 0.0; + state.dataRoomAir->HWall = 0.0; + state.dataRoomAir->HFloor = 0.0; + state.dataRoomAir->HInternal = 0.0; + state.dataRoomAir->HWindow = 0.0; + state.dataRoomAir->HDoor = 0.0; + + int contWall = 0, contFloor = 0, contCeiling = 0, contWindow = 0, contInternal = 0, contDoor = 0; + int contWallBeg = 0, contFloorBeg = 0, contCeilingBeg = 0, contWindowBeg = 0, contInternalBeg = 0, contDoorBeg = 0; + int contWallLast = 0, contFloorLast = 0, contCeilingLast = 0, contWindowLast = 0, contInternalLast = 0, contDoorLast = 0; // Put the surface and zone information in Apos and PosZ arrays for (int ZNum = 1; ZNum <= state.dataGlobal->NumOfZones; ++ZNum) { // advance ONE position in the arrays PosZ because this is a new zone - state.dataRoomAirModelMgr->contWallBegin = state.dataRoomAirModelMgr->contWall + 1; - state.dataRoomAirModelMgr->contFloorBegin = state.dataRoomAirModelMgr->contFloor + 1; - state.dataRoomAirModelMgr->contCeilingBegin = state.dataRoomAirModelMgr->contCeiling + 1; - state.dataRoomAirModelMgr->contWindowBegin = state.dataRoomAirModelMgr->contWindow + 1; - state.dataRoomAirModelMgr->contInternalBegin = state.dataRoomAirModelMgr->contInternal + 1; - state.dataRoomAirModelMgr->contDoorBegin = state.dataRoomAirModelMgr->contDoor + 1; + contWallBeg = contWall + 1; + contFloorBeg = contFloor + 1; + contCeilingBeg = contCeiling + 1; + contWindowBeg = contWindow + 1; + contInternalBeg = contInternal + 1; + contDoorBeg = contDoor + 1; SetZoneAux = true; + Real64 Z1ofZone = std::numeric_limits::max(); + Real64 Z2ofZone = std::numeric_limits::lowest(); + // cycle in this zone for all the surfaces for (int spaceNum : state.dataHeatBal->Zone(ZNum).spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); + for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - if (state.dataSurface->Surface(SurfNum).Class != DataSurfaces::SurfaceClass::IntMass) { + auto const &surf = state.dataSurface->Surface(SurfNum); + if (surf.Class != DataSurfaces::SurfaceClass::IntMass) { // Recalculate lowest and highest height for the zone - state.dataRoomAirModelMgr->Z1ofZone = std::numeric_limits::max(); - state.dataRoomAirModelMgr->Z2ofZone = std::numeric_limits::lowest(); - for (int i = 1, u = state.dataSurface->Surface(SurfNum).Sides; i <= u; ++i) { - Real64 const z_i(state.dataSurface->Surface(SurfNum).Vertex(i).z); - state.dataRoomAirModelMgr->Z1ofZone = std::min(state.dataRoomAirModelMgr->Z1ofZone, z_i); - state.dataRoomAirModelMgr->Z2ofZone = std::max(state.dataRoomAirModelMgr->Z2ofZone, z_i); + for (int i = 1, u = surf.Sides; i <= u; ++i) { + Real64 const z_i = surf.Vertex(i).z; + if (z_i < Z1ofZone) { + Z1ofZone = z_i; + }; + if (z_i > Z2ofZone) { + Z2ofZone = z_i; + }; } } - if (SetZoneAux) { - // lowest height for the zone (for the first surface of the zone) - state.dataRoomAirModelMgr->Z1ofZoneAux = state.dataRoomAirModelMgr->Z1ofZone; - // highest height for the zone (for the first surface of the zone) - state.dataRoomAirModelMgr->Z2ofZoneAux = state.dataRoomAirModelMgr->Z2ofZone; - SetZoneAux = false; - } - - if (state.dataRoomAirModelMgr->Z1ofZone < state.dataRoomAirModelMgr->Z1ofZoneAux) { - state.dataRoomAirModelMgr->Z1ofZoneAux = state.dataRoomAirModelMgr->Z1ofZone; - } - if (state.dataRoomAirModelMgr->Z2ofZone > state.dataRoomAirModelMgr->Z2ofZoneAux) { - state.dataRoomAirModelMgr->Z2ofZoneAux = state.dataRoomAirModelMgr->Z2ofZone; - } - state.dataRoomAirModelMgr->Z1ofZone = state.dataRoomAirModelMgr->Z1ofZoneAux; - state.dataRoomAirModelMgr->Z2ofZone = state.dataRoomAirModelMgr->Z2ofZoneAux; - // Put the reference to this surface in the appropriate array - if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Floor) { - ++state.dataRoomAirModelMgr->contFloor; - state.dataUCSDShared->APos_Floor(state.dataRoomAirModelMgr->contFloor) = SurfNum; - } else if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Wall) { - ++state.dataRoomAirModelMgr->contWall; - state.dataUCSDShared->APos_Wall(state.dataRoomAirModelMgr->contWall) = SurfNum; - } else if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) { - ++state.dataRoomAirModelMgr->contWindow; - state.dataUCSDShared->APos_Window(state.dataRoomAirModelMgr->contWindow) = SurfNum; - } else if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::IntMass) { - ++state.dataRoomAirModelMgr->contInternal; - state.dataUCSDShared->APos_Internal(state.dataRoomAirModelMgr->contInternal) = SurfNum; - } else if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Door) { - ++state.dataRoomAirModelMgr->contDoor; - state.dataUCSDShared->APos_Door(state.dataRoomAirModelMgr->contDoor) = SurfNum; + if (surf.Class == SurfaceClass::Floor) { + ++contFloor; + state.dataRoomAir->APos_Floor(contFloor) = SurfNum; + } else if (surf.Class == SurfaceClass::Wall) { + ++contWall; + state.dataRoomAir->APos_Wall(contWall) = SurfNum; + } else if (surf.Class == SurfaceClass::Window) { + ++contWindow; + state.dataRoomAir->APos_Window(contWindow) = SurfNum; + } else if (surf.Class == SurfaceClass::IntMass) { + ++contInternal; + state.dataRoomAir->APos_Internal(contInternal) = SurfNum; + } else if (surf.Class == SurfaceClass::Door) { + ++contDoor; + state.dataRoomAir->APos_Door(contDoor) = SurfNum; } else { - ++state.dataRoomAirModelMgr->contCeiling; - state.dataUCSDShared->APos_Ceiling(state.dataRoomAirModelMgr->contCeiling) = SurfNum; + ++contCeiling; + state.dataRoomAir->APos_Ceiling(contCeiling) = SurfNum; } } - } // Surfaces - - state.dataRoomAirModelMgr->contWallLast = state.dataRoomAirModelMgr->contWall; - state.dataRoomAirModelMgr->contFloorLast = state.dataRoomAirModelMgr->contFloor; - state.dataRoomAirModelMgr->contCeilingLast = state.dataRoomAirModelMgr->contCeiling; - state.dataRoomAirModelMgr->contWindowLast = state.dataRoomAirModelMgr->contWindow; - state.dataRoomAirModelMgr->contDoorLast = state.dataRoomAirModelMgr->contDoor; - state.dataRoomAirModelMgr->contInternalLast = state.dataRoomAirModelMgr->contInternal; + } // for (SurfNum) + + contWallLast = contWall; + contFloorLast = contFloor; + contCeilingLast = contCeiling; + contWindowLast = contWindow; + contDoorLast = contDoor; + contInternalLast = contInternal; // PosZ_Wall (... + 1) has the Begin Wall reference in Apos_Wall for the ZNum // PosZ_Wall (... + 2) has the End Wall reference in Apos_Wall for the ZNum - state.dataUCSDShared->PosZ_Wall((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contWallBegin; - state.dataUCSDShared->PosZ_Wall((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contWallLast; - state.dataUCSDShared->PosZ_Floor((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contFloorBegin; - state.dataUCSDShared->PosZ_Floor((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contFloorLast; - state.dataUCSDShared->PosZ_Ceiling((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contCeilingBegin; - state.dataUCSDShared->PosZ_Ceiling((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contCeilingLast; - state.dataUCSDShared->PosZ_Window((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contWindowBegin; - state.dataUCSDShared->PosZ_Window((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contWindowLast; - state.dataUCSDShared->PosZ_Door((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contDoorBegin; - state.dataUCSDShared->PosZ_Door((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contDoorLast; - state.dataUCSDShared->PosZ_Internal((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->contInternalBegin; - state.dataUCSDShared->PosZ_Internal((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->contInternalLast; + state.dataRoomAir->PosZ_Wall(ZNum).beg = contWallBeg; + state.dataRoomAir->PosZ_Wall(ZNum).end = contWallLast; + state.dataRoomAir->PosZ_Floor(ZNum).beg = contFloorBeg; + state.dataRoomAir->PosZ_Floor(ZNum).end = contFloorLast; + state.dataRoomAir->PosZ_Ceiling(ZNum).beg = contCeilingBeg; + state.dataRoomAir->PosZ_Ceiling(ZNum).end = contCeilingLast; + state.dataRoomAir->PosZ_Window(ZNum).beg = contWindowBeg; + state.dataRoomAir->PosZ_Window(ZNum).end = contWindowLast; + state.dataRoomAir->PosZ_Door(ZNum).beg = contDoorBeg; + state.dataRoomAir->PosZ_Door(ZNum).end = contDoorLast; + state.dataRoomAir->PosZ_Internal(ZNum).beg = contInternalBeg; + state.dataRoomAir->PosZ_Internal(ZNum).end = contInternalLast; // Save the highest and lowest height for this zone - state.dataRoomAirMod->ZoneCeilingHeight((ZNum - 1) * 2 + 1) = state.dataRoomAirModelMgr->Z1ofZone; - state.dataRoomAirMod->ZoneCeilingHeight((ZNum - 1) * 2 + 2) = state.dataRoomAirModelMgr->Z2ofZone; + state.dataRoomAir->ZoneCeilingHeight1(ZNum) = Z1ofZone; + state.dataRoomAir->ZoneCeilingHeight2(ZNum) = Z2ofZone; - if (std::abs((state.dataRoomAirModelMgr->Z2ofZone - state.dataRoomAirModelMgr->Z1ofZone) - - state.dataHeatBal->Zone(ZNum).CeilingHeight) > state.dataRoomAirModelMgr->CeilingHeightDiffMaximum) { + constexpr Real64 CeilingHeightDiffMaximum = 0.1; + if (std::abs((Z2ofZone - Z1ofZone) - state.dataHeatBal->Zone(ZNum).CeilingHeight) > CeilingHeightDiffMaximum) { ShowWarningError(state, format("RoomAirManager: Inconsistent ceiling heights in Zone: {}", state.dataHeatBal->Zone(ZNum).Name)); - ShowContinueError(state, format("Lowest height=[{:.3R}].", state.dataRoomAirModelMgr->Z1ofZone)); - ShowContinueError(state, format("Highest height=[{:.3R}].", state.dataRoomAirModelMgr->Z2ofZone)); + ShowContinueError(state, format("Lowest height=[{:.3R}].", Z1ofZone)); + ShowContinueError(state, format("Highest height=[{:.3R}].", Z2ofZone)); ShowContinueError(state, format("Ceiling height=[{:.3R}].", state.dataHeatBal->Zone(ZNum).CeilingHeight)); } - } // Zones + } // for (ZoneNum) AuxSurf = 0; - state.dataRoomAirMod->CVNumAirflowNetworkSurfaces = 0; + state.dataRoomAir->CrossVentNumAFNSurfaces = 0; // calculate maximum number of airflow network surfaces in each zone - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.afn->NumOfLinksMultiZone; - ++state.dataRoomAirModelMgr->Loop) { - ++AuxSurf(state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop).SurfNum).Zone); - ++state.dataRoomAirMod->CVNumAirflowNetworkSurfaces; + for (int iMzLink = 1; iMzLink <= state.afn->NumOfLinksMultiZone; ++iMzLink) { + auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).SurfNum); + ++AuxSurf(mzSurf.Zone); + ++state.dataRoomAir->CrossVentNumAFNSurfaces; // Check if this is an interzone airflow network surface - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop).SurfNum).ExtBoundCond > 0 && - (state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop).SurfNum != - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop).SurfNum).ExtBoundCond)) { - ++AuxSurf( - state.dataSurface - ->Surface( - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop).SurfNum).ExtBoundCond) - .Zone); - ++state.dataRoomAirMod->CVNumAirflowNetworkSurfaces; + if (mzSurf.ExtBoundCond > 0 && (state.afn->MultizoneSurfaceData(iMzLink).SurfNum != mzSurf.ExtBoundCond)) { + ++AuxSurf(state.dataSurface->Surface(mzSurf.ExtBoundCond).Zone); + ++state.dataRoomAir->CrossVentNumAFNSurfaces; } } // calculate maximum number of airflow network surfaces in a single zone MaxSurf = AuxSurf(1); - for (state.dataRoomAirModelMgr->Loop = 2; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { - if (AuxSurf(state.dataRoomAirModelMgr->Loop) > MaxSurf) MaxSurf = AuxSurf(state.dataRoomAirModelMgr->Loop); + for (int iZone = 2; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (AuxSurf(iZone) > MaxSurf) MaxSurf = AuxSurf(iZone); } - if (!allocated(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV)) { - state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); + if (!allocated(state.dataRoomAir->AFNSurfaceCrossVent)) { + state.dataRoomAir->AFNSurfaceCrossVent.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); } - if (!allocated(state.dataRoomAirMod->CVJetRecFlows)) { - state.dataRoomAirMod->CVJetRecFlows.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); + if (!allocated(state.dataRoomAir->CrossVentJetRecFlows)) { + state.dataRoomAir->CrossVentJetRecFlows.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); } AuxAirflowNetworkSurf.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); // Width and Height for airflow network surfaces - if (!allocated(state.dataRoomAirMod->SurfParametersCVDV)) { - state.dataRoomAirMod->SurfParametersCVDV.allocate(state.afn->NumOfLinksMultiZone); + if (!allocated(state.dataRoomAir->SurfParametersCrossDispVent)) { + state.dataRoomAir->SurfParametersCrossDispVent.allocate(state.afn->NumOfLinksMultiZone); } - state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV = 0; + state.dataRoomAir->AFNSurfaceCrossVent = 0; // Organize surfaces in vector AirflowNetworkSurfaceUCSDCV(Zone, surface indexes) - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { // the 0 component of the array has the number of relevant AirflowNetwork surfaces for the zone - state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, state.dataRoomAirModelMgr->Loop) = AuxSurf(state.dataRoomAirModelMgr->Loop); - if (AuxSurf(state.dataRoomAirModelMgr->Loop) != 0) { - Real64 const ceilingHeight(state.dataRoomAirMod->ZoneCeilingHeight((state.dataRoomAirModelMgr->Loop - 1) * 2 + 1)); - int SurfNum = 1; - for (state.dataRoomAirModelMgr->Loop2 = 1; state.dataRoomAirModelMgr->Loop2 <= state.afn->NumOfLinksMultiZone; - ++state.dataRoomAirModelMgr->Loop2) { - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Zone == - state.dataRoomAirModelMgr->Loop) { - // SurfNum has the reference surface number relative to AirflowNetworkSurfaceData - state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(SurfNum, state.dataRoomAirModelMgr->Loop) = - state.dataRoomAirModelMgr->Loop2; - // calculate the surface width and height - state.dataRoomAirModelMgr->CompNumber = state.afn->AirflowNetworkLinkageData(state.dataRoomAirModelMgr->Loop2).CompNum; - state.dataRoomAirModelMgr->TypeNumber = state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNumber).TypeNum; - if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNumber).CompTypeNum == - AirflowNetwork::iComponentTypeNum::DOP) { - WidthFactMax = 0.0; - HeightFactMax = 0.0; - for (state.dataRoomAirModelMgr->Loop3 = 1; - state.dataRoomAirModelMgr->Loop3 <= - state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).NumFac; - ++state.dataRoomAirModelMgr->Loop3) { - if (state.dataRoomAirModelMgr->Loop3 == 1) { - WidthFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).WidthFac1; - HeightFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).HeightFac1; - } - if (state.dataRoomAirModelMgr->Loop3 == 2) { - WidthFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).WidthFac2; - HeightFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).HeightFac2; - } - if (state.dataRoomAirModelMgr->Loop3 == 3) { - WidthFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).WidthFac3; - HeightFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).HeightFac3; - } - if (state.dataRoomAirModelMgr->Loop3 == 4) { - WidthFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).WidthFac4; - HeightFact = state.afn->MultizoneCompDetOpeningData(state.dataRoomAirModelMgr->TypeNumber).HeightFac4; - } - if (WidthFact > WidthFactMax) { - WidthFactMax = WidthFact; - } - if (HeightFact > HeightFactMax) { - HeightFactMax = HeightFact; - } + state.dataRoomAir->AFNSurfaceCrossVent(0, iZone) = AuxSurf(iZone); + if (AuxSurf(iZone) == 0) continue; + + Real64 const ceilingHeight = state.dataRoomAir->ZoneCeilingHeight1(iZone); + int SurfNum = 1; + + for (int iMzLink = 1; iMzLink <= state.afn->NumOfLinksMultiZone; ++iMzLink) { + auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).SurfNum); + auto &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(iMzLink); + + if (mzSurf.Zone == iZone) { + // SurfNum has the reference surface number relative to AirflowNetworkSurfaceData + state.dataRoomAir->AFNSurfaceCrossVent(SurfNum, iZone) = iMzLink; + // calculate the surface width and height + int compNum = state.afn->AirflowNetworkLinkageData(iMzLink).CompNum; + int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum; + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { + Real64 WidthFactMax = 0.0; + Real64 HeightFactMax = 0.0; + + Real64 WidthFact = 0.0; + Real64 HeightFact = 0.0; + auto const &mzCompDetOpening = state.afn->MultizoneCompDetOpeningData(typeNum); + for (int Loop3 = 1; Loop3 <= mzCompDetOpening.NumFac; ++Loop3) { + if (Loop3 == 1) { + WidthFact = mzCompDetOpening.WidthFac1; + HeightFact = mzCompDetOpening.HeightFac1; + } else if (Loop3 == 2) { + WidthFact = mzCompDetOpening.WidthFac2; + HeightFact = mzCompDetOpening.HeightFac2; + } else if (Loop3 == 3) { + WidthFact = mzCompDetOpening.WidthFac3; + HeightFact = mzCompDetOpening.HeightFac3; + } else if (Loop3 == 4) { + WidthFact = mzCompDetOpening.WidthFac4; + HeightFact = mzCompDetOpening.HeightFac4; } - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Width = - WidthFactMax * - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Width; - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Height = - HeightFactMax * - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Height; - } else if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNumber).CompTypeNum == - AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Width = - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Width / 2; - AinCV = - state.afn->MultizoneSurfaceCrackData(state.dataRoomAirModelMgr->TypeNumber).coefficient / - (BaseDischargeCoef * - std::sqrt( - 2.0 / - PsyRhoAirFnPbTdbW( - state, - state.dataEnvrn->OutBaroPress, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataRoomAirModelMgr->Loop).MAT, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataRoomAirModelMgr->Loop).ZoneAirHumRat))); - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Height = - AinCV / state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Width; - } - // calculate the surface Zmin and Zmax - if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNumber).CompTypeNum == - AirflowNetwork::iComponentTypeNum::DOP) { - AirflowNetworkSurfPtr = state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum; - NSides = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Sides; - Real64 z_min(std::numeric_limits::max()), z_max(std::numeric_limits::lowest()); - for (int i = 1; i <= NSides; ++i) { - Real64 const z_i(state.dataSurface->Surface(AirflowNetworkSurfPtr).Vertex(i).z); - z_min = std::min(z_min, z_i); - z_max = std::max(z_max, z_i); + if (WidthFact > WidthFactMax) { + WidthFactMax = WidthFact; } - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Zmin = z_min - ceilingHeight; - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Zmax = z_max - ceilingHeight; - } else if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->CompNumber).CompTypeNum == - AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK - AirflowNetworkSurfPtr = state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum; - NSides = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).SurfNum).Sides; - Real64 z_min(std::numeric_limits::max()), z_max(std::numeric_limits::lowest()); - for (int i = 1; i <= NSides; ++i) { - Real64 const z_i(state.dataSurface->Surface(AirflowNetworkSurfPtr).Vertex(i).z); - z_min = std::min(z_min, z_i); - z_max = std::max(z_max, z_i); + if (HeightFact > HeightFactMax) { + HeightFactMax = HeightFact; } - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Zmin = z_min - ceilingHeight; - state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirModelMgr->Loop2).Zmax = z_max - ceilingHeight; } + surfParams.Width = WidthFactMax * mzSurf.Width; + surfParams.Height = HeightFactMax * mzSurf.Height; + + } else if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == + AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK + surfParams.Width = mzSurf.Width / 2; + auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone); + Real64 AinCV = state.afn->MultizoneSurfaceCrackData(typeNum).coefficient / + (BaseDischargeCoef * + std::sqrt(2.0 / PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, zoneHeatBal.MAT, zoneHeatBal.ZoneAirHumRat))); + surfParams.Height = AinCV / surfParams.Width; + } - ++SurfNum; - // Check if airflow network Surface is an interzone surface: - } else { - state.dataRoomAirModelMgr->NodeNumber1 = state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).NodeNums[0]; - state.dataRoomAirModelMgr->NodeNumber2 = state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->Loop2).NodeNums[1]; - if ((state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNumber2).EPlusZoneNum == - state.dataRoomAirModelMgr->Loop && - state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNumber1).EPlusZoneNum > 0) || - (state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNumber2).EPlusZoneNum > 0 && - state.afn->AirflowNetworkNodeData(state.dataRoomAirModelMgr->NodeNumber1).EPlusZoneNum == - state.dataRoomAirModelMgr->Loop)) { - state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(SurfNum, state.dataRoomAirModelMgr->Loop) = - state.dataRoomAirModelMgr->Loop2; - ++SurfNum; + // calculate the surface Zmin and Zmax + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP || + state.afn->AirflowNetworkCompData(compNum).CompTypeNum == + AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK + Real64 z_min(std::numeric_limits::max()), z_max(std::numeric_limits::lowest()); + for (int i = 1; i <= mzSurf.Sides; ++i) { + Real64 const z_i = mzSurf.Vertex(i).z; + z_min = std::min(z_min, z_i); + z_max = std::max(z_max, z_i); } + surfParams.Zmin = z_min - ceilingHeight; + surfParams.Zmax = z_max - ceilingHeight; + } + + ++SurfNum; + // Check if airflow network Surface is an interzone surface: + + } else { // if (mzSurf.Zone == iZone) + int nodeNum1 = state.afn->MultizoneSurfaceData(iMzLink).NodeNums[0]; + int nodeNum2 = state.afn->MultizoneSurfaceData(iMzLink).NodeNums[1]; + if ((state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum == iZone && + state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum > 0) || + (state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum > 0 && + state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum == iZone)) { + state.dataRoomAir->AFNSurfaceCrossVent(SurfNum, iZone) = iMzLink; + ++SurfNum; } } - } - } + } // for (Loop2) + } // for (iZone) AuxSurf.deallocate(); - if (any(state.dataRoomAirMod->IsZoneDV) || any(state.dataRoomAirMod->IsZoneUI)) { - state.dataRoomAirMod->MaxTempGrad.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->AvgTempGrad.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->TCMF.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->FracMinFlow.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneAirSystemON.allocate(state.dataGlobal->NumOfZones); + if (any(state.dataRoomAir->IsZoneDispVent3Node) || any(state.dataRoomAir->IsZoneUFAD)) { + state.dataRoomAir->MaxTempGrad.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->AvgTempGrad.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->TCMF.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->FracMinFlow.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneAirSystemON.allocate(state.dataGlobal->NumOfZones); // Allocate histories of displacement ventilation temperatures PH 3/5/04 - state.dataRoomAirMod->MATFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XMATFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM2TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM3TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM4TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXMATFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM2TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM3TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM4TFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->MATOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XMATOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM2TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM3TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM4TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXMATOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM2TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM3TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM4TOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->MATMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XMATMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM2TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM3TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->XM4TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXMATMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM2TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM3TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DSXM4TMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM1Floor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM2Floor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM3Floor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM1OC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM2OC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM3OC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM1MX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM2MX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTM3MX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->AIRRATFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->AIRRATOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->AIRRATMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZTFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->HeightTransition.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Phi.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Zone1Floor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneMXFloor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneM2Floor.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Zone1OC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneMXOC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneM2OC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Zone1MX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneMXMX.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneM2MX.allocate(state.dataGlobal->NumOfZones); - - state.dataRoomAirMod->MaxTempGrad = 0.0; - state.dataRoomAirMod->AvgTempGrad = 0.0; - state.dataRoomAirMod->TCMF = 23.0; - state.dataRoomAirMod->FracMinFlow = 0.0; + state.dataRoomAir->MATFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->XMATFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->DSXMATFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->MATOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->XMATOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->DSXMATOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->MATMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->XMATMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->DSXMATMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTMFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTMOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTMMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->AIRRATFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->AIRRATOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->AIRRATMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->HeightTransition.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Phi.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Zone1Floor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneMXFloor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneM2Floor.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Zone1OC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneMXOC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneM2OC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Zone1MX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneMXMX.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneM2MX.allocate(state.dataGlobal->NumOfZones); + + state.dataRoomAir->MaxTempGrad = 0.0; + state.dataRoomAir->AvgTempGrad = 0.0; + state.dataRoomAir->TCMF = 23.0; + state.dataRoomAir->FracMinFlow = 0.0; // ZoneDVMixedFlagRep = 0.0 - state.dataRoomAirMod->ZoneAirSystemON = false; + state.dataRoomAir->ZoneAirSystemON = false; // ZoneDVMixedFlag=0 - state.dataRoomAirMod->MATFloor = 23.0; - state.dataRoomAirMod->XMATFloor = 23.0; - state.dataRoomAirMod->XM2TFloor = 23.0; - state.dataRoomAirMod->XM3TFloor = 23.0; - state.dataRoomAirMod->XM4TFloor = 23.0; - state.dataRoomAirMod->DSXMATFloor = 23.0; - state.dataRoomAirMod->DSXM2TFloor = 23.0; - state.dataRoomAirMod->DSXM3TFloor = 23.0; - state.dataRoomAirMod->DSXM4TFloor = 23.0; - state.dataRoomAirMod->MATOC = 23.0; - state.dataRoomAirMod->XMATOC = 23.0; - state.dataRoomAirMod->XM2TOC = 23.0; - state.dataRoomAirMod->XM3TOC = 23.0; - state.dataRoomAirMod->XM4TOC = 23.0; - state.dataRoomAirMod->DSXMATOC = 23.0; - state.dataRoomAirMod->DSXM2TOC = 23.0; - state.dataRoomAirMod->DSXM3TOC = 23.0; - state.dataRoomAirMod->DSXM4TOC = 23.0; - state.dataRoomAirMod->MATMX = 23.0; - state.dataRoomAirMod->XMATMX = 23.0; - state.dataRoomAirMod->XM2TMX = 23.0; - state.dataRoomAirMod->XM3TMX = 23.0; - state.dataRoomAirMod->XM4TMX = 23.0; - state.dataRoomAirMod->DSXMATMX = 23.0; - state.dataRoomAirMod->DSXM2TMX = 23.0; - state.dataRoomAirMod->DSXM3TMX = 23.0; - state.dataRoomAirMod->DSXM4TMX = 23.0; - state.dataRoomAirMod->ZTM1Floor = 23.0; - state.dataRoomAirMod->ZTM2Floor = 23.0; - state.dataRoomAirMod->ZTM3Floor = 23.0; - state.dataRoomAirMod->ZTM1OC = 23.0; - state.dataRoomAirMod->ZTM2OC = 23.0; - state.dataRoomAirMod->ZTM3OC = 23.0; - state.dataRoomAirMod->ZTM1MX = 23.0; - state.dataRoomAirMod->ZTM2MX = 23.0; - state.dataRoomAirMod->ZTM3MX = 23.0; - state.dataRoomAirMod->Zone1Floor = 23.0; - state.dataRoomAirMod->ZoneMXFloor = 23.0; - state.dataRoomAirMod->ZoneM2Floor = 23.0; - state.dataRoomAirMod->Zone1OC = 23.0; - state.dataRoomAirMod->ZoneMXOC = 23.0; - state.dataRoomAirMod->ZoneM2OC = 23.0; - state.dataRoomAirMod->Zone1MX = 23.0; - state.dataRoomAirMod->ZoneMXMX = 23.0; - state.dataRoomAirMod->ZoneM2MX = 23.0; - state.dataRoomAirMod->AIRRATFloor = 0.0; - state.dataRoomAirMod->AIRRATOC = 0.0; - state.dataRoomAirMod->AIRRATMX = 0.0; - state.dataRoomAirMod->ZTOC = 23.0; - state.dataRoomAirMod->ZTMX = 23.0; - state.dataRoomAirMod->ZTFloor = 23.0; - state.dataRoomAirMod->HeightTransition = 0.0; - state.dataRoomAirMod->Phi = 0.0; - state.dataUCSDShared->HCeiling = 0.0; - state.dataUCSDShared->HWall = 0.0; - state.dataUCSDShared->HFloor = 0.0; - state.dataUCSDShared->HInternal = 0.0; - state.dataUCSDShared->HWindow = 0.0; - state.dataUCSDShared->HDoor = 0.0; - } - - if (any(state.dataRoomAirMod->IsZoneDV)) { - - state.dataRoomAirMod->DVHcIn.allocate(state.dataSurface->TotSurfaces); - state.dataRoomAirMod->ZoneDVMixedFlagRep.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneDVMixedFlag.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->DVHcIn = 0.0; - state.dataRoomAirMod->ZoneDVMixedFlagRep = 0.0; - state.dataRoomAirMod->ZoneDVMixedFlag = 0; + state.dataRoomAir->MATFloor = 23.0; + state.dataRoomAir->XMATFloor = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATFloor = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->MATOC = 23.0; + state.dataRoomAir->XMATOC = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATOC = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->MATMX = 23.0; + state.dataRoomAir->XMATMX = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATMX = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->ZTMFloor = {23.0, 23.0, 23.0}; + state.dataRoomAir->ZTMOC = {23.0, 23.0, 23.0}; + state.dataRoomAir->ZTMMX = {23.0, 23.0, 23.0}; + state.dataRoomAir->Zone1Floor = 23.0; + state.dataRoomAir->ZoneMXFloor = 23.0; + state.dataRoomAir->ZoneM2Floor = 23.0; + state.dataRoomAir->Zone1OC = 23.0; + state.dataRoomAir->ZoneMXOC = 23.0; + state.dataRoomAir->ZoneM2OC = 23.0; + state.dataRoomAir->Zone1MX = 23.0; + state.dataRoomAir->ZoneMXMX = 23.0; + state.dataRoomAir->ZoneM2MX = 23.0; + state.dataRoomAir->AIRRATFloor = 0.0; + state.dataRoomAir->AIRRATOC = 0.0; + state.dataRoomAir->AIRRATMX = 0.0; + state.dataRoomAir->ZTOC = 23.0; + state.dataRoomAir->ZTMX = 23.0; + state.dataRoomAir->ZTFloor = 23.0; + state.dataRoomAir->HeightTransition = 0.0; + state.dataRoomAir->Phi = 0.0; + state.dataRoomAir->HCeiling = 0.0; + state.dataRoomAir->HWall = 0.0; + state.dataRoomAir->HFloor = 0.0; + state.dataRoomAir->HInternal = 0.0; + state.dataRoomAir->HWindow = 0.0; + state.dataRoomAir->HDoor = 0.0; + } + + if (any(state.dataRoomAir->IsZoneDispVent3Node)) { + + state.dataRoomAir->DispVent3NodeHcIn.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneDispVent3NodeMixedFlag.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->DispVent3NodeHcIn = 0.0; + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep = 0.0; + state.dataRoomAir->ZoneDispVent3NodeMixedFlag = 0; // Output variables and DV zone flag - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { - if (state.dataRoomAirMod->AirModel(state.dataRoomAirModelMgr->Loop).AirModelType != DataRoomAirModel::RoomAirModel::UCSDDV) + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::DispVent3Node) continue; // don't set these up if they don't make sense // CurrentModuleObject='RoomAirSettings:ThreeNodeDisplacementVentilation' SetupOutputVariable(state, "Room Air Zone Mixed Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTMX(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTMX(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Occupied Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTOC(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTOC(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Floor Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTFloor(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTFloor(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Transition Height", OutputProcessor::Unit::m, - state.dataRoomAirMod->HeightTransition(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->HeightTransition(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Recommended Minimum Flow Fraction", OutputProcessor::Unit::None, - state.dataRoomAirMod->FracMinFlow(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->FracMinFlow(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Is Mixed Status", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneDVMixedFlagRep(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Average Temperature Gradient", OutputProcessor::Unit::K_m, - state.dataRoomAirMod->AvgTempGrad(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->AvgTempGrad(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Maximum Temperature Gradient", OutputProcessor::Unit::K_m, - state.dataRoomAirMod->MaxTempGrad(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->MaxTempGrad(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Thermal Comfort Effective Air Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->TCMF(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->TCMF(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + state.dataHeatBal->Zone(iZone).Name); SetupOutputVariable(state, "Room Air Zone Thermostat Temperature", OutputProcessor::Unit::C, - state.dataHeatBalFanSys->TempTstatAir(state.dataRoomAirModelMgr->Loop), + state.dataHeatBalFanSys->TempTstatAir(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); - } - } + state.dataHeatBal->Zone(iZone).Name); + } // for (iZone) + } // if (any(IsZoneDV)) + + if (any(state.dataRoomAir->IsZoneUFAD)) { + state.dataRoomAir->ZoneUFADMixedFlag.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneUFADMixedFlagRep.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->UFADHcIn.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->ZoneUFADGamma.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneUFADPowInPlumes.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneUFADMixedFlag = 0; + state.dataRoomAir->ZoneUFADMixedFlagRep = 0.0; + state.dataRoomAir->UFADHcIn = 0.0; + state.dataRoomAir->ZoneUFADGamma = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumes = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows = 0.0; - if (any(state.dataRoomAirMod->IsZoneUI)) { - state.dataRoomAirMod->ZoneUFMixedFlag.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneUFMixedFlagRep.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->UFHcIn.allocate(state.dataSurface->TotSurfaces); - state.dataRoomAirMod->ZoneUFGamma.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneUFPowInPlumes.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneUFMixedFlag = 0; - state.dataRoomAirMod->ZoneUFMixedFlagRep = 0.0; - state.dataRoomAirMod->UFHcIn = 0.0; - state.dataRoomAirMod->ZoneUFGamma = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumes = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows = 0.0; // Output variables and UF zone flag - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { - if (state.dataRoomAirMod->AirModel(state.dataRoomAirModelMgr->Loop).AirModelType != DataRoomAirModel::RoomAirModel::UCSDUFI) - continue; // don't set these up if they don't make sense + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::UFADInt) continue; // don't set these up if they don't make sense + + auto &zone = state.dataHeatBal->Zone(iZone); // CurrentModuleObject='RoomAirSettings:UnderFloorAirDistributionInterior' SetupOutputVariable(state, "Room Air Zone Mixed Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTMX(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTMX(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Occupied Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTOC(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTOC(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Transition Height", OutputProcessor::Unit::m, - state.dataRoomAirMod->HeightTransition(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->HeightTransition(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Is Mixed Status", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneUFMixedFlagRep(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADMixedFlagRep(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Average Temperature Gradient", OutputProcessor::Unit::K_m, - state.dataRoomAirMod->AvgTempGrad(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->AvgTempGrad(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Effective Comfort Air Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->TCMF(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->TCMF(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Thermostat Temperature", OutputProcessor::Unit::C, - state.dataHeatBalFanSys->TempTstatAir(state.dataRoomAirModelMgr->Loop), + state.dataHeatBalFanSys->TempTstatAir(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Transition Height Gamma Value", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneUFGamma(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADGamma(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Plume Heat Transfer Rate", OutputProcessor::Unit::W, - state.dataRoomAirMod->ZoneUFPowInPlumes(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADPowInPlumes(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Temperature Stratification Fraction", OutputProcessor::Unit::None, - state.dataRoomAirMod->Phi(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Phi(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); // set zone equip pointer in the UCSDUI data structure - state.dataRoomAirMod->ZoneUCSDUI(state.dataRoomAirMod->ZoneUFPtr(state.dataRoomAirModelMgr->Loop)).ZoneEquipPtr = - state.dataRoomAirModelMgr->Loop; - } - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { - if (state.dataRoomAirMod->AirModel(state.dataRoomAirModelMgr->Loop).AirModelType != DataRoomAirModel::RoomAirModel::UCSDUFE) - continue; // don't set these up if they don't make sense + state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(iZone)).ZoneEquipPtr = iZone; + } // for (iZone) + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::UFADExt) continue; // don't set these up if they don't make sense // CurrentModuleObject='RoomAirSettings:UnderFloorAirDistributionExterior' + auto const &zone = state.dataHeatBal->Zone(iZone); SetupOutputVariable(state, "Room Air Zone Mixed Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTMX(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTMX(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Occupied Subzone Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTOC(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTOC(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Transition Height", OutputProcessor::Unit::m, - state.dataRoomAirMod->HeightTransition(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->HeightTransition(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Is Mixed Status", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneUFMixedFlagRep(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADMixedFlagRep(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Average Temperature Gradient", OutputProcessor::Unit::K_m, - state.dataRoomAirMod->AvgTempGrad(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->AvgTempGrad(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Effective Comfort Air Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->TCMF(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->TCMF(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Thermostat Temperature", OutputProcessor::Unit::C, - state.dataHeatBalFanSys->TempTstatAir(state.dataRoomAirModelMgr->Loop), + state.dataHeatBalFanSys->TempTstatAir(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Transition Height Gamma Value", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneUFGamma(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADGamma(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Plume Heat Transfer Rate", OutputProcessor::Unit::W, - state.dataRoomAirMod->ZoneUFPowInPlumes(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADPowInPlumes(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Window Plume Heat Transfer Rate", OutputProcessor::Unit::W, - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Temperature Stratification Fraction", OutputProcessor::Unit::None, - state.dataRoomAirMod->Phi(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Phi(iZone), OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); // set zone equip pointer in the UCSDUE data structure - state.dataRoomAirMod->ZoneUCSDUE(state.dataRoomAirMod->ZoneUFPtr(state.dataRoomAirModelMgr->Loop)).ZoneEquipPtr = - state.dataRoomAirModelMgr->Loop; + state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(iZone)).ZoneEquipPtr = iZone; } } - if (any(state.dataRoomAirMod->IsZoneCV)) { - state.dataRoomAirMod->CVHcIn.allocate(state.dataSurface->TotSurfaces); - state.dataRoomAirMod->ZTJET.allocate(state.dataGlobal->NumOfZones); + if (any(state.dataRoomAir->IsZoneCrossVent)) { + state.dataRoomAir->CrossVentHcIn.allocate(state.dataSurface->TotSurfaces); + state.dataRoomAir->ZTJET.allocate(state.dataGlobal->NumOfZones); // Most ZTJet takes defaults - state.dataRoomAirMod->ZTREC.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->RoomOutflowTemp.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZTREC.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->RoomOutflowTemp.allocate(state.dataGlobal->NumOfZones); // Most ZTREC takes defaults - state.dataRoomAirMod->JetRecAreaRatio.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Urec.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Ujet.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Qrec.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Qtot.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->RecInflowRatio.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Uhc.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Ain.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Tin.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Droom.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Dstar.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneCVisMixing.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->Rfr.allocate(state.dataGlobal->NumOfZones); - state.dataRoomAirMod->ZoneCVhasREC.allocate(state.dataGlobal->NumOfZones); - - state.dataRoomAirMod->ZTJET = 23.0; - state.dataRoomAirMod->RoomOutflowTemp = 23.0; - state.dataRoomAirMod->ZTREC = 23.0; - state.dataRoomAirMod->CVHcIn = 0.0; - state.dataRoomAirMod->JetRecAreaRatio = 0.2; - state.dataRoomAirMod->Urec = 0.2; - state.dataRoomAirMod->Ujet = 0.2; - state.dataRoomAirMod->Qrec = 0.2; - state.dataRoomAirMod->Uhc = 0.2; - state.dataRoomAirMod->Ain = 1.0; - state.dataRoomAirMod->Tin = 23.0; - state.dataRoomAirMod->Droom = 6.0; - state.dataRoomAirMod->ZoneCVisMixing = 0.0; - state.dataRoomAirMod->Rfr = 10.0; - state.dataRoomAirMod->ZoneCVhasREC = 1.0; - state.dataUCSDShared->HCeiling = 0.0; - state.dataUCSDShared->HWall = 0.0; - state.dataUCSDShared->HFloor = 0.0; - state.dataUCSDShared->HInternal = 0.0; - state.dataUCSDShared->HWindow = 0.0; - state.dataUCSDShared->HDoor = 0.0; - - for (state.dataRoomAirModelMgr->Loop = 1; state.dataRoomAirModelMgr->Loop <= state.dataGlobal->NumOfZones; - ++state.dataRoomAirModelMgr->Loop) { - if (state.dataRoomAirMod->AirModel(state.dataRoomAirModelMgr->Loop).AirModelType != DataRoomAirModel::RoomAirModel::UCSDCV) + state.dataRoomAir->JetRecAreaRatio.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Urec.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Ujet.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Qrec.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Qtot.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->RecInflowRatio.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Uhc.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Ain.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Tin.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Droom.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Dstar.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneCrossVentIsMixing.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->Rfr.allocate(state.dataGlobal->NumOfZones); + state.dataRoomAir->ZoneCrossVentHasREC.allocate(state.dataGlobal->NumOfZones); + + state.dataRoomAir->ZTJET = 23.0; + state.dataRoomAir->RoomOutflowTemp = 23.0; + state.dataRoomAir->ZTREC = 23.0; + state.dataRoomAir->CrossVentHcIn = 0.0; + state.dataRoomAir->JetRecAreaRatio = 0.2; + state.dataRoomAir->Urec = 0.2; + state.dataRoomAir->Ujet = 0.2; + state.dataRoomAir->Qrec = 0.2; + state.dataRoomAir->Uhc = 0.2; + state.dataRoomAir->Ain = 1.0; + state.dataRoomAir->Tin = 23.0; + state.dataRoomAir->Droom = 6.0; + state.dataRoomAir->ZoneCrossVentIsMixing = 0.0; + state.dataRoomAir->Rfr = 10.0; + state.dataRoomAir->ZoneCrossVentHasREC = 1.0; + state.dataRoomAir->HCeiling = 0.0; + state.dataRoomAir->HWall = 0.0; + state.dataRoomAir->HFloor = 0.0; + state.dataRoomAir->HInternal = 0.0; + state.dataRoomAir->HWindow = 0.0; + state.dataRoomAir->HDoor = 0.0; + + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::CrossVent) continue; // don't set these up if they don't make sense - ZoneEquipConfigNum = ZoneNum; + + ZoneEquipConfigNum = ZoneNum; // Where does this ZoneNum come from? + + auto const &zone = state.dataHeatBal->Zone(iZone); // check whether this zone is a controlled zone or not if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).IsControlled) { - state.dataRoomAirMod->IsZoneCV(state.dataRoomAirModelMgr->Loop) = false; - state.dataRoomAirMod->AirModel(state.dataRoomAirModelMgr->Loop).SimAirModel = false; - ShowSevereError(state, - format("Unmixed Flow: Cross Ventilation cannot be applied for Zone={}", - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name)); - ShowContinueError(state, - format("An HVAC system is present in the zone. Fully mixed airflow model will be used for Zone={}", - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name)); + state.dataRoomAir->IsZoneCrossVent(iZone) = false; + state.dataRoomAir->AirModel(iZone).SimAirModel = false; + ShowSevereError(state, format("Unmixed Flow: Cross Ventilation cannot be applied for Zone={}", zone.Name)); + ShowContinueError( + state, format("An HVAC system is present in the zone. Fully mixed airflow model will be used for Zone={}", zone.Name)); continue; } // CurrentModuleObject='RoomAirSettings:CrossVentilation' SetupOutputVariable(state, "Room Air Zone Jet Region Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTJET(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTJET(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Recirculation Region Temperature", OutputProcessor::Unit::C, - state.dataRoomAirMod->ZTREC(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZTREC(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Jet Region Average Air Velocity", OutputProcessor::Unit::m_s, - state.dataRoomAirMod->Ujet(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Ujet(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Recirculation Region Average Air Velocity", OutputProcessor::Unit::m_s, - state.dataRoomAirMod->Urec(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Urec(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Recirculation and Inflow Rate Ratio", OutputProcessor::Unit::None, - state.dataRoomAirMod->RecInflowRatio(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->RecInflowRatio(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Inflow Opening Area", OutputProcessor::Unit::m2, - state.dataRoomAirMod->Ain(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Ain(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Room Length", OutputProcessor::Unit::m, - state.dataRoomAirMod->Dstar(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->Dstar(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::Average, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Is Mixing Status", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneCVisMixing(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneCrossVentIsMixing(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); + zone.Name); SetupOutputVariable(state, "Room Air Zone Is Recirculating Status", OutputProcessor::Unit::None, - state.dataRoomAirMod->ZoneCVhasREC(state.dataRoomAirModelMgr->Loop), + state.dataRoomAir->ZoneCrossVentHasREC(iZone), OutputProcessor::SOVTimeStepType::Zone, OutputProcessor::SOVStoreType::State, - state.dataHeatBal->Zone(state.dataRoomAirModelMgr->Loop).Name); - for (state.dataRoomAirModelMgr->i = 1; - state.dataRoomAirModelMgr->i <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); - ++state.dataRoomAirModelMgr->i) { - state.dataRoomAirModelMgr->N = state.afn->AirflowNetworkLinkageData(state.dataRoomAirModelMgr->i).CompNum; - if (state.afn->AirflowNetworkCompData(state.dataRoomAirModelMgr->N).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { - SetupOutputVariable( - state, - "Room Air Window Jet Region Average Air Velocity", - OutputProcessor::Unit::m_s, - state.dataRoomAirMod->CVJetRecFlows(state.dataRoomAirModelMgr->i, state.dataRoomAirModelMgr->Loop).Ujet, - OutputProcessor::SOVTimeStepType::Zone, - OutputProcessor::SOVStoreType::Average, - state.afn->MultizoneSurfaceData(state.dataRoomAirModelMgr->i).SurfName); + zone.Name); + for (int i = 1; i <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++i) { + int N = state.afn->AirflowNetworkLinkageData(i).CompNum; + if (state.afn->AirflowNetworkCompData(N).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { + SetupOutputVariable(state, + "Room Air Window Jet Region Average Air Velocity", + OutputProcessor::Unit::m_s, + state.dataRoomAir->CrossVentJetRecFlows(i, iZone).Ujet, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Average, + state.afn->MultizoneSurfaceData(i).SurfName); } } - } - } + } // for (iZone) + } // if (any(isZoneCV)) - state.dataRoomAirModelMgr->MyEnvrnFlag = true; + state.dataRoomAir->MyEnvrnFlag = true; - state.dataRoomAirModelMgr->MyOneTimeFlag = false; - } + state.dataRoomAir->MyOneTimeFlag = false; + } // if (myOneTimeFlag) // Do the Begin Environment initializations - if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAirModelMgr->MyEnvrnFlag(ZoneNum)) { - - if (state.dataRoomAirMod->IsZoneDV(ZoneNum) || state.dataRoomAirMod->IsZoneUI(ZoneNum)) { - - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->TCMF(ZoneNum) = 23.0; - state.dataRoomAirMod->FracMinFlow(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneAirSystemON(ZoneNum) = false; - state.dataRoomAirMod->MATFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->XMATFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->XM2TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->XM3TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->XM4TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXMATFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM2TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM3TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM4TFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->MATOC(ZoneNum) = 23.0; - state.dataRoomAirMod->XMATOC(ZoneNum) = 23.0; - state.dataRoomAirMod->XM2TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->XM3TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->XM4TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXMATOC(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM2TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM3TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM4TOC(ZoneNum) = 23.0; - state.dataRoomAirMod->MATMX(ZoneNum) = 23.0; - state.dataRoomAirMod->XMATMX(ZoneNum) = 23.0; - state.dataRoomAirMod->XM2TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->XM3TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->XM4TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXMATMX(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM2TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM3TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->DSXM4TMX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM1Floor(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM2Floor(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM3Floor(ZoneNum) = 23.0; - state.dataRoomAirMod->Zone1Floor(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneMXFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneM2Floor(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM1OC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM2OC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM3OC(ZoneNum) = 23.0; - state.dataRoomAirMod->Zone1OC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneMXOC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneM2OC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM1MX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM2MX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTM3MX(ZoneNum) = 23.0; - state.dataRoomAirMod->Zone1MX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneMXMX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZoneM2MX(ZoneNum) = 23.0; - state.dataRoomAirMod->AIRRATFloor(ZoneNum) = 0.0; - state.dataRoomAirMod->AIRRATOC(ZoneNum) = 0.0; - state.dataRoomAirMod->AIRRATMX(ZoneNum) = 0.0; - state.dataRoomAirMod->ZTOC(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTMX(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTFloor(ZoneNum) = 23.0; - state.dataRoomAirMod->HeightTransition(ZoneNum) = 0.0; - state.dataRoomAirMod->Phi(ZoneNum) = 0.0; - state.dataUCSDShared->HCeiling = 0.0; - state.dataUCSDShared->HWall = 0.0; - state.dataUCSDShared->HFloor = 0.0; - state.dataUCSDShared->HInternal = 0.0; - state.dataUCSDShared->HWindow = 0.0; - state.dataUCSDShared->HDoor = 0.0; - } - - if (state.dataRoomAirMod->IsZoneDV(ZoneNum)) { - - state.dataRoomAirMod->DVHcIn = 0.0; - state.dataRoomAirMod->ZoneDVMixedFlagRep(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneDVMixedFlag(ZoneNum) = 0; - } - - if (state.dataRoomAirMod->IsZoneUI(ZoneNum)) { - - state.dataRoomAirMod->UFHcIn = 0.0; - state.dataRoomAirMod->ZoneUFMixedFlag(ZoneNum) = 0; - state.dataRoomAirMod->ZoneUFMixedFlagRep(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows(ZoneNum) = 0.0; - } - - if (state.dataRoomAirMod->IsZoneCV(ZoneNum)) { - state.dataRoomAirMod->ZTJET(ZoneNum) = 23.0; - state.dataRoomAirMod->RoomOutflowTemp(ZoneNum) = 23.0; - state.dataRoomAirMod->ZTREC(ZoneNum) = 23.0; - state.dataRoomAirMod->CVHcIn = 0.0; - state.dataRoomAirMod->JetRecAreaRatio(ZoneNum) = 0.2; - state.dataRoomAirMod->Urec(ZoneNum) = 0.2; - state.dataRoomAirMod->Ujet(ZoneNum) = 0.2; - state.dataRoomAirMod->Uhc(ZoneNum) = 0.2; - state.dataRoomAirMod->Ain(ZoneNum) = 1.0; - state.dataRoomAirMod->Tin(ZoneNum) = 23.0; - state.dataRoomAirMod->Droom(ZoneNum) = 6.0; - state.dataRoomAirMod->Dstar(ZoneNum) = 6.0; - state.dataRoomAirMod->ZoneCVisMixing(ZoneNum) = 0.0; - state.dataRoomAirMod->Rfr(ZoneNum) = 10.0; - state.dataRoomAirMod->ZoneCVhasREC(ZoneNum) = 1.0; - state.dataUCSDShared->HCeiling = 0.0; - state.dataUCSDShared->HWall = 0.0; - state.dataUCSDShared->HFloor = 0.0; - state.dataUCSDShared->HInternal = 0.0; - state.dataUCSDShared->HWindow = 0.0; - state.dataUCSDShared->HDoor = 0.0; - } - - state.dataRoomAirModelMgr->MyEnvrnFlag(ZoneNum) = false; + if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAir->MyEnvrnFlag(ZoneNum)) { + + if (state.dataRoomAir->IsZoneDispVent3Node(ZoneNum) || state.dataRoomAir->IsZoneUFAD(ZoneNum)) { + + state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->TCMF(ZoneNum) = 23.0; + state.dataRoomAir->FracMinFlow(ZoneNum) = 0.0; + state.dataRoomAir->ZoneAirSystemON(ZoneNum) = false; + state.dataRoomAir->MATFloor(ZoneNum) = 23.0; + state.dataRoomAir->XMATFloor(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATFloor(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->MATOC(ZoneNum) = 23.0; + state.dataRoomAir->XMATOC(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATOC(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->MATMX(ZoneNum) = 23.0; + state.dataRoomAir->XMATMX(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->DSXMATMX(ZoneNum) = {23.0, 23.0, 23.0, 23.0}; + state.dataRoomAir->ZTMFloor(ZoneNum) = {23.0, 23.0, 23.0}; + state.dataRoomAir->Zone1Floor(ZoneNum) = 23.0; + state.dataRoomAir->ZoneMXFloor(ZoneNum) = 23.0; + state.dataRoomAir->ZoneM2Floor(ZoneNum) = 23.0; + state.dataRoomAir->ZTMOC(ZoneNum) = {23.0, 23.0, 23.0}; + state.dataRoomAir->Zone1OC(ZoneNum) = 23.0; + state.dataRoomAir->ZoneMXOC(ZoneNum) = 23.0; + state.dataRoomAir->ZoneM2OC(ZoneNum) = 23.0; + state.dataRoomAir->ZTMMX(ZoneNum) = {23.0, 23.0, 23.0}; + state.dataRoomAir->Zone1MX(ZoneNum) = 23.0; + state.dataRoomAir->ZoneMXMX(ZoneNum) = 23.0; + state.dataRoomAir->ZoneM2MX(ZoneNum) = 23.0; + state.dataRoomAir->AIRRATFloor(ZoneNum) = 0.0; + state.dataRoomAir->AIRRATOC(ZoneNum) = 0.0; + state.dataRoomAir->AIRRATMX(ZoneNum) = 0.0; + state.dataRoomAir->ZTOC(ZoneNum) = 23.0; + state.dataRoomAir->ZTMX(ZoneNum) = 23.0; + state.dataRoomAir->ZTFloor(ZoneNum) = 23.0; + state.dataRoomAir->HeightTransition(ZoneNum) = 0.0; + state.dataRoomAir->Phi(ZoneNum) = 0.0; + state.dataRoomAir->HCeiling = 0.0; + state.dataRoomAir->HWall = 0.0; + state.dataRoomAir->HFloor = 0.0; + state.dataRoomAir->HInternal = 0.0; + state.dataRoomAir->HWindow = 0.0; + state.dataRoomAir->HDoor = 0.0; + } + + if (state.dataRoomAir->IsZoneDispVent3Node(ZoneNum)) { + + state.dataRoomAir->DispVent3NodeHcIn = 0.0; + state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 0.0; + state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 0; + } + + if (state.dataRoomAir->IsZoneUFAD(ZoneNum)) { + + state.dataRoomAir->UFADHcIn = 0.0; + state.dataRoomAir->ZoneUFADMixedFlag(ZoneNum) = 0; + state.dataRoomAir->ZoneUFADMixedFlagRep(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows(ZoneNum) = 0.0; + } + + if (state.dataRoomAir->IsZoneCrossVent(ZoneNum)) { + state.dataRoomAir->ZTJET(ZoneNum) = 23.0; + state.dataRoomAir->RoomOutflowTemp(ZoneNum) = 23.0; + state.dataRoomAir->ZTREC(ZoneNum) = 23.0; + state.dataRoomAir->CrossVentHcIn = 0.0; + state.dataRoomAir->JetRecAreaRatio(ZoneNum) = 0.2; + state.dataRoomAir->Urec(ZoneNum) = 0.2; + state.dataRoomAir->Ujet(ZoneNum) = 0.2; + state.dataRoomAir->Uhc(ZoneNum) = 0.2; + state.dataRoomAir->Ain(ZoneNum) = 1.0; + state.dataRoomAir->Tin(ZoneNum) = 23.0; + state.dataRoomAir->Droom(ZoneNum) = 6.0; + state.dataRoomAir->Dstar(ZoneNum) = 6.0; + state.dataRoomAir->ZoneCrossVentIsMixing(ZoneNum) = 0.0; + state.dataRoomAir->Rfr(ZoneNum) = 10.0; + state.dataRoomAir->ZoneCrossVentHasREC(ZoneNum) = 1.0; + state.dataRoomAir->HCeiling = 0.0; + state.dataRoomAir->HWall = 0.0; + state.dataRoomAir->HFloor = 0.0; + state.dataRoomAir->HInternal = 0.0; + state.dataRoomAir->HWindow = 0.0; + state.dataRoomAir->HDoor = 0.0; + } + + state.dataRoomAir->MyEnvrnFlag(ZoneNum) = false; } // end one time inits if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataRoomAirModelMgr->MyEnvrnFlag(ZoneNum) = true; + state.dataRoomAir->MyEnvrnFlag(ZoneNum) = true; } } @@ -3010,30 +2640,24 @@ namespace RoomAirModelManager { // FUNCTION INFORMATION: // AUTHOR Lixing Gu // DATE WRITTEN November 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given RoomAirNode name and returns the Zone number and RoomAir node // number. If incorrect name is given, errorsfound is returned as true and value is returned // as zero. - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int I; // Zone index - // Obtains and Allocates RoomAirSettings : AirflowNetwork - if (state.dataRoomAirModelMgr->GetAirModelData) { + if (state.dataRoomAir->GetAirModelData) { GetAirModelDatas(state); - state.dataRoomAirModelMgr->GetAirModelData = false; + state.dataRoomAir->GetAirModelData = false; } Errorfound = false; RAFNNodeNum = 0; - for (I = 1; I <= state.dataGlobal->NumOfZones; ++I) { - if (state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(I).NumOfAirNodes > 0) { - RAFNNodeNum = UtilityRoutines::FindItemInList(RAFNNodeName, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(I).Node, - state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(I).NumOfAirNodes); + for (int I = 1; I <= state.dataGlobal->NumOfZones; ++I) { + auto const &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(I); + if (afnZoneInfo.NumOfAirNodes > 0) { + RAFNNodeNum = UtilityRoutines::FindItemInList(RAFNNodeName, afnZoneInfo.Node, afnZoneInfo.NumOfAirNodes); if (RAFNNodeNum > 0) { ZoneNum = I; break; @@ -3049,20 +2673,16 @@ namespace RoomAirModelManager { } bool CheckEquipName(EnergyPlusData &state, - std::string const &EquipType, // Equipment type std::string const &EquipName, // Equipment Name std::string &SupplyNodeName, // Supply node name std::string &ReturnNodeName, // Return node name int TotNumEquip, // how many of this equipment type - int TypeNum // equipment type number - ) + DataZoneEquipment::ZoneEquipType zoneEquipType) { // FUNCTION INFORMATION: // AUTHOR Lixing Gu // DATE WRITTEN March 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given RoomAirNode name and returns the Zone number and RoomAir node @@ -3078,7 +2698,6 @@ namespace RoomAirModelManager { // FUNCTION LOCAL VARIABLE DECLARATIONS: int NumAlphas; int NumNumbers; - int I; int Status; // Used in GetObjectItem int MaxNums = 0; // Maximum number of numeric input fields int MaxAlphas = 0; // Maximum number of alpha input fields @@ -3093,9 +2712,10 @@ namespace RoomAirModelManager { SupplyNodeName = ""; - if (TypeNum == 0) return EquipFind; + if (zoneEquipType == DataZoneEquipment::ZoneEquipType::Invalid) return EquipFind; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, EquipType, TotalArgs, NumAlphas, NumNumbers); + std::string_view equipTypeName = DataZoneEquipment::zoneEquipTypeNamesUC[(int)zoneEquipType]; + state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, equipTypeName, TotalArgs, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlphas = max(MaxAlphas, NumAlphas); @@ -3114,136 +2734,175 @@ namespace RoomAirModelManager { Alphas.allocate(NumAlphas); } - for (I = 1; I <= TotNumEquip; ++I) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, EquipType, I, Alphas, NumAlphas, Numbers, NumNumbers, Status); + for (int I = 1; I <= TotNumEquip; ++I) { + state.dataInputProcessing->inputProcessor->getObjectItem(state, equipTypeName, I, Alphas, NumAlphas, Numbers, NumNumbers, Status); if (UtilityRoutines::SameString(Alphas(1), EquipName)) { EquipFind = true; break; } } - if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_VariableRefrigerantFlow) { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow + switch (zoneEquipType) { + case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { // ZoneHVAC:TerminalUnit : VariableRefrigerantFlow SupplyNodeName = Alphas(4); - ReturnNodeName = ""; // Zone return node - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_EnergyRecoveryVentilator) { // ZoneHVAC : EnergyRecoveryVentilator - I = GetFanOutletNode(state, "Fan:OnOff", Alphas(4), errorfound); + ReturnNodeName = ""; // Zone return node + } break; + case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { // ZoneHVAC : EnergyRecoveryVentilator + int nodeNum = GetFanOutletNode(state, "Fan:OnOff", Alphas(4), errorfound); if (errorfound) { } - SupplyNodeName = state.dataLoopNodes->NodeID(I); // ????? - ReturnNodeName = ""; // Zone exhaust node - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_FourPipeFanCoil) { // ZoneHVAC : FourPipeFanCoil + SupplyNodeName = state.dataLoopNodes->NodeID(nodeNum); // ????? + ReturnNodeName = ""; // Zone exhaust node + } break; + case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { // ZoneHVAC : FourPipeFanCoil SupplyNodeName = Alphas(6); ReturnNodeName = Alphas(5); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_OutdoorAirUnit) { // ZoneHVAC : OutdoorAirUnit + } break; + case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { // ZoneHVAC : OutdoorAirUnit SupplyNodeName = Alphas(13); ReturnNodeName = Alphas(14); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalAirConditioner) { // ZoneHVAC : PackagedTerminalAirConditioner + } break; + case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: { // ZoneHVAC : PackagedTerminalAirConditioner SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_PackagedTerminalHeatPump) { // ZoneHVAC : PackagedTerminalHeatPump + } break; + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: { // ZoneHVAC : PackagedTerminalHeatPump SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_UnitHeater) { // ZoneHVAC : UnitHeater + } break; + case DataZoneEquipment::ZoneEquipType::UnitHeater: { // ZoneHVAC : UnitHeater SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_UnitVentilator) { // ZoneHVAC : UnitVentilator + } break; + case DataZoneEquipment::ZoneEquipType::UnitVentilator: { // ZoneHVAC : UnitVentilator SupplyNodeName = Alphas(7); ReturnNodeName = Alphas(6); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_VentilatedSlab) { // ZoneHVAC : VentilatedSlab + } break; + case DataZoneEquipment::ZoneEquipType::VentilatedSlab: { // ZoneHVAC : VentilatedSlab SupplyNodeName = Alphas(20); ReturnNodeName = Alphas(18); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_WaterToAirHeatPump) { // ZoneHVAC : WaterToAirHeatPump + } break; + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // ZoneHVAC : WaterToAirHeatPump SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_WindowAirConditioner) { // ZoneHVAC : WindowAirConditioner + } break; + case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // ZoneHVAC : WindowAirConditioner SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == - DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveElectric) { // ZoneHVAC : Baseboard : RadiantConvective : Electric - SupplyNodeName = ""; // convection only - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveWater) { // ZoneHVAC : Baseboard : RadiantConvective : Water + } break; + case DataZoneEquipment::ZoneEquipType::BaseboardElectric: { // ZoneHVAC : Baseboard : RadiantConvective : Electric + SupplyNodeName = ""; // convection only + } break; + case DataZoneEquipment::ZoneEquipType::BaseboardWater: { // ZoneHVAC : Baseboard : RadiantConvective : Water SupplyNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_BaseboardRadiantConvectiveSteam) { // ZoneHVAC : Baseboard : RadiantConvective : Steam + } break; + case DataZoneEquipment::ZoneEquipType::BaseboardSteam: { // ZoneHVAC : Baseboard : RadiantConvective : Steam SupplyNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_BaseboardConvectiveElectric) { // ZoneHVAC : Baseboard : Convective : Electric + } break; + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: { // ZoneHVAC : Baseboard : Convective : Electric SupplyNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_BaseboardConvectiveWater) { // ZoneHVAC : Baseboard : Convective : Water + } break; + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: { // ZoneHVAC : Baseboard : Convective : Water SupplyNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_HighTemperatureRadiant) { // ZoneHVAC : HighTemperatureRadiant + } break; + case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: { // ZoneHVAC : HighTemperatureRadiant SupplyNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_DehumidifierDX) { // ZoneHVAC : Dehumidifier : DX + } break; + case DataZoneEquipment::ZoneEquipType::DehumidifierDX: { // ZoneHVAC : Dehumidifier : DX SupplyNodeName = Alphas(4); ReturnNodeName = Alphas(3); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_IdealLoadsAirSystem) { // ZoneHVAC : IdealLoadsAirSystem + } break; + case DataZoneEquipment::ZoneEquipType::PurchasedAir: { // ZoneHVAC : IdealLoadsAirSystem SupplyNodeName = Alphas(3); ReturnNodeName = Alphas(4); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_RefrigerationChillerSet) { // ZoneHVAC : RefrigerationChillerSet + } break; + case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: { // ZoneHVAC : RefrigerationChillerSet SupplyNodeName = Alphas(5); ReturnNodeName = Alphas(4); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_HybridUnitaryAirConditioners) { // ZoneHVAC : HybridUnitaryAirConditioners + } break; + case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { // ZoneHVAC : HybridUnitaryAirConditioners SupplyNodeName = Alphas(11); ReturnNodeName = Alphas(9); - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_FanZoneExhaust) { // Fan : ZoneExhaust - SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_WaterHeaterHeatPump) { // WaterHeater : HeatPump + } break; + case DataZoneEquipment::ZoneEquipType::ExhaustFan: { // Fan : ZoneExhaust + SupplyNodeName = ""; // ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? May not use + } break; + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: { // WaterHeater : HeatPump SupplyNodeName = Alphas(8); ReturnNodeName = Alphas(7); // For AirTerminals, find matching return node later - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalDualDuctConstantVolume) { // AirTerminal : DualDuct : ConstantVolume + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctConstantVolume: { // AirTerminal : DualDuct : ConstantVolume SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalDualDuctVAV) { // AirTerminal : DualDuct : VAV + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctVAV: { // AirTerminal : DualDuct : VAV SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == - DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeReheat) { // AirTerminal : SingleDuct : ConstantVolume : Reheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeReheat: { // AirTerminal : SingleDuct : ConstantVolume : Reheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeNoReheat) { // AirTerminal : SingleDuct : - // ConstantVolume : NoReheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeNoReheat: { // AirTerminal : SingleDuct : + // ConstantVolume : NoReheat SupplyNodeName = Alphas(4); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctVAVReheat) { // AirTerminal : SingleDuct : VAV : Reheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVReheat: { // AirTerminal : SingleDuct : VAV : Reheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctVAVNoReheat) { // AirTerminal : SingleDuct : VAV : NoReheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVNoReheat: { // AirTerminal : SingleDuct : VAV : NoReheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == - DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctSeriesPIUReheat) { // AirTerminal : SingleDuct : SeriesPIU : Reheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctSeriesPIUReheat: { // AirTerminal : SingleDuct : SeriesPIU : Reheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == - DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctParallelPIUReheat) { // AirTerminal : SingleDuct : ParallelPIU : Reheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctParallelPIUReheat: { // AirTerminal : SingleDuct : ParallelPIU : Reheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctCAVFourPipeInduction) { // AirTerminal : SingleDuct : - // ConstantVolume : FourPipeInduction + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctCAVFourPipeInduction: { // AirTerminal : SingleDuct : + // ConstantVolume : FourPipeInduction SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctVAVReheatVariableSpeedFan) { // AirTerminal : SingleDuct : VAV - // : Reheat : VariableSpeedFan + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVReheatVariableSpeedFan: { // AirTerminal : SingleDuct : VAV + // : Reheat : VariableSpeedFan SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctVAVHeatAndCoolReheat) { // AirTerminal : SingleDuct : VAV : - // HeatAndCool : Reheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVHeatAndCoolReheat: { // AirTerminal : SingleDuct : VAV : + // HeatAndCool : Reheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctVAVHeatAndCoolNoReheat) { // AirTerminal : SingleDuct : VAV : - // HeatAndCool : NoReheat + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat: { // AirTerminal : SingleDuct : VAV : + // HeatAndCool : NoReheat SupplyNodeName = Alphas(1); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalSingleDuctConstantVolumeCooledBeam) { // AirTerminal : SingleDuct : - // ConstantVolume : CooledBeam + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalSingleDuctConstantVolumeCooledBeam: { // AirTerminal : SingleDuct : + // ConstantVolume : CooledBeam SupplyNodeName = Alphas(5); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirTerminalDualDuctVAVOutdoorAir) { // AirTerminal : DualDuct : VAV : OutdoorAir + } break; + case DataZoneEquipment::ZoneEquipType::AirTerminalDualDuctVAVOutdoorAir: { // AirTerminal : DualDuct : VAV : OutdoorAir SupplyNodeName = Alphas(3); ReturnNodeName = ""; - } else if (TypeNum == DataHVACGlobals::ZoneEquipTypeOf_AirLoopHVACReturnAir) { // AirLoopHVACReturnAir - SupplyNodeName = Alphas(4); // - ReturnNodeName = ""; // - } + } break; + case DataZoneEquipment::ZoneEquipType::AirLoopHVACReturnAir: { // AirLoopHVACReturnAir + SupplyNodeName = Alphas(4); // + ReturnNodeName = ""; // + } break; + default: { + assert(false); + } break; + + } // switch // Need to find a better to handle allocate and deallocate if (MaxAlphas > NumAlphas) { @@ -3258,6 +2917,6 @@ namespace RoomAirModelManager { //***************************************************************************************** -} // namespace RoomAirModelManager +} // namespace RoomAir } // namespace EnergyPlus diff --git a/src/EnergyPlus/RoomAirModelManager.hh b/src/EnergyPlus/RoomAirModelManager.hh index 244995e2318..b01b6952ff1 100644 --- a/src/EnergyPlus/RoomAirModelManager.hh +++ b/src/EnergyPlus/RoomAirModelManager.hh @@ -57,7 +57,7 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace RoomAirModelManager { +namespace RoomAir { void ManageAirModel(EnergyPlusData &state, int const ZoneNum); @@ -86,69 +86,13 @@ namespace RoomAirModelManager { bool &Errorfound); // find zone number and node number based on the node name bool CheckEquipName(EnergyPlusData &state, - std::string const &EquipType, // Equipment type - std::string const &EquipName, // Equipment Name - std::string &SupplyNodeName, // Supply node name - std::string &ReturnNodeName, // Return node name - int TotNumEquip, // how many of this equipment type - int TypeNum); // equipment type number - -} // namespace RoomAirModelManager - -struct RoomAirModelManagerData : BaseGlobalStruct -{ - - bool GetUCSDDVDataFlag = true; // UCSD - bool GetAirModelData = true; // Used to "get" all air model data - bool MyOneTimeFlag = true; - int CompNum = 0; - int TypeNum = 0; - int NodeNum1 = 0; - int NodeNum2 = 0; - int CompNumber = 0; // AirflowNetwork Component number - int TypeNumber = 0; // Airflownetwork Type Number within a component - int NodeNumber1 = 0; // The first node number in an AirflowNetwork linkage data - int NodeNumber2 = 0; // The Second node number in an AirflowNetwork linkage data - int contFloorBegin = 0; // counter - int contFloorLast = 0; // counter - int contFloor = 0; // counter - int contCeilingBegin = 0; // counter - int contCeilingLast = 0; // counter - int contCeiling = 0; // counter - int contWallBegin = 0; // counter - int contWallLast = 0; // counter - int contWall = 0; // counter - int contWindowBegin = 0; // counter - int contWindowLast = 0; // counter - int contWindow = 0; // counter - int contInternalBegin = 0; // counter - int contInternalLast = 0; // counter - int contInternal = 0; // counter - int contDoorBegin = 0; // counter - int contDoorLast = 0; // counter - int contDoor = 0; // counter - int Loop = 0; // counter - int Loop2 = 0; // counter - int Loop3 = 0; // counter - int i = 0; // counter - int N = 0; // counter - Real64 Z1ZoneAux = 0.0; // Auxiliary variables - Real64 Z2ZoneAux = 0.0; // Auxiliary variables - Real64 Z1Zone = 0.0; // Auxiliary variables - Real64 Z2Zone = 0.0; // Auxiliary variables - Real64 CeilingHeightDiffMax = 0.1; // Maximum difference between wall height and ceiling height - Real64 Z1ofZoneAux = 0.0; // Auxiliary variables - Real64 Z2ofZoneAux = 0.0; // Auxiliary variables - Real64 Z1ofZone = 0.0; // Auxiliary variables - Real64 Z2ofZone = 0.0; // Auxiliary variables - Real64 CeilingHeightDiffMaximum = 0.1; // Maximum difference between wall height and ceiling height - Array1D_bool MyEnvrnFlag; - - void clear_state() override - { - *this = RoomAirModelManagerData(); - } -}; + std::string const &EquipName, // Equipment Name + std::string &SupplyNodeName, // Supply node name + std::string &ReturnNodeName, // Return node name + int TotNumEquip, // how many of this equipment type + DataZoneEquipment::ZoneEquipType zoneEquipType); // equipment type number + +} // namespace RoomAir } // namespace EnergyPlus diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.cc b/src/EnergyPlus/RoomAirModelUserTempPattern.cc index e05e422e49c..fd8b5ec4c22 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.cc +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.cc @@ -74,7 +74,7 @@ #include #include -namespace EnergyPlus::RoomAirModelUserTempPattern { +namespace EnergyPlus::RoomAir { // MODULE INFORMATION: // AUTHOR Brent Griffith @@ -94,9 +94,6 @@ namespace EnergyPlus::RoomAirModelUserTempPattern { // user defined temperature pattern roomair modeling. // See DataRoomAir.cc for variable declarations -// Using/Aliasing -using namespace DataRoomAirModel; - // Functions void ManageUserDefinedPatterns(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone @@ -111,9 +108,6 @@ void ManageUserDefinedPatterns(EnergyPlusData &state, int const ZoneNum) // inde // PURPOSE OF THIS SUBROUTINE: // manage the user-defined air temp. distribution model - // METHODOLOGY EMPLOYED: - // calls subroutines - // transfer data from surface domain to air domain for the specified zone InitTempDistModel(state, ZoneNum); @@ -134,24 +128,21 @@ void InitTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number // SUBROUTINE INFORMATION: // AUTHOR // DATE WRITTEN - // MODIFIED na - // RE-ENGINEERED na - - int SurfNum; // do loop counter if (state.dataRoomAirModelTempPattern->MyOneTimeFlag) { state.dataRoomAirModelTempPattern->MyEnvrnFlag.dimension(state.dataGlobal->NumOfZones, true); state.dataRoomAirModelTempPattern->MyOneTimeFlag = false; } + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAirModelTempPattern->MyEnvrnFlag(ZoneNum)) { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean = 23.0; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = 23.0; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = 23.0; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = 23.0; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Gradient = 0.0; - for (SurfNum = 1; SurfNum <= state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs; ++SurfNum) { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(SurfNum).TadjacentAir = 23.0; + patternZoneInfo.TairMean = 23.0; + patternZoneInfo.Tstat = 23.0; + patternZoneInfo.Tleaving = 23.0; + patternZoneInfo.Texhaust = 23.0; + patternZoneInfo.Gradient = 0.0; + for (int SurfNum = 1; SurfNum <= patternZoneInfo.totNumSurfs; ++SurfNum) { + patternZoneInfo.Surf(SurfNum).TadjacentAir = 23.0; } state.dataRoomAirModelTempPattern->MyEnvrnFlag(ZoneNum) = false; } @@ -159,7 +150,7 @@ void InitTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number if (!state.dataGlobal->BeginEnvrnFlag) state.dataRoomAirModelTempPattern->MyEnvrnFlag(ZoneNum) = true; // init report variable - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Gradient = 0.0; + patternZoneInfo.Gradient = 0.0; } void GetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone @@ -168,8 +159,6 @@ void GetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN August 2005 - // MODIFIED - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // map data from Heat Balance domain to Room Air Modeling Domain @@ -179,18 +168,17 @@ void GetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // METHODOLOGY EMPLOYED: // use ZT from DataHeatBalFanSys - // Using/Aliasing - + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); // intialize in preperation for calculations - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; - for (auto &e : state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf) - e.TadjacentAir = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; + patternZoneInfo.Tstat = zoneHeatBal.MAT; + patternZoneInfo.Tleaving = zoneHeatBal.MAT; + patternZoneInfo.Texhaust = zoneHeatBal.MAT; + for (auto &e : patternZoneInfo.Surf) + e.TadjacentAir = zoneHeatBal.MAT; // the only input this method needs is the zone MAT or ZT or ZTAV ? (original was ZT) - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean = - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; // this is lagged from previous corrector result + patternZoneInfo.TairMean = zoneHeatBal.MAT; // this is lagged from previous corrector result } //***************************************************************************************** @@ -212,31 +200,26 @@ void CalcTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number using General::FindNumberInList; using ScheduleManager::GetCurrentScheduleValue; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // unused INTEGER :: thisZoneInfo - Real64 AvailTest; - int CurntPatternKey; - int CurPatrnID; - + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); // first determine availability - AvailTest = GetCurrentScheduleValue(state, state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).AvailSchedID); + Real64 AvailTest = GetCurrentScheduleValue(state, patternZoneInfo.AvailSchedID); - if ((AvailTest != 1.0) || (!state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).IsUsed)) { + if ((AvailTest != 1.0) || (!patternZoneInfo.IsUsed)) { // model not to be used. Use complete mixing method - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; - for (auto &e : state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf) - e.TadjacentAir = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; + patternZoneInfo.Tstat = patternZoneInfo.TairMean; + patternZoneInfo.Tleaving = patternZoneInfo.TairMean; + patternZoneInfo.Texhaust = patternZoneInfo.TairMean; + for (auto &e : patternZoneInfo.Surf) + e.TadjacentAir = patternZoneInfo.TairMean; return; } else { // choose pattern and call subroutine - CurntPatternKey = GetCurrentScheduleValue(state, state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).PatternSchedID); + int CurntPatternKey = GetCurrentScheduleValue(state, patternZoneInfo.PatternSchedID); - CurPatrnID = FindNumberInList(CurntPatternKey, state.dataRoomAirMod->RoomAirPattern, &TemperaturePatternStruct::PatrnID); + int CurPatrnID = FindNumberInList(CurntPatternKey, state.dataRoomAir->AirPattern, &TemperaturePattern::PatrnID); if (CurPatrnID == 0) { // throw error here ? way to test schedules before getting to this point? @@ -244,23 +227,22 @@ void CalcTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number return; } - switch (state.dataRoomAirMod->RoomAirPattern(CurPatrnID).PatternMode) { - case DataRoomAirModel::UserDefinedPatternType::ConstGradTemp: { + switch (state.dataRoomAir->AirPattern(CurPatrnID).PatternMode) { + case UserDefinedPatternType::ConstGradTemp: { FigureConstGradPattern(state, CurPatrnID, ZoneNum); } break; - case DataRoomAirModel::UserDefinedPatternType::TwoGradInterp: { + case UserDefinedPatternType::TwoGradInterp: { FigureTwoGradInterpPattern(state, CurPatrnID, ZoneNum); } break; - case DataRoomAirModel::UserDefinedPatternType::NonDimenHeight: { + case UserDefinedPatternType::NonDimenHeight: { FigureHeightPattern(state, CurPatrnID, ZoneNum); } break; - case DataRoomAirModel::UserDefinedPatternType::SurfMapTemp: + case UserDefinedPatternType::SurfMapTemp: { FigureSurfMapPattern(state, CurPatrnID, ZoneNum); - break; + } break; default: { - // should not come here - break; - } + assert(false); + } break; } } // availability control construct } @@ -285,29 +267,23 @@ void FigureSurfMapPattern(EnergyPlusData &state, int const PattrnID, int const Z // Using/Aliasing using General::FindNumberInList; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Tmean; - int found; - int i; - - Tmean = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + auto &pattern = state.dataRoomAir->AirPattern(PattrnID); + Real64 Tmean = patternZoneInfo.TairMean; - for (i = 1; i <= state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs; ++i) { + for (int i = 1; i <= patternZoneInfo.totNumSurfs; ++i) { // cycle through zone surfaces and look for match - found = FindNumberInList(state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).SurfID, - state.dataRoomAirMod->RoomAirPattern(PattrnID).MapPatrn.SurfID, - state.dataRoomAirMod->RoomAirPattern(PattrnID).MapPatrn.NumSurfs); + int found = FindNumberInList(patternZoneInfo.Surf(i).SurfID, pattern.MapPatrn.SurfID, pattern.MapPatrn.NumSurfs); if (found != 0) { // if surf is in map then assign, else give it MAT - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).TadjacentAir = - state.dataRoomAirMod->RoomAirPattern(PattrnID).MapPatrn.DeltaTai(found) + Tmean; + patternZoneInfo.Surf(i).TadjacentAir = pattern.MapPatrn.DeltaTai(found) + Tmean; } else { - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).TadjacentAir = Tmean; + patternZoneInfo.Surf(i).TadjacentAir = Tmean; } } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTstat + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTleaving + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTexhaust + Tmean; + patternZoneInfo.Tstat = pattern.DeltaTstat + Tmean; + patternZoneInfo.Tleaving = pattern.DeltaTleaving + Tmean; + patternZoneInfo.Texhaust = pattern.DeltaTexhaust + Tmean; } void FigureHeightPattern(EnergyPlusData &state, int const PattrnID, int const ZoneNum) @@ -316,8 +292,6 @@ void FigureHeightPattern(EnergyPlusData &state, int const PattrnID, int const Zo // SUBROUTINE INFORMATION: // AUTHOR B Griffith // DATE WRITTEN August 2005 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculate the pattern for non-dimensional vertical profile @@ -329,50 +303,39 @@ void FigureHeightPattern(EnergyPlusData &state, int const PattrnID, int const Zo using FluidProperties::FindArrayIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Tmean; - int lowSideID; - int highSideID; - Real64 thisZeta; - int i; - Real64 lowSideZeta; - Real64 hiSideZeta; - Real64 fractBtwn; - Real64 tmpDeltaTai; - - tmpDeltaTai = 0.0; - Tmean = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; - - for (i = 1; i <= state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs; ++i) { - - thisZeta = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).Zeta; - lowSideID = FindArrayIndex(thisZeta, state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.ZetaPatrn); - highSideID = lowSideID + 1; + + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + auto &pattern = state.dataRoomAir->AirPattern(PattrnID); + Real64 tmpDeltaTai = 0.0; + Real64 Tmean = patternZoneInfo.TairMean; + + for (int i = 1; i <= patternZoneInfo.totNumSurfs; ++i) { + + Real64 zeta = patternZoneInfo.Surf(i).Zeta; + int lowSideID = FindArrayIndex(zeta, pattern.VertPatrn.ZetaPatrn); + int highSideID = lowSideID + 1; if (lowSideID == 0) lowSideID = 1; // protect against array bounds - lowSideZeta = state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.ZetaPatrn(lowSideID); - if (highSideID <= isize(state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.ZetaPatrn)) { - hiSideZeta = state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.ZetaPatrn(highSideID); - } else { // trap array bounds - hiSideZeta = lowSideZeta; - } + Real64 lowSideZeta = pattern.VertPatrn.ZetaPatrn(lowSideID); + Real64 hiSideZeta = (highSideID <= isize(pattern.VertPatrn.ZetaPatrn)) ? pattern.VertPatrn.ZetaPatrn(highSideID) : lowSideZeta; + if ((hiSideZeta - lowSideZeta) != 0.0) { - fractBtwn = (thisZeta - lowSideZeta) / (hiSideZeta - lowSideZeta); - tmpDeltaTai = state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.DeltaTaiPatrn(lowSideID) + - fractBtwn * (state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.DeltaTaiPatrn(highSideID) - - state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.DeltaTaiPatrn(lowSideID)); + Real64 fractBtwn = (zeta - lowSideZeta) / (hiSideZeta - lowSideZeta); + tmpDeltaTai = pattern.VertPatrn.DeltaTaiPatrn(lowSideID) + + fractBtwn * (pattern.VertPatrn.DeltaTaiPatrn(highSideID) - pattern.VertPatrn.DeltaTaiPatrn(lowSideID)); } else { // would divide by zero, using low side value - tmpDeltaTai = state.dataRoomAirMod->RoomAirPattern(PattrnID).VertPatrn.DeltaTaiPatrn(lowSideID); + tmpDeltaTai = pattern.VertPatrn.DeltaTaiPatrn(lowSideID); } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).TadjacentAir = tmpDeltaTai + Tmean; + patternZoneInfo.Surf(i).TadjacentAir = tmpDeltaTai + Tmean; } // surfaces in this zone - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTstat + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTleaving + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTexhaust + Tmean; + patternZoneInfo.Tstat = pattern.DeltaTstat + Tmean; + patternZoneInfo.Tleaving = pattern.DeltaTleaving + Tmean; + patternZoneInfo.Texhaust = pattern.DeltaTexhaust + Tmean; } void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int const ZoneNum) @@ -381,8 +344,6 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c // SUBROUTINE INFORMATION: // AUTHOR B Griffith // DATE WRITTEN Aug 2005 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculate two gradient interpolation pattern @@ -392,19 +353,11 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c // based on user selected mode. // calculations vary by mode - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Tmean; // MAT deg C - Real64 Grad; // vertical temperature gradient C/m - Real64 DeltaT; // temperature difference - Real64 CoolLoad; // sensible cooling load - Real64 HeatLoad; // sensible heating load - Real64 ZetaTmean; // non-dimensional height for mean air temp - int i; // do loop index - Real64 thisZeta; // non-dimensional height - Real64 DeltaHeight; // height difference in m - Real64 tempDeltaTai; // temporary temperature difference + Real64 Grad; // vertical temperature gradient C/m + + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + auto &pattern = state.dataRoomAir->AirPattern(PattrnID); if (state.dataRoomAirModelTempPattern->MyOneTimeFlag2) { state.dataRoomAirModelTempPattern->SetupOutputFlag.dimension(state.dataGlobal->NumOfZones, true); // init @@ -415,152 +368,103 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c SetupOutputVariable(state, "Room Air Zone Vertical Temperature Gradient", OutputProcessor::Unit::K_m, - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Gradient, + patternZoneInfo.Gradient, OutputProcessor::SOVTimeStepType::HVAC, OutputProcessor::SOVStoreType::State, - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneName); + patternZoneInfo.ZoneName); state.dataRoomAirModelTempPattern->SetupOutputFlag(ZoneNum) = false; } - Tmean = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; + Real64 Tmean = patternZoneInfo.TairMean; + auto const &twoGrad = pattern.TwoGradPatrn; // determine gradient depending on mode - switch (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.InterpolationMode) { - case DataRoomAirModel::UserDefinedPatternMode::OutdoorDryBulb: { + switch (pattern.TwoGradPatrn.InterpolationMode) { + case UserDefinedPatternMode::OutdoorDryBulb: { Grad = OutdoorDryBulbGrad(state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp, - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale, - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient, - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale, - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient); + twoGrad.UpperBoundTempScale, + twoGrad.HiGradient, + twoGrad.LowerBoundTempScale, + twoGrad.LowGradient); } break; - case DataRoomAirModel::UserDefinedPatternMode::ZoneAirTemp: { - if (Tmean >= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient; - - } else if (Tmean <= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { // interpolate - if ((state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) == 0.0) { - // bad user input, trapped during get input - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient + - ((Tmean - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) / - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale)) * - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient); - } + case UserDefinedPatternMode::ZoneAirTemp: { + if (Tmean >= twoGrad.UpperBoundTempScale) { + Grad = twoGrad.HiGradient; + } else if (Tmean <= twoGrad.LowerBoundTempScale) { + Grad = twoGrad.LowGradient; + } else if ((twoGrad.UpperBoundTempScale - twoGrad.LowerBoundTempScale) == 0.0) { + // bad user input, trapped during get input + Grad = twoGrad.LowGradient; + } else { + Grad = twoGrad.LowGradient + ((Tmean - twoGrad.LowerBoundTempScale) / (twoGrad.UpperBoundTempScale - twoGrad.LowerBoundTempScale)) * + (twoGrad.HiGradient - twoGrad.LowGradient); } } break; - case DataRoomAirModel::UserDefinedPatternMode::DeltaOutdoorZone: { - DeltaT = state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp - Tmean; - if (DeltaT >= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient; - - } else if (DeltaT <= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { // interpolate - if ((state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) == 0.0) { - // bad user input, trapped during get input - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient + - ((DeltaT - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale) / - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundTempScale)) * - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient); - } + case UserDefinedPatternMode::DeltaOutdoorZone: { + Real64 DeltaT = state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp - Tmean; + if (DeltaT >= twoGrad.UpperBoundTempScale) { + Grad = twoGrad.HiGradient; + } else if (DeltaT <= twoGrad.LowerBoundTempScale) { + Grad = twoGrad.LowGradient; + } else if ((twoGrad.UpperBoundTempScale - twoGrad.LowerBoundTempScale) == 0.0) { + Grad = twoGrad.LowGradient; + } else { + Grad = twoGrad.LowGradient + ((DeltaT - twoGrad.LowerBoundTempScale) / (twoGrad.UpperBoundTempScale - twoGrad.LowerBoundTempScale)) * + (twoGrad.HiGradient - twoGrad.LowGradient); } } break; - case DataRoomAirModel::UserDefinedPatternMode::SensibleCooling: { - CoolLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadCoolRate; - if (CoolLoad >= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient; + case UserDefinedPatternMode::SensibleCooling: { + Real64 CoolLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadCoolRate; + if (CoolLoad >= twoGrad.UpperBoundHeatRateScale) { + Grad = twoGrad.HiGradient; - } else if (CoolLoad <= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) { + } else if (CoolLoad <= twoGrad.LowerBoundHeatRateScale) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; + Grad = twoGrad.LowGradient; } else { // interpolate - if ((state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) == 0.0) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; + if ((twoGrad.UpperBoundHeatRateScale - twoGrad.LowerBoundHeatRateScale) == 0.0) { + Grad = twoGrad.LowGradient; } else { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient + - ((CoolLoad - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) / - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale)) * - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient); + Grad = twoGrad.LowGradient + + ((CoolLoad - twoGrad.LowerBoundHeatRateScale) / (twoGrad.UpperBoundHeatRateScale - twoGrad.LowerBoundHeatRateScale)) * + (twoGrad.HiGradient - twoGrad.LowGradient); } } } break; - case DataRoomAirModel::UserDefinedPatternMode::SensibleHeating: { - HeatLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadHeatRate; - if (HeatLoad >= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient; - - } else if (HeatLoad <= state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { // interpolate - if ((state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) == 0.0) { - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient; - } else { - - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient + - ((HeatLoad - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale) / - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundHeatRateScale - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowerBoundHeatRateScale)) * - (state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient); - } + case UserDefinedPatternMode::SensibleHeating: { + Real64 HeatLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadHeatRate; + if (HeatLoad >= twoGrad.UpperBoundHeatRateScale) { + Grad = twoGrad.HiGradient; + } else if (HeatLoad <= twoGrad.LowerBoundHeatRateScale) { + Grad = twoGrad.LowGradient; + } else if ((twoGrad.UpperBoundHeatRateScale - twoGrad.LowerBoundHeatRateScale) == 0.0) { + Grad = twoGrad.LowGradient; + } else { + Grad = twoGrad.LowGradient + + ((HeatLoad - twoGrad.LowerBoundHeatRateScale) / (twoGrad.UpperBoundHeatRateScale - twoGrad.LowerBoundHeatRateScale)) * + (twoGrad.HiGradient - twoGrad.LowGradient); } } break; default: break; } - ZetaTmean = 0.5; // by definition, - - for (i = 1; i <= state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs; ++i) { - thisZeta = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).Zeta; + Real64 ZetaTmean = 0.5; // by definition, - DeltaHeight = -1.0 * (ZetaTmean - thisZeta) * state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneHeight; - - tempDeltaTai = DeltaHeight * Grad; - - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).TadjacentAir = tempDeltaTai + Tmean; + for (int i = 1; i <= patternZoneInfo.totNumSurfs; ++i) { + Real64 zeta = patternZoneInfo.Surf(i).Zeta; + Real64 DeltaHeight = -1.0 * (ZetaTmean - zeta) * patternZoneInfo.ZoneHeight; + patternZoneInfo.Surf(i).TadjacentAir = (DeltaHeight * Grad) + Tmean; } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = -1.0 * - (0.5 * state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneHeight - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.TstatHeight) * - Grad + - Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = -1.0 * - (0.5 * state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneHeight - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.TleavingHeight) * - Grad + - Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = -1.0 * - (0.5 * state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneHeight - - state.dataRoomAirMod->RoomAirPattern(PattrnID).TwoGradPatrn.TexhaustHeight) * - Grad + - Tmean; - - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Gradient = Grad; + patternZoneInfo.Tstat = -1.0 * (0.5 * patternZoneInfo.ZoneHeight - twoGrad.TstatHeight) * Grad + Tmean; + patternZoneInfo.Tleaving = -1.0 * (0.5 * patternZoneInfo.ZoneHeight - twoGrad.TleavingHeight) * Grad + Tmean; + patternZoneInfo.Texhaust = -1.0 * (0.5 * patternZoneInfo.ZoneHeight - twoGrad.TexhaustHeight) * Grad + Tmean; + patternZoneInfo.Gradient = Grad; } + Real64 OutdoorDryBulbGrad(Real64 DryBulbTemp, // Zone(ZoneNum).OutDryBulbTemp Real64 UpperBound, // RoomAirPattern(PattrnID).TwoGradPatrn.UpperBoundTempScale Real64 HiGradient, // RoomAirPattern(PattrnID).TwoGradPatrn.HiGradient @@ -568,24 +472,15 @@ Real64 OutdoorDryBulbGrad(Real64 DryBulbTemp, // Zone(ZoneNum).OutDryBulbTemp Real64 LowGradient // RoomAirPattern(PattrnID).TwoGradPatrn.LowGradient ) { - Real64 Grad; if (DryBulbTemp >= UpperBound) { - Grad = HiGradient; - + return HiGradient; } else if (DryBulbTemp <= LowerBound) { - - Grad = LowGradient; - } else { // interpolate - - if ((UpperBound - LowerBound) == 0.0) { - // bad user input. should be trapped during get input in RoomAirManager.cc - Grad = LowGradient; - } else { - - Grad = LowGradient + ((DryBulbTemp - LowerBound) / (UpperBound - LowerBound)) * (HiGradient - LowGradient); - } + return LowGradient; + } else if ((UpperBound - LowerBound) == 0.0) { + return LowGradient; + } else { + return LowGradient + ((DryBulbTemp - LowerBound) / (UpperBound - LowerBound)) * (HiGradient - LowGradient); } - return Grad; } void FigureConstGradPattern(EnergyPlusData &state, int const PattrnID, int const ZoneNum) @@ -594,32 +489,23 @@ void FigureConstGradPattern(EnergyPlusData &state, int const PattrnID, int const // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN August 2005 - // MODIFIED na - // RE-ENGINEERED na - - Real64 Tmean; // MAT - int i; // loop counter - Real64 Grad; // vertical temperature gradient - Real64 ZetaTmean; // non-dimens. height for MAT, 0.5 - Real64 thisZeta; // temporary non-dimens height - Real64 DeltaHeight; // temporary height difference - Real64 tempDeltaTai; // temporary Delta Tai - Tmean = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).TairMean; - Grad = state.dataRoomAirMod->RoomAirPattern(PattrnID).GradPatrn.Gradient; + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + auto &pattern = state.dataRoomAir->AirPattern(PattrnID); + Real64 Tmean = patternZoneInfo.TairMean; // MAT + Real64 Grad = pattern.GradPatrn.Gradient; // Vertical temperature gradient - ZetaTmean = 0.5; // by definition, + Real64 ZetaTmean = 0.5; // non-dimensional height for MAT - for (i = 1; i <= state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).totNumSurfs; ++i) { - thisZeta = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).Zeta; - DeltaHeight = -1.0 * (ZetaTmean - thisZeta) * state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneHeight; - tempDeltaTai = DeltaHeight * Grad; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(i).TadjacentAir = tempDeltaTai + Tmean; + for (int i = 1; i <= patternZoneInfo.totNumSurfs; ++i) { + Real64 zeta = patternZoneInfo.Surf(i).Zeta; + Real64 DeltaHeight = -1.0 * (ZetaTmean - zeta) * patternZoneInfo.ZoneHeight; + patternZoneInfo.Surf(i).TadjacentAir = DeltaHeight * Grad + Tmean; } - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTstat + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTleaving + Tmean; - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Texhaust = state.dataRoomAirMod->RoomAirPattern(PattrnID).DeltaTexhaust + Tmean; + patternZoneInfo.Tstat = pattern.DeltaTstat + Tmean; + patternZoneInfo.Tleaving = pattern.DeltaTleaving + Tmean; + patternZoneInfo.Texhaust = pattern.DeltaTexhaust + Tmean; } //***************************************************************************************** @@ -629,8 +515,6 @@ Real64 FigureNDheightInZone(EnergyPlusData &state, int const thisHBsurf) // inde // FUNCTION INFORMATION: // AUTHOR B.Griffith // DATE WRITTEN aug 2005, Jan2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // return a non-dimensional height zeta @@ -640,83 +524,57 @@ Real64 FigureNDheightInZone(EnergyPlusData &state, int const thisHBsurf) // inde // use ceiling height from Zone structure // non dimensionalize surface's centroid's Z value - // Using/Aliasing - using DataVectorTypes::Vector; - - // Return value - Real64 FigureNDheightInZone; - // FUNCTION PARAMETER DEFINITIONS: Real64 constexpr TolValue(0.0001); - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int thisZone; - Real64 ZoneZorig; - Real64 ZoneCeilHeight; - Real64 Zcm; - Real64 SurfMinZ; - Real64 SurfMaxZ; - Real64 Zeta; - Real64 FloorCount; - Real64 ZFlrAvg; - Real64 ZMax; - Real64 ZMin; - int Count; - Real64 Z1; - Real64 Z2; - // Get the centroid height for the surface - Zcm = state.dataSurface->Surface(thisHBsurf).Centroid.z; - thisZone = state.dataSurface->Surface(thisHBsurf).Zone; + Real64 Zcm = state.dataSurface->Surface(thisHBsurf).Centroid.z; + auto &zone = state.dataHeatBal->Zone(state.dataSurface->Surface(thisHBsurf).Zone); // this next Do block is copied from SurfaceGeometry.cc with modification for just floor Z // used find floor z. - FloorCount = 0.0; - ZFlrAvg = 0.0; - ZMax = 0.0; - ZMin = 0.0; - Count = 0; - for (int spaceNum : state.dataHeatBal->Zone(thisZone).spaceIndexes) { + int FloorCount = 0; + Real64 ZFlrAvg = 0.0; + Real64 ZMax = 0.0; + Real64 ZMin = 0.0; + int Count = 0; + for (int spaceNum : zone.spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - if (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Floor) { + auto const &surf = state.dataSurface->Surface(SurfNum); + if (surf.Class == DataSurfaces::SurfaceClass::Floor) { // Use Average Z for surface, more important for roofs than floors... ++FloorCount; - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); + Real64 Z1 = minval(surf.Vertex, &Vector3::z); + Real64 Z2 = maxval(surf.Vertex, &Vector3::z); ZFlrAvg += (Z1 + Z2) / 2.0; - } - if (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Wall) { + } else if (surf.Class == DataSurfaces::SurfaceClass::Wall) { // Use Wall calculation in case no floor in zone ++Count; if (Count == 1) { - ZMax = state.dataSurface->Surface(SurfNum).Vertex(1).z; + ZMax = surf.Vertex(1).z; ZMin = ZMax; } - ZMax = max(ZMax, maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z)); - ZMin = min(ZMin, minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z)); + ZMax = max(ZMax, maxval(surf.Vertex, &Vector3::z)); + ZMin = min(ZMin, minval(surf.Vertex, &Vector3::z)); } } } - if (FloorCount > 0.0) { - ZFlrAvg /= FloorCount; - } else { - ZFlrAvg = ZMin; - } - ZoneZorig = ZFlrAvg; // Z floor [M] - ZoneCeilHeight = state.dataHeatBal->Zone(thisZone).CeilingHeight; + + ZFlrAvg = (FloorCount > 0.0) ? (ZFlrAvg / FloorCount) : ZMin; + + Real64 ZoneZorig = ZFlrAvg; // Z floor [M] + Real64 ZoneCeilHeight = zone.CeilingHeight; // first check if some basic things are reasonable - SurfMinZ = minval(state.dataSurface->Surface(thisHBsurf).Vertex, &Vector::z); - SurfMaxZ = maxval(state.dataSurface->Surface(thisHBsurf).Vertex, &Vector::z); + Real64 SurfMinZ = minval(state.dataSurface->Surface(thisHBsurf).Vertex, &Vector3::z); + Real64 SurfMaxZ = maxval(state.dataSurface->Surface(thisHBsurf).Vertex, &Vector3::z); if (SurfMinZ < (ZoneZorig - TolValue)) { if (state.dataGlobal->DisplayExtraWarnings) { ShowWarningError(state, "RoomAirModelUserTempPattern: Problem in non-dimensional height calculation"); - ShowContinueError( - state, - format("too low surface: {} in zone: {}", state.dataSurface->Surface(thisHBsurf).Name, state.dataHeatBal->Zone(thisZone).Name)); + ShowContinueError(state, format("too low surface: {} in zone: {}", state.dataSurface->Surface(thisHBsurf).Name, zone.Name)); ShowContinueError(state, format("**** Average floor height of zone is: {:.3R}", ZoneZorig)); ShowContinueError(state, format("**** Surface minimum height is: {:.3R}", SurfMinZ)); } else { @@ -727,9 +585,7 @@ Real64 FigureNDheightInZone(EnergyPlusData &state, int const thisHBsurf) // inde if (SurfMaxZ > (ZoneZorig + ZoneCeilHeight + TolValue)) { if (state.dataGlobal->DisplayExtraWarnings) { ShowWarningError(state, "RoomAirModelUserTempPattern: Problem in non-dimensional height calculation"); - ShowContinueError( - state, - format(" too high surface: {} in zone: {}", state.dataSurface->Surface(thisHBsurf).Name, state.dataHeatBal->Zone(thisZone).Name)); + ShowContinueError(state, format(" too high surface: {} in zone: {}", state.dataSurface->Surface(thisHBsurf).Name, zone.Name)); ShowContinueError(state, format("**** Average Ceiling height of zone is: {:.3R}", (ZoneZorig + ZoneCeilHeight))); ShowContinueError(state, format("**** Surface Maximum height is: {:.3R}", SurfMaxZ)); } else { @@ -738,16 +594,13 @@ Real64 FigureNDheightInZone(EnergyPlusData &state, int const thisHBsurf) // inde } // non dimensionalize. - Zeta = (Zcm - ZoneZorig) / ZoneCeilHeight; - // bound so that floors and ceiling are just in from endpoints. - - if (Zeta > 0.99) Zeta = 0.99; - - if (Zeta < 0.01) Zeta = 0.01; - - FigureNDheightInZone = Zeta; + Real64 Zeta = (Zcm - ZoneZorig) / ZoneCeilHeight; + if (Zeta > 0.99) + Zeta = 0.99; + else if (Zeta < 0.01) + Zeta = 0.01; - return FigureNDheightInZone; + return Zeta; } //*************************************************** @@ -758,8 +611,6 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN August 2005,Feb. 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // map data from air domain back to surface domain for each zone @@ -777,69 +628,59 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // using Psychrometrics::PsyHgAirFnWTdb; using Psychrometrics::PsyRhoAirFnPbTdbW; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 QRetAir; // Heat to return air from lights - Real64 CpAir; // Air heat capacity [J/kg-K] - Real64 TempRetAir; // Return air temperature [C] - Real64 TempZoneAir; // Zone air temperature [C] - int ZoneNode; // Node number of controlled zone - Real64 MassFlowRA; // Return air mass flow [kg/s] - Real64 FlowThisTS; // Window gap air mass flow [kg/s] - Real64 WinGapFlowToRA; // Mass flow to return air from all airflow windows in zone [kg/s] - Real64 WinGapFlowTtoRA; // Sum of mass flow times outlet temp for all airflow windows in zone [(kg/s)-C] - Real64 WinGapTtoRA; // Temp of outlet flow mixture to return air from all airflow windows in zone [C] - Real64 H2OHtOfVap; // Heat of vaporization of water (W/kg) - Real64 RhoAir; // Density of air (Kg/m3) - Real64 ZoneMult; - Real64 SumRetAirLatentGainRate; - // set air system leaving node conditions // this is not so easy. THis task is normally done in CalcZoneLeavingConditions // but efforts to do this update there were not successful. // Need to revisit how to best implement this. Ended up taking code from CalcZoneLeavingConditions // ZoneNum is already equal to ActualZoneNum , changed block of source - if (state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneNodeID != 0) { + auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); + + if (patternZoneInfo.ZoneNodeID != 0) { // the zone system node should get the conditions leaving the zone (but before return air heat gains are added). - state.dataLoopNodes->Node(state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneNodeID).Temp = - state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving; + state.dataLoopNodes->Node(patternZoneInfo.ZoneNodeID).Temp = patternZoneInfo.Tleaving; } - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - for (int nodeCount = 1; nodeCount <= state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumReturnNodes; ++nodeCount) { + // What if ZoneNodeID is 0? + + auto &zoneNode = state.dataLoopNodes->Node(patternZoneInfo.ZoneNodeID); + auto &zone = state.dataHeatBal->Zone(ZoneNum); + auto &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + + int ZoneMult = zone.Multiplier * zone.ListMultiplier; + + for (int returnNodeNum : state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ReturnNode) { // BEGIN BLOCK of code from CalcZoneLeavingConditions********************************* - int ReturnNode = state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ReturnNode(nodeCount); - ZoneNode = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ZoneNodeID; - ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; + auto &returnNode = state.dataLoopNodes->Node(returnNodeNum); + // RETURN AIR HEAT GAIN from the Lights statement; this heat gain is stored in // Add sensible heat gain from refrigerated cases with under case returns - QRetAir = InternalHeatGains::zoneSumAllReturnAirConvectionGains(state, ZoneNum, ReturnNode); + Real64 QRetAir = InternalHeatGains::zoneSumAllReturnAirConvectionGains(state, ZoneNum, returnNodeNum); - CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNode).HumRat); + Real64 CpAir = PsyCpAirFnW(zoneNode.HumRat); // Need to add the energy to the return air from lights and from airflow windows. Where the heat // is added depends on if there is system flow or not. If there is system flow the heat is added // to the Zone Return Node. If there is no system flow then the heat is added back to the zone in the // Correct step through the SysDepZoneLoads variable. - MassFlowRA = state.dataLoopNodes->Node(ReturnNode).MassFlowRate / ZoneMult; - TempZoneAir = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving; // key difference from - TempRetAir = TempZoneAir; - WinGapFlowToRA = 0.0; - WinGapTtoRA = 0.0; - WinGapFlowTtoRA = 0.0; + Real64 MassFlowRA = returnNode.MassFlowRate / ZoneMult; + Real64 TempZoneAir = patternZoneInfo.Tleaving; // key difference from + Real64 TempRetAir = TempZoneAir; + Real64 WinGapFlowToRA = 0.0; + Real64 WinGapTtoRA = 0.0; + Real64 WinGapFlowTtoRA = 0.0; - if (state.dataHeatBal->Zone(ZoneNum).HasAirFlowWindowReturn) { - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + if (zone.HasAirFlowWindowReturn) { + for (int spaceNum : zone.spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0 && state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) { - FlowThisTS = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum), - state.dataLoopNodes->Node(ZoneNode).HumRat) * - state.dataSurface->SurfWinAirflowThisTS(SurfNum) * state.dataSurface->Surface(SurfNum).Width; + Real64 FlowThisTS = + PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum), zoneNode.HumRat) * + state.dataSurface->SurfWinAirflowThisTS(SurfNum) * state.dataSurface->Surface(SurfNum).Width; WinGapFlowToRA += FlowThisTS; WinGapFlowTtoRA += FlowThisTS * state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum); } @@ -848,7 +689,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // } if (WinGapFlowToRA > 0.0) WinGapTtoRA = WinGapFlowTtoRA / WinGapFlowToRA; - if (!state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + if (!zone.NoHeatToReturnAir) { if (MassFlowRA > 0.0) { if (WinGapFlowToRA > 0.0) { // Add heat-to-return from window gap airflow @@ -858,96 +699,87 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // All of return air comes from flow through airflow windows TempRetAir = WinGapTtoRA; // Put heat from window airflow that exceeds return air flow into zone air - thisZoneHB.SysDepZoneLoads += (WinGapFlowToRA - MassFlowRA) * CpAir * (WinGapTtoRA - TempZoneAir); + zoneHeatBal.SysDepZoneLoads += (WinGapFlowToRA - MassFlowRA) * CpAir * (WinGapTtoRA - TempZoneAir); } } // Add heat-to-return from lights TempRetAir += QRetAir / (MassFlowRA * CpAir); if (TempRetAir > RetTempMax) { - state.dataLoopNodes->Node(ReturnNode).Temp = RetTempMax; + returnNode.Temp = RetTempMax; if (!state.dataGlobal->ZoneSizingCalc) { - thisZoneHB.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - RetTempMax); + zoneHeatBal.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - RetTempMax); } } else if (TempRetAir < RetTempMin) { - state.dataLoopNodes->Node(ReturnNode).Temp = RetTempMin; + returnNode.Temp = RetTempMin; if (!state.dataGlobal->ZoneSizingCalc) { - thisZoneHB.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - RetTempMin); + zoneHeatBal.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - RetTempMin); } } else { - state.dataLoopNodes->Node(ReturnNode).Temp = TempRetAir; + returnNode.Temp = TempRetAir; } } else { // No return air flow // Assign all heat-to-return from window gap airflow to zone air - if (WinGapFlowToRA > 0.0) thisZoneHB.SysDepZoneLoads += WinGapFlowToRA * CpAir * (WinGapTtoRA - TempZoneAir); + if (WinGapFlowToRA > 0.0) zoneHeatBal.SysDepZoneLoads += WinGapFlowToRA * CpAir * (WinGapTtoRA - TempZoneAir); // Assign all heat-to-return from lights to zone air - if (QRetAir > 0.0) thisZoneHB.SysDepZoneLoads += QRetAir; - state.dataLoopNodes->Node(ReturnNode).Temp = state.dataLoopNodes->Node(ZoneNode).Temp; + if (QRetAir > 0.0) zoneHeatBal.SysDepZoneLoads += QRetAir; + returnNode.Temp = zoneNode.Temp; } } else { - state.dataLoopNodes->Node(ReturnNode).Temp = state.dataLoopNodes->Node(ZoneNode).Temp; + returnNode.Temp = zoneNode.Temp; } // Update the rest of the Return Air Node conditions, if the return air system exists! - state.dataLoopNodes->Node(ReturnNode).Press = state.dataLoopNodes->Node(ZoneNode).Press; + returnNode.Press = zoneNode.Press; - H2OHtOfVap = PsyHgAirFnWTdb(state.dataLoopNodes->Node(ZoneNode).HumRat, state.dataLoopNodes->Node(ReturnNode).Temp); - RhoAir = PsyRhoAirFnPbTdbW( - state, state.dataEnvrn->OutBaroPress, state.dataLoopNodes->Node(ReturnNode).Temp, state.dataLoopNodes->Node(ZoneNode).HumRat); + Real64 H2OHtOfVap = PsyHgAirFnWTdb(zoneNode.HumRat, returnNode.Temp); // Include impact of under case returns for refrigerated display cases when updateing return node // humidity ratio - if (!state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + if (!zone.NoHeatToReturnAir) { if (MassFlowRA > 0) { - SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode); - state.dataLoopNodes->Node(ReturnNode).HumRat = - state.dataLoopNodes->Node(ZoneNode).HumRat + (SumRetAirLatentGainRate / (H2OHtOfVap * MassFlowRA)); + Real64 SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, returnNodeNum); + returnNode.HumRat = zoneNode.HumRat + (SumRetAirLatentGainRate / (H2OHtOfVap * MassFlowRA)); } else { // If no mass flow rate exists, include the latent HVAC case credit with the latent Zone case credit - state.dataLoopNodes->Node(ReturnNode).HumRat = state.dataLoopNodes->Node(ZoneNode).HumRat; + returnNode.HumRat = zoneNode.HumRat; state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? - SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, 0); - thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate; + Real64 SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, 0); + zoneHeatBal.ZoneLatentGain += SumRetAirLatentGainRate; } } else { - state.dataLoopNodes->Node(ReturnNode).HumRat = state.dataLoopNodes->Node(ZoneNode).HumRat; + returnNode.HumRat = zoneNode.HumRat; state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? - SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode); - thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate; + + zoneHeatBal.ZoneLatentGain += SumAllReturnAirLatentGains(state, ZoneNum, returnNodeNum); } - state.dataLoopNodes->Node(ReturnNode).Enthalpy = - PsyHFnTdbW(state.dataLoopNodes->Node(ReturnNode).Temp, state.dataLoopNodes->Node(ReturnNode).HumRat); + returnNode.Enthalpy = PsyHFnTdbW(returnNode.Temp, returnNode.HumRat); // END BLOCK of code from CalcZoneLeavingConditions********************************* } // set exhaust node leaving temp if present - if (allocated(state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).ExhaustAirNodeID)) { - auto const &APZoneInfo(state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum)); - auto const &EANodeID(APZoneInfo.ExhaustAirNodeID); - Real64 const Texhaust(APZoneInfo.Texhaust); - for (int i = 1, ie = EANodeID.u(); i <= ie; ++i) { - state.dataLoopNodes->Node(EANodeID(i)).Temp = Texhaust; + if (allocated(patternZoneInfo.ExhaustAirNodeID)) { + for (int exhaustAirNodeID : patternZoneInfo.ExhaustAirNodeID) { + state.dataLoopNodes->Node(exhaustAirNodeID).Temp = patternZoneInfo.Texhaust; } } // set thermostat reading for air system . - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tstat; + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = patternZoneInfo.Tstat; // set results for all surface - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + for (int spaceNum : zone.spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); - int j = 0; - for (int i = thisSpace.HTSurfaceFirst; i <= thisSpace.HTSurfaceLast; ++i) { - ++j; - state.dataHeatBal->SurfTempEffBulkAir(i) = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Surf(j).TadjacentAir; + for (int i = thisSpace.HTSurfaceFirst, j = 0; i <= thisSpace.HTSurfaceLast; ++i) { + state.dataHeatBal->SurfTempEffBulkAir(i) = patternZoneInfo.Surf(++j).TadjacentAir; } } // set flag for reference air temperature mode - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + for (int spaceNum : zone.spaceIndexes) { auto &thisSpace = state.dataHeatBal->space(spaceNum); for (int i = thisSpace.HTSurfaceFirst; i <= thisSpace.HTSurfaceLast; ++i) { state.dataSurface->SurfTAirRef(i) = DataSurfaces::RefAirTemp::AdjacentAirTemp; @@ -958,4 +790,4 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // //***************************************************************************************** -} // namespace EnergyPlus::RoomAirModelUserTempPattern +} // namespace EnergyPlus::RoomAir diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.hh b/src/EnergyPlus/RoomAirModelUserTempPattern.hh index f880ecfbc53..de17d3a779f 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.hh +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.hh @@ -57,7 +57,7 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace RoomAirModelUserTempPattern { +namespace RoomAir { // Data // MODULE PARAMETER DEFINITIONS: @@ -114,7 +114,7 @@ namespace RoomAirModelUserTempPattern { //***************************************************************************************** -} // namespace RoomAirModelUserTempPattern +} // namespace RoomAir struct RoomAirModelUserTempPatternData : BaseGlobalStruct { diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 8213bb3487b..929afbc2c98 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -422,7 +422,7 @@ void ParseStack(EnergyPlusData &state, int const StackNum) } else { Remainder = stripped(Line.substr(Pos + 1)); } - // Keyword = UtilityRoutines::MakeUPPERCase(Line(1:Pos-1)) + // Keyword = UtilityRoutines::makeUPPER(Line(1:Pos-1)) Keyword = Line.substr(0, Pos); // the functionality in each block of this parser structure is so different that a regular IF block seems reasonable @@ -467,8 +467,7 @@ void ParseStack(EnergyPlusData &state, int const StackNum) } else { Pos = scan(Remainder, ' '); if (Pos == std::string::npos) Pos = Remainder.length(); - Variable = - UtilityRoutines::MakeUPPERCase(stripped(Remainder.substr(0, Pos))); // really the subroutine, or reference to instruction set + Variable = UtilityRoutines::makeUPPER(stripped(Remainder.substr(0, Pos))); // really the subroutine, or reference to instruction set StackNum2 = UtilityRoutines::FindItemInList(Variable, state.dataRuntimeLang->ErlStack); if (StackNum2 == 0) { AddError(state, StackNum, LineNum, "Program or Subroutine name [" + Variable + "] not found for the RUN instruction."); @@ -4059,7 +4058,7 @@ int FindEMSVariable(EnergyPlusData &state, int TrendVarNum; Found = false; - std::string const UppercaseName = UtilityRoutines::MakeUPPERCase(VariableName); + std::string const UppercaseName = UtilityRoutines::makeUPPER(VariableName); // check in ErlVariables for (VariableNum = 1; VariableNum <= state.dataRuntimeLang->NumErlVariables; ++VariableNum) { @@ -4113,7 +4112,7 @@ int NewEMSVariable(EnergyPlusData &state, std::string const &VariableName, int c // Add the new variable VariableNum = state.dataRuntimeLang->NumErlVariables; - state.dataRuntimeLang->ErlVariable(VariableNum).Name = UtilityRoutines::MakeUPPERCase(VariableName); + state.dataRuntimeLang->ErlVariable(VariableNum).Name = UtilityRoutines::makeUPPER(VariableName); state.dataRuntimeLang->ErlVariable(VariableNum).StackNum = StackNum; state.dataRuntimeLang->ErlVariable(VariableNum).Value.Type = Value::Number; // ErlVariable values are numbers } diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index 2bbc70adc10..01f9b3872d4 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -232,7 +232,7 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state) state.dataSQLiteProcedures->sqlite->addVentilationData(ventNum, state.dataHeatBal->Ventilation(ventNum)); } for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - state.dataSQLiteProcedures->sqlite->addRoomAirModelData(zoneNum, state.dataRoomAirMod->AirModel(zoneNum)); + state.dataSQLiteProcedures->sqlite->addRoomAirModelData(zoneNum, state.dataRoomAir->AirModel(zoneNum)); } state.dataSQLiteProcedures->sqlite->createZoneExtendedOutput(); @@ -2239,7 +2239,7 @@ void SQLite::addVentilationData(int const number, DataHeatBalance::VentilationDa { ventilations.push_back(std::make_unique(m_errorStream, m_db, number, ventilationData)); } -void SQLite::addRoomAirModelData(int const number, DataRoomAirModel::AirModelData const &roomAirModelData) +void SQLite::addRoomAirModelData(int const number, RoomAir::AirModelData const &roomAirModelData) { roomAirModels.push_back(std::make_unique(m_errorStream, m_db, number, roomAirModelData)); } @@ -2509,7 +2509,7 @@ bool SQLite::RoomAirModel::insertIntoSQLite(sqlite3_stmt *insertStmt) { sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, airModelName); - sqliteBindInteger(insertStmt, 3, static_cast(airModelType)); + sqliteBindInteger(insertStmt, 3, static_cast(airModel)); sqliteBindInteger(insertStmt, 4, static_cast(tempCoupleScheme)); sqliteBindLogical(insertStmt, 5, simAirModel); diff --git a/src/EnergyPlus/SQLiteProcedures.hh b/src/EnergyPlus/SQLiteProcedures.hh index bb7f1ed14e7..956a83827a6 100644 --- a/src/EnergyPlus/SQLiteProcedures.hh +++ b/src/EnergyPlus/SQLiteProcedures.hh @@ -132,7 +132,7 @@ public: void addNominalBaseboardData(int const number, DataHeatBalance::BBHeatData const &nominalBaseboardData); void addInfiltrationData(int const number, DataHeatBalance::InfiltrationData const &infiltrationData); void addVentilationData(int const number, DataHeatBalance::VentilationData const &ventilationData); - void addRoomAirModelData(int const number, DataRoomAirModel::AirModelData const &roomAirModelData); + void addRoomAirModelData(int const number, RoomAir::AirModelData const &roomAirModelData); // Open the DB and prepare for writing data // Create all of the tables on construction @@ -970,10 +970,9 @@ private: RoomAirModel(std::shared_ptr const &errorStream, std::shared_ptr const &db, int const roomAirModelNumber, - DataRoomAirModel::AirModelData const &roomAirModelData) - : SQLiteData(errorStream, db), number(roomAirModelNumber), airModelName(roomAirModelData.AirModelName), - airModelType(roomAirModelData.AirModelType), tempCoupleScheme(roomAirModelData.TempCoupleScheme), - simAirModel(roomAirModelData.SimAirModel) + RoomAir::AirModelData const &roomAirModelData) + : SQLiteData(errorStream, db), number(roomAirModelNumber), airModelName(roomAirModelData.Name), airModel(roomAirModelData.AirModel), + tempCoupleScheme(roomAirModelData.TempCoupleScheme), simAirModel(roomAirModelData.SimAirModel) { } @@ -982,8 +981,8 @@ private: private: int const number; std::string const &airModelName; - DataRoomAirModel::RoomAirModel const &airModelType; - DataRoomAirModel::CouplingScheme const &tempCoupleScheme; + RoomAir::RoomAirModel const &airModel; + RoomAir::CouplingScheme const &tempCoupleScheme; bool const &simAirModel; }; diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 0d1068d1b08..b13ba27c876 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -633,7 +633,7 @@ namespace ScheduleManager { } if (NumAlphas >= 3) { if (!lAlphaBlanks(3)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).UnitType = getEnumerationValue(scheduleTypeLimitUnitTypes, Alphas(3)) + 1; + state.dataScheduleMgr->ScheduleType(LoopIndex).UnitType = getEnumValue(scheduleTypeLimitUnitTypes, Alphas(3)) + 1; if (state.dataScheduleMgr->ScheduleType(LoopIndex).UnitType == 0) { ShowWarningError( state, @@ -817,7 +817,7 @@ namespace ScheduleManager { // Depending on value of "Interpolate" field, the value for each time step in each hour gets processed: state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = - static_cast(getEnumerationValue(interpolationTypesUC, Alphas(3))); + static_cast(getEnumValue(interpolationTypesUC, Alphas(3))); if (state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated == ScheduleInterpolation::Invalid) { ShowSevereError( state, @@ -2326,7 +2326,7 @@ namespace ScheduleManager { // IDD only allows Hourly or Timestep as valid values on the required field, anything else should be an error in the input processor OutputReportLevel reportLevel = - static_cast(getEnumerationValue(outputScheduleReportLevelNamesUC, Alphas(1))); // NOLINT(modernize-use-auto) + static_cast(getEnumValue(outputScheduleReportLevelNamesUC, Alphas(1))); // NOLINT(modernize-use-auto) if (reportLevel == OutputReportLevel::Invalid) { ShowWarningError(state, format("{}Report for Schedules should specify \"HOURLY\" or \"TIMESTEP\" (\"DETAILED\")", RoutineName)); ShowContinueError(state, "HOURLY report will be done"); diff --git a/src/EnergyPlus/SetPointManager.cc b/src/EnergyPlus/SetPointManager.cc index 885ba97a6a7..a44fd91983d 100644 --- a/src/EnergyPlus/SetPointManager.cc +++ b/src/EnergyPlus/SetPointManager.cc @@ -1677,8 +1677,8 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2); // setup program flow control integers. - state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = static_cast(getEnumerationValue( - controlTypeNameUC, UtilityRoutines::MakeUPPERCase(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ctrlVarType))); + state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = static_cast( + getEnumValue(controlTypeNameUC, UtilityRoutines::makeUPPER(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ctrlVarType))); if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Invalid) { // should not come here if idd type choice and key list is working ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -1872,7 +1872,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MinSetTemp)); } - if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == controlTypeNameUC[static_cast(CtrlVarType::MaxTemp)]) { + if (UtilityRoutines::makeUPPER(cAlphaArgs(4)) == controlTypeNameUC[static_cast(CtrlVarType::MaxTemp)]) { state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Strategy = SupplyFlowTempStrategy::MaxTemp; } else { ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -1972,7 +1972,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MinSetTemp)); } - if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == controlTypeNameUC[static_cast(CtrlVarType::MinTemp)]) { + if (UtilityRoutines::makeUPPER(cAlphaArgs(4)) == controlTypeNameUC[static_cast(CtrlVarType::MinTemp)]) { state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Strategy = SupplyFlowTempStrategy::MinTemp; } else { ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -2084,7 +2084,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) } state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy = - static_cast(getEnumerationValue(strategyNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)))); + static_cast(getEnumValue(strategyNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(4)))); if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy == ControlStrategy::Invalid) { ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); ShowContinueError(state, format("..invalid {}=\"{}\".", cAlphaFieldNames(4), cAlphaArgs(4))); @@ -3813,7 +3813,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) setpointManager.Name = cAlphaArgs(1); setpointManager.ctrlVarType = cAlphaArgs(2); - int typeNum = getEnumerationValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2)); + int typeNum = getEnumValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2)); setpointManager.CtrlTypeMode = static_cast(typeNum); if (setpointManager.CtrlTypeMode == SetPointManager::CtrlVarType::Invalid) { // should not come here if idd type choice and key list is working @@ -3935,7 +3935,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) setpointManager.Name = cAlphaArgs(1); setpointManager.ctrlVarType = cAlphaArgs(2); - int typeNum = getEnumerationValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2)); + int typeNum = getEnumValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2)); setpointManager.CtrlTypeMode = static_cast(typeNum); if (setpointManager.CtrlTypeMode == SetPointManager::CtrlVarType::Invalid) { // should not come here if idd type choice and key list is working diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index e30d78aea14..4d51da78544 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -1076,15 +1076,15 @@ namespace SimulationManager { state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, thisObjectName); if (fields.find("use_coil_direct_solutions") != fields.end()) { state.dataGlobal->DoCoilDirectSolutions = - UtilityRoutines::MakeUPPERCase(fields.at("use_coil_direct_solutions").get()) == "YES"; + UtilityRoutines::makeUPPER(fields.at("use_coil_direct_solutions").get()) == "YES"; } if (fields.find("zone_radiant_exchange_algorithm") != fields.end()) { state.dataHeatBalIntRadExchg->CarrollMethod = - UtilityRoutines::MakeUPPERCase(fields.at("zone_radiant_exchange_algorithm").get()) == "CARROLLMRT"; + UtilityRoutines::makeUPPER(fields.at("zone_radiant_exchange_algorithm").get()) == "CARROLLMRT"; } if (fields.find("use_representative_surfaces_for_calculations") != fields.end()) { state.dataSurface->UseRepresentativeSurfaceCalculations = - UtilityRoutines::MakeUPPERCase(fields.at("use_representative_surfaces_for_calculations").get()) == "YES"; + UtilityRoutines::makeUPPER(fields.at("use_representative_surfaces_for_calculations").get()) == "YES"; } bool overrideTimestep(false); bool overrideZoneAirHeatBalAlg(false); @@ -1096,7 +1096,7 @@ namespace SimulationManager { bool overridePsychTsatFnPb(false); state.dataZoneTempPredictorCorrector->OscillationVariablesNeeded = true; if (fields.find("override_mode") != fields.end()) { - overrideModeValue = UtilityRoutines::MakeUPPERCase(fields.at("override_mode").get()); + overrideModeValue = UtilityRoutines::makeUPPER(fields.at("override_mode").get()); if (overrideModeValue == "NORMAL") { // no overrides } else if (overrideModeValue == "MODE01") { @@ -2579,7 +2579,7 @@ namespace SimulationManager { print(state.files.bnd, " Zone Equipment Component,{},{},{},{},{},{}\n", Count1, - state.dataZoneEquip->ZoneEquipList(Count).EquipType(Count1), + state.dataZoneEquip->ZoneEquipList(Count).EquipTypeName(Count1), state.dataZoneEquip->ZoneEquipList(Count).EquipName(Count1), state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName, state.dataZoneEquip->ZoneEquipList(Count).CoolingPriority(Count1), diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index 27883b8a43d..beb21896255 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -5873,7 +5873,7 @@ void GetATMixers(EnergyPlusData &state) if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipName(Num)) && UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(2), - state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipType(Num))) { + state.dataZoneEquip->ZoneEquipList(CtrlZone).EquipTypeName(Num))) { state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->SysATMixer(ATMixerNum).ADUNum).ZoneEqNum = CtrlZone; state.dataSingleDuct->SysATMixer(ATMixerNum).ZoneNum = CtrlZone; // Must wait until InitATMixer to fill other zone equip config data because ultimate zone inlet node is not known yet diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index f536dc4b2ad..301edadf7d4 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -2383,7 +2383,7 @@ void GetOARequirements(EnergyPlusData &state) auto const &objectFields = instance.value(); auto &thisOAReq = state.dataSize->OARequirements(oaIndex); ip->markObjectAsUsed(cCurrentModuleObject2, instance.key()); - std::string thisOAReqName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string thisOAReqName = UtilityRoutines::makeUPPER(instance.key()); if (UtilityRoutines::FindItemInList(thisOAReqName, state.dataSize->OARequirements) > 0) { ShowSevereError( @@ -2480,8 +2480,7 @@ void ProcessInputOARequirements(EnergyPlusData &state, auto &thisOARequirements(state.dataSize->OARequirements(OAIndex)); if (NumAlphas > 1) { - thisOARequirements.OAFlowMethod = - static_cast(getEnumerationValue(OAFlowCalcMethodNamesUC, UtilityRoutines::MakeUPPERCase(Alphas(2)))); + thisOARequirements.OAFlowMethod = static_cast(getEnumValue(OAFlowCalcMethodNamesUC, UtilityRoutines::makeUPPER(Alphas(2)))); if (thisOARequirements.OAFlowMethod == OAFlowCalcMethod::Invalid) { ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->OARequirements(OAIndex).Name)); ShowContinueError(state, format("...Invalid {}=\"{}\",", cAlphaFields(2), Alphas(2))); @@ -3399,10 +3398,10 @@ void GetZoneSizingInput(EnergyPlusData &state) constexpr static std::array(DataSizing::AirflowSizingMethod::Num)> AirflowSizingMethodNamesUC = { "DESIGNDAY", "FLOW/ZONE", "DESIGNDAYWITHLIMIT"}; state.dataSize->ZoneSizingInput(ZoneSizIndex).CoolAirDesMethod = static_cast( - getEnumerationValue(AirflowSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)))); + getEnumValue(AirflowSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); assert(state.dataSize->ZoneSizingInput(ZoneSizIndex).CoolAirDesMethod != AirflowSizingMethod::Invalid); state.dataSize->ZoneSizingInput(ZoneSizIndex).HeatAirDesMethod = static_cast( - getEnumerationValue(AirflowSizingMethodNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(6)))); + getEnumValue(AirflowSizingMethodNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(6)))); assert(state.dataSize->ZoneSizingInput(ZoneSizIndex).HeatAirDesMethod != AirflowSizingMethod::Invalid); BooleanSwitch accountForDOAS = getYesNoValue(state.dataIPShortCut->cAlphaArgs(8)); @@ -3412,7 +3411,7 @@ void GetZoneSizingInput(EnergyPlusData &state) constexpr static std::array(DataSizing::DOASControl::Num)> DOASControlNamesUC = { "NEUTRALSUPPLYAIR", "NEUTRALDEHUMIDIFIEDSUPPLYAIR", "COLDSUPPLYAIR"}; state.dataSize->ZoneSizingInput(ZoneSizIndex).DOASControlStrategy = static_cast( - getEnumerationValue(DOASControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(9)))); + getEnumValue(DOASControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(9)))); state.dataSize->ZoneSizingInput(ZoneSizIndex).DOASLowSetpoint = state.dataIPShortCut->rNumericArgs(17); state.dataSize->ZoneSizingInput(ZoneSizIndex).DOASHighSetpoint = state.dataIPShortCut->rNumericArgs(18); @@ -3423,8 +3422,8 @@ void GetZoneSizingInput(EnergyPlusData &state) ErrorsFound = true; } } - zoneSizingIndex.zoneSizingMethod = static_cast( - getEnumerationValue(DataSizing::ZoneSizingMethodNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + zoneSizingIndex.zoneSizingMethod = + static_cast(getEnumValue(DataSizing::ZoneSizingMethodNamesUC, state.dataIPShortCut->cAlphaArgs(10))); if (zoneSizingIndex.zoneSizingMethod != ZoneSizing::SensibleOnly) { zoneSizingIndex.zoneLatentSizing = true; state.dataHeatBal->DoLatentSizing = true; @@ -3703,7 +3702,7 @@ void GetSystemSizingInput(EnergyPlusData &state) constexpr std::array(DataSizing::LoadSizing::Num)> LoadSizingNamesUC{ "SENSIBLE", "LATENT", "TOTAL", "VENTILATIONREQUIREMENT"}; SysSizInput(SysSizIndex).loadSizingType = static_cast( - getEnumerationValue(LoadSizingNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(iLoadTypeSizeAlphaNum)))); + getEnumValue(LoadSizingNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(iLoadTypeSizeAlphaNum)))); // assign PeakLoad based on LoadSizing for now if (SysSizInput(SysSizIndex).loadSizingType == DataSizing::LoadSizing::Sensible) { @@ -3717,7 +3716,7 @@ void GetSystemSizingInput(EnergyPlusData &state) // set the CoolCapControl input constexpr std::array(CapacityControl::Num)> CapacityControlNamesUC{"VAV", "BYPASS", "VT", "ONOFF"}; SysSizInput(SysSizIndex).CoolCapControl = static_cast( - getEnumerationValue(CapacityControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(iCoolCapControlAlphaNum)))); + getEnumValue(CapacityControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(iCoolCapControlAlphaNum)))); { std::string const &sizingOption = state.dataIPShortCut->cAlphaArgs(iSizingOptionAlphaNum); @@ -4261,8 +4260,8 @@ void GetPlantSizingInput(EnergyPlusData &state) constexpr static std::array(DataSizing::TypeOfPlantLoop::Num)> TypeOfPlantLoopNamesUC = { "HEATING", "COOLING", "CONDENSER", "STEAM"}; - state.dataSize->PlantSizData(PltSizIndex).LoopType = static_cast( - getEnumerationValue(TypeOfPlantLoopNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)))); + state.dataSize->PlantSizData(PltSizIndex).LoopType = + static_cast(getEnumValue(TypeOfPlantLoopNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); assert(state.dataSize->PlantSizData(PltSizIndex).LoopType != TypeOfPlantLoop::Invalid); if (NumAlphas > 2) { diff --git a/src/EnergyPlus/SolarCollectors.cc b/src/EnergyPlus/SolarCollectors.cc index 7e9233076a9..d38c027d8c8 100644 --- a/src/EnergyPlus/SolarCollectors.cc +++ b/src/EnergyPlus/SolarCollectors.cc @@ -237,7 +237,7 @@ namespace SolarCollectors { } std::string_view const key = state.dataIPShortCut->cAlphaArgs(3); - state.dataSolarCollectors->Parameters(ParametersNum).TestType = static_cast(getEnumerationValue(testTypesUC, key)); + state.dataSolarCollectors->Parameters(ParametersNum).TestType = static_cast(getEnumValue(testTypesUC, key)); if (state.dataSolarCollectors->Parameters(ParametersNum).TestType == TestTypeEnum::INVALID) { ShowSevereError(state, format("{} = {}: {} is not supported for {}", diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 5a16420a5bd..70db3acca88 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -704,7 +704,8 @@ namespace SteamBaseboardRadiator { // search zone equipment list structure for zone index for (int ctrlZone = 1; ctrlZone <= state.dataGlobal->NumOfZones; ++ctrlZone) { for (int zoneEquipTypeNum = 1; zoneEquipTypeNum <= state.dataZoneEquip->ZoneEquipList(ctrlZone).NumOfEquipTypes; ++zoneEquipTypeNum) { - if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipTypeEnum(zoneEquipTypeNum) == DataZoneEquipment::ZoneEquip::BBSteam && + if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipType(zoneEquipTypeNum) == + DataZoneEquipment::ZoneEquipType::BaseboardSteam && state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipName(zoneEquipTypeNum) == state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID) { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr = ctrlZone; diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index 74ebb7d9870..e602cc04571 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -336,9 +336,8 @@ namespace SteamCoils { NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); - std::string controlMode = UtilityRoutines::MakeUPPERCase(AlphArray(7)); - state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil = - static_cast(getEnumerationValue(coilControlTypeNames, controlMode)); + std::string controlMode = UtilityRoutines::makeUPPER(AlphArray(7)); + state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil = static_cast(getEnumValue(coilControlTypeNames, controlMode)); switch (state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil) { case CoilControlType::TemperatureSetPoint: state.dataSteamCoils->SteamCoil(CoilNum).TempSetPointNodeNum = GetOnlySingleNode(state, diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 97634719b75..dc620b6838a 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -8063,7 +8063,7 @@ namespace SurfaceGeometry { constexpr std::array(CalculationMethod::Num)> CalculationMethodUC = { "TOTALEXPOSEDPERIMETER", "EXPOSEDPERIMETERFRACTION", "BYSEGMENT"}; CalculationMethod calculationMethod = - static_cast(getEnumerationValue(CalculationMethodUC, state.dataIPShortCut->cAlphaArgs(alpF))); + static_cast(getEnumValue(CalculationMethodUC, state.dataIPShortCut->cAlphaArgs(alpF))); if (calculationMethod != CalculationMethod::TotalExposedPerimeter && calculationMethod != CalculationMethod::ExposedPerimeterFraction && calculationMethod != CalculationMethod::Bysegment) { ShowSevereError(state, @@ -8532,7 +8532,7 @@ namespace SurfaceGeometry { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); GroundSurfacesProperty thisGndSurfsObj; - thisGndSurfsObj.Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisGndSurfsObj.Name = UtilityRoutines::makeUPPER(thisObjectName); state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjectName); auto groundSurfaces = fields.find("ground_surfaces"); if (groundSurfaces != fields.end()) { @@ -8544,7 +8544,7 @@ namespace SurfaceGeometry { if (GndSurfName != groundSurface.end()) { std::string ground_surf_name = GndSurfName.value().get(); if (!ground_surf_name.empty()) { - thisGndSurf.Name = UtilityRoutines::MakeUPPERCase(ground_surf_name); + thisGndSurf.Name = UtilityRoutines::makeUPPER(ground_surf_name); } } auto groundSurfViewFactor = groundSurface.find("ground_surface_view_factor"); @@ -8556,16 +8556,14 @@ namespace SurfaceGeometry { if (TempSchName != groundSurface.end()) { std::string gnd_surf_TempSchName = TempSchName.value().get(); if (!gnd_surf_TempSchName.empty()) { - thisGndSurf.TempSchPtr = - ScheduleManager::GetScheduleIndex(state, UtilityRoutines::MakeUPPERCase(gnd_surf_TempSchName)); + thisGndSurf.TempSchPtr = ScheduleManager::GetScheduleIndex(state, UtilityRoutines::makeUPPER(gnd_surf_TempSchName)); } } auto ReflSchName = groundSurface.find("ground_surface_reflectance_schedule_name"); if (ReflSchName != groundSurface.end()) { std::string gnd_surf_ReflSchName = ReflSchName.value().get(); if (!gnd_surf_ReflSchName.empty()) { - thisGndSurf.ReflSchPtr = - ScheduleManager::GetScheduleIndex(state, UtilityRoutines::MakeUPPERCase(gnd_surf_ReflSchName)); + thisGndSurf.ReflSchPtr = ScheduleManager::GetScheduleIndex(state, UtilityRoutines::makeUPPER(gnd_surf_ReflSchName)); } } thisGndSurfsObj.GndSurfs.push_back(thisGndSurf); @@ -10018,7 +10016,7 @@ namespace SurfaceGeometry { windowShadingControl.DaylightingControlName = state.dataIPShortCut->cAlphaArgs(12); windowShadingControl.multiSurfaceControl = static_cast( - getEnumerationValue(MultiSurfaceControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(13)))); + getEnumValue(MultiSurfaceControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(13)))); if (windowShadingControl.multiSurfaceControl == MultiSurfaceControl::Invalid) { windowShadingControl.multiSurfaceControl = MultiSurfaceControl::Sequential; @@ -10045,7 +10043,7 @@ namespace SurfaceGeometry { } windowShadingControl.shadingControlType = static_cast( - getEnumerationValue(WindowShadingControlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)))); + getEnumValue(WindowShadingControlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); if (windowShadingControl.ShadingDevice > 0) { if (state.dataMaterial->Material(windowShadingControl.ShadingDevice)->group == Material::Group::Screen && @@ -10137,8 +10135,8 @@ namespace SurfaceGeometry { state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaFieldNames(5))); } - windowShadingControl.slatAngleControl = static_cast( - getEnumerationValue(SlatAngleNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(10)))); + windowShadingControl.slatAngleControl = + static_cast(getEnumValue(SlatAngleNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(10)))); // For upward compatibility change old "noninsulating" and "insulating" shade types to // INTERIORSHADE or EXTERIORSHADE @@ -10955,10 +10953,10 @@ namespace SurfaceGeometry { if (SurfNum > 0) { state.dataSurface->AirflowWindows = true; state.dataSurface->SurfWinAirflowSource(SurfNum) = - static_cast(getEnumerationValue(WindowAirFlowSourceNamesUC, state.dataIPShortCut->cAlphaArgs(2))); + static_cast(getEnumValue(WindowAirFlowSourceNamesUC, state.dataIPShortCut->cAlphaArgs(2))); state.dataSurface->SurfWinAirflowDestination(SurfNum) = - static_cast(getEnumerationValue(WindowAirFlowDestinationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + static_cast(getEnumValue(WindowAirFlowDestinationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { int controlledZoneNum = DataZoneEquipment::GetControlledZoneIndex(state, state.dataSurface->Surface(SurfNum).ZoneName); @@ -12175,8 +12173,7 @@ namespace SurfaceGeometry { state.dataIPShortCut->cAlphaArgs(3), state.dataMaterial->Material, state.dataMaterial->TotMaterials); auto *thisMaterial = state.dataMaterial->Material(MaterNum); SchNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - InsulationType insulationType = - static_cast(getEnumerationValue(insulationTypeNamesUC, state.dataIPShortCut->cAlphaArgs(1))); + InsulationType insulationType = static_cast(getEnumValue(insulationTypeNamesUC, state.dataIPShortCut->cAlphaArgs(1))); if (insulationType == InsulationType::Invalid) { ShowSevereError(state, format("{}, {}=\"{}\", invalid data.", diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index f99d8f850e5..132927a7847 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -605,14 +605,14 @@ namespace SystemAvailabilityManager { ErrorsFound = true; } - nightCycleMgr.nightCycleControlType = static_cast( - getEnumerationValue(NightCycleControlTypeNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)))); + nightCycleMgr.nightCycleControlType = + static_cast(getEnumValue(NightCycleControlTypeNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(4)))); assert(nightCycleMgr.nightCycleControlType != NightCycleControlType::Invalid); // Cycling Run Time Control Type - nightCycleMgr.cyclingRunTimeControl = static_cast( - getEnumerationValue(CyclingRunTimeControlNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(5)))); + nightCycleMgr.cyclingRunTimeControl = + static_cast(getEnumValue(CyclingRunTimeControlNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(5)))); assert(nightCycleMgr.cyclingRunTimeControl != CyclingRunTimeControl::Invalid); @@ -808,8 +808,8 @@ namespace SystemAvailabilityManager { optimumStartMgr.MaxOptStartTime = rNumericArgs(1); - optimumStartMgr.optimumStartControlType = static_cast( - getEnumerationValue(OptimumStartControlTypeNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)))); + optimumStartMgr.optimumStartControlType = + static_cast(getEnumValue(OptimumStartControlTypeNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(4)))); if (optimumStartMgr.optimumStartControlType == OptimumStartControlType::Invalid) { optimumStartMgr.optimumStartControlType = OptimumStartControlType::ControlZone; @@ -848,7 +848,7 @@ namespace SystemAvailabilityManager { } optimumStartMgr.controlAlgorithm = - static_cast(getEnumerationValue(ControlAlgorithmNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(7)))); + static_cast(getEnumValue(ControlAlgorithmNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(7)))); assert(optimumStartMgr.controlAlgorithm != ControlAlgorithm::Invalid); @@ -1319,7 +1319,7 @@ namespace SystemAvailabilityManager { for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { ++Item; auto const &objectFields = instance.value(); - std::string const thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const thisObjectName = UtilityRoutines::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); auto &mgrList = state.dataSystemAvailabilityManager->ListData(Item); mgrList.Name = thisObjectName; @@ -1345,7 +1345,7 @@ namespace SystemAvailabilityManager { std::string availManagerObjType = ip->getAlphaFieldValue(extensibleInstance, extensionSchemaProps, "availability_manager_object_type"); mgrList.AvailManagerType(listItem) = static_cast( - getEnumerationValue(SystemAvailabilityTypeNamesUC, UtilityRoutines::MakeUPPERCase(availManagerObjType))); + getEnumValue(SystemAvailabilityTypeNamesUC, UtilityRoutines::makeUPPER(availManagerObjType))); if (mgrList.AvailManagerType(listItem) == DataPlant::SystemAvailabilityType::HybridVent) mgrList.AvailManagerType(listItem) = DataPlant::SystemAvailabilityType::Invalid; // these are validated individually in the GetPlant, GetSystem and GetZoneEq lists diff --git a/src/EnergyPlus/SystemReports.cc b/src/EnergyPlus/SystemReports.cc index 32fd4cee9e7..b37bdbc1392 100644 --- a/src/EnergyPlus/SystemReports.cc +++ b/src/EnergyPlus/SystemReports.cc @@ -2220,8 +2220,8 @@ void CreateEnergyReportStructure(EnergyPlusData &state) for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { DataLoopNode::ConnectionObjectType TypeOfComp = static_cast( - EnergyPlus::getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf)); + EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, + state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf)); std::string &NameOfComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name; // Get complete list of components for complex branches if (BranchNodeConnections::IsParentObject(state, TypeOfComp, NameOfComp)) { @@ -2277,10 +2277,9 @@ void CreateEnergyReportStructure(EnergyPlusData &state) // check for 'grandchildren' for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) { - DataLoopNode::ConnectionObjectType TypeOfSubComp = - static_cast(EnergyPlus::getEnumerationValue( - BranchNodeConnections::ConnectionObjectTypeNamesUC, - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).TypeOf)); + DataLoopNode::ConnectionObjectType TypeOfSubComp = static_cast(EnergyPlus::getEnumValue( + BranchNodeConnections::ConnectionObjectTypeNamesUC, + state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).TypeOf)); std::string &NameOfSubComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).Name; if (BranchNodeConnections::IsParentObject(state, TypeOfSubComp, NameOfSubComp)) { @@ -2568,10 +2567,10 @@ void CreateEnergyReportStructure(EnergyPlusData &state) if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue; // Set index of air loop serving zone for (CompNum = 1; CompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).NumOfEquipTypes; ++CompNum) { - std::string &TypeOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipType(CompNum); + std::string &TypeOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipTypeName(CompNum); std::string &NameOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipName(CompNum); DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast( - EnergyPlus::getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp)); + EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp)); BranchNodeConnections::GetComponentData(state, TypeOfCompNum, NameOfComp, @@ -2711,7 +2710,7 @@ void CreateEnergyReportStructure(EnergyPlusData &state) std::string &TypeOfSubComp = thisEquipData.SubEquipData(SubCompNum).TypeOf; std::string &NameOfSubComp = thisEquipData.SubEquipData(SubCompNum).Name; DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast( - EnergyPlus::getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp)); + EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp)); if (BranchNodeConnections::IsParentObject(state, TypeOfSubCompNum, NameOfSubComp)) { NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubCompNum, NameOfSubComp); thisEquipData.SubEquipData(SubCompNum).NumSubSubEquip = NumGrandChildren; @@ -2935,7 +2934,7 @@ void CreateEnergyReportStructure(EnergyPlusData &state) std::string &TypeOfComp = thisComp.TypeOf; std::string &NameOfComp = thisComp.Name; DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast( - EnergyPlus::getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp)); + EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp)); // Get complete list of components for complex branches if (BranchNodeConnections::IsParentObject(state, TypeOfCompNum, NameOfComp)) { @@ -2988,7 +2987,7 @@ void CreateEnergyReportStructure(EnergyPlusData &state) std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf; std::string NameOfSubComp = thisComp.SubComp(SubCompNum).Name; DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast( - EnergyPlus::getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp)); + EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp)); if (BranchNodeConnections::IsParentObject(state, TypeOfSubCompNum, NameOfSubComp)) { NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubCompNum, NameOfSubComp); SubCompTypes.allocate(NumGrandChildren); @@ -4133,10 +4132,10 @@ void ReportVentilationLoads(EnergyPlusData &state) for (int thisZoneEquipNum = 1; thisZoneEquipNum <= thisZoneEquipList.NumOfEquipTypes; ++thisZoneEquipNum) { auto &thisEquipIndex = thisZoneEquipList.EquipIndex(thisZoneEquipNum); - switch (thisZoneEquipList.EquipTypeEnum(thisZoneEquipNum)) { + switch (thisZoneEquipList.EquipType(thisZoneEquipNum)) { // case statement to cover all possible zone forced air units that could have outside air - case DataZoneEquipment::ZoneEquip::WindowAC: { // Window Air Conditioner + case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // Window Air Conditioner int OutAirNode = WindowAC::GetWindowACOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4152,10 +4151,9 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::VRFTerminalUnit: { + case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: { int OutAirNode = HVACVariableRefrigerantFlow::GetVRFTUOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; int ZoneInletAirNode = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, thisEquipIndex); @@ -4170,12 +4168,11 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir: - case DataZoneEquipment::ZoneEquip::PkgTermACAirToAir: - case DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir: { + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump: + case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner: + case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: { // loop index accesses correct pointer to equipment on this equipment list, DataZoneEquipment::GetZoneEquipmentData // thisEquipIndex (EquipIndex) is used to access specific equipment for a single class of equipment (e.g., PTAC 1, 2 and 3) int OutAirNode = thisZoneEquipList.compPointer[thisZoneEquipNum]->getMixerOANode(); @@ -4190,10 +4187,9 @@ void ReportVentilationLoads(EnergyPlusData &state) // Calculate the zone ventilation load for this supply air path (i.e. zone inlet) ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::FanCoil4Pipe: { + case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: { int OutAirNode = FanCoilUnits::GetFanCoilOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4209,10 +4205,9 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::UnitVentilator: { + case DataZoneEquipment::ZoneEquipType::UnitVentilator: { int OutAirNode = UnitVentilator::GetUnitVentilatorOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4228,10 +4223,9 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::PurchasedAir: { + case DataZoneEquipment::ZoneEquipType::PurchasedAir: { ZFAUOutAirFlow += PurchasedAirManager::GetPurchasedAirOutAirMassFlow(state, thisEquipIndex); int ZoneInletAirNode = PurchasedAirManager::GetPurchasedAirZoneInletAirNode(state, thisEquipIndex); if (ZoneInletAirNode > 0) ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0); @@ -4246,10 +4240,9 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::ERVStandAlone: { + case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: { int OutAirNode = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4265,15 +4258,13 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::ZoneUnitarySys: { + case DataZoneEquipment::ZoneEquipType::UnitarySystem: { // add accounting for OA when unitary system is used as zone equipment + } break; - break; - } - case DataZoneEquipment::ZoneEquip::OutdoorAirUnit: { + case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: { int OutAirNode = OutdoorAirUnit::GetOutdoorAirUnitOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4288,10 +4279,9 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::ZoneHybridEvaporativeCooler: { + case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: { int OutAirNode = HybridUnitaryAirConditioners::GetHybridUnitaryACOutAirNode(state, thisEquipIndex); if (OutAirNode > 0) ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate; @@ -4308,36 +4298,33 @@ void ReportVentilationLoads(EnergyPlusData &state) } else { ZFAUZoneVentLoad += 0.0; } + } break; - break; - } - case DataZoneEquipment::ZoneEquip::UnitHeater: - case DataZoneEquipment::ZoneEquip::VentilatedSlab: + case DataZoneEquipment::ZoneEquipType::UnitHeater: + case DataZoneEquipment::ZoneEquipType::VentilatedSlab: // ZoneHVAC:EvaporativeCoolerUnit ????? - case DataZoneEquipment::ZoneEquip::ZoneEvaporativeCoolerUnit: - case DataZoneEquipment::ZoneEquip::AirDistUnit: - case DataZoneEquipment::ZoneEquip::BBWaterConvective: - case DataZoneEquipment::ZoneEquip::BBElectricConvective: - case DataZoneEquipment::ZoneEquip::HiTempRadiant: + case DataZoneEquipment::ZoneEquipType::EvaporativeCooler: + case DataZoneEquipment::ZoneEquipType::AirDistributionUnit: + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: + case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: + case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: // not sure how HeatExchanger:* could be used as zone equipment ????? - case DataZoneEquipment::ZoneEquip::LoTempRadiant: - case DataZoneEquipment::ZoneEquip::ZoneExhaustFan: - case DataZoneEquipment::ZoneEquip::HeatXchngr: + case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiant: + case DataZoneEquipment::ZoneEquipType::ExhaustFan: + case DataZoneEquipment::ZoneEquipType::HeatExchanger: // HPWaterHeater can be used as zone equipment - case DataZoneEquipment::ZoneEquip::HPWaterHeater: - case DataZoneEquipment::ZoneEquip::BBWater: - case DataZoneEquipment::ZoneEquip::ZoneDXDehumidifier: - case DataZoneEquipment::ZoneEquip::BBSteam: - case DataZoneEquipment::ZoneEquip::BBElectric: - case DataZoneEquipment::ZoneEquip::RefrigerationAirChillerSet: - case DataZoneEquipment::ZoneEquip::UserDefinedZoneHVACForcedAir: - case DataZoneEquipment::ZoneEquip::CoolingPanel: { + case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater: + case DataZoneEquipment::ZoneEquipType::BaseboardWater: + case DataZoneEquipment::ZoneEquipType::DehumidifierDX: + case DataZoneEquipment::ZoneEquipType::BaseboardSteam: + case DataZoneEquipment::ZoneEquipType::BaseboardElectric: + case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: + case DataZoneEquipment::ZoneEquipType::UserDefinedHVACForcedAir: + case DataZoneEquipment::ZoneEquipType::CoolingPanel: { // do nothing, OA not included + } break; - break; - } default: { - ShowFatalError(state, "ReportMaxVentilationLoads: Developer must either create accounting for OA or include in final else if " "to do nothing"); diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index 4c0769c36e9..94c42adaf59 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -536,18 +536,17 @@ namespace ThermalComfort { } else { state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; } - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->anyNonMixingRoomAirModel) { state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; - if (state.dataRoomAirMod->IsZoneDV(state.dataThermalComforts->ZoneNum) || - state.dataRoomAirMod->IsZoneUI(state.dataThermalComforts->ZoneNum)) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 + if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || + state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 // UCSD-CV - } else if (state.dataRoomAirMod->IsZoneCV(state.dataThermalComforts->ZoneNum)) { - if (state.dataRoomAirMod->ZoneUCSDCV(state.dataThermalComforts->ZoneNum).VforComfort == DataRoomAirModel::Comfort::Jet) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->ZTJET(state.dataThermalComforts->ZoneNum); - } else if (state.dataRoomAirMod->ZoneUCSDCV(state.dataThermalComforts->ZoneNum).VforComfort == - DataRoomAirModel::Comfort::Recirculation) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->ZTJET(state.dataThermalComforts->ZoneNum); + } else if (state.dataRoomAir->IsZoneCrossVent(state.dataThermalComforts->ZoneNum)) { + if (state.dataRoomAir->ZoneCrossVent(state.dataThermalComforts->ZoneNum).VforComfort == RoomAir::Comfort::Jet) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->ZTJET(state.dataThermalComforts->ZoneNum); + } else if (state.dataRoomAir->ZoneCrossVent(state.dataThermalComforts->ZoneNum).VforComfort == RoomAir::Comfort::Recirculation) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->ZTJET(state.dataThermalComforts->ZoneNum); } } } @@ -618,12 +617,11 @@ namespace ThermalComfort { state, format("PEOPLE=\"{}\", Incorrect Clothing Type", state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); } - if (state.dataRoomAirMod->anyNonMixingRoomAirModel && state.dataRoomAirMod->IsZoneCV(state.dataThermalComforts->ZoneNum)) { - if (state.dataRoomAirMod->ZoneUCSDCV(state.dataThermalComforts->ZoneNum).VforComfort == DataRoomAirModel::Comfort::Jet) { - state.dataThermalComforts->AirVel = state.dataRoomAirMod->Ujet(state.dataThermalComforts->ZoneNum); - } else if (state.dataRoomAirMod->ZoneUCSDCV(state.dataThermalComforts->ZoneNum).VforComfort == - DataRoomAirModel::Comfort::Recirculation) { - state.dataThermalComforts->AirVel = state.dataRoomAirMod->Urec(state.dataThermalComforts->ZoneNum); + if (state.dataRoomAir->anyNonMixingRoomAirModel && state.dataRoomAir->IsZoneCrossVent(state.dataThermalComforts->ZoneNum)) { + if (state.dataRoomAir->ZoneCrossVent(state.dataThermalComforts->ZoneNum).VforComfort == RoomAir::Comfort::Jet) { + state.dataThermalComforts->AirVel = state.dataRoomAir->Ujet(state.dataThermalComforts->ZoneNum); + } else if (state.dataRoomAir->ZoneCrossVent(state.dataThermalComforts->ZoneNum).VforComfort == RoomAir::Comfort::Recirculation) { + state.dataThermalComforts->AirVel = state.dataRoomAir->Urec(state.dataThermalComforts->ZoneNum); } else { state.dataThermalComforts->AirVel = 0.2; } @@ -828,10 +826,10 @@ namespace ThermalComfort { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum); // (var TA) state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(state.dataThermalComforts->ZoneNum) || - state.dataRoomAirMod->IsZoneUI(state.dataThermalComforts->ZoneNum)) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || + state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 } } // (var TR) @@ -1476,10 +1474,10 @@ namespace ThermalComfort { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum); state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(state.dataThermalComforts->ZoneNum) || - state.dataRoomAirMod->IsZoneUI(state.dataThermalComforts->ZoneNum)) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || + state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 } } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); @@ -2319,9 +2317,9 @@ namespace ThermalComfort { // keep track of occupied hours state.dataThermalComforts->ZoneOccHrs(iZone) += state.dataGlobal->TimeStepZone; CurAirTemp = thisZoneHB.ZTAVComf; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(iZone) || state.dataRoomAirMod->IsZoneUI(iZone)) { - CurAirTemp = state.dataRoomAirMod->TCMF(iZone); + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(iZone) || state.dataRoomAir->IsZoneUFAD(iZone)) { + CurAirTemp = state.dataRoomAir->TCMF(iZone); } } CurMeanRadiantTemp = state.dataHeatBal->ZoneMRT(iZone); @@ -2539,7 +2537,7 @@ namespace ThermalComfort { testCooling = (state.dataHeatBalFanSys->TempControlType(iZone) != DataHVACGlobals::ThermostatType::SingleHeating); if (testHeating && (SensibleLoadPredictedNoAdj > 0)) { // heating - if (state.dataRoomAirMod->AirModel(iZone).AirModelType != DataRoomAirModel::RoomAirModel::Mixing) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAir::RoomAirModel::Mixing) { deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(iZone); } else { if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { @@ -2565,7 +2563,7 @@ namespace ThermalComfort { } } } else if (testCooling && (SensibleLoadPredictedNoAdj < 0)) { // cooling - if (state.dataRoomAirMod->AirModel(iZone).AirModelType != DataRoomAirModel::RoomAirModel::Mixing) { + if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAir::RoomAirModel::Mixing) { deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(iZone); } else { if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { @@ -2877,10 +2875,10 @@ namespace ThermalComfort { if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AdaptiveASH55) continue; state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; state.dataThermalComforts->AirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum).ZTAVComf; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(state.dataThermalComforts->ZoneNum) || - state.dataRoomAirMod->IsZoneUI(state.dataThermalComforts->ZoneNum)) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->TCMF(state.dataThermalComforts->ZoneNum); + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || + state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); } } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); @@ -3088,10 +3086,10 @@ namespace ThermalComfort { if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AdaptiveCEN15251) continue; state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; state.dataThermalComforts->AirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum).ZTAVComf; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(state.dataThermalComforts->ZoneNum) || - state.dataRoomAirMod->IsZoneUI(state.dataThermalComforts->ZoneNum)) { - state.dataThermalComforts->AirTemp = state.dataRoomAirMod->TCMF(state.dataThermalComforts->ZoneNum); + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || + state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { + state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); } } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); diff --git a/src/EnergyPlus/UFADManager.cc b/src/EnergyPlus/UFADManager.cc index 7426c0f65a3..c8159bb98b8 100644 --- a/src/EnergyPlus/UFADManager.cc +++ b/src/EnergyPlus/UFADManager.cc @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include @@ -75,59 +74,30 @@ #include #include -namespace EnergyPlus::UFADManager { +namespace EnergyPlus { -// Module containing the routines dealing with the UnderFloor Air -// Distribution zone model +namespace RoomAir { -// MODULE INFORMATION: -// AUTHOR Fred Buhl -// DATE WRITTEN August 2005 -// MODIFIED na -// RE-ENGINEERED na + // Module containing the routines dealing with the UnderFloor Air + // Distribution zone model -// PURPOSE OF THIS MODULE: -// Encapsulate the routines that do the simulation of the UCSD UFAD non-uniform -// zone models - -// METHODOLOGY EMPLOYED: -// 2-node zone model with the node heights varying as a function of internal loads -// and supply air flow (and other factors) - -// REFERENCES: -// See the EnergyPlus Engineering Reference and the PhD thesis of Anna Liu, UC San Diego - -// OTHER NOTES: -// na - -// Using/Aliasing -using namespace DataLoopNode; -using namespace DataEnvironment; -using namespace DataHeatBalance; -using namespace DataHeatBalSurface; -using namespace DataSurfaces; -using namespace DataRoomAirModel; -using Convect::CalcDetailedHcInForDVModel; - -void ManageUCSDUFModels(EnergyPlusData &state, - int const ZoneNum, // index number for the specified zone - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 -) -{ - - // SUBROUTINE INFORMATION: + // MODULE INFORMATION: // AUTHOR Fred Buhl - // DATE WRITTEN August, 2005 - // MODIFIED na - // RE-ENGINEERED na + // DATE WRITTEN August 2005 - // PURPOSE OF THIS SUBROUTINE: - // Manages the simulation of the 2-node nonuniform zone models for underfloor air - // distribution systems (UFAD). Called from RoomAirManager, ManageAirModel + // PURPOSE OF THIS MODULE: + // Encapsulate the routines that do the simulation of the UCSD UFAD non-uniform + // zone models // METHODOLOGY EMPLOYED: - // uses Init and Calc routines in the standard EPlus manner to manage the calculation - // Note that much of the initialization is done in RoomAirManager, SharedDVCVUFDataInit + // 2-node zone model with the node heights varying as a function of internal loads + // and supply air flow (and other factors) + + // REFERENCES: + // See the EnergyPlus Engineering Reference and the PhD thesis of Anna Liu, UC San Diego + + // OTHER NOTES: + // na // Using/Aliasing using namespace DataLoopNode; @@ -135,608 +105,353 @@ void ManageUCSDUFModels(EnergyPlusData &state, using namespace DataHeatBalance; using namespace DataHeatBalSurface; using namespace DataSurfaces; - using namespace DataRoomAirModel; using Convect::CalcDetailedHcInForDVModel; - // input was obtained in RoomAirManager, GetUFADIntZoneData - - InitUCSDUF(state, ZoneNum, ZoneModelType); // initialize some module variables - - switch (ZoneModelType) { - case DataRoomAirModel::RoomAirModel::UCSDUFI: { // UCSD UFAD interior zone model - // simulate room airflow using the UCSDUFI model - CalcUCSDUI(state, ZoneNum); - } break; - case DataRoomAirModel::RoomAirModel::UCSDUFE: { // UCSD UFAD interior zone model - // simulate room airflow using the UCSDUFI model - CalcUCSDUE(state, ZoneNum); - } break; - default: - break; + void ManageUFAD(EnergyPlusData &state, + int const ZoneNum, // index number for the specified zone + RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 + ) + { + + // SUBROUTINE INFORMATION: + // AUTHOR Fred Buhl + // DATE WRITTEN August, 2005 + // MODIFIED na + // RE-ENGINEERED na + + // PURPOSE OF THIS SUBROUTINE: + // Manages the simulation of the 2-node nonuniform zone models for underfloor air + // distribution systems (UFAD). Called from RoomAirManager, ManageAirModel + + // METHODOLOGY EMPLOYED: + // uses Init and Calc routines in the standard EPlus manner to manage the calculation + // Note that much of the initialization is done in RoomAirManager, SharedDVCVUFDataInit + + // Using/Aliasing + using namespace DataLoopNode; + using namespace DataEnvironment; + using namespace DataHeatBalance; + using namespace DataHeatBalSurface; + using namespace DataSurfaces; + using Convect::CalcDetailedHcInForDVModel; + + // input was obtained in RoomAirManager, GetUFADIntZoneData + + InitUFAD(state, ZoneNum, ZoneModelType); // initialize some module variables + + switch (ZoneModelType) { + case RoomAirModel::UFADInt: { // UCSD UFAD interior zone model + // simulate room airflow using the UCSDUFI model + CalcUFADInt(state, ZoneNum); + } break; + case RoomAirModel::UFADExt: { // UCSD UFAD exterior zone model + // simulate room airflow using the UCSDUFE model + CalcUFADExt(state, ZoneNum); + } break; + default: + break; + } } -} -void InitUCSDUF(EnergyPlusData &state, - int const ZoneNum, - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 -) -{ + void InitUFAD(EnergyPlusData &state, + int const ZoneNum, + RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 + ) + { - // SUBROUTINE INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN August 2005 - // MODIFIED na - // RE-ENGINEERED na + // SUBROUTINE INFORMATION: + // AUTHOR Fred Buhl + // DATE WRITTEN August 2005 - // PURPOSE OF THIS SUBROUTINE: - // initialize arrays & variables used by the UCSD UFAD zone models + // PURPOSE OF THIS SUBROUTINE: + // initialize arrays & variables used by the UCSD UFAD zone models - // METHODOLOGY EMPLOYED: - // Note that much of the initialization is done in RoomAirManager, SharedDVCVUFDataInit - - Real64 NumShadesDown(0.0); - int UINum; // index to underfloor interior zone model data - - // Do the one time initializations - if (state.dataUFADManager->MyOneTimeFlag) { - state.dataUFADManager->HeightFloorSubzoneTop = 0.2; - state.dataUFADManager->ThickOccupiedSubzoneMin = 0.2; - state.dataUFADManager->HeightIntMassDefault = 2.0; - state.dataUFADManager->MyOneTimeFlag = false; - state.dataUFADManager->MySizeFlag.dimension(state.dataGlobal->NumOfZones, true); - } + // METHODOLOGY EMPLOYED: + // Note that much of the initialization is done in RoomAirManager, SharedDVCVUFDataInit - if (state.dataUFADManager->MySizeFlag(ZoneNum)) { - SizeUCSDUF(state, ZoneNum, ZoneModelType); - state.dataUFADManager->MySizeFlag(ZoneNum) = false; - } + Real64 NumShadesDown(0.0); - // initialize these variables every timestep - - state.dataUFADManager->HeightIntMass = state.dataUFADManager->HeightIntMassDefault; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = 0.0; - NumShadesDown = 0.0; - for (int Ctd = state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 2); ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Window(Ctd); - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).ExtBoundCond == ExternalEnvironment || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCoefCalcExt || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCondModeledExt) { - if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) { - ++NumShadesDown; - } + // Do the one time initializations + if (state.dataUFADManager->MyOneTimeFlag) { + state.dataUFADManager->HeightFloorSubzoneTop = 0.2; + state.dataUFADManager->ThickOccupiedSubzoneMin = 0.2; + state.dataUFADManager->HeightIntMassDefault = 2.0; + state.dataUFADManager->MyOneTimeFlag = false; + state.dataUFADManager->MySizeFlag.dimension(state.dataGlobal->NumOfZones, true); } - } - if (ZoneModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { - UINum = state.dataRoomAirMod->ZoneUFPtr(ZoneNum); - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).NumExtWin > 1.0) { - if (NumShadesDown / state.dataRoomAirMod->ZoneUCSDUE(UINum).NumExtWin >= 0.5) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).ShadeDown = true; - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).ShadeDown = false; + + if (state.dataUFADManager->MySizeFlag(ZoneNum)) { + SizeUFAD(state, ZoneNum, ZoneModelType); + state.dataUFADManager->MySizeFlag(ZoneNum) = false; + } + + // initialize these variables every timestep + + state.dataUFADManager->HeightIntMass = state.dataUFADManager->HeightIntMassDefault; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = 0.0; + NumShadesDown = 0.0; + for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Window(Ctd); + if (SurfNum == 0) continue; + auto &surf = state.dataSurface->Surface(SurfNum); + if (surf.ExtBoundCond == ExternalEnvironment || surf.ExtBoundCond == OtherSideCoefNoCalcExt || + surf.ExtBoundCond == OtherSideCoefCalcExt || surf.ExtBoundCond == OtherSideCondModeledExt) { + if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) { + ++NumShadesDown; + } } - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).ShadeDown = false; + } + if (ZoneModelType == RoomAirModel::UFADExt) { + auto &zoneUE = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); + zoneUE.ShadeDown = (zoneUE.NumExtWin > 1.0) && (NumShadesDown / zoneUE.NumExtWin >= 0.5); } } -} -void SizeUCSDUF(EnergyPlusData &state, - int const ZoneNum, - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 -) -{ + void SizeUFAD(EnergyPlusData &state, + int const ZoneNum, + RoomAirModel const model // type of zone model; UCSDUFI = 6 + ) + { - // SUBROUTINE INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN August 2005 - // MODIFIED na - // RE-ENGINEERED na + // SUBROUTINE INFORMATION: + // AUTHOR Fred Buhl + // DATE WRITTEN August 2005 - // PURPOSE OF THIS SUBROUTINE: - // set some smart defaults for UFAD systems + // PURPOSE OF THIS SUBROUTINE: + // set some smart defaults for UFAD systems - // METHODOLOGY EMPLOYED: - // use data from Center for Built Environment - - using DataSizing::AutoSize; - - int UINum; // index to underfloor interior zone model data - Real64 NumberOfOccupants(0.0); // design number of occupants in the zone - Real64 NumberOfPlumes(0.0); // design number of plumes in the zone - Real64 ZoneElecConv(0.0); // zone elec equip design convective gain [W] - Real64 ZoneGasConv(0.0); // zone gas equip design convective gain [W] - Real64 ZoneOthEqConv(0.0); // zone other equip design convective gain [W] - Real64 ZoneHWEqConv(0.0); // zone hot water equip design convective gain [W] - Real64 ZoneSteamEqConv(0.0); // zone steam equip design convective gain [W] - - if (ZoneModelType == DataRoomAirModel::RoomAirModel::UCSDUFI) { - UINum = state.dataRoomAirMod->ZoneUFPtr(ZoneNum); - NumberOfOccupants = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { - if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) { - NumberOfOccupants += state.dataHeatBal->People(Ctd).NumberOfPeople; - } + // METHODOLOGY EMPLOYED: + // use data from Center for Built Environment + + using DataSizing::AutoSize; + + Real64 ZoneElecConv(0.0); // zone elec equip design convective gain [W] + Real64 ZoneGasConv(0.0); // zone gas equip design convective gain [W] + Real64 ZoneOthEqConv(0.0); // zone other equip design convective gain [W] + Real64 ZoneHWEqConv(0.0); // zone hot water equip design convective gain [W] + Real64 ZoneSteamEqConv(0.0); // zone steam equip design convective gain [W] + + // This is for both UFADInt and UFADExt + auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); + + std::string_view cCMO = (model == RoomAirModel::UFADExt) ? "RoomAirSettings:UnderFloorAirDistributionExterior" + : "RoomAirSettings:UnderFloorAirDistributionInterior"; + + Real64 NumberOfOccupants = 0.0; + for (auto const &people : state.dataHeatBal->People) { + if (people.ZonePtr == ZoneNum) NumberOfOccupants += people.NumberOfPeople; } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea == AutoSize) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::Swirl) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea = 0.0075; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::VarArea) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea = 0.035; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::DisplVent) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea = 0.0060; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::LinBarGrille) { - // 4 ft x 4 inches; 75 cfm per linear foot; area is .025 m2/m - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea = 0.03; - } else { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea = 0.0075; + + if (model == RoomAirModel::UFADExt) { + // calculate total window width in zone + for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Window(Ctd); + if (SurfNum == 0) continue; + auto &surf = state.dataSurface->Surface(SurfNum); + if (surf.ExtBoundCond == ExternalEnvironment || surf.ExtBoundCond == OtherSideCoefNoCalcExt || + surf.ExtBoundCond == OtherSideCoefCalcExt || surf.ExtBoundCond == OtherSideCondModeledExt) { + zoneU.WinWidth += surf.Width; + ++zoneU.NumExtWin; + } } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionInterior", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName, - "Design effective area of diffuser", - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea); - } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle == AutoSize) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::Swirl) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle = 28.0; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::VarArea) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle = 45.0; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::DisplVent) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle = 73.0; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::LinBarGrille) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle = 15.0; - } else { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle = 28.0; + if (zoneU.WinWidth <= 0.0) { + ShowWarningError( + state, + format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {} there are no exterior windows.", zoneU.ZoneName)); + ShowContinueError(state, " The zone will be treated as a UFAD interior zone"); } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionInterior", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName, - "Angle between diffuser slots and the vertical", - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle); + } // if (model == RoomAirModel::UFADExt) + + if (zoneU.DiffArea == AutoSize) { + constexpr std::array diffArea = {0.0075, 0.035, 0.0060, 0.03, 0.0075}; + zoneU.DiffArea = diffArea[(int)zoneU.DiffuserType]; + // 4 ft x 4 inches; 75 cfm per linear foot; area is .025 m2/m + + BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Design effective area of diffuser", zoneU.DiffArea); } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).TransHeight == AutoSize) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).CalcTransHeight = true; - state.dataRoomAirMod->ZoneUCSDUI(UINum).TransHeight = 0.0; - } else { - state.dataRoomAirMod->ZoneUCSDUI(UINum).CalcTransHeight = false; + if (zoneU.DiffAngle == AutoSize) { + constexpr std::array diffAngle = {28.0, 45.0, 73.0, 15.0, 28.0}; + zoneU.DiffAngle = diffAngle[(int)zoneU.DiffuserType]; + + BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Angle between diffuser slots and the vertical", zoneU.DiffAngle); } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::Swirl) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionInterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = Swirl.", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc = 0.6531; - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc = 0.0069; - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc = -0.00004; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::VarArea) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionInterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = VariableArea.", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc = 0.88; - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc = 0.0; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::DisplVent) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionInterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = HorizontalDisplacement.", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc = 0.67; - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc = 0.0; - } else if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::LinBarGrille) { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionInterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = LinearBarGrille.", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc = 0.8; - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc = 0.0; + if (zoneU.TransHeight == AutoSize) { + zoneU.CalcTransHeight = true; + zoneU.TransHeight = 0.0; } else { - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc == Constant::AutoCalculate) { - ShowFatalError(state, - format("For RoomAirSettings:UnderFloorAirDistributionInterior for Zone {}, input for Coefficients A - E must be " - "specified when Floor Diffuser Type = Custom.", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName)); - } + zoneU.CalcTransHeight = false; } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).PowerPerPlume == Constant::AutoCalculate) { - NumberOfPlumes = 0.0; - if (NumberOfOccupants > 0.0) { - NumberOfPlumes = NumberOfOccupants; - } else { - NumberOfPlumes = 1.0; - } - ZoneElecConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotElecEquip; ++Ctd) { - if (state.dataHeatBal->ZoneElectric(Ctd).ZonePtr == ZoneNum) { - ZoneElecConv += state.dataHeatBal->ZoneElectric(Ctd).DesignLevel * state.dataHeatBal->ZoneElectric(Ctd).FractionConvected; - } - } - ZoneGasConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotGasEquip; ++Ctd) { - if (state.dataHeatBal->ZoneGas(Ctd).ZonePtr == ZoneNum) { - ZoneGasConv += state.dataHeatBal->ZoneGas(Ctd).DesignLevel * state.dataHeatBal->ZoneGas(Ctd).FractionConvected; - } - } - ZoneOthEqConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotOthEquip; ++Ctd) { - if (state.dataHeatBal->ZoneOtherEq(Ctd).ZonePtr == ZoneNum) { - ZoneOthEqConv += state.dataHeatBal->ZoneOtherEq(Ctd).DesignLevel * state.dataHeatBal->ZoneOtherEq(Ctd).FractionConvected; - } - } - ZoneHWEqConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotHWEquip; ++Ctd) { - if (state.dataHeatBal->ZoneHWEq(Ctd).ZonePtr == ZoneNum) { - ZoneHWEqConv += state.dataHeatBal->ZoneHWEq(Ctd).DesignLevel * state.dataHeatBal->ZoneHWEq(Ctd).FractionConvected; - } - } - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotStmEquip; ++Ctd) { - ZoneSteamEqConv = 0.0; - if (state.dataHeatBal->ZoneSteamEq(Ctd).ZonePtr == ZoneNum) { - ZoneSteamEqConv += state.dataHeatBal->ZoneSteamEq(Ctd).DesignLevel * state.dataHeatBal->ZoneSteamEq(Ctd).FractionConvected; - } - } - state.dataRoomAirMod->ZoneUCSDUI(UINum).PowerPerPlume = - (NumberOfOccupants * 73.0 + ZoneElecConv + ZoneGasConv + ZoneOthEqConv + ZoneHWEqConv + ZoneSteamEqConv) / NumberOfPlumes; - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionInterior", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName, - "Power per plume [W]", - state.dataRoomAirMod->ZoneUCSDUI(UINum).PowerPerPlume); - } - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffusersPerZone == AutoSize) { - if (NumberOfOccupants > 0.0) { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffusersPerZone = NumberOfOccupants; - } else { - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffusersPerZone = 1.0; - } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionInterior", - state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneName, - "Number of diffusers per zone", - state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffusersPerZone); - } - } - if (ZoneModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { - UINum = state.dataRoomAirMod->ZoneUFPtr(ZoneNum); - // calculate total window width in zone - for (int Ctd = state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 2); - ++Ctd) { - int SurfNum = state.dataUCSDShared->APos_Window(Ctd); - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).ExtBoundCond == ExternalEnvironment || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCoefCalcExt || - state.dataSurface->Surface(SurfNum).ExtBoundCond == OtherSideCondModeledExt) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth += state.dataSurface->Surface(SurfNum).Width; - ++state.dataRoomAirMod->ZoneUCSDUE(UINum).NumExtWin; - } - } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth <= 0.0) { + if (zoneU.DiffuserType != Diffuser::Custom && + (zoneU.A_Kc != Constant::AutoCalculate || zoneU.B_Kc != Constant::AutoCalculate || zoneU.C_Kc != Constant::AutoCalculate || + zoneU.D_Kc != Constant::AutoCalculate || zoneU.E_Kc != Constant::AutoCalculate)) { ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {} there are no exterior windows.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - ShowContinueError(state, " The zone will be treated as a UFAD interior zone"); - } - NumberOfOccupants = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) { - if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) { - NumberOfOccupants += state.dataHeatBal->People(Ctd).NumberOfPeople; - } - } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea == AutoSize) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::Swirl) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea = 0.0075; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::VarArea) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea = 0.035; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::DisplVent) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea = 0.0060; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::LinBarGrille) { - // 4 ft x 4 inches; eff area is 50% of total area; 75 cfm per linear foot. - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea = 0.03; - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea = 0.0075; - } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionExterior", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName, - "Design effective area of diffuser", - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea); - } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle == AutoSize) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::Swirl) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle = 28.0; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::VarArea) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle = 45.0; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::DisplVent) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle = 73.0; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::LinBarGrille) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle = 15.0; - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle = 28.0; - } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionExterior", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName, - "Angle between diffuser slots and the vertical", - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle); - } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).TransHeight == AutoSize) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).CalcTransHeight = true; - state.dataRoomAirMod->ZoneUCSDUE(UINum).TransHeight = 0.0; - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).CalcTransHeight = false; + format("For {} for Zone {}, input for Coefficients A - E will be " + "ignored when Floor Diffuser Type = {}.", + cCMO, + zoneU.ZoneName, + diffuserNamesUC[(int)zoneU.DiffuserType])); + ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::Swirl) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = Swirl.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc = 0.6531; - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc = 0.0069; - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc = -0.00004; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::VarArea) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = VariableArea.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc = 0.83; - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc = 0.0; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::DisplVent) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = HorizontalDisplacement.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc = 0.67; - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc = 0.0; - } else if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::LinBarGrille) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc != Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc != Constant::AutoCalculate) { - ShowWarningError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {}, input for Coefficients A - E will be " - "ignored when Floor Diffuser Type = LinearBarGrille.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - ShowContinueError(state, " To input these Coefficients, use Floor Diffuser Type = Custom."); - } - state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc = 0.0; - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc = 0.8214; - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc = -0.0263; - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc = 0.0014; - } else { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc == Constant::AutoCalculate || - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc == Constant::AutoCalculate) { - ShowFatalError(state, - format("For RoomAirSettings:UnderFloorAirDistributionExterior for Zone {}, input for Coefficients A - E must be " - "specified when Floor Diffuser Type = Custom.", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName)); - } + + if (zoneU.DiffuserType == Diffuser::Swirl) { + zoneU.A_Kc = 0.0; + zoneU.B_Kc = 0.0; + zoneU.C_Kc = 0.6531; + zoneU.D_Kc = 0.0069; + zoneU.E_Kc = -0.00004; + } else if (zoneU.DiffuserType == Diffuser::VarArea) { + zoneU.A_Kc = 0.0; + zoneU.B_Kc = 0.0; + zoneU.C_Kc = (model == RoomAirModel::UFADExt) ? 0.83 : 0.88; + zoneU.D_Kc = 0.0; + zoneU.E_Kc = 0.0; + } else if (zoneU.DiffuserType == Diffuser::DisplVent) { + zoneU.A_Kc = 0.0; + zoneU.B_Kc = 0.0; + zoneU.C_Kc = 0.67; + zoneU.D_Kc = 0.0; + zoneU.E_Kc = 0.0; + } else if (zoneU.DiffuserType == Diffuser::LinBarGrille) { + zoneU.A_Kc = 0.0; + zoneU.B_Kc = 0.0; + zoneU.C_Kc = (model == RoomAirModel::UFADExt) ? 0.8214 : 0.8; + zoneU.D_Kc = (model == RoomAirModel::UFADExt) ? -0.0263 : 0.0; + zoneU.E_Kc = (model == RoomAirModel::UFADExt) ? 0.0014 : 0.0; + } else if (zoneU.A_Kc == Constant::AutoCalculate || zoneU.B_Kc == Constant::AutoCalculate || zoneU.C_Kc == Constant::AutoCalculate || + zoneU.D_Kc == Constant::AutoCalculate || zoneU.E_Kc == Constant::AutoCalculate) { + ShowFatalError(state, + format("For {} for Zone {}, input for Coefficients A - E must be " + "specified when Floor Diffuser Type = Custom.", + cCMO, + zoneU.ZoneName)); } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).PowerPerPlume == Constant::AutoCalculate) { - if (NumberOfOccupants > 0) { - NumberOfPlumes = NumberOfOccupants; - } else { - NumberOfPlumes = 1.0; - } + + if (zoneU.PowerPerPlume == Constant::AutoCalculate) { + Real64 NumberOfPlumes = (NumberOfOccupants > 0.0) ? NumberOfOccupants : 1.0; + ZoneElecConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotElecEquip; ++Ctd) { - if (state.dataHeatBal->ZoneElectric(Ctd).ZonePtr == ZoneNum) { - ZoneElecConv += state.dataHeatBal->ZoneElectric(Ctd).DesignLevel; + for (auto const &zoneElectric : state.dataHeatBal->ZoneElectric) { + if (zoneElectric.ZonePtr == ZoneNum) { + // Is the behavior for Exterior UFAD supposed to be different than for Interior UFAD? + ZoneElecConv += + (model == RoomAirModel::UFADExt) ? zoneElectric.DesignLevel : (zoneElectric.DesignLevel * zoneElectric.FractionConvected); } } ZoneGasConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotGasEquip; ++Ctd) { - if (state.dataHeatBal->ZoneGas(Ctd).ZonePtr == ZoneNum) { - ZoneGasConv += state.dataHeatBal->ZoneGas(Ctd).DesignLevel; + for (auto const &zoneGas : state.dataHeatBal->ZoneGas) { + if (zoneGas.ZonePtr == ZoneNum) { + ZoneGasConv += (model == RoomAirModel::UFADExt) ? zoneGas.DesignLevel : (zoneGas.DesignLevel * zoneGas.FractionConvected); } } ZoneOthEqConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotOthEquip; ++Ctd) { - if (state.dataHeatBal->ZoneOtherEq(Ctd).ZonePtr == ZoneNum) { - ZoneOthEqConv += state.dataHeatBal->ZoneOtherEq(Ctd).DesignLevel; + for (auto const &zoneOtherEq : state.dataHeatBal->ZoneOtherEq) { + if (zoneOtherEq.ZonePtr == ZoneNum) { + ZoneOthEqConv += + (model == RoomAirModel::UFADExt) ? zoneOtherEq.DesignLevel : (zoneOtherEq.DesignLevel * zoneOtherEq.FractionConvected); } } ZoneHWEqConv = 0.0; - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotHWEquip; ++Ctd) { - if (state.dataHeatBal->ZoneHWEq(Ctd).ZonePtr == ZoneNum) { - ZoneHWEqConv += state.dataHeatBal->ZoneHWEq(Ctd).DesignLevel; + for (auto const &zoneHWEq : state.dataHeatBal->ZoneHWEq) { + if (zoneHWEq.ZonePtr == ZoneNum) { + ZoneHWEqConv += (model == RoomAirModel::UFADExt) ? zoneHWEq.DesignLevel : (zoneHWEq.DesignLevel * zoneHWEq.FractionConvected); } } - for (int Ctd = 1; Ctd <= state.dataHeatBal->TotStmEquip; ++Ctd) { - ZoneSteamEqConv = 0.0; - if (state.dataHeatBal->ZoneSteamEq(Ctd).ZonePtr == ZoneNum) { - ZoneSteamEqConv += state.dataHeatBal->ZoneSteamEq(Ctd).DesignLevel; + + for (auto const &zoneSteamEq : state.dataHeatBal->ZoneSteamEq) { + ZoneSteamEqConv = 0.0; // I'm 99.72% sure this is a bug. + if (zoneSteamEq.ZonePtr == ZoneNum) { + ZoneSteamEqConv += + (model == RoomAirModel::UFADExt) ? zoneSteamEq.DesignLevel : (zoneSteamEq.DesignLevel * zoneSteamEq.FractionConvected); } } - state.dataRoomAirMod->ZoneUCSDUE(UINum).PowerPerPlume = + zoneU.PowerPerPlume = (NumberOfOccupants * 73.0 + ZoneElecConv + ZoneGasConv + ZoneOthEqConv + ZoneHWEqConv + ZoneSteamEqConv) / NumberOfPlumes; - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionExterior", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName, - "Power per plume [W]", - state.dataRoomAirMod->ZoneUCSDUE(UINum).PowerPerPlume); - } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffusersPerZone == AutoSize) { - if (NumberOfOccupants > 0.0) { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffusersPerZone = NumberOfOccupants; - } else { - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffusersPerZone = 1.0; + + BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Power per plume [W]", zoneU.PowerPerPlume); + + if (zoneU.DiffusersPerZone == AutoSize) { + zoneU.DiffusersPerZone = (NumberOfOccupants > 0.0) ? NumberOfOccupants : 1.0; + BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Number of diffusers per zone", zoneU.DiffusersPerZone); } - BaseSizer::reportSizerOutput(state, - "RoomAirSettings:UnderFloorAirDistributionExterior", - state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneName, - "Number of diffusers per zone", - state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffusersPerZone); + } + + if (zoneU.DiffusersPerZone == AutoSize) { + zoneU.DiffusersPerZone = (NumberOfOccupants > 0.0) ? NumberOfOccupants : 1.0; + + BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Number of diffusers per zone", zoneU.DiffusersPerZone); } } -} -void HcUCSDUF(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight) -{ + void HcUFAD(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight, UFADConvCoef &ufadCC) + { - // SUBROUTINE INFORMATION: - // AUTHOR G. Carrilho da Graca - // DATE WRITTEN February 2004 - // MODIFIED - - // RE-ENGINEERED - + // SUBROUTINE INFORMATION: + // AUTHOR G. Carrilho da Graca + // DATE WRITTEN February 2004 - // PURPOSE OF THIS SUBROUTINE: - // Main subroutine for convection calculation in the UCSD Displacement Ventilation model. - // It calls CalcDetailedHcInForDVModel for convection coefficient - // initial calculations and averages the final result comparing the position of the surface with - // the interface subzone height. + // PURPOSE OF THIS SUBROUTINE: + // Main subroutine for convection calculation in the UCSD Displacement Ventilation model. + // It calls CalcDetailedHcInForDVModel for convection coefficient + // initial calculations and averages the final result comparing the position of the surface with + // the interface subzone height. - // Using/Aliasing - using namespace DataEnvironment; - using namespace DataHeatBalance; + // Using/Aliasing + using namespace DataEnvironment; + using namespace DataHeatBalance; + + // Is the air flow model for this zone set to UCSDDV Displacement Ventilation? + if (!state.dataRoomAir->IsZoneUFAD(ZoneNum)) return; + + ufadCC.HAT_MX = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone + ufadCC.HAT_MXWin = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone (windows only) + ufadCC.HA_MX = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone + ufadCC.HA_MXWin = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone (windows only) + ufadCC.HAT_OC = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone + ufadCC.HAT_OCWin = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone (windows only) + ufadCC.HA_OC = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone + ufadCC.HA_OCWin = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone (windows only) + ufadCC.HAT_FLOOR = 0.0; // HAT_FLOOR Convection Coefficient times Area times Temperature for the floor(?) subzone + ufadCC.HA_FLOOR = 0.0; // HA_FLOOR Convection Coefficient times Area for the floor(?) subzone + + Real64 zoneCeilingHeight1 = state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + Real64 zoneCeilingHeight2 = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum); + + Real64 LayH = FractionHeight * (zoneCeilingHeight2 - zoneCeilingHeight1); // Height of the Occupied/Mixed subzone interface - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Ctd; // DO loop counter for surfaces - Real64 HLD; // Convection coefficient for the lower area of surface - Real64 TmedDV; // Average temperature for DV - Real64 Z1; // auxiliary var for lowest height - Real64 Z2; // auxiliary var for highest height - Real64 ZSupSurf; // highest height for this surface - Real64 ZInfSurf; // lowest height for this surface - Real64 HLU; // Convection coefficient for the upper area of surface - Real64 LayH; // Height of the Occupied/Mixed subzone interface - Real64 LayFrac; // Fraction height of the Occupied/Mixed subzone interface - int SurfNum; // Surface number - // Initialize HAT and HA - - state.dataUFADManager->HAT_MX = 0.0; - state.dataUFADManager->HAT_OC = 0.0; - state.dataUFADManager->HA_MX = 0.0; - state.dataUFADManager->HA_OC = 0.0; - state.dataUFADManager->HAT_FLOOR = 0.0; - state.dataUFADManager->HA_FLOOR = 0.0; - state.dataUFADManager->HAT_MXWin = 0.0; - state.dataUFADManager->HAT_OCWin = 0.0; - state.dataUFADManager->HA_MXWin = 0.0; - state.dataUFADManager->HA_OCWin = 0.0; - - // Is the air flow model for this zone set to UCSDDV Displacement Ventilation? - if (state.dataRoomAirMod->IsZoneUI(ZoneNum)) { - LayFrac = FractionHeight; - LayH = FractionHeight * - (state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1)); // WALL Hc, HA and HAT calculation - for (Ctd = state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Wall((ZoneNum - 1) * 2 + 2); ++Ctd) { - SurfNum = state.dataUCSDShared->APos_Wall(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Wall(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Wall(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Wall(Ctd); + if (SurfNum == 0) continue; + + auto &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); + Real64 ZSupSurf = maxval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; // highest height for this surface + Real64 ZInfSurf = minval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; // lowest height for this surface // The Wall surface is in the upper subzone if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWall(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWall(Ctd); - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWall(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_MX += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd); + ufadCC.HA_MX += surf.Area * state.dataRoomAir->HWall(Ctd); } // The Wall surface is in the lower subzone if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWall(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWall(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWall(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HWall(Ctd); } if (std::abs(ZInfSurf - ZSupSurf) < 1.e-10) { ShowSevereError(state, "RoomAirModelUFAD:HcUCSDUF: Surface values will cause divide by zero."); - ShowContinueError(state, - format("Zone=\"{}\", Surface=\"{}\".", - state.dataHeatBal->Zone(state.dataSurface->Surface(SurfNum).Zone).Name, - state.dataSurface->Surface(SurfNum).Name)); + ShowContinueError(state, format("Zone=\"{}\", Surface=\"{}\".", state.dataHeatBal->Zone(surf.Zone).Name, surf.Name)); ShowContinueError(state, format("ZInfSurf=[{:.4R}], LayH=[{:.4R}].", ZInfSurf, LayH)); ShowContinueError(state, format("ZSupSurf=[{:.4R}], LayH=[{:.4R}].", ZSupSurf, LayH)); ShowFatalError(state, "...Previous condition causes termination."); @@ -744,327 +459,222 @@ void HcUCSDUF(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHei // The Wall surface is partially in upper and partially in lower subzone if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLU = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLD = state.dataRoomAirMod->UFHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataUFADManager->HAT_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataUFADManager->HAT_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLU = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the upper area of surface + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLD = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the lower area of surface + Real64 TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); // Average temperature for DV + state.dataRoomAir->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + ufadCC.HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; + ufadCC.HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + ufadCC.HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; + ufadCC.HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; } - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HWall(Ctd); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HWall(Ctd); } // END WALL // WINDOW Hc, HA and HAT CALCULATION - for (Ctd = state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Window((ZoneNum - 1) * 2 + 2); ++Ctd) { - SurfNum = state.dataUCSDShared->APos_Window(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Window(Ctd); + if (SurfNum == 0) continue; + + auto &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - if (state.dataSurface->Surface(SurfNum).Tilt > 10.0 && state.dataSurface->Surface(SurfNum).Tilt < 170.0) { // Window Wall - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); + + if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Window Wall + Real64 ZSupSurf = maxval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; + Real64 ZInfSurf = minval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HAT_MXWin += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_MXWin += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_MX += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd); + ufadCC.HAT_MXWin += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_MXWin += surf.Area * state.dataRoomAir->HWindow(Ctd); } if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HAT_OCWin += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_OCWin += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd); + ufadCC.HAT_OCWin += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_OCWin += surf.Area * state.dataRoomAir->HWindow(Ctd); } if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLU = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLD = state.dataRoomAirMod->UFHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataUFADManager->HAT_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataUFADManager->HAT_MXWin += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; - state.dataUFADManager->HA_MXWin += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataUFADManager->HAT_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; - state.dataUFADManager->HAT_OCWin += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; - state.dataUFADManager->HA_OCWin += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLU = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the upper area of surface + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLD = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the lower area of surface + Real64 TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); // Average temperature + + state.dataRoomAir->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + ufadCC.HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; + ufadCC.HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + ufadCC.HAT_MXWin += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; + ufadCC.HA_MXWin += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + ufadCC.HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; + ufadCC.HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + ufadCC.HAT_OCWin += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; + ufadCC.HA_OCWin += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; } } - if (state.dataSurface->Surface(SurfNum).Tilt <= 10.0) { // Window Ceiling - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); - } - - if (state.dataSurface->Surface(SurfNum).Tilt >= 170.0) { // Window Floor - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HWindow(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HWindow(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HWindow(Ctd); + if (surf.Tilt <= 10.0) { // Window Ceiling + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_MX += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd); + } else if (surf.Tilt >= 170.0) { // Window Floor + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd); } - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HWindow(Ctd); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HWindow(Ctd); } // END WINDOW // DOOR Hc, HA and HAT CALCULATION - for (Ctd = state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Door((ZoneNum - 1) * 2 + 2); - ++Ctd) { // DOOR - SurfNum = state.dataUCSDShared->APos_Door(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Door(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Door(ZoneNum).end; ++Ctd) { // DOOR + int SurfNum = state.dataRoomAir->APos_Door(Ctd); + if (SurfNum == 0) continue; + auto &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - Z1 = minval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - Z2 = maxval(state.dataSurface->Surface(SurfNum).Vertex, &Vector::z); - ZSupSurf = Z2 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - ZInfSurf = Z1 - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); + + Real64 ZSupSurf = maxval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; + Real64 ZInfSurf = minval(surf.Vertex, &Vector::z) - zoneCeilingHeight1; if (ZInfSurf > LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_MX += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + ufadCC.HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd); } if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HDoor(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HDoor(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HDoor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd); } if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLU = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLD = state.dataRoomAirMod->UFHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataUFADManager->HAT_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataUFADManager->HAT_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLU = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the upper area of surface + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLD = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the lower area of surface + Real64 TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); // Average temperature + state.dataRoomAir->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + ufadCC.HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; + ufadCC.HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + ufadCC.HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; + ufadCC.HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; } - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HDoor(Ctd); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HDoor(Ctd); } // END DOOR // INTERNAL Hc, HA and HAT CALCULATION - state.dataUFADManager->HeightIntMass = - min(state.dataUFADManager->HeightIntMassDefault, - (state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1))); - for (Ctd = state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Internal((ZoneNum - 1) * 2 + 2); - ++Ctd) { - SurfNum = state.dataUCSDShared->APos_Internal(Ctd); + state.dataUFADManager->HeightIntMass = min(state.dataUFADManager->HeightIntMassDefault, (zoneCeilingHeight2 - zoneCeilingHeight1)); + for (int Ctd = state.dataRoomAir->PosZ_Internal(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Internal(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Internal(Ctd); + if (SurfNum == 0) continue; + + auto &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - ZSupSurf = state.dataUFADManager->HeightIntMass; - ZInfSurf = 0.0; + Real64 ZSupSurf = state.dataUFADManager->HeightIntMass; + Real64 ZInfSurf = 0.0; if (ZSupSurf < LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HInternal(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HInternal(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HInternal(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HInternal(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HInternal(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HInternal(Ctd); } if (ZInfSurf <= LayH && ZSupSurf >= LayH) { - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLU = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - HLD = state.dataRoomAirMod->UFHcIn(SurfNum); - TmedDV = ((ZSupSurf - LayH) * state.dataRoomAirMod->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAirMod->ZTOC(ZoneNum)) / - (ZSupSurf - ZInfSurf); - state.dataUCSDShared->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); - state.dataUFADManager->HAT_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; - state.dataUFADManager->HAT_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * - state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLU = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the upper area of surface + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + Real64 HLD = state.dataRoomAir->UFADHcIn(SurfNum); // Convection coefficient for the lower area of surface + Real64 TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) / + (ZSupSurf - ZInfSurf); // Average temperature + state.dataRoomAir->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf); + ufadCC.HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLU; + ufadCC.HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU; + ufadCC.HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * state.dataHeatBalSurf->SurfTempIn(SurfNum) * HLD; + ufadCC.HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD; state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV; } - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HInternal(Ctd); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HInternal(Ctd); } // END INTERNAL // CEILING Hc, HA and HAT CALCULATION - for (Ctd = state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Ceiling((ZoneNum - 1) * 2 + 2); - ++Ctd) { - SurfNum = state.dataUCSDShared->APos_Ceiling(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd); + if (SurfNum == 0) continue; + auto &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTMX(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HCeiling(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_MX += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HCeiling(Ctd); - state.dataUFADManager->HA_MX += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HCeiling(Ctd); - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HCeiling(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HCeiling(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_MX += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HCeiling(Ctd); + ufadCC.HA_MX += surf.Area * state.dataRoomAir->HCeiling(Ctd); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HCeiling(Ctd); } // END CEILING // FLOOR Hc, HA and HAT CALCULATION - for (Ctd = state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 1); Ctd <= state.dataUCSDShared->PosZ_Floor((ZoneNum - 1) * 2 + 2); ++Ctd) { - SurfNum = state.dataUCSDShared->APos_Floor(Ctd); + for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) { + int SurfNum = state.dataRoomAir->APos_Floor(Ctd); + if (SurfNum == 0) continue; + auto &surf = state.dataSurface->Surface(SurfNum); + state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; - if (SurfNum == 0) continue; - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAirMod->UFHcIn); - state.dataUCSDShared->HFloor(Ctd) = state.dataRoomAirMod->UFHcIn(SurfNum); - state.dataUFADManager->HAT_OC += - state.dataSurface->Surface(SurfNum).Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataUCSDShared->HFloor(Ctd); - state.dataUFADManager->HA_OC += state.dataSurface->Surface(SurfNum).Area * state.dataUCSDShared->HFloor(Ctd); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAirMod->ZTFloor(ZoneNum); - state.dataRoomAirMod->UFHcIn(SurfNum) = state.dataUCSDShared->HFloor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum); + CalcDetailedHcInForDVModel(state, SurfNum, state.dataHeatBalSurf->SurfTempIn, state.dataRoomAir->UFADHcIn); + state.dataRoomAir->HFloor(Ctd) = state.dataRoomAir->UFADHcIn(SurfNum); + ufadCC.HAT_OC += surf.Area * state.dataHeatBalSurf->SurfTempIn(SurfNum) * state.dataRoomAir->HFloor(Ctd); + ufadCC.HA_OC += surf.Area * state.dataRoomAir->HFloor(Ctd); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum); + state.dataRoomAir->UFADHcIn(SurfNum) = state.dataRoomAir->HFloor(Ctd); } // END FLOOR } -} - -void CalcUCSDUI(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone -{ - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN August 2005 - // MODIFIED Brent Griffith June 2008 for new interpolation and time history - // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // Using the UCSD UFAD interior zone model, this subroutine calculates the occupied subzone height, - // surface heat transfer coefficients, the occupied subzone temperature, and the upper subzone temperature. - - // METHODOLOGY EMPLOYED: - // The zone is divided into 2 subzones with a variable transition height. - - // REFERENCES: - // The model is described in the EnergyPlus Engineering Reference in Anna Liu's UCSD PhD thesis. - - // Using/Aliasing - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using InternalHeatGains::SumInternalConvectionGainsByTypes; - using InternalHeatGains::SumReturnAirConvectionGainsByTypes; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool MIXFLAG(false); // if true treat as a mixed zone - Real64 CeilingHeight; // zone ceiling height above floor [m] - int UINum; // index to underfloor interior zone model data - Real64 GainsFrac; // fraction of occupied subzone heat gains that remain in the subzone; - // that is, don't go into the plumes - // REAL(r64) :: NumPLPP ! number of plumes per person - Real64 HeightThermostat; // height of the thermostat above the floor [m] - Real64 HeightComfort; // height at which comfort temperature is calculated - Real64 TempDiffCritRep; // Minimum temperature difference between upper and occupied subzones for reporting - Real64 ConvGainsOccSubzone; // convective heat gains into the lower (occupied) subzone [W] - Real64 ConvGainsUpSubzone; // convective heat gains into the upper subzone [W] - Real64 ConvGains; // total zone convective gains (excluding surfaces) [W] - int ZoneEquipConfigNum; // ZoneEquipConfig index for this UFAD zone - Real64 SumSysMCp; // Sum of system mass flow rate * specific heat for this zone [W/K] - Real64 SumSysMCpT; // Sum of system mass flow rate * specific heat * temperature for this zone [W] - Real64 SumSysM; // Sum of systems mass flow rate [kg/s] - Real64 NodeTemp; // inlet node temperature [K] - Real64 MassFlowRate; // system mass flow rate [kg/s] - Real64 CpAir; // specific heat of air [J/kgK] - int InNodeIndex; // inlet node index in ZoneEquipConfig - Real64 SumMCp; // mass flow rate * specific heat for this zone for infiltration, ventilation, mixing [W/K] - Real64 SumMCpT; // mass flow rate * specific heat* temp for this zone for infiltration, ventilation, mixing [W] - Real64 MCp_Total; // total mass flow rate * specific heat for this zone [W/K] - Real64 MCpT_Total; // total mass flow rate * specific heat* temp for this zone [W] - Real64 NumberOfPlumes; - Real64 PowerInPlumes; // [W] - Real64 PowerPerPlume(0.0); // power generating each plume [W] - Real64 HeightFrac; // Fractional height of transition between occupied and upper subzones - Real64 TotSysFlow; // [m3/s] - Real64 NumDiffusersPerPlume; - Real64 NumDiffusers; - Real64 TSupK; // supply yemperature [K] - Real64 Gamma; // dimensionless height parameter; higher gamma means interface height will be - // higher, smaller gamma means interface height will be lower. - Real64 DiffArea; // diffuser effective area [m2] - Real64 ThrowAngle; // diffuser slot angle relative to vertical [radians] - Real64 SourceHeight; // height of plume sources above the floor [m] - int Ctd; - Real64 TempHistTerm; - Real64 ZTAveraged; - Real64 HeightUpSubzoneAve; // Height of center of upper air subzone - Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone - Real64 ZoneMult; // total zone multiplier - int ZoneNodeNum; // node number of the HVAC zone node static constexpr std::array IntGainTypesOccupied = { DataHeatBalance::IntGainType::People, DataHeatBalance::IntGainType::WaterHeaterMixed, @@ -1085,8 +695,8 @@ void CalcUCSDUI(EnergyPlusData &state, int const ZoneNum) // index number for th DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, DataHeatBalance::IntGainType::PipeIndoor, DataHeatBalance::IntGainType::RefrigerationCase, @@ -1099,940 +709,887 @@ void CalcUCSDUI(EnergyPlusData &state, int const ZoneNum) // index number for th static constexpr std::array IntGainTypesUpSubzone = {DataHeatBalance::IntGainType::DaylightingDeviceTubular, DataHeatBalance::IntGainType::Lights}; - Real64 RetAirGains; - - // Exact solution or Euler method - if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { - if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneM2OC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneM2MX(ZoneNum); + + void CalcUFADInt(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + { + + // SUBROUTINE INFORMATION: + // AUTHOR Fred Buhl + // DATE WRITTEN August 2005 + // MODIFIED Brent Griffith June 2008 for new interpolation and time history + // RE-ENGINEERED na + + // PURPOSE OF THIS SUBROUTINE: + // Using the UCSD UFAD interior zone model, this subroutine calculates the occupied subzone height, + // surface heat transfer coefficients, the occupied subzone temperature, and the upper subzone temperature. + + // METHODOLOGY EMPLOYED: + // The zone is divided into 2 subzones with a variable transition height. + + // REFERENCES: + // The model is described in the EnergyPlus Engineering Reference in Anna Liu's UCSD PhD thesis. + + // Using/Aliasing + using Psychrometrics::PsyCpAirFnW; + using Psychrometrics::PsyRhoAirFnPbTdbW; + Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + using InternalHeatGains::SumInternalConvectionGainsByTypes; + using InternalHeatGains::SumReturnAirConvectionGainsByTypes; + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + + Real64 HeightFrac; // Fractional height of transition between occupied and upper subzones + Real64 Gamma; // dimensionless height parameter; higher gamma means interface height will be + // higher, smaller gamma means interface height will be lower. + Real64 ZTAveraged; + + // Exact solution or Euler method + if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { + if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { + if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneM2OC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneM2MX(ZoneNum); + } else { + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneMXOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneMXMX(ZoneNum); + } } else { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneMXOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneMXMX(ZoneNum); + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); } - } else { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); } - } - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - MIXFLAG = false; - state.dataRoomAirMod->UFHcIn = state.dataHeatBalSurf->SurfHConvInt; - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - TotSysFlow = 0.0; - TSupK = 0.0; - SumSysM = 0.0; - ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; - CeilingHeight = state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - UINum = state.dataRoomAirMod->ZoneUFPtr(ZoneNum); - HeightThermostat = state.dataRoomAirMod->ZoneUCSDUI(UINum).ThermostatHeight; - HeightComfort = state.dataRoomAirMod->ZoneUCSDUI(UINum).ComfortHeight; - TempDiffCritRep = state.dataRoomAirMod->ZoneUCSDUI(UINum).TempTrigger; - DiffArea = state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffArea; - ThrowAngle = Constant::DegToRadians * state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffAngle; - SourceHeight = 0.0; - NumDiffusers = state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffusersPerZone; - PowerPerPlume = state.dataRoomAirMod->ZoneUCSDUI(UINum).PowerPerPlume; - // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, - // baseboards (nonthermostatic), water heater skin loss - ConvGainsOccSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); - - // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very - // low or zero) - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { - RetAirGains = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); - ConvGainsOccSubzone += RetAirGains; - } + auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + bool MIXFLAG = false; + state.dataRoomAir->UFADHcIn = state.dataHeatBalSurf->SurfHConvInt; + Real64 SumSysMCp = 0.0; // Sum of system mass flow rate * specific heat for this zone [W/K] + Real64 SumSysMCpT = 0.0; // Sum of system mass flow rate * specific heat * temperature for this zone [W] + Real64 TSupK = 0.0; // supply temperature [K] + Real64 SumSysM = 0.0; // Sum of systems mass flow rate [kg/s] + Real64 TotSysFlow = 0.0; // [m3/s] + int ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; + Real64 CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + + auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); + Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] + Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated + Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting + Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] + Real64 ThrowAngle = Constant::DegToRadians * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] + Real64 SourceHeight = 0.0; // height of plume sources above the floor [m] + Real64 NumDiffusers = zoneU.DiffusersPerZone; + Real64 PowerPerPlume = zoneU.PowerPerPlume; + // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, + // baseboards (nonthermostatic), water heater skin loss + Real64 ConvGainsOccSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); + + // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very + // low or zero) + if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + ConvGainsOccSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); + } - // Add convection from pool cover to occupied region - ConvGainsOccSubzone += state.dataHeatBalFanSys->SumConvPool(ZoneNum); + // Add convection from pool cover to occupied region + ConvGainsOccSubzone += state.dataHeatBalFanSys->SumConvPool(ZoneNum); - // gains from lights (ceiling), tubular daylighting devices, high temp radiant heaters + // gains from lights (ceiling), tubular daylighting devices, high temp radiant heaters - ConvGainsUpSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); - ConvGainsUpSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum); - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { - RetAirGains = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); - ConvGainsUpSubzone += RetAirGains; - } - ConvGains = ConvGainsOccSubzone + ConvGainsUpSubzone + thisZoneHB.SysDepZoneLoadsLagged; - ZoneEquipConfigNum = state.dataRoomAirMod->ZoneUCSDUI(UINum).ZoneEquipPtr; - if (ZoneEquipConfigNum > 0) { - for (InNodeIndex = 1; InNodeIndex <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++InNodeIndex) { - NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(InNodeIndex)).Temp; - MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(InNodeIndex)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); - TSupK += MassFlowRate * NodeTemp; - SumSysM += MassFlowRate; - } - if (TotSysFlow > 0.0) { - TSupK = TSupK / SumSysM + Constant::KelvinConv; - } else { - TSupK = 0.0; - } - } - // mass flow times specific heat for infiltration, ventilation, mixing, earth tube - SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA; - // mass flow times specific heat times temperature for infiltration, ventilation, mixing, earth tube - SumMCpT = thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + - thisZoneHB.MDotCPOA * state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp; - MCp_Total = SumMCp + SumSysMCp; - MCpT_Total = SumMCpT + SumSysMCpT; - // For the York MIT diffusers (variable area) the area varies with the flow rate. Assume 400 ft/min velocity - // at the diffuser, and a design flow rate of 150 cfm (.0708 m3/s). Then the design area for each diffuser is - // 150 ft3/min / 400 ft/min = .375 ft2 = .035 m2. This is adjusted each time step by - // (TotSysFlow/(NumDiffusers*.0708))*.035 - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).DiffuserType == Diffuser::VarArea) { - DiffArea = 0.035 * TotSysFlow / (0.0708 * NumDiffusers); - } - // initial estimate of convective transfer from surfaces; assume HeightFrac is 0.5. - HcUCSDUF(state, ZoneNum, 0.5); - PowerInPlumes = ConvGains + state.dataUFADManager->HAT_OC - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum) + - state.dataUFADManager->HAT_MX - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum); - if (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) { - NumberOfPlumes = PowerInPlumes / PowerPerPlume; - NumDiffusersPerPlume = NumDiffusers / NumberOfPlumes; - } else { - NumberOfPlumes = 1.0; - NumDiffusersPerPlume = 1.0; - } - if ((PowerInPlumes <= 0.0) || (TotSysFlow == 0.0) || (TSupK - Constant::KelvinConv) > thisZoneHB.MAT) { - // The system will mix - HeightFrac = 0.0; - } else { - Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / - (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).CalcTransHeight) { - HeightFrac = (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; - } else { - HeightFrac = state.dataRoomAirMod->ZoneUCSDUI(UINum).TransHeight / CeilingHeight; + Real64 ConvGainsUpSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); + ConvGainsUpSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum); + if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + ConvGainsUpSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); } - HeightFrac = max(0.0, min(1.0, HeightFrac)); - for (Ctd = 1; Ctd <= 4; ++Ctd) { - HcUCSDUF(state, ZoneNum, HeightFrac); - PowerInPlumes = ConvGains + state.dataUFADManager->HAT_OC - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum) + - state.dataUFADManager->HAT_MX - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum); - if (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) { - NumberOfPlumes = PowerInPlumes / PowerPerPlume; - NumDiffusersPerPlume = NumDiffusers / NumberOfPlumes; + + Real64 ConvGains = ConvGainsOccSubzone + ConvGainsUpSubzone + thisZoneHB.SysDepZoneLoadsLagged; + Real64 ZoneEquipConfigNum = zoneU.ZoneEquipPtr; + if (ZoneEquipConfigNum > 0) { + auto const &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum); + for (int InNodeIndex = 1; InNodeIndex <= zoneEquipConfig.NumInletNodes; ++InNodeIndex) { + Real64 NodeTemp = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).Temp; + Real64 MassFlowRate = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).MassFlowRate; + Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + SumSysMCp += MassFlowRate * CpAir; + SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); + TSupK += MassFlowRate * NodeTemp; + SumSysM += MassFlowRate; + } + if (TotSysFlow > 0.0) { + TSupK = TSupK / SumSysM + Constant::KelvinConv; } else { - NumberOfPlumes = 1.0; - NumDiffusersPerPlume = 1.0; + TSupK = 0.0; } - if (PowerInPlumes <= 0.0) break; + } + // mass flow rate * specific heat for this zone for infiltration, ventilation, mixing [W/K] + Real64 SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA; + // mass flow rate * specific heat* temp for this zone for infiltration, ventilation, mixing [W] + Real64 SumMCpT = thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + + thisZoneHB.MDotCPOA * state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp; + Real64 MCp_Total = SumMCp + SumSysMCp; // total mass flow rate * specific heat for this zone [W/K] + Real64 MCpT_Total = SumMCpT + SumSysMCpT; // total mass flow rate * specific heat* temp for this zone [W] + // For the York MIT diffusers (variable area) the area varies with the flow rate. Assume 400 ft/min velocity + // at the diffuser, and a design flow rate of 150 cfm (.0708 m3/s). Then the design area for each diffuser is + // 150 ft3/min / 400 ft/min = .375 ft2 = .035 m2. This is adjusted each time step by + // (TotSysFlow/(NumDiffusers*.0708))*.035 + if (zoneU.DiffuserType == Diffuser::VarArea) { + DiffArea = 0.035 * TotSysFlow / (0.0708 * NumDiffusers); + } + // initial estimate of convective transfer from surfaces; assume HeightFrac is 0.5. + UFADConvCoef ufadCC; + HcUFAD(state, ZoneNum, 0.5, ufadCC); + Real64 PowerInPlumes = ConvGains + ufadCC.HAT_OC - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum) + ufadCC.HAT_MX - + ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum); + + Real64 NumberOfPlumes = (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) ? (PowerInPlumes / PowerPerPlume) : 1.0; + Real64 NumDiffusersPerPlume = (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) ? (NumDiffusers / NumberOfPlumes) : 1.0; + + if ((PowerInPlumes <= 0.0) || (TotSysFlow == 0.0) || (TSupK - Constant::KelvinConv) > thisZoneHB.MAT) { + // The system will mix + HeightFrac = 0.0; + } else { Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); - if (state.dataRoomAirMod->ZoneUCSDUI(UINum).CalcTransHeight) { + if (zoneU.CalcTransHeight) { HeightFrac = (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; } else { - HeightFrac = state.dataRoomAirMod->ZoneUCSDUI(UINum).TransHeight / CeilingHeight; + HeightFrac = zoneU.TransHeight / CeilingHeight; } HeightFrac = max(0.0, min(1.0, HeightFrac)); - state.dataRoomAirMod->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; - GainsFrac = state.dataRoomAirMod->ZoneUCSDUI(UINum).A_Kc * std::pow(Gamma, state.dataRoomAirMod->ZoneUCSDUI(UINum).B_Kc) + - state.dataRoomAirMod->ZoneUCSDUI(UINum).C_Kc + state.dataRoomAirMod->ZoneUCSDUI(UINum).D_Kc * Gamma + - state.dataRoomAirMod->ZoneUCSDUI(UINum).E_Kc * pow_2(Gamma); - GainsFrac = max(0.6, min(GainsFrac, 1.0)); - state.dataRoomAirMod->AIRRATOC(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).Volume * - (state.dataRoomAirMod->HeightTransition(ZoneNum) - min(state.dataRoomAirMod->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * - state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - state.dataRoomAirMod->AIRRATMX(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAirMod->HeightTransition(ZoneNum)) / CeilingHeight * - state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - - if (state.dataHVACGlobal->UseZoneTimeStepHistory) { - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->XM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->XM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->XMATOC(ZoneNum); - - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->XM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->XM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->XMATMX(ZoneNum); + for (int Ctd = 1; Ctd <= 4; ++Ctd) { + HcUFAD(state, ZoneNum, HeightFrac, ufadCC); + PowerInPlumes = ConvGains + ufadCC.HAT_OC - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum) + ufadCC.HAT_MX - + ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum); + if (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) { + NumberOfPlumes = PowerInPlumes / PowerPerPlume; + NumDiffusersPerPlume = NumDiffusers / NumberOfPlumes; + } else { + NumberOfPlumes = 1.0; + NumDiffusersPerPlume = 1.0; + } + if (PowerInPlumes <= 0.0) break; + Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / + (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); + if (zoneU.CalcTransHeight) { + HeightFrac = (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; + } else { + HeightFrac = zoneU.TransHeight / CeilingHeight; + } + HeightFrac = max(0.0, min(1.0, HeightFrac)); + state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; + Real64 GainsFrac = zoneU.A_Kc * std::pow(Gamma, zoneU.B_Kc) + zoneU.C_Kc + zoneU.D_Kc * Gamma + zoneU.E_Kc * pow_2(Gamma); + GainsFrac = max(0.6, min(GainsFrac, 1.0)); + state.dataRoomAir->AIRRATOC(ZoneNum) = + state.dataHeatBal->Zone(ZoneNum).Volume * + (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * + state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + state.dataRoomAir->AIRRATMX(ZoneNum) = + state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * + state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + + if (state.dataHVACGlobal->UseZoneTimeStepHistory) { + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->XMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->XMATOC(ZoneNum)[0]; + + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->XMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->XMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->XMATMX(ZoneNum)[0]; - } else { - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->DSXM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->DSXM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->DSXMATOC(ZoneNum); + } else { + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->DSXMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->DSXMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->DSXMATOC(ZoneNum)[0]; - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->DSXM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->DSXM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->DSXMATMX(ZoneNum); - } + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->DSXMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->DSXMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->DSXMATMX(ZoneNum)[0]; + } - Real64 AirCap = state.dataRoomAirMod->AIRRATOC(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1OC(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2OC(ZoneNum) + - (1.0 / 3.0) * state.dataRoomAirMod->ZTM3OC(ZoneNum)); - // Formerly CoefSumha, coef in zone temp equation with dimensions of h*A - Real64 TempDepCoef = GainsFrac * state.dataUFADManager->HA_OC + MCp_Total; - Real64 TempIndCoef = GainsFrac * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum)) + - MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (TempHistTerm + - GainsFrac * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum)) + - MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult) / - ((11.0 / 6.0) * AirCap + GainsFrac * state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTOC(ZoneNum) = state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef / AirCap; - } else { - state.dataRoomAirMod->ZTOC(ZoneNum) = - (state.dataRoomAirMod->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + Real64 AirCap = state.dataRoomAir->AIRRATOC(ZoneNum); + Real64 TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMOC(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMOC(ZoneNum)[1] + + (1.0 / 3.0) * state.dataRoomAir->ZTMOC(ZoneNum)[2]); + // Formerly CoefSumha, coef in zone temp equation with dimensions of h*A + Real64 TempDepCoef = GainsFrac * ufadCC.HA_OC + MCp_Total; + Real64 TempIndCoef = GainsFrac * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum)) + + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTOC(ZoneNum) = + (TempHistTerm + GainsFrac * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum)) + + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult) / + ((11.0 / 6.0) * AirCap + GainsFrac * ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTOC(ZoneNum) = state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef / AirCap; + } else { + state.dataRoomAir->ZTOC(ZoneNum) = + (state.dataRoomAir->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTOC(ZoneNum) = (AirCap * state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - AirCap = state.dataRoomAirMod->AIRRATMX(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1MX(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2MX(ZoneNum) + - (1.0 / 3.0) * state.dataRoomAirMod->ZTM3MX(ZoneNum)); - TempDepCoef = (1.0 - GainsFrac) * state.dataUFADManager->HA_MX + MCp_Total; - TempIndCoef = (1.0 - GainsFrac) * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum)) + - state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTMX(ZoneNum) = - (TempHistTerm + - (1.0 - GainsFrac) * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum)) + - state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total) / - ((11.0 / 6.0) * AirCap + (1.0 - GainsFrac) * state.dataUFADManager->HA_MX + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTMX(ZoneNum) = state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef / AirCap; - } else { - state.dataRoomAirMod->ZTMX(ZoneNum) = - (state.dataRoomAirMod->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + AirCap = state.dataRoomAir->AIRRATMX(ZoneNum); + TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMMX(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMMX(ZoneNum)[1] + + (1.0 / 3.0) * state.dataRoomAir->ZTMMX(ZoneNum)[2]); + TempDepCoef = (1.0 - GainsFrac) * ufadCC.HA_MX + MCp_Total; + TempIndCoef = (1.0 - GainsFrac) * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum)) + + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTMX(ZoneNum) = + (TempHistTerm + + (1.0 - GainsFrac) * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum)) + + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total) / + ((11.0 / 6.0) * AirCap + (1.0 - GainsFrac) * ufadCC.HA_MX + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTMX(ZoneNum) = state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef / AirCap; + } else { + state.dataRoomAir->ZTMX(ZoneNum) = + (state.dataRoomAir->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTMX(ZoneNum) = (AirCap * state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTMX(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + state.dataRoomAir->ZTFloor(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } + if (PowerInPlumes <= 0.0) { + HeightFrac = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = 0.0; + } else { + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = Gamma; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = PowerInPlumes; } - state.dataRoomAirMod->ZTFloor(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); } - if (PowerInPlumes <= 0.0) { + + //=============================== M I X E D Calculation ============================================== + if (state.dataRoomAir->ZTMX(ZoneNum) < state.dataRoomAir->ZTOC(ZoneNum) || MCp_Total <= 0.0 || + HeightFrac * CeilingHeight < state.dataUFADManager->ThickOccupiedSubzoneMin) { + MIXFLAG = true; HeightFrac = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = 0.0; - } else { - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = Gamma; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = PowerInPlumes; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + Real64 AirCap = thisZoneHB.AirPowerCap; + Real64 TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + (1.0 / 3.0) * thisZoneHB.ZTM[2]); + + for (int Ctd = 1; Ctd <= 3; ++Ctd) { + Real64 TempDepCoef = ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total; + Real64 const thisZoneT1 = thisZoneHB.ZoneT1; + // Formerly CoefSumhat, coef in zone temp equation with dimensions of h*A(T1 + Real64 TempIndCoef = ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total) / + ((11.0 / 6.0) * AirCap + ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; + } else { + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; + } + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; + HcUFAD(state, ZoneNum, HeightFrac, ufadCC); + TempDepCoef = ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total; + TempIndCoef = ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total) / + ((11.0 / 6.0) * AirCap + ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; + } else { + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; + } + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; + } } - } + //========================================================================================= - //=============================== M I X E D Calculation ============================================== - if (state.dataRoomAirMod->ZTMX(ZoneNum) < state.dataRoomAirMod->ZTOC(ZoneNum) || MCp_Total <= 0.0 || - HeightFrac * CeilingHeight < state.dataUFADManager->ThickOccupiedSubzoneMin) { - MIXFLAG = true; - HeightFrac = 0.0; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - Real64 AirCap = thisZoneHB.AirPowerCap; - TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + (1.0 / 3.0) * thisZoneHB.ZTM[2]); - - for (Ctd = 1; Ctd <= 3; ++Ctd) { - Real64 TempDepCoef = state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; - // Formerly CoefSumhat, coef in zone temp equation with dimensions of h*A(T1 - Real64 TempIndCoef = ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; - } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + // Comfort temperature and temperature at the thermostat/temperature control sensor + + state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; + Real64 HeightUpSubzoneAve = (CeilingHeight + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0; + Real64 HeightOccupiedSubzoneAve = state.dataRoomAir->HeightTransition(ZoneNum) / 2.0; + // Comfort temperature + + if (MIXFLAG) { + state.dataRoomAir->TCMF(ZoneNum) = ZTAveraged; + } else { + if (HeightComfort < HeightOccupiedSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightUpSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightComfort) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / + (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightComfort >= HeightUpSubzoneAve && HeightComfort <= CeilingHeight) { + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, + format("UFAD comfort height is above ceiling or below floor in Zone: {}", state.dataHeatBal->Zone(ZoneNum).Name)); } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; - HcUCSDUF(state, ZoneNum, HeightFrac); - TempDepCoef = state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total; - TempIndCoef = ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; - } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + } + + // Temperature at the thermostat/temperature control sensor + + if (MIXFLAG) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; + } else { + if (HeightThermostat < HeightOccupiedSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightUpSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightThermostat) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / + (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightThermostat >= HeightUpSubzoneAve && HeightThermostat <= CeilingHeight) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, + format("Underfloor air distribution thermostat height is above ceiling or below floor in Zone: {}", + state.dataHeatBal->Zone(ZoneNum).Name)); } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; } - } - //========================================================================================= - - // Comfort temperature and temperature at the thermostat/temperature control sensor - - state.dataRoomAirMod->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; - HeightUpSubzoneAve = (CeilingHeight + state.dataRoomAirMod->HeightTransition(ZoneNum)) / 2.0; - HeightOccupiedSubzoneAve = state.dataRoomAirMod->HeightTransition(ZoneNum) / 2.0; - // Comfort temperature - - if (MIXFLAG) { - state.dataRoomAirMod->TCMF(ZoneNum) = ZTAveraged; - } else { - if (HeightComfort < HeightOccupiedSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightUpSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightComfort) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / - (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightComfort >= HeightUpSubzoneAve && HeightComfort <= CeilingHeight) { - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + + // Temperature gradients + if ((HeightUpSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { + state.dataRoomAir->AvgTempGrad(ZoneNum) = + (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) / (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); } else { - ShowFatalError(state, format("UFAD comfort height is above ceiling or below floor in Zone: {}", state.dataHeatBal->Zone(ZoneNum).Name)); + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; } - } - // Temperature at the thermostat/temperature control sensor - - if (MIXFLAG) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; - } else { - if (HeightThermostat < HeightOccupiedSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightUpSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightThermostat) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / - (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightThermostat >= HeightUpSubzoneAve && HeightThermostat <= CeilingHeight) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + if (MIXFLAG) { + state.dataRoomAir->ZoneUFADMixedFlag(ZoneNum) = 1; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; } else { - ShowFatalError(state, - format("Underfloor air distribution thermostat height is above ceiling or below floor in Zone: {}", - state.dataHeatBal->Zone(ZoneNum).Name)); + state.dataRoomAir->ZoneUFADMixedFlag(ZoneNum) = 0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; } - } - // Temperature gradients - if ((HeightUpSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = - (state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) / (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - } + if (ZoneEquipConfigNum > 0) { + int ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; + state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAir->ZTMX(ZoneNum); + } - if (MIXFLAG) { - state.dataRoomAirMod->ZoneUFMixedFlag(ZoneNum) = 1; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - } else { - state.dataRoomAirMod->ZoneUFMixedFlag(ZoneNum) = 0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - } + if (MIXFLAG) { + state.dataRoomAir->Phi(ZoneNum) = 1.0; + } else { + state.dataRoomAir->Phi(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) - (TSupK - Constant::KelvinConv)) / + (state.dataRoomAir->ZTMX(ZoneNum) - (TSupK - Constant::KelvinConv)); + } - if (ZoneEquipConfigNum > 0) { - ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; - state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAirMod->ZTMX(ZoneNum); + // Mixed for reporting purposes + if ((MIXFLAG) || ((state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) < TempDiffCritRep)) { + state.dataRoomAir->ZoneUFADMixedFlagRep(ZoneNum) = 1.0; + state.dataRoomAir->HeightTransition(ZoneNum) = 0.0; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + } else { + state.dataRoomAir->ZoneUFADMixedFlagRep(ZoneNum) = 0.0; + } } - if (MIXFLAG) { - state.dataRoomAirMod->Phi(ZoneNum) = 1.0; - } else { - state.dataRoomAirMod->Phi(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) - (TSupK - Constant::KelvinConv)) / - (state.dataRoomAirMod->ZTMX(ZoneNum) - (TSupK - Constant::KelvinConv)); - } + void CalcUFADExt(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone + { - // Mixed for reporting purposes - if ((MIXFLAG) || ((state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) < TempDiffCritRep)) { - state.dataRoomAirMod->ZoneUFMixedFlagRep(ZoneNum) = 1.0; - state.dataRoomAirMod->HeightTransition(ZoneNum) = 0.0; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - } else { - state.dataRoomAirMod->ZoneUFMixedFlagRep(ZoneNum) = 0.0; - } -} + // SUBROUTINE INFORMATION: + // AUTHOR Fred Buhl + // DATE WRITTEN January 2006 + // MODIFIED Brent Griffith June 2008 for new interpolation and time history + // RE-ENGINEERED na -void CalcUCSDUE(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone -{ + // PURPOSE OF THIS SUBROUTINE: + // Using the UCSD UFAD exterior zone model, this subroutine calculates the occupied subzone height, + // surface heat transfer coefficients, the occupied subzone temperature, and the upper subzone temperature. - // SUBROUTINE INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN January 2006 - // MODIFIED Brent Griffith June 2008 for new interpolation and time history - // RE-ENGINEERED na + // METHODOLOGY EMPLOYED: + // The zone is divided into 2 subzones with a variable transition height. - // PURPOSE OF THIS SUBROUTINE: - // Using the UCSD UFAD exterior zone model, this subroutine calculates the occupied subzone height, - // surface heat transfer coefficients, the occupied subzone temperature, and the upper subzone temperature. + // REFERENCES: + // The model is described in the EnergyPlus Engineering Reference in Anna Liu's UCSD PhD thesis. - // METHODOLOGY EMPLOYED: - // The zone is divided into 2 subzones with a variable transition height. + // Using/Aliasing + using Psychrometrics::PsyCpAirFnW; + using Psychrometrics::PsyRhoAirFnPbTdbW; + Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + using InternalHeatGains::SumInternalConvectionGainsByTypes; + using InternalHeatGains::SumReturnAirConvectionGainsByTypes; - // REFERENCES: - // The model is described in the EnergyPlus Engineering Reference in Anna Liu's UCSD PhD thesis. + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // Using/Aliasing - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using InternalHeatGains::SumInternalConvectionGainsByTypes; - using InternalHeatGains::SumReturnAirConvectionGainsByTypes; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool MIXFLAG(false); // if true treat as a mixed zone - Real64 CeilingHeight; // zone ceiling height above floor [m] - int UINum; // index to underfloor interior zone model data - Real64 GainsFrac; // fraction of occupied subzone heat gains that remain in the subzone; - // that is, don't go into the plumes - Real64 HeightThermostat; // height of the thermostat above the floor [m] - Real64 HeightComfort; // height at which comfort temperature is calculated - Real64 TempDiffCritRep; // Minimum temperature difference between upper and occupied subzones for reporting - Real64 ConvGainsOccSubzone; // convective heat gains into the lower (occupied) subzone [W] - Real64 ConvGainsUpSubzone; // convective heat gains into the upper subzone [W] - Real64 ConvGains; // total zone convective gains (excluding surfaces) [W] - Real64 ConvGainsWindows; // convective gain from windows [W] - int ZoneEquipConfigNum; // ZoneEquipConfig index for this UFAD zone - Real64 SumSysMCp; // Sum of system mass flow rate * specific heat for this zone [W/K] - Real64 SumSysMCpT; // Sum of system mass flow rate * specific heat * temperature for this zone [W] - Real64 SumSysM; // Sum of systems mass flow rate [kg/s] - Real64 NodeTemp; // inlet node temperature [K] - Real64 MassFlowRate; // system mass flow rate [kg/s] - Real64 CpAir; // specific heat of air [J/kgK] - int InNodeIndex; // inlet node index in ZoneEquipConfig - Real64 SumMCp; // mass flow rate * specific heat for this zone for infiltration, ventilation, mixing [W/K] - Real64 SumMCpT; // mass flow rate * specific heat* temp for this zone for infiltration, ventilation, mixing [W] - Real64 MCp_Total; // total mass flow rate * specific heat for this zone [W/K] - Real64 MCpT_Total; // total mass flow rate * specific heat* temp for this zone [W] - Real64 NumberOfPlumes; - Real64 PowerInPlumes; // [W] - Real64 PowerPerPlume(0.0); // power carried by each plume [W] - Real64 PowerInPlumesPerMeter; // Power in Plumes per meter of window length [W/m] - Real64 NumDiffusersPerPlume(0.0); - Real64 HeightFrac; // Fractional height of transition between occupied and upper subzones - Real64 TotSysFlow; // [m3/s] - Real64 NumDiffusers; - Real64 TSupK; // supply yemperature [K] - Real64 Gamma; // dimensionless height parameter; higher gamma means interface height will be - // higher, smaller gamma means interface height will be lower. - Real64 DiffArea; // diffuser effective area [m2] - Real64 ThrowAngle; // diffuser slot angle relative to vertical [radians] - Real64 SourceHeight; // height of plume sources above the floor [m] - int Ctd; - Real64 AirCap; - Real64 TempHistTerm; - Real64 ZTAveraged; - Real64 HeightUpSubzoneAve; // Height of center of upper air subzone - Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone - Real64 ZoneMult; // total zone multiplier - int ZoneNodeNum; // node number of the HVAC zone node - Real64 TempDepCoef(0.0); // Formerly CoefSumha, coef in zone temp equation with dimensions of h*A - Real64 TempIndCoef(0.0); // Formerly CoefSumhat, coef in zone temp equation with dimensions of h*A(T1 - static constexpr std::array IntGainTypesOccupied = { - DataHeatBalance::IntGainType::People, - DataHeatBalance::IntGainType::WaterHeaterMixed, - DataHeatBalance::IntGainType::WaterHeaterStratified, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified, - DataHeatBalance::IntGainType::ElectricEquipment, - DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled, - DataHeatBalance::IntGainType::GasEquipment, - DataHeatBalance::IntGainType::HotWaterEquipment, - DataHeatBalance::IntGainType::SteamEquipment, - DataHeatBalance::IntGainType::OtherEquipment, - DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled, - DataHeatBalance::IntGainType::GeneratorFuelCell, - DataHeatBalance::IntGainType::WaterUseEquipment, - DataHeatBalance::IntGainType::GeneratorMicroCHP, - DataHeatBalance::IntGainType::ElectricLoadCenterTransformer, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, - DataHeatBalance::IntGainType::PipeIndoor, - DataHeatBalance::IntGainType::RefrigerationCase, - DataHeatBalance::IntGainType::RefrigerationCompressorRack, - DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser, - DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe, - DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver, - DataHeatBalance::IntGainType::RefrigerationSecondaryPipe, - DataHeatBalance::IntGainType::RefrigerationWalkIn}; + Real64 PowerInPlumesPerMeter; // Power in Plumes per meter of window length [W/m] + Real64 ZTAveraged; - static constexpr std::array IntGainTypesUpSubzone = {DataHeatBalance::IntGainType::DaylightingDeviceTubular, - DataHeatBalance::IntGainType::Lights}; - Real64 RetAirGains; - - // Exact solution or Euler method - if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { - if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneM2OC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneM2MX(ZoneNum); + // Exact solution or Euler method + if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { + if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) { + if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneM2OC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneM2MX(ZoneNum); + } else { + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneMXOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneMXMX(ZoneNum); + } } else { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZoneMXOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZoneMXMX(ZoneNum); + state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); } - } else { - state.dataRoomAirMod->Zone1OC(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - state.dataRoomAirMod->Zone1MX(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); } - } - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - HeightFrac = 0.0; - MIXFLAG = false; - state.dataRoomAirMod->UFHcIn = state.dataHeatBalSurf->SurfHConvInt; - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - TotSysFlow = 0.0; - TSupK = 0.0; - SumSysM = 0.0; - PowerInPlumes = 0.0; - ConvGainsWindows = 0.0; - Gamma = 0.0; - ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; - CeilingHeight = state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 2) - state.dataRoomAirMod->ZoneCeilingHeight((ZoneNum - 1) * 2 + 1); - UINum = state.dataRoomAirMod->ZoneUFPtr(ZoneNum); - HeightThermostat = state.dataRoomAirMod->ZoneUCSDUE(UINum).ThermostatHeight; - HeightComfort = state.dataRoomAirMod->ZoneUCSDUE(UINum).ComfortHeight; - TempDiffCritRep = state.dataRoomAirMod->ZoneUCSDUE(UINum).TempTrigger; - DiffArea = state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffArea; - ThrowAngle = Constant::DegToRadians * state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffAngle; - SourceHeight = state.dataRoomAirMod->ZoneUCSDUE(UINum).HeatSrcHeight; - NumDiffusers = state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffusersPerZone; - PowerPerPlume = state.dataRoomAirMod->ZoneUCSDUE(UINum).PowerPerPlume; - // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, - // baseboards (nonthermostatic), water heater skin loss - ConvGainsOccSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); - - // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very - // low or zero) - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { - RetAirGains = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); - ConvGainsOccSubzone += RetAirGains; - } + auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + Real64 HeightFrac = 0.0; // Fractional height of transition between occupied and upper subzones + bool MIXFLAG = false; + state.dataRoomAir->UFADHcIn = state.dataHeatBalSurf->SurfHConvInt; + Real64 SumSysMCp = 0.0; // Sum of system mass flow rate * specific heat for this zone [W/K] + Real64 SumSysMCpT = 0.0; // Sum of system mass flow rate * specific heat * temperature for this zone [W] + Real64 TotSysFlow = 0.0; // [m3/s] + Real64 TSupK = 0.0; // supply temperature [K] + Real64 SumSysM = 0.0; // Sum of systems mass flow rate [kg/s] + Real64 PowerInPlumes = 0.0; // [W] + Real64 Gamma = 0.0; // dimensionless height parameter; higher gamma means interface height will be + // higher, smaller gamma means interface height will be lower. + int ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier; + Real64 CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); + + auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); + Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] + Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated + Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting + Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] + Real64 ThrowAngle = Constant::DegToRadians * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] + Real64 SourceHeight = zoneU.HeatSrcHeight; // height of plume sources above the floor [m] + Real64 NumDiffusers = zoneU.DiffusersPerZone; + Real64 PowerPerPlume = zoneU.PowerPerPlume; + // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, + // baseboards (nonthermostatic), water heater skin loss + Real64 ConvGainsOccSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); + + // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very + // low or zero) + if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + ConvGainsOccSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied); + } - // Add convection from pool cover to occupied region - ConvGainsOccSubzone += state.dataHeatBalFanSys->SumConvPool(ZoneNum); + // Add convection from pool cover to occupied region + ConvGainsOccSubzone += state.dataHeatBalFanSys->SumConvPool(ZoneNum); - // gains from lights (ceiling), tubular daylighting devices, high temp radiant heaters - ConvGainsUpSubzone = SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); - ConvGainsUpSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum); - if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { - RetAirGains = SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); - ConvGainsUpSubzone += RetAirGains; - } - ConvGains = ConvGainsOccSubzone + ConvGainsUpSubzone + thisZoneHB.SysDepZoneLoadsLagged; - ZoneEquipConfigNum = state.dataRoomAirMod->ZoneUCSDUE(UINum).ZoneEquipPtr; - if (ZoneEquipConfigNum > 0) { - for (InNodeIndex = 1; InNodeIndex <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++InNodeIndex) { - NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(InNodeIndex)).Temp; - MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(InNodeIndex)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); - TSupK += MassFlowRate * NodeTemp; - SumSysM += MassFlowRate; - } - if (TotSysFlow > 0.0) { - TSupK = TSupK / SumSysM + Constant::KelvinConv; - } else { - TSupK = 0.0; - } - } - // mass flow times specific heat for infiltration, ventilation, mixing - SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MDotCPOA; - // mass flow times specific heat times temperature for infiltration, ventilation, mixing - SumMCpT = thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MDotCPOA * state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp; - - MCp_Total = SumMCp + SumSysMCp; - MCpT_Total = SumMCpT + SumSysMCpT; - - // For the York MIT diffusers (variable area) the area varies with the flow rate. Assume 400 ft/min velocity - // at the diffuser, and a design flow rate of 150 cfm (.0708 m3/s). Then the design area for each diffuser is - // 150 ft3/min / 400 ft/min = .375 ft2 = .035 m2. This is adjusted each time step by - // (TotSysFlow/(NumDiffusers*.0708))*.035 - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).DiffuserType == Diffuser::VarArea) { - DiffArea = 0.035 * TotSysFlow / (0.0708 * NumDiffusers); - } - // initial estimate of convective transfer from surfaces; assume HeightFrac is 0.5. - HcUCSDUF(state, ZoneNum, 0.5); - ConvGainsWindows = state.dataUFADManager->HAT_MXWin + state.dataUFADManager->HAT_OCWin - - state.dataUFADManager->HA_MXWin * state.dataRoomAirMod->ZTMX(ZoneNum) - - state.dataUFADManager->HA_OCWin * state.dataRoomAirMod->ZTOC(ZoneNum); - PowerInPlumes = ConvGains + state.dataUFADManager->HAT_OC - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum) + - state.dataUFADManager->HAT_MX - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum); - // NumberOfPlumes = PowerInPlumes / PowerPerPlume - if (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) { - NumberOfPlumes = PowerInPlumes / PowerPerPlume; - NumDiffusersPerPlume = NumDiffusers / NumberOfPlumes; - } else { - NumberOfPlumes = 1.0; - NumDiffusersPerPlume = 1.0; - } - if ((PowerInPlumes <= 0.0) || (TotSysFlow == 0.0) || (TSupK - Constant::KelvinConv) > thisZoneHB.MAT) { - // The system will mix - HeightFrac = 0.0; - } else { - if (PowerInPlumes > 0.0) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth > 0.0) { // exterior zone formula - PowerInPlumesPerMeter = PowerInPlumes / state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth; - Gamma = (TotSysFlow * std::cos(ThrowAngle)) / (NumDiffusers * DiffArea * std::pow(0.0281 * 0.001 * PowerInPlumesPerMeter, 0.333333)); - } else { // interior zone formula - Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / - (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); - } - } else { - Gamma = 1000.0; + // gains from lights (ceiling), tubular daylighting devices, high temp radiant heaters + Real64 ConvGainsUpSubzone = + SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); // convective heat gains into the upper subzone [W] + ConvGainsUpSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum); + if (state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) { + ConvGainsUpSubzone += SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesUpSubzone); } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).CalcTransHeight) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth > 0.0) { // use exterior zone formula - HeightFrac = (std::sqrt(DiffArea) * (11.03 * std::log(Gamma) - 10.73) + 0.5 * SourceHeight) / CeilingHeight; - } else { // use interior zone formula - HeightFrac = (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; + Real64 ConvGains = + ConvGainsOccSubzone + ConvGainsUpSubzone + thisZoneHB.SysDepZoneLoadsLagged; // total zone convective gains (excluding surfaces) [W] + int ZoneEquipConfigNum = zoneU.ZoneEquipPtr; + if (ZoneEquipConfigNum > 0) { + auto const &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum); + for (int InNodeIndex = 1; InNodeIndex <= zoneEquipConfig.NumInletNodes; ++InNodeIndex) { + Real64 NodeTemp = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).Temp; + Real64 MassFlowRate = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).MassFlowRate; + Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + SumSysMCp += MassFlowRate * CpAir; + SumSysMCpT += MassFlowRate * CpAir * NodeTemp; + TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); + TSupK += MassFlowRate * NodeTemp; + SumSysM += MassFlowRate; + } + if (TotSysFlow > 0.0) { + TSupK = TSupK / SumSysM + Constant::KelvinConv; + } else { + TSupK = 0.0; } - } else { - HeightFrac = state.dataRoomAirMod->ZoneUCSDUE(UINum).TransHeight / CeilingHeight; } - HeightFrac = max(0.0, min(1.0, HeightFrac)); - GainsFrac = state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc * std::pow(Gamma, state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc) + - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc + state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc * Gamma + - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc * pow_2(Gamma); - GainsFrac = max(0.7, min(GainsFrac, 1.0)); - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).ShadeDown) { - GainsFrac -= 0.2; + + // mass flow rate * specific heat for this zone for infiltration, ventilation, mixing [W/K] + Real64 SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MDotCPOA; + // mass flow rate * specific heat* temp for this zone for infiltration, ventilation, mixing [W] + Real64 SumMCpT = + thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MDotCPOA * state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp; + + Real64 MCp_Total = SumMCp + SumSysMCp; // total mass flow rate * specific heat for this zone [W/K] + Real64 MCpT_Total = SumMCpT + SumSysMCpT; // total mass flow rate * specific heat* temp for this zone [W] + + // For the York MIT diffusers (variable area) the area varies with the flow rate. Assume 400 ft/min velocity + // at the diffuser, and a design flow rate of 150 cfm (.0708 m3/s). Then the design area for each diffuser is + // 150 ft3/min / 400 ft/min = .375 ft2 = .035 m2. This is adjusted each time step by + // (TotSysFlow/(NumDiffusers*.0708))*.035 + if (zoneU.DiffuserType == Diffuser::VarArea) { + DiffArea = 0.035 * TotSysFlow / (0.0708 * NumDiffusers); } - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = PowerInPlumes; - for (Ctd = 1; Ctd <= 4; ++Ctd) { - HcUCSDUF(state, ZoneNum, HeightFrac); - ConvGainsWindows = state.dataUFADManager->HAT_MXWin + state.dataUFADManager->HAT_OCWin - - state.dataUFADManager->HA_MXWin * state.dataRoomAirMod->ZTMX(ZoneNum) - - state.dataUFADManager->HA_OCWin * state.dataRoomAirMod->ZTOC(ZoneNum); - ConvGainsWindows = max(ConvGainsWindows, 0.0); - PowerInPlumes = ConvGains + state.dataUFADManager->HAT_OC - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum) + - state.dataUFADManager->HAT_MX - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum); - // NumberOfPlumes = PowerInPlumes / PowerPerPlume - NumberOfPlumes = 1.0; - if (PowerInPlumes <= 0.0) break; - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth > 0.0) { // use exterior zone formula - PowerInPlumesPerMeter = PowerInPlumes / state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth; - Gamma = (TotSysFlow * std::cos(ThrowAngle)) / (NumDiffusers * DiffArea * std::pow(0.0281 * 0.001 * PowerInPlumesPerMeter, 0.333333)); - } else { // use interior zone formula - Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / - (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); + // initial estimate of convective transfer from surfaces; assume HeightFrac is 0.5. + UFADConvCoef ufadCC; + HcUFAD(state, ZoneNum, 0.5, ufadCC); + Real64 ConvGainsWindows = ufadCC.HAT_MXWin + ufadCC.HAT_OCWin - // ZoneEquipConfig index for this UFAD zone + ufadCC.HA_MXWin * state.dataRoomAir->ZTMX(ZoneNum) - ufadCC.HA_OCWin * state.dataRoomAir->ZTOC(ZoneNum); + PowerInPlumes = ConvGains + ufadCC.HAT_OC - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum) + ufadCC.HAT_MX - + ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum); + // NumberOfPlumes = PowerInPlumes / PowerPerPlume + Real64 NumberOfPlumes = (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) ? (PowerInPlumes / PowerPerPlume) : 1.0; + Real64 NumDiffusersPerPlume = (PowerPerPlume > 0.0 && PowerInPlumes > 0.0) ? (NumDiffusers / NumberOfPlumes) : 1.0; + + if ((PowerInPlumes <= 0.0) || (TotSysFlow == 0.0) || (TSupK - Constant::KelvinConv) > thisZoneHB.MAT) { + // The system will mix + HeightFrac = 0.0; + } else { + if (PowerInPlumes > 0.0) { + if (zoneU.WinWidth > 0.0) { // exterior zone formula + PowerInPlumesPerMeter = PowerInPlumes / zoneU.WinWidth; + Gamma = + (TotSysFlow * std::cos(ThrowAngle)) / (NumDiffusers * DiffArea * std::pow(0.0281 * 0.001 * PowerInPlumesPerMeter, 0.333333)); + } else { // interior zone formula + Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / + (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); + } + } else { + Gamma = 1000.0; } - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).CalcTransHeight) { - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).WinWidth > 0.0) { // exterior zone formula + if (zoneU.CalcTransHeight) { + if (zoneU.WinWidth > 0.0) { // use exterior zone formula HeightFrac = (std::sqrt(DiffArea) * (11.03 * std::log(Gamma) - 10.73) + 0.5 * SourceHeight) / CeilingHeight; - } else { // interior zone formula + } else { // use interior zone formula HeightFrac = (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; } } else { - HeightFrac = state.dataRoomAirMod->ZoneUCSDUE(UINum).TransHeight / CeilingHeight; + HeightFrac = zoneU.TransHeight / CeilingHeight; } - HeightFrac = min(1.0, HeightFrac); - state.dataRoomAirMod->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; - GainsFrac = state.dataRoomAirMod->ZoneUCSDUE(UINum).A_Kc * std::pow(Gamma, state.dataRoomAirMod->ZoneUCSDUE(UINum).B_Kc) + - state.dataRoomAirMod->ZoneUCSDUE(UINum).C_Kc + state.dataRoomAirMod->ZoneUCSDUE(UINum).D_Kc * Gamma + - state.dataRoomAirMod->ZoneUCSDUE(UINum).E_Kc * pow_2(Gamma); + HeightFrac = max(0.0, min(1.0, HeightFrac)); + Real64 GainsFrac = zoneU.A_Kc * std::pow(Gamma, zoneU.B_Kc) + zoneU.C_Kc + zoneU.D_Kc * Gamma + zoneU.E_Kc * pow_2(Gamma); GainsFrac = max(0.7, min(GainsFrac, 1.0)); - if (state.dataRoomAirMod->ZoneUCSDUE(UINum).ShadeDown) { + if (zoneU.ShadeDown) { GainsFrac -= 0.2; } - state.dataRoomAirMod->AIRRATOC(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).Volume * - (state.dataRoomAirMod->HeightTransition(ZoneNum) - min(state.dataRoomAirMod->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * - state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - state.dataRoomAirMod->AIRRATMX(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAirMod->HeightTransition(ZoneNum)) / CeilingHeight * - state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAirMod->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; - - if (state.dataHVACGlobal->UseZoneTimeStepHistory) { - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->XM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->XM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->XMATOC(ZoneNum); - - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->XM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->XM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->XMATMX(ZoneNum); + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = PowerInPlumes; + for (int Ctd = 1; Ctd <= 4; ++Ctd) { + HcUFAD(state, ZoneNum, HeightFrac, ufadCC); + ConvGainsWindows = ufadCC.HAT_MXWin + ufadCC.HAT_OCWin - ufadCC.HA_MXWin * state.dataRoomAir->ZTMX(ZoneNum) - + ufadCC.HA_OCWin * state.dataRoomAir->ZTOC(ZoneNum); + ConvGainsWindows = max(ConvGainsWindows, 0.0); + PowerInPlumes = ConvGains + ufadCC.HAT_OC - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum) + ufadCC.HAT_MX - + ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum); + // NumberOfPlumes = PowerInPlumes / PowerPerPlume + NumberOfPlumes = 1.0; + if (PowerInPlumes <= 0.0) break; + if (zoneU.WinWidth > 0.0) { // use exterior zone formula + PowerInPlumesPerMeter = PowerInPlumes / zoneU.WinWidth; + Gamma = + (TotSysFlow * std::cos(ThrowAngle)) / (NumDiffusers * DiffArea * std::pow(0.0281 * 0.001 * PowerInPlumesPerMeter, 0.333333)); + } else { // use interior zone formula + Gamma = std::pow(TotSysFlow * std::cos(ThrowAngle), 1.5) / + (NumberOfPlumes * std::pow(NumDiffusersPerPlume * DiffArea, 1.25) * std::sqrt(0.0281 * 0.001 * PowerInPlumes)); + } + if (zoneU.CalcTransHeight) { + if (zoneU.WinWidth > 0.0) { // exterior zone formula + HeightFrac = (std::sqrt(DiffArea) * (11.03 * std::log(Gamma) - 10.73) + 0.5 * SourceHeight) / CeilingHeight; + } else { // interior zone formula + HeightFrac = + (std::sqrt(NumDiffusersPerPlume * DiffArea) * (7.43 * std::log(Gamma) - 1.35) + 0.5 * SourceHeight) / CeilingHeight; + } + } else { + HeightFrac = zoneU.TransHeight / CeilingHeight; + } + HeightFrac = min(1.0, HeightFrac); + state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight; + Real64 GainsFrac = zoneU.A_Kc * std::pow(Gamma, zoneU.B_Kc) + zoneU.C_Kc + zoneU.D_Kc * Gamma + zoneU.E_Kc * pow_2(Gamma); + GainsFrac = max(0.7, min(GainsFrac, 1.0)); + if (zoneU.ShadeDown) { + GainsFrac -= 0.2; + } + state.dataRoomAir->AIRRATOC(ZoneNum) = + state.dataHeatBal->Zone(ZoneNum).Volume * + (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * + state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + state.dataRoomAir->AIRRATMX(ZoneNum) = + state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * + state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * + PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + + if (state.dataHVACGlobal->UseZoneTimeStepHistory) { + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->XMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->XMATOC(ZoneNum)[0]; + + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->XMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->XMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->XMATMX(ZoneNum)[0]; - } else { - state.dataRoomAirMod->ZTM3OC(ZoneNum) = state.dataRoomAirMod->DSXM3TOC(ZoneNum); - state.dataRoomAirMod->ZTM2OC(ZoneNum) = state.dataRoomAirMod->DSXM2TOC(ZoneNum); - state.dataRoomAirMod->ZTM1OC(ZoneNum) = state.dataRoomAirMod->DSXMATOC(ZoneNum); + } else { + state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->DSXMATOC(ZoneNum)[2]; + state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->DSXMATOC(ZoneNum)[1]; + state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->DSXMATOC(ZoneNum)[0]; - state.dataRoomAirMod->ZTM3MX(ZoneNum) = state.dataRoomAirMod->DSXM3TMX(ZoneNum); - state.dataRoomAirMod->ZTM2MX(ZoneNum) = state.dataRoomAirMod->DSXM2TMX(ZoneNum); - state.dataRoomAirMod->ZTM1MX(ZoneNum) = state.dataRoomAirMod->DSXMATMX(ZoneNum); - } + state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->DSXMATMX(ZoneNum)[2]; + state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->DSXMATMX(ZoneNum)[1]; + state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->DSXMATMX(ZoneNum)[0]; + } - AirCap = state.dataRoomAirMod->AIRRATOC(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1OC(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2OC(ZoneNum) + - (1.0 / 3.0) * state.dataRoomAirMod->ZTM3OC(ZoneNum)); - TempDepCoef = GainsFrac * state.dataUFADManager->HA_OC + MCp_Total; - TempIndCoef = GainsFrac * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum)) + - MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (TempHistTerm + - GainsFrac * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_MX * state.dataRoomAirMod->ZTMX(ZoneNum)) + - MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult) / - ((11.0 / 6.0) * AirCap + GainsFrac * state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTOC(ZoneNum) = state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef / AirCap; - } else { - state.dataRoomAirMod->ZTOC(ZoneNum) = - (state.dataRoomAirMod->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + Real64 AirCap = state.dataRoomAir->AIRRATOC(ZoneNum); + Real64 TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMOC(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMOC(ZoneNum)[1] + + (1.0 / 3.0) * state.dataRoomAir->ZTMOC(ZoneNum)[2]); + Real64 TempDepCoef = GainsFrac * ufadCC.HA_OC + MCp_Total; + Real64 TempIndCoef = GainsFrac * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum)) + + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTOC(ZoneNum) = + (TempHistTerm + GainsFrac * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_MX * state.dataRoomAir->ZTMX(ZoneNum)) + + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult) / + ((11.0 / 6.0) * AirCap + GainsFrac * ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTOC(ZoneNum) = state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef / AirCap; + } else { + state.dataRoomAir->ZTOC(ZoneNum) = + (state.dataRoomAir->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTOC(ZoneNum) = (AirCap * state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTOC(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - AirCap = state.dataRoomAirMod->AIRRATMX(ZoneNum); - TempHistTerm = AirCap * (3.0 * state.dataRoomAirMod->ZTM1MX(ZoneNum) - (3.0 / 2.0) * state.dataRoomAirMod->ZTM2MX(ZoneNum) + - (1.0 / 3.0) * state.dataRoomAirMod->ZTM3MX(ZoneNum)); - TempDepCoef = (1.0 - GainsFrac) * state.dataUFADManager->HA_MX + MCp_Total; - TempIndCoef = (1.0 - GainsFrac) * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum)) + - state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - state.dataRoomAirMod->ZTMX(ZoneNum) = - (TempHistTerm + - (1.0 - GainsFrac) * (ConvGains + state.dataUFADManager->HAT_OC + state.dataUFADManager->HAT_MX - - state.dataUFADManager->HA_OC * state.dataRoomAirMod->ZTOC(ZoneNum)) + - state.dataRoomAirMod->ZTOC(ZoneNum) * MCp_Total) / - ((11.0 / 6.0) * AirCap + (1.0 - GainsFrac) * state.dataUFADManager->HA_MX + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - state.dataRoomAirMod->ZTMX(ZoneNum) = state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef / AirCap; - } else { - state.dataRoomAirMod->ZTMX(ZoneNum) = - (state.dataRoomAirMod->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + - TempIndCoef / TempDepCoef; + AirCap = state.dataRoomAir->AIRRATMX(ZoneNum); + TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMMX(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMMX(ZoneNum)[1] + + (1.0 / 3.0) * state.dataRoomAir->ZTMMX(ZoneNum)[2]); + TempDepCoef = (1.0 - GainsFrac) * ufadCC.HA_MX + MCp_Total; + TempIndCoef = (1.0 - GainsFrac) * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum)) + + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + state.dataRoomAir->ZTMX(ZoneNum) = + (TempHistTerm + + (1.0 - GainsFrac) * (ConvGains + ufadCC.HAT_OC + ufadCC.HAT_MX - ufadCC.HA_OC * state.dataRoomAir->ZTOC(ZoneNum)) + + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total) / + ((11.0 / 6.0) * AirCap + (1.0 - GainsFrac) * ufadCC.HA_MX + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + state.dataRoomAir->ZTMX(ZoneNum) = state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef / AirCap; + } else { + state.dataRoomAir->ZTMX(ZoneNum) = + (state.dataRoomAir->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + state.dataRoomAir->ZTMX(ZoneNum) = (AirCap * state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - state.dataRoomAirMod->ZTMX(ZoneNum) = (AirCap * state.dataRoomAirMod->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + state.dataRoomAir->ZTFloor(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } + if (PowerInPlumes <= 0.0) { + HeightFrac = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = 0.0; + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows(ZoneNum) = 0.0; + } else { + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + state.dataRoomAir->ZoneUFADGamma(ZoneNum) = Gamma; + state.dataRoomAir->ZoneUFADPowInPlumes(ZoneNum) = PowerInPlumes; + state.dataRoomAir->ZoneUFADPowInPlumesfromWindows(ZoneNum) = ConvGainsWindows; } - state.dataRoomAirMod->ZTFloor(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); } - if (PowerInPlumes <= 0.0) { + + //=============================== M I X E D Calculation ============================================== + if (state.dataRoomAir->ZTMX(ZoneNum) < state.dataRoomAir->ZTOC(ZoneNum) || MCp_Total <= 0.0 || + HeightFrac * CeilingHeight < state.dataUFADManager->ThickOccupiedSubzoneMin) { + MIXFLAG = true; HeightFrac = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = 0.0; - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows(ZoneNum) = 0.0; - } else { - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - state.dataRoomAirMod->ZoneUFGamma(ZoneNum) = Gamma; - state.dataRoomAirMod->ZoneUFPowInPlumes(ZoneNum) = PowerInPlumes; - state.dataRoomAirMod->ZoneUFPowInPlumesfromWindows(ZoneNum) = ConvGainsWindows; - } - } + Real64 const thisZoneT1 = thisZoneHB.ZoneT1; - //=============================== M I X E D Calculation ============================================== - if (state.dataRoomAirMod->ZTMX(ZoneNum) < state.dataRoomAirMod->ZTOC(ZoneNum) || MCp_Total <= 0.0 || - HeightFrac * CeilingHeight < state.dataUFADManager->ThickOccupiedSubzoneMin) { - MIXFLAG = true; - HeightFrac = 0.0; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; - - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->MaxTempGrad(ZoneNum) = 0.0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - Real64 AirCap = thisZoneHB.AirPowerCap; - TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + (1.0 / 3.0) * thisZoneHB.ZTM[2]); - - for (Ctd = 1; Ctd <= 3; ++Ctd) { - TempDepCoef = state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total; - TempIndCoef = ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + Real64 AirCap = thisZoneHB.AirPowerCap; + Real64 TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + (1.0 / 3.0) * thisZoneHB.ZTM[2]); + + for (int Ctd = 1; Ctd <= 3; ++Ctd) { + Real64 TempDepCoef = ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total; + Real64 TempIndCoef = ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total) / + ((11.0 / 6.0) * AirCap + ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; + } else { + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; - } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; - HcUCSDUF(state, ZoneNum, HeightFrac); - TempDepCoef = state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total; - TempIndCoef = ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total; - switch (state.dataHeatBal->ZoneAirSolutionAlgo) { - case DataHeatBalance::SolutionAlgo::ThirdOrder: { - ZTAveraged = (TempHistTerm + ConvGains + state.dataUFADManager->HAT_MX + state.dataUFADManager->HAT_OC + MCpT_Total) / - ((11.0 / 6.0) * AirCap + state.dataUFADManager->HA_MX + state.dataUFADManager->HA_OC + MCp_Total); - } break; - case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (TempDepCoef == 0.0) { // B=0 - ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; - } else { - ZTAveraged = (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; + HcUFAD(state, ZoneNum, HeightFrac, ufadCC); + TempDepCoef = ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total; + TempIndCoef = ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total; + switch (state.dataHeatBal->ZoneAirSolutionAlgo) { + case DataHeatBalance::SolutionAlgo::ThirdOrder: { + ZTAveraged = (TempHistTerm + ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total) / + ((11.0 / 6.0) * AirCap + ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { + if (TempDepCoef == 0.0) { // B=0 + ZTAveraged = thisZoneT1 + TempIndCoef / AirCap; + } else { + ZTAveraged = + (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef; + } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { + ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); + } break; + default: + break; } - } break; - case DataHeatBalance::SolutionAlgo::EulerMethod: { - ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef); - } break; - default: - break; + state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged; + state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged; } - state.dataRoomAirMod->ZTOC(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTMX(ZoneNum) = ZTAveraged; - state.dataRoomAirMod->ZTFloor(ZoneNum) = ZTAveraged; } - } - //========================================================================================= - - // Comfort temperature and temperature at the thermostat/temperature control sensor - - HeightUpSubzoneAve = (CeilingHeight + state.dataRoomAirMod->HeightTransition(ZoneNum)) / 2.0; - HeightOccupiedSubzoneAve = state.dataRoomAirMod->HeightTransition(ZoneNum) / 2.0; - // Comfort temperature - - if (MIXFLAG) { - state.dataRoomAirMod->TCMF(ZoneNum) = ZTAveraged; - } else { - if (HeightComfort < HeightOccupiedSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightUpSubzoneAve) { - state.dataRoomAirMod->TCMF(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightComfort) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / - (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightComfort >= HeightUpSubzoneAve && HeightComfort <= CeilingHeight) { - state.dataRoomAirMod->TCMF(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + //========================================================================================= + + // Comfort temperature and temperature at the thermostat/temperature control sensor + + Real64 HeightUpSubzoneAve = (CeilingHeight + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0; + Real64 HeightOccupiedSubzoneAve = state.dataRoomAir->HeightTransition(ZoneNum) / 2.0; + // Comfort temperature + + if (MIXFLAG) { + state.dataRoomAir->TCMF(ZoneNum) = ZTAveraged; } else { - ShowFatalError(state, format("UFAD comfort height is above ceiling or below floor in Zone: {}", state.dataHeatBal->Zone(ZoneNum).Name)); + if (HeightComfort < HeightOccupiedSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightUpSubzoneAve) { + state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightComfort) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) / + (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightComfort >= HeightUpSubzoneAve && HeightComfort <= CeilingHeight) { + state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, + format("UFAD comfort height is above ceiling or below floor in Zone: {}", state.dataHeatBal->Zone(ZoneNum).Name)); + } } - } - // Temperature at the thermostat/temperature control sensor - - if (MIXFLAG) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; - } else { - if (HeightThermostat < HeightOccupiedSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTOC(ZoneNum); - } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightUpSubzoneAve) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightThermostat) + - state.dataRoomAirMod->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / - (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else if (HeightThermostat >= HeightUpSubzoneAve && HeightThermostat <= CeilingHeight) { - state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAirMod->ZTMX(ZoneNum); + // Temperature at the thermostat/temperature control sensor + + if (MIXFLAG) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged; } else { - ShowFatalError(state, - format("Underfloor air distribution thermostat height is above ceiling or below floor in Zone: {}", - state.dataHeatBal->Zone(ZoneNum).Name)); + if (HeightThermostat < HeightOccupiedSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum); + } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightUpSubzoneAve) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightUpSubzoneAve - HeightThermostat) + + state.dataRoomAir->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) / + (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); + } else if (HeightThermostat >= HeightUpSubzoneAve && HeightThermostat <= CeilingHeight) { + state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum); + } else { + ShowFatalError(state, + format("Underfloor air distribution thermostat height is above ceiling or below floor in Zone: {}", + state.dataHeatBal->Zone(ZoneNum).Name)); + } } - } - // Temperature gradients - if ((HeightUpSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = - (state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) / (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); - } else { - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - } + // Temperature gradients + if ((HeightUpSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) { + state.dataRoomAir->AvgTempGrad(ZoneNum) = + (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) / (HeightUpSubzoneAve - HeightOccupiedSubzoneAve); + } else { + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + } - if (MIXFLAG) { - state.dataRoomAirMod->ZoneUFMixedFlag(ZoneNum) = 1; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = false; - } else { - state.dataRoomAirMod->ZoneUFMixedFlag(ZoneNum) = 0; - state.dataRoomAirMod->AirModel(ZoneNum).SimAirModel = true; - } + if (MIXFLAG) { + state.dataRoomAir->ZoneUFADMixedFlag(ZoneNum) = 1; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; + } else { + state.dataRoomAir->ZoneUFADMixedFlag(ZoneNum) = 0; + state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true; + } - if (ZoneEquipConfigNum > 0) { - ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; - state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAirMod->ZTMX(ZoneNum); - } + if (ZoneEquipConfigNum > 0) { + int ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; + state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAir->ZTMX(ZoneNum); + } - if (MIXFLAG) { - state.dataRoomAirMod->Phi(ZoneNum) = 1.0; - } else { - state.dataRoomAirMod->Phi(ZoneNum) = (state.dataRoomAirMod->ZTOC(ZoneNum) - (TSupK - Constant::KelvinConv)) / - (state.dataRoomAirMod->ZTMX(ZoneNum) - (TSupK - Constant::KelvinConv)); - } + if (MIXFLAG) { + state.dataRoomAir->Phi(ZoneNum) = 1.0; + } else { + state.dataRoomAir->Phi(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) - (TSupK - Constant::KelvinConv)) / + (state.dataRoomAir->ZTMX(ZoneNum) - (TSupK - Constant::KelvinConv)); + } - // Mixed for reporting purposes - if ((MIXFLAG) || ((state.dataRoomAirMod->ZTMX(ZoneNum) - state.dataRoomAirMod->ZTOC(ZoneNum)) < TempDiffCritRep)) { - state.dataRoomAirMod->ZoneUFMixedFlagRep(ZoneNum) = 1.0; - state.dataRoomAirMod->HeightTransition(ZoneNum) = 0.0; - state.dataRoomAirMod->AvgTempGrad(ZoneNum) = 0.0; - } else { - state.dataRoomAirMod->ZoneUFMixedFlagRep(ZoneNum) = 0.0; + // Mixed for reporting purposes + if ((MIXFLAG) || ((state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) < TempDiffCritRep)) { + state.dataRoomAir->ZoneUFADMixedFlagRep(ZoneNum) = 1.0; + state.dataRoomAir->HeightTransition(ZoneNum) = 0.0; + state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; + } else { + state.dataRoomAir->ZoneUFADMixedFlagRep(ZoneNum) = 0.0; + } } -} -} // namespace EnergyPlus::UFADManager +} // namespace RoomAir +} // namespace EnergyPlus diff --git a/src/EnergyPlus/UFADManager.hh b/src/EnergyPlus/UFADManager.hh index 707f05d1122..634f0620b14 100644 --- a/src/EnergyPlus/UFADManager.hh +++ b/src/EnergyPlus/UFADManager.hh @@ -57,44 +57,48 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace UFADManager { +namespace RoomAir { - void ManageUCSDUFModels(EnergyPlusData &state, - int const ZoneNum, // index number for the specified zone - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 + struct UFADConvCoef + { + Real64 HAT_MX = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone + Real64 HAT_MXWin = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone (windows only) + Real64 HA_MX = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone + Real64 HA_MXWin = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone (windows only) + Real64 HAT_OC = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone + Real64 HAT_OCWin = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone (windows only) + Real64 HA_OC = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone + Real64 HA_OCWin = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone (windows only) + Real64 HAT_FLOOR = 0.0; // HAT_FLOOR Convection Coefficient times Area times Temperature for the floor(?) subzone + Real64 HA_FLOOR = 0.0; // HA_FLOOR Convection Coefficient times Area for the floor(?) subzone + }; + + void ManageUFAD(EnergyPlusData &state, + int const ZoneNum, // index number for the specified zone + RoomAir::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 ); - void InitUCSDUF(EnergyPlusData &state, - int const ZoneNum, - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 + void InitUFAD(EnergyPlusData &state, + int const ZoneNum, + RoomAir::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 ); - void SizeUCSDUF(EnergyPlusData &state, - int const ZoneNum, - DataRoomAirModel::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 + void SizeUFAD(EnergyPlusData &state, + int const ZoneNum, + RoomAir::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 ); - void HcUCSDUF(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight); + void HcUFAD(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight, UFADConvCoef &ufadCC); - void CalcUCSDUI(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone + void CalcUFADInt(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone - void CalcUCSDUE(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone + void CalcUFADExt(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone -} // namespace UFADManager +} // namespace RoomAir struct UFADManagerData : BaseGlobalStruct { - Real64 HAT_MX = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone - Real64 HAT_MXWin = 0.0; // HAT_MX Convection Coefficient times Area times Temperature for the upper subzone (windows only) - Real64 HA_MX = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone - Real64 HA_MXWin = 0.0; // HA_MX Convection Coefficient times Area for the upper subzone (windows only) - Real64 HAT_OC = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone - Real64 HAT_OCWin = 0.0; // HAT_OC Convection Coefficient times Area times Temperature for the lower subzone (windows only) - Real64 HA_OC = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone - Real64 HA_OCWin = 0.0; // HA_OC Convection Coefficient times Area for the lower subzone (windows only) - Real64 HAT_FLOOR = 0.0; // HAT_FLOOR Convection Coefficient times Area times Temperature for the floor(?) subzone - Real64 HA_FLOOR = 0.0; // HA_FLOOR Convection Coefficient times Area for the floor(?) subzone Real64 HeightFloorSubzoneTop = 0.2; // Assumed thickness of floor subzone Real64 ThickOccupiedSubzoneMin = 0.2; // Minimum thickness of occupied subzone Real64 HeightIntMass = 0.0; // Height of internal mass surfaces, assumed vertical, cannot exceed ceiling height diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 349c2e454ae..d36031eef59 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -469,7 +469,7 @@ namespace UnitHeater { // Heating coil information: { state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type = - static_cast(getEnumerationValue(HCoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(Alphas(7)))); + static_cast(getEnumValue(HCoilTypeNamesUC, UtilityRoutines::makeUPPER(Alphas(7)))); switch (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type) { case HCoilType::WaterHeatingCoil: state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -800,14 +800,13 @@ namespace UnitHeater { } if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::UnitHeater).ZoneCompAvailMgrs(UnitHeatNum); if (state.dataUnitHeaters->MyZoneEqFlag(UnitHeatNum)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::UnitHeater).ZoneCompAvailMgrs(UnitHeatNum).AvailManagerListName = - state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::UnitHeater).ZoneCompAvailMgrs(UnitHeatNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataUnitHeaters->MyZoneEqFlag(UnitHeatNum) = false; } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailStatus = - ZoneComp(DataZoneEquipment::ZoneEquip::UnitHeater).ZoneCompAvailMgrs(UnitHeatNum).AvailStatus; + state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailStatus = availMgr.AvailStatus; } if (state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum) && allocated(state.dataPlnt->PlantLoop)) { diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index c19ecbb6840..cb6da9c0af0 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -306,7 +306,7 @@ namespace UnitVentilator { cHeatingCoilType = ""; { - unitVent.OAControlType = (OAControl)getEnumerationValue(OAControlNamesUC, Alphas(3)); + unitVent.OAControlType = (OAControl)getEnumValue(OAControlNamesUC, Alphas(3)); switch (unitVent.OAControlType) { case OAControl::VariablePercent: case OAControl::FixedAmount: { @@ -376,7 +376,8 @@ namespace UnitVentilator { if (unitVent.ATMixerType == DataHVACGlobals::ATMixer_InletSide || unitVent.ATMixerType == DataHVACGlobals::ATMixer_SupplySide) { unitVent.ATMixerExists = true; } - unitVent.ZonePtr = DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquip::UnitVentilator, unitVent.Name); + unitVent.ZonePtr = + DataZoneEquipment::GetZoneEquipControlledZoneNum(state, DataZoneEquipment::ZoneEquipType::UnitVentilator, unitVent.Name); if (unitVent.ZonePtr == 0) { ErrorsFound = true; } @@ -590,7 +591,7 @@ namespace UnitVentilator { } } - unitVent.CoilOption = (CoilsUsed)getEnumerationValue(CoilsUsedNamesUC, Alphas(13)); + unitVent.CoilOption = (CoilsUsed)getEnumValue(CoilsUsedNamesUC, Alphas(13)); unitVent.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(14)); // Default to cycling fan when fan mode schedule is not present @@ -624,8 +625,8 @@ namespace UnitVentilator { unitVent.HCoilPresent = true; cHeatingCoilType = Alphas(15); unitVent.HCoilTypeCh = cHeatingCoilType; - unitVent.HCoilType = (HeatCoilType)getEnumerationValue(HeatCoilTypeNamesUC, cHeatingCoilType); - unitVent.HeatingCoilType = (DataPlant::PlantEquipmentType)getEnumerationValue(DataPlant::PlantEquipTypeNamesUC, cHeatingCoilType); + unitVent.HCoilType = (HeatCoilType)getEnumValue(HeatCoilTypeNamesUC, cHeatingCoilType); + unitVent.HeatingCoilType = (DataPlant::PlantEquipmentType)getEnumValue(DataPlant::PlantEquipTypeNamesUC, cHeatingCoilType); unitVent.HCoilName = Alphas(16); ValidateComponent(state, cHeatingCoilType, unitVent.HCoilName, IsNotOK, CurrentModuleObject); @@ -673,8 +674,8 @@ namespace UnitVentilator { cCoolingCoilType = Alphas(17); unitVent.CCoilTypeCh = cCoolingCoilType; - unitVent.CCoilType = (CoolCoilType)getEnumerationValue(CoolCoilTypeNamesUC, cCoolingCoilType); - unitVent.CoolingCoilType = (DataPlant::PlantEquipmentType)getEnumerationValue(DataPlant::PlantEquipTypeNamesUC, cCoolingCoilType); + unitVent.CCoilType = (CoolCoilType)getEnumValue(CoolCoilTypeNamesUC, cCoolingCoilType); + unitVent.CoolingCoilType = (DataPlant::PlantEquipmentType)getEnumValue(DataPlant::PlantEquipTypeNamesUC, cCoolingCoilType); unitVent.CCoilPlantName = Alphas(18); if (cCoolingCoilType == "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED") { @@ -1103,13 +1104,13 @@ namespace UnitVentilator { } if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::UnitVentilator).ZoneCompAvailMgrs(UnitVentNum); if (state.dataUnitVentilators->MyZoneEqFlag(UnitVentNum)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::UnitVentilator).ZoneCompAvailMgrs(UnitVentNum).AvailManagerListName = - unitVent.AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::UnitVentilator).ZoneCompAvailMgrs(UnitVentNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = unitVent.AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataUnitVentilators->MyZoneEqFlag(UnitVentNum) = false; } - unitVent.AvailStatus = ZoneComp(DataZoneEquipment::ZoneEquip::UnitVentilator).ZoneCompAvailMgrs(UnitVentNum).AvailStatus; + unitVent.AvailStatus = availMgr.AvailStatus; } if (state.dataUnitVentilators->MyPlantScanFlag(UnitVentNum) && allocated(state.dataPlnt->PlantLoop)) { diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 14c02d3793e..1e1ba4fcdae 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -260,14 +260,14 @@ namespace UnitarySystems { std::string const &thisObjectName = instance.key(); DesignSpecMSHP thisDesignSpec; - thisDesignSpec.name = UtilityRoutines::MakeUPPERCase(thisObjectName); + thisDesignSpec.name = UtilityRoutines::makeUPPER(thisObjectName); thisDesignSpec.numOfSpeedHeating = fields.at("number_of_speeds_for_heating").get(); // required field thisDesignSpec.numOfSpeedCooling = fields.at("number_of_speeds_for_cooling").get(); // required field int maxSpeeds = max(thisDesignSpec.numOfSpeedHeating, thisDesignSpec.numOfSpeedCooling); thisDesignSpec.m_DesignSpecMSHPType_Num = 1; // add global int value for factory if (fields.find("single_mode_operation") != fields.end()) { // not required field - std::string loc_m_SingleModeOp = UtilityRoutines::MakeUPPERCase(fields.at("single_mode_operation").get()); + std::string loc_m_SingleModeOp = UtilityRoutines::makeUPPER(fields.at("single_mode_operation").get()); if (UtilityRoutines::SameString(loc_m_SingleModeOp, "Yes")) thisDesignSpec.m_SingleModeFlag = true; } @@ -382,16 +382,16 @@ namespace UnitarySystems { // need to move to better location and save thisObjectIndex and thisObjectType in struct // this->m_EquipCompNum is by parent type, not total UnitarySystems // e.g., PTAC = 1,2,3; PTHP = 1,2; PTWSHP = 1,2,3,4; UnitarySystems = 9 total - DataZoneEquipment::ZoneEquip thisObjectType = DataZoneEquipment::ZoneEquip::Invalid; + DataZoneEquipment::ZoneEquipType thisObjectType = DataZoneEquipment::ZoneEquipType::Invalid; switch (this->m_sysType) { case SysType::PackagedAC: - thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir; + thisObjectType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; break; case SysType::PackagedHP: - thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir; + thisObjectType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump; break; case SysType::PackagedWSHP: - thisObjectType = DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir; + thisObjectType = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir; break; default: break; @@ -2171,11 +2171,11 @@ namespace UnitarySystems { this->m_CoolingCoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed) { WaterCoils::SimulateWaterCoilComponents( state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex, QActual, this->m_FanOpMode, 1.0); - EqSizing.DesCoolingLoad = WaterCoils::GetWaterCoilCapacity( - state, - UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)), - this->m_CoolingCoilName, - ErrFound); + EqSizing.DesCoolingLoad = + WaterCoils::GetWaterCoilCapacity(state, + UtilityRoutines::makeUPPER(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)), + this->m_CoolingCoilName, + ErrFound); } } this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.DesCoolingLoad; @@ -2188,11 +2188,11 @@ namespace UnitarySystems { if (this->m_HeatingCoilType_Num == DataHVACGlobals::Coil_HeatingWater) { WaterCoils::SimulateWaterCoilComponents( state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex, QActual, this->m_FanOpMode, 1.0); - EqSizing.DesHeatingLoad = WaterCoils::GetWaterCoilCapacity( - state, - UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)), - this->m_HeatingCoilName, - ErrFound); + EqSizing.DesHeatingLoad = + WaterCoils::GetWaterCoilCapacity(state, + UtilityRoutines::makeUPPER(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)), + this->m_HeatingCoilName, + ErrFound); } } this->m_MaxNoCoolHeatAirVolFlow *= EqSizing.DesHeatingLoad; @@ -3032,7 +3032,7 @@ namespace UnitarySystems { state, this->m_CoolingCoilName, FirstHVACIteration, this->m_CoolingCoilIndex, QActual, this->m_FanOpMode, 1.0); state.dataSize->DataConstantUsedForSizing = WaterCoils::GetWaterCoilCapacity(state, - UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)), + UtilityRoutines::makeUPPER(DataHVACGlobals::cAllCoilTypes(this->m_CoolingCoilType_Num)), this->m_CoolingCoilName, ErrFound); EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing; @@ -3047,7 +3047,7 @@ namespace UnitarySystems { HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( state, blankString, true, DataHVACGlobals::CompressorOperation::On, 1.0, this->m_CoolingCoilIndex, 1, false, 1.0, false); state.dataSize->DataConstantUsedForSizing = WaterCoils::GetWaterCoilCapacity( - state, UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType)), HXCoilName, ErrFound); + state, UtilityRoutines::makeUPPER(DataHVACGlobals::cAllCoilTypes(ActualCoolCoilType)), HXCoilName, ErrFound); EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing; state.dataSize->DataFractionUsedForSizing = 1.0; SizingMethod = DataHVACGlobals::AutoCalculateSizing; @@ -3151,7 +3151,7 @@ namespace UnitarySystems { state, this->m_HeatingCoilName, FirstHVACIteration, this->m_HeatingCoilIndex, QActual, this->m_FanOpMode, 1.0); state.dataSize->DataConstantUsedForSizing = WaterCoils::GetWaterCoilCapacity(state, - UtilityRoutines::MakeUPPERCase(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)), + UtilityRoutines::makeUPPER(DataHVACGlobals::cAllCoilTypes(this->m_HeatingCoilType_Num)), this->m_HeatingCoilName, ErrFound); EqSizing.DesHeatingLoad = state.dataSize->DataConstantUsedForSizing; @@ -3470,9 +3470,9 @@ namespace UnitarySystems { std::string const &cCurrentModuleObject = input_data.system_type; DataLoopNode::ConnectionObjectType objType = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(input_data.system_type))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(input_data.system_type))); std::string const &thisObjectName = input_data.name; - this->Name = UtilityRoutines::MakeUPPERCase(thisObjectName); + this->Name = UtilityRoutines::makeUPPER(thisObjectName); sysNum = getUnitarySystemIndex(state, thisObjectName); this->m_UnitarySysNum = sysNum; @@ -3673,7 +3673,7 @@ namespace UnitarySystems { constexpr static std::array(UnitarySysCtrlType::Num)> UnitarySysCtrlTypeNamesUC = { "NONE", "LOAD", "SETPOINT", "SINGLEZONEVAV"}; this->m_ControlType = - static_cast(getEnumerationValue(UnitarySysCtrlTypeNamesUC, UtilityRoutines::MakeUPPERCase(input_data.control_type))); + static_cast(getEnumValue(UnitarySysCtrlTypeNamesUC, UtilityRoutines::makeUPPER(input_data.control_type))); if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) { this->m_ValidASHRAECoolCoil = true; this->m_ValidASHRAEHeatCoil = true; @@ -4094,7 +4094,7 @@ namespace UnitarySystems { if (!ZoneEquipment) BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, - UtilityRoutines::MakeUPPERCase(thisObjectName), + UtilityRoutines::makeUPPER(thisObjectName), input_data.air_inlet_node_name, input_data.air_outlet_node_name, "Air Nodes"); @@ -4188,7 +4188,7 @@ namespace UnitarySystems { } constexpr static std::array(FanPlace::Num)> FanPlaceNamesUC = {"NOTYETSET", "BLOWTHROUGH", "DRAWTHROUGH"}; - this->m_FanPlace = static_cast(getEnumerationValue(FanPlaceNamesUC, UtilityRoutines::MakeUPPERCase(input_data.fan_placement))); + this->m_FanPlace = static_cast(getEnumValue(FanPlaceNamesUC, UtilityRoutines::makeUPPER(input_data.fan_placement))); if ((this->m_FanPlace == FanPlace::NotYetSet || this->m_FanPlace == FanPlace::Invalid) && this->m_FanExists) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); ShowContinueError(state, format("Illegal Fan Placement = {}", input_data.fan_placement)); @@ -7044,7 +7044,7 @@ namespace UnitarySystems { int numCoilSystemDX = 0; for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object @@ -7066,38 +7066,38 @@ namespace UnitarySystems { thisSys.input_specs.system_type = cCurrentModuleObject; if (fields.find("availability_schedule_name") != fields.end()) { // not required field thisSys.input_specs.availability_schedule_name = - UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get()); + UtilityRoutines::makeUPPER(fields.at("availability_schedule_name").get()); } thisSys.input_specs.air_inlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_inlet_node_name").get()); // required field + UtilityRoutines::makeUPPER(fields.at("dx_cooling_coil_system_inlet_node_name").get()); // required field thisSys.input_specs.air_outlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_outlet_node_name").get()); // required field + UtilityRoutines::makeUPPER(fields.at("dx_cooling_coil_system_outlet_node_name").get()); // required field thisSys.input_specs.dx_cooling_coil_system_sensor_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("dx_cooling_coil_system_sensor_node_name").get()); // required field + UtilityRoutines::makeUPPER(fields.at("dx_cooling_coil_system_sensor_node_name").get()); // required field thisSys.input_specs.cooling_coil_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get()); // required field + UtilityRoutines::makeUPPER(fields.at("cooling_coil_object_type").get()); // required field thisSys.input_specs.cooling_coil_name = - UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get()); // required field + UtilityRoutines::makeUPPER(fields.at("cooling_coil_name").get()); // required field // min-fields = 7, begin optional inputs if (fields.find("dehumidification_control_type") != fields.end()) { // not required field thisSys.input_specs.dehumidification_control_type = - UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get()); + UtilityRoutines::makeUPPER(fields.at("dehumidification_control_type").get()); } else { // find default value thisSys.input_specs.dehumidification_control_type = "None"; } std::string loc_RunOnSensLoad(""); if (fields.find("run_on_sensible_load") != fields.end()) { // not required field - loc_RunOnSensLoad = UtilityRoutines::MakeUPPERCase(fields.at("run_on_sensible_load").get()); + loc_RunOnSensLoad = UtilityRoutines::makeUPPER(fields.at("run_on_sensible_load").get()); } else { // find default value loc_RunOnSensLoad = "YES"; } std::string loc_RunOnLatLoad(""); if (fields.find("run_on_latent_load") != fields.end()) { // not required field - loc_RunOnLatLoad = UtilityRoutines::MakeUPPERCase(fields.at("run_on_latent_load").get()); + loc_RunOnLatLoad = UtilityRoutines::makeUPPER(fields.at("run_on_latent_load").get()); } else { // find default value loc_RunOnLatLoad = "NO"; @@ -7113,7 +7113,7 @@ namespace UnitarySystems { if (fields.find("use_outdoor_air_dx_cooling_coil") != fields.end()) { // not required field thisSys.input_specs.use_doas_dx_cooling_coil = - UtilityRoutines::MakeUPPERCase(fields.at("use_outdoor_air_dx_cooling_coil").get()); + UtilityRoutines::makeUPPER(fields.at("use_outdoor_air_dx_cooling_coil").get()); } else { // find default value thisSys.input_specs.use_doas_dx_cooling_coil = "NO"; @@ -7154,7 +7154,7 @@ namespace UnitarySystems { { std::string cCurrentModuleObject = "ZoneHVAC:PackagedTerminalAirConditioner"; SysType sysTypeNum = SysType::PackagedAC; - DataZoneEquipment::ZoneEquip zoneEqType = DataZoneEquipment::ZoneEquip::Invalid; + DataZoneEquipment::ZoneEquipType zoneEqType = DataZoneEquipment::ZoneEquipType::Invalid; int numPTAC = 0; int numPTHP = 0; int numPTWSHP = 0; @@ -7162,11 +7162,11 @@ namespace UnitarySystems { for (int getPTUnitType = 1; getPTUnitType <= 3; ++getPTUnitType) { if (getPTUnitType == 2) { sysTypeNum = SysType::PackagedHP; - zoneEqType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir; + zoneEqType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; cCurrentModuleObject = "ZoneHVAC:PackagedTerminalHeatPump"; } else if (getPTUnitType == 3) { sysTypeNum = SysType::PackagedWSHP; - zoneEqType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir; + zoneEqType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; cCurrentModuleObject = "ZoneHVAC:WaterToAirHeatPump"; } auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); @@ -7175,7 +7175,7 @@ namespace UnitarySystems { auto const &objectSchemaProps = ip->getObjectSchemaProps(state, cCurrentModuleObject); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object @@ -7285,7 +7285,7 @@ namespace UnitarySystems { thisSys.UnitType = cCurrentModuleObject; thisSys.m_sysType = sysTypeNum; - thisSys.ZoneEqType = zoneEqType; + thisSys.zoneEquipType = zoneEqType; // TODO: figure out another way to set this next variable // Unitary System will not turn on unless this mode is set OR a different method is used to set air flow rate @@ -7295,11 +7295,11 @@ namespace UnitarySystems { if (sysNum == -1) { // zone equipment require a 1-n index for access to zone availability managers switch (getPTUnitType) { - case 1: + case 1: // Excuse me? ++numPTAC; thisSys.m_EquipCompNum = numPTAC; break; - case 2: + case 2: // Baking powder? ++numPTHP; thisSys.m_EquipCompNum = numPTHP; break; @@ -7349,7 +7349,7 @@ namespace UnitarySystems { for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); if (!UtilityRoutines::SameString(CoilSysName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue; @@ -7366,21 +7366,20 @@ namespace UnitarySystems { thisSys.input_specs.name = thisObjectName; thisSys.input_specs.system_type = cCurrentModuleObject; thisSys.input_specs.control_type = "Setpoint"; - thisSys.input_specs.air_inlet_node_name = UtilityRoutines::MakeUPPERCase(fields.at("air_inlet_node_name").get()); - thisSys.input_specs.air_outlet_node_name = UtilityRoutines::MakeUPPERCase(fields.at("air_outlet_node_name").get()); + thisSys.input_specs.air_inlet_node_name = UtilityRoutines::makeUPPER(fields.at("air_inlet_node_name").get()); + thisSys.input_specs.air_outlet_node_name = UtilityRoutines::makeUPPER(fields.at("air_outlet_node_name").get()); std::string availScheduleName(""); if (fields.find("availability_schedule_name") != fields.end()) { // not required field, has default value of Always On - availScheduleName = UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get()); + availScheduleName = UtilityRoutines::makeUPPER(fields.at("availability_schedule_name").get()); } thisSys.input_specs.availability_schedule_name = availScheduleName; - thisSys.input_specs.cooling_coil_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get()); - thisSys.input_specs.cooling_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get()); + thisSys.input_specs.cooling_coil_object_type = UtilityRoutines::makeUPPER(fields.at("cooling_coil_object_type").get()); + thisSys.input_specs.cooling_coil_name = UtilityRoutines::makeUPPER(fields.at("cooling_coil_name").get()); // why is this cooling coil does not have a field for Design Air Vol Flow Rate // set it "SupplyAirFlowRate" to avoid blank, which lead to fatal out during get input static constexpr std::string_view loc_cooling_coil_object_type("COIL:COOLING:WATER:DETAILEDGEOMETRY"); if (UtilityRoutines::SameString(loc_cooling_coil_object_type, thisSys.input_specs.cooling_coil_object_type)) { - thisSys.input_specs.cooling_supply_air_flow_rate_method = UtilityRoutines::MakeUPPERCase("SupplyAirFlowRate"); + thisSys.input_specs.cooling_supply_air_flow_rate_method = UtilityRoutines::makeUPPER("SupplyAirFlowRate"); thisSys.input_specs.cooling_supply_air_flow_rate = DataSizing::AutoSize; } // optional input fields @@ -7389,7 +7388,7 @@ namespace UnitarySystems { } if (fields.find("dehumidification_control_type") != fields.end()) { thisSys.input_specs.dehumidification_control_type = - UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get()); + UtilityRoutines::makeUPPER(fields.at("dehumidification_control_type").get()); } else { thisSys.input_specs.dehumidification_control_type = "None"; } @@ -7435,7 +7434,7 @@ namespace UnitarySystems { } std::string HRWaterCoolingCoilName; if (fields.find("companion_coil_used_for_heat_recovery") != fields.end()) { - HRWaterCoolingCoilName = UtilityRoutines::MakeUPPERCase(fields.at("companion_coil_used_for_heat_recovery").get()); + HRWaterCoolingCoilName = UtilityRoutines::makeUPPER(fields.at("companion_coil_used_for_heat_recovery").get()); thisSys.m_WaterHRPlantLoopModel = true; } if (thisSys.m_WaterHRPlantLoopModel) { @@ -7445,7 +7444,7 @@ namespace UnitarySystems { thisSys.m_HRcoolCoilFluidInletNode = WaterCoils::GetCoilWaterInletNode(state, HRcoolingCoilType, HRWaterCoolingCoilName, errFound); int HRCoilIndex = - WaterCoils::GetWaterCoilIndex(state, UtilityRoutines::MakeUPPERCase(HRcoolingCoilType), HRWaterCoolingCoilName, errFound); + WaterCoils::GetWaterCoilIndex(state, UtilityRoutines::makeUPPER(HRcoolingCoilType), HRWaterCoolingCoilName, errFound); bool heatRecoveryCoil = true; // use local here to highlight where this parameter is set WaterCoils::SetWaterCoilData(state, HRCoilIndex, errFound, _, _, heatRecoveryCoil); if (errFound) { @@ -7497,7 +7496,7 @@ namespace UnitarySystems { auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object if (!UtilityRoutines::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue; @@ -7522,59 +7521,57 @@ namespace UnitarySystems { thisSys.input_specs.control_type = fields.at("control_type").get(); if (fields.find("controlling_zone_or_thermostat_location") != fields.end()) { // not required field thisSys.input_specs.controlling_zone_or_thermostat_location = - UtilityRoutines::MakeUPPERCase(fields.at("controlling_zone_or_thermostat_location").get()); + UtilityRoutines::makeUPPER(fields.at("controlling_zone_or_thermostat_location").get()); } if (fields.find("dehumidification_control_type") != fields.end()) { // not required field, has default thisSys.input_specs.dehumidification_control_type = - UtilityRoutines::MakeUPPERCase(fields.at("dehumidification_control_type").get()); + UtilityRoutines::makeUPPER(fields.at("dehumidification_control_type").get()); } else { thisSys.input_specs.dehumidification_control_type = "NONE"; // default value } if (fields.find("availability_schedule_name") != fields.end()) { // not required field thisSys.input_specs.availability_schedule_name = - UtilityRoutines::MakeUPPERCase(fields.at("availability_schedule_name").get()); + UtilityRoutines::makeUPPER(fields.at("availability_schedule_name").get()); } - thisSys.input_specs.air_inlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("air_inlet_node_name").get()); // required + thisSys.input_specs.air_inlet_node_name = UtilityRoutines::makeUPPER(fields.at("air_inlet_node_name").get()); // required thisSys.input_specs.air_outlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("air_outlet_node_name").get()); // required - if (fields.find("supply_fan_object_type") != fields.end()) { // not required field - thisSys.input_specs.supply_fan_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("supply_fan_object_type").get()); + UtilityRoutines::makeUPPER(fields.at("air_outlet_node_name").get()); // required + if (fields.find("supply_fan_object_type") != fields.end()) { // not required field + thisSys.input_specs.supply_fan_object_type = UtilityRoutines::makeUPPER(fields.at("supply_fan_object_type").get()); } if (fields.find("supply_fan_name") != fields.end()) { // not required field - thisSys.input_specs.supply_fan_name = UtilityRoutines::MakeUPPERCase(fields.at("supply_fan_name").get()); + thisSys.input_specs.supply_fan_name = UtilityRoutines::makeUPPER(fields.at("supply_fan_name").get()); } if (fields.find("fan_placement") != fields.end()) { // not required field - thisSys.input_specs.fan_placement = UtilityRoutines::MakeUPPERCase(fields.at("fan_placement").get()); + thisSys.input_specs.fan_placement = UtilityRoutines::makeUPPER(fields.at("fan_placement").get()); } if (fields.find("supply_air_fan_operating_mode_schedule_name") != fields.end()) { // not required field thisSys.input_specs.supply_air_fan_operating_mode_schedule_name = - UtilityRoutines::MakeUPPERCase(fields.at("supply_air_fan_operating_mode_schedule_name").get()); + UtilityRoutines::makeUPPER(fields.at("supply_air_fan_operating_mode_schedule_name").get()); } if (fields.find("heating_coil_object_type") != fields.end()) { // not required field thisSys.input_specs.heating_coil_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("heating_coil_object_type").get()); + UtilityRoutines::makeUPPER(fields.at("heating_coil_object_type").get()); thisSys.m_HeatCoilExists = true; } if (fields.find("heating_coil_name") != fields.end()) { // not required field - thisSys.input_specs.heating_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("heating_coil_name").get()); + thisSys.input_specs.heating_coil_name = UtilityRoutines::makeUPPER(fields.at("heating_coil_name").get()); } if (fields.find("dx_heating_coil_sizing_ratio") != fields.end()) { // not required field, has default thisSys.input_specs.dx_heating_coil_sizing_ratio = fields.at("dx_heating_coil_sizing_ratio").get(); } if (fields.find("cooling_coil_object_type") != fields.end()) { // not required field thisSys.input_specs.cooling_coil_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_object_type").get()); + UtilityRoutines::makeUPPER(fields.at("cooling_coil_object_type").get()); thisSys.m_CoolCoilExists = true; } if (fields.find("cooling_coil_name") != fields.end()) { // not required field - thisSys.input_specs.cooling_coil_name = UtilityRoutines::MakeUPPERCase(fields.at("cooling_coil_name").get()); + thisSys.input_specs.cooling_coil_name = UtilityRoutines::makeUPPER(fields.at("cooling_coil_name").get()); } if (fields.find("use_doas_dx_cooling_coil") != fields.end()) { // not required field, has default thisSys.input_specs.use_doas_dx_cooling_coil = - UtilityRoutines::MakeUPPERCase(fields.at("use_doas_dx_cooling_coil").get()); + UtilityRoutines::makeUPPER(fields.at("use_doas_dx_cooling_coil").get()); } else { thisSys.input_specs.use_doas_dx_cooling_coil = "No"; } @@ -7587,21 +7584,21 @@ namespace UnitarySystems { } } if (fields.find("latent_load_control") != fields.end()) { // not required field, has default - thisSys.input_specs.latent_load_control = UtilityRoutines::MakeUPPERCase(fields.at("latent_load_control").get()); + thisSys.input_specs.latent_load_control = UtilityRoutines::makeUPPER(fields.at("latent_load_control").get()); } else { thisSys.input_specs.latent_load_control = "SensibleOnlyLoadControl"; } if (fields.find("supplemental_heating_coil_object_type") != fields.end()) { // not required field thisSys.input_specs.supplemental_heating_coil_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("supplemental_heating_coil_object_type").get()); + UtilityRoutines::makeUPPER(fields.at("supplemental_heating_coil_object_type").get()); } if (fields.find("supplemental_heating_coil_name") != fields.end()) { // not required field thisSys.input_specs.supplemental_heating_coil_name = - UtilityRoutines::MakeUPPERCase(fields.at("supplemental_heating_coil_name").get()); + UtilityRoutines::makeUPPER(fields.at("supplemental_heating_coil_name").get()); } if (fields.find("cooling_supply_air_flow_rate_method") != fields.end()) { // not required field thisSys.input_specs.cooling_supply_air_flow_rate_method = - UtilityRoutines::MakeUPPERCase(fields.at("cooling_supply_air_flow_rate_method").get()); + UtilityRoutines::makeUPPER(fields.at("cooling_supply_air_flow_rate_method").get()); } if (fields.find("cooling_supply_air_flow_rate") != fields.end()) { // not required field, autosizable auto const &tempFieldVal = fields.at("cooling_supply_air_flow_rate"); @@ -7625,7 +7622,7 @@ namespace UnitarySystems { } if (fields.find("heating_supply_air_flow_rate_method") != fields.end()) { // not required field thisSys.input_specs.heating_supply_air_flow_rate_method = - UtilityRoutines::MakeUPPERCase(fields.at("heating_supply_air_flow_rate_method").get()); + UtilityRoutines::makeUPPER(fields.at("heating_supply_air_flow_rate_method").get()); } if (fields.find("heating_supply_air_flow_rate") != fields.end()) { // not required field auto const &tempFieldVal = fields.at("heating_supply_air_flow_rate"); @@ -7649,7 +7646,7 @@ namespace UnitarySystems { } if (fields.find("no_load_supply_air_flow_rate_method") != fields.end()) { // not required field thisSys.input_specs.no_load_supply_air_flow_rate_method = - UtilityRoutines::MakeUPPERCase(fields.at("no_load_supply_air_flow_rate_method").get()); + UtilityRoutines::makeUPPER(fields.at("no_load_supply_air_flow_rate_method").get()); } if (fields.find("no_load_supply_air_flow_rate") != fields.end()) { // not required field auto const &tempFieldVal = fields.at("no_load_supply_air_flow_rate"); @@ -7694,7 +7691,7 @@ namespace UnitarySystems { } if (fields.find("outdoor_dry_bulb_temperature_sensor_node_name") != fields.end()) { // not required field thisSys.input_specs.outdoor_dry_bulb_temperature_sensor_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("outdoor_dry_bulb_temperature_sensor_node_name").get()); + UtilityRoutines::makeUPPER(fields.at("outdoor_dry_bulb_temperature_sensor_node_name").get()); } if (fields.find("maximum_cycling_rate") != fields.end()) { // not required field, has default thisSys.input_specs.maximum_cycling_rate = fields.at("maximum_cycling_rate").get(); @@ -7722,19 +7719,19 @@ namespace UnitarySystems { } if (fields.find("heat_recovery_water_inlet_node_name") != fields.end()) { // not required field thisSys.input_specs.heat_recovery_water_inlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("heat_recovery_water_inlet_node_name").get()); + UtilityRoutines::makeUPPER(fields.at("heat_recovery_water_inlet_node_name").get()); } if (fields.find("heat_recovery_water_outlet_node_name") != fields.end()) { // not required field thisSys.input_specs.heat_recovery_water_outlet_node_name = - UtilityRoutines::MakeUPPERCase(fields.at("heat_recovery_water_outlet_node_name").get()); + UtilityRoutines::makeUPPER(fields.at("heat_recovery_water_outlet_node_name").get()); } if (fields.find("design_specification_multispeed_object_type") != fields.end()) { // not required field thisSys.input_specs.design_specification_multispeed_object_type = - UtilityRoutines::MakeUPPERCase(fields.at("design_specification_multispeed_object_type").get()); + UtilityRoutines::makeUPPER(fields.at("design_specification_multispeed_object_type").get()); } if (fields.find("design_specification_multispeed_object_name") != fields.end()) { // not required field thisSys.input_specs.design_specification_multispeed_object_name = - UtilityRoutines::MakeUPPERCase(fields.at("design_specification_multispeed_object_name").get()); + UtilityRoutines::makeUPPER(fields.at("design_specification_multispeed_object_name").get()); } thisSys.processInputSpec(state, thisSys.input_specs, sysNum, errorsFound, ZoneEquipment, ZoneOAUnitNum); @@ -17332,27 +17329,21 @@ namespace UnitarySystems { void UnitarySys::setSystemParams(EnergyPlusData &state, Real64 &TotalFloorAreaOnAirLoop, const std::string &thisObjectName) { - this->NodeNumOfControlledZone = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).ZoneNode; + auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum); + this->NodeNumOfControlledZone = zoneEquipConfig.ZoneNode; TotalFloorAreaOnAirLoop = state.dataHeatBal->Zone(this->ControlZoneNum).FloorArea; this->m_AirLoopEquipment = false; - if (state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex > 0) { - for (int EquipNum = 1; - EquipNum <= - state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex).NumOfEquipTypes; - ++EquipNum) { - if ((state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex) - .EquipTypeEnum(EquipNum) != DataZoneEquipment::ZoneEquip::ZoneUnitarySys) || - state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex) - .EquipName(EquipNum) != thisObjectName) - continue; - this->m_ZoneSequenceCoolingNum = - state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex) - .CoolingPriority(EquipNum); - this->m_ZoneSequenceHeatingNum = - state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(this->ControlZoneNum).EquipListIndex) - .HeatingPriority(EquipNum); - break; + if (zoneEquipConfig.EquipListIndex == 0) return; + + auto &zoneEquipList = state.dataZoneEquip->ZoneEquipList(zoneEquipConfig.EquipListIndex); + for (int EquipNum = 1; EquipNum <= zoneEquipList.NumOfEquipTypes; ++EquipNum) { + if ((zoneEquipList.EquipType(EquipNum) != DataZoneEquipment::ZoneEquipType::UnitarySystem) || + zoneEquipList.EquipName(EquipNum) != thisObjectName) { + continue; } + this->m_ZoneSequenceCoolingNum = zoneEquipList.CoolingPriority(EquipNum); + this->m_ZoneSequenceHeatingNum = zoneEquipList.HeatingPriority(EquipNum); + break; } } diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index 6e8162132a2..392009ffd39 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -489,7 +489,7 @@ namespace UnitarySystems { public: // SZVAV variables - DataZoneEquipment::ZoneEquip ZoneEqType = DataZoneEquipment::ZoneEquip::Invalid; + DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::Invalid; SimAirServingZones::CompType AirloopEqType = SimAirServingZones::CompType::Invalid; int MaxIterIndex = 0; int RegulaFalsiFailedIndex = 0; diff --git a/src/EnergyPlus/UserDefinedComponents.cc b/src/EnergyPlus/UserDefinedComponents.cc index 3c29cdab40e..67b68a69d01 100644 --- a/src/EnergyPlus/UserDefinedComponents.cc +++ b/src/EnergyPlus/UserDefinedComponents.cc @@ -627,7 +627,7 @@ namespace UserDefinedComponents { { state.dataUserDefinedComponents->UserPlantComp(CompLoop).Loop(ConnectionLoop).HowLoadServed = static_cast( - getEnumerationValue(DataPlant::HowMetTypeNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(aArgCount + 2)))); + getEnumValue(DataPlant::HowMetTypeNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(aArgCount + 2)))); if (state.dataUserDefinedComponents->UserPlantComp(CompLoop).Loop(ConnectionLoop).HowLoadServed == DataPlant::HowMet::ByNominalCapLowOutLimit) { // actuator for low out limit @@ -653,8 +653,8 @@ namespace UserDefinedComponents { { state.dataUserDefinedComponents->UserPlantComp(CompLoop).Loop(ConnectionLoop).FlowPriority = - static_cast(getEnumerationValue( - DataPlant::LoopFlowStatusTypeNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(aArgCount + 3)))); + static_cast( + getEnumValue(DataPlant::LoopFlowStatusTypeNamesUC, UtilityRoutines::makeUPPER(cAlphaArgs(aArgCount + 3)))); } // find program manager for initial setup, begin environment and sizing of this plant connection diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 6392ed08ed9..660a5c9169e 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -64,21 +64,21 @@ extern "C" { // EnergyPlus Headers #include #include -#include +// #include #include #include -#include +// #include #include #include #include -#include +// #include #include -#include +// #include #include -#include +// #include #include #include -#include +// #include #include #include #include @@ -88,7 +88,6 @@ extern "C" { #include #include #include - // Third Party Headers #include @@ -400,7 +399,7 @@ namespace UtilityRoutines { size_t case_insensitive_hasher::operator()(std::string_view const key) const noexcept { - std::string keyCopy = MakeUPPERCase(key); + std::string keyCopy = makeUPPER(key); return std::hash()(keyCopy); } @@ -1661,4 +1660,12 @@ void ShowSevereInvalidKey(EnergyPlusData &state, ErrorObjectHeader const &eoh, s ShowContinueError(state, format("{} = {}, invalid key", fieldName, fieldVal)); } +void ShowSevereEmptyField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view depFieldName, std::string_view depFieldVal) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, + format("{} cannot be empty{}.", fieldName, depFieldName.empty() ? "" : format(" when {} = {}", depFieldName, depFieldVal))); +} + } // namespace EnergyPlus diff --git a/src/EnergyPlus/UtilityRoutines.hh b/src/EnergyPlus/UtilityRoutines.hh index d49475e6a0b..f1cac345051 100644 --- a/src/EnergyPlus/UtilityRoutines.hh +++ b/src/EnergyPlus/UtilityRoutines.hh @@ -229,6 +229,11 @@ struct ErrorObjectHeader void ShowSevereItemNotFound(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); void ShowSevereInvalidKey(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); +void ShowSevereEmptyField(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view depFieldName = {}, + std::string_view depFieldVal = {}); namespace UtilityRoutines { @@ -475,7 +480,7 @@ namespace UtilityRoutines { return FindItem(String, ListOfItems, name_p, ListOfItems.isize()); } - inline std::string MakeUPPERCase(std::string_view const InputString) // Input String + inline std::string makeUPPER(std::string_view const InputString) // Input String { // FUNCTION INFORMATION: @@ -659,7 +664,7 @@ namespace UtilityRoutines { } // namespace UtilityRoutines -constexpr int getEnumerationValue(const gsl::span sList, const std::string_view s) +constexpr int getEnumValue(const gsl::span sList, const std::string_view s) { for (unsigned int i = 0; i < sList.size(); ++i) { if (sList[i] == s) return i; @@ -670,7 +675,7 @@ constexpr int getEnumerationValue(const gsl::span sList, constexpr BooleanSwitch getYesNoValue(const std::string_view s) { constexpr std::array yesNo = {"NO", "YES"}; - return static_cast(getEnumerationValue(yesNo, s)); + return static_cast(getEnumValue(yesNo, s)); } struct UtilityRoutinesData : BaseGlobalStruct diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index f15c34d82c9..ddf6fe0bd8a 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -486,7 +486,7 @@ namespace VentilatedSlab { ventSlab.OutAirVolFlow = state.dataIPShortCut->rNumericArgs(3); ventSlab.outsideAirControlType = static_cast( - getEnumerationValue(OutsideAirControlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(5)))); + getEnumValue(OutsideAirControlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); switch (ventSlab.outsideAirControlType) { case OutsideAirControlType::VariablePercent: { @@ -564,7 +564,7 @@ namespace VentilatedSlab { // System Configuration: ventSlab.SysConfg = static_cast( - getEnumerationValue(VentilatedSlabConfigNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + getEnumValue(VentilatedSlabConfigNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); if (ventSlab.SysConfg == VentilatedSlabConfig::Invalid) { ShowSevereError( @@ -610,8 +610,8 @@ namespace VentilatedSlab { } // Process the temperature control type - ventSlab.controlType = static_cast( - getEnumerationValue(ControlTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(9)))); + ventSlab.controlType = + static_cast(getEnumValue(ControlTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(9)))); if (ventSlab.controlType == ControlType::Invalid) { ShowSevereError( @@ -987,7 +987,7 @@ namespace VentilatedSlab { // Coil options assign ventSlab.coilOption = - static_cast(getEnumerationValue(CoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(26)))); + static_cast(getEnumValue(CoilTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(26)))); if (ventSlab.coilOption == CoilType::Invalid) { ShowSevereError( @@ -1016,7 +1016,7 @@ namespace VentilatedSlab { errFlag = false; ventSlab.hCoilType = static_cast( - getEnumerationValue(HeatingCoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(27)))); + getEnumValue(HeatingCoilTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(27)))); switch (ventSlab.hCoilType) { @@ -1132,7 +1132,7 @@ namespace VentilatedSlab { errFlag = false; ventSlab.cCoilType = static_cast( - getEnumerationValue(CoolingCoilTypeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(30)))); + getEnumValue(CoolingCoilTypeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(30)))); switch (ventSlab.cCoilType) { case CoolingCoilType::WaterCooling: { @@ -1561,12 +1561,13 @@ namespace VentilatedSlab { } if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::VentilatedSlab).ZoneCompAvailMgrs(Item); if (state.dataVentilatedSlab->MyZoneEqFlag(Item)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::VentilatedSlab).ZoneCompAvailMgrs(Item).AvailManagerListName = ventSlab.AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::VentilatedSlab).ZoneCompAvailMgrs(Item).ZoneNum = VentSlabZoneNum; + availMgr.AvailManagerListName = ventSlab.AvailManagerListName; + availMgr.ZoneNum = VentSlabZoneNum; state.dataVentilatedSlab->MyZoneEqFlag(Item) = false; } - ventSlab.AvailStatus = ZoneComp(DataZoneEquipment::ZoneEquip::VentilatedSlab).ZoneCompAvailMgrs(Item).AvailStatus; + ventSlab.AvailStatus = availMgr.AvailStatus; } if (state.dataVentilatedSlab->MyPlantScanFlag(Item) && allocated(state.dataPlnt->PlantLoop)) { diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 75bf0fb2430..98e6249a998 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1334,7 +1334,7 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) // Inlet Air Configuration HPWH.InletAirConfiguration = - static_cast(getEnumerationValue(HPWHAmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(hpwhAlpha[6 + nAlphaOffset]))); + static_cast(getEnumValue(HPWHAmbientTempNamesUC, UtilityRoutines::makeUPPER(hpwhAlpha[6 + nAlphaOffset]))); switch (HPWH.InletAirConfiguration) { case WTTAmbientTemp::Schedule: { @@ -1560,7 +1560,7 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) // Compressor Location HPWH.CrankcaseTempIndicator = static_cast( - getEnumerationValue(CrankcaseHeaterControlTempNamesUC, UtilityRoutines::MakeUPPERCase(hpwhAlpha[20 + nAlphaOffset]))); + getEnumValue(CrankcaseHeaterControlTempNamesUC, UtilityRoutines::makeUPPER(hpwhAlpha[20 + nAlphaOffset]))); switch (HPWH.CrankcaseTempIndicator) { case CrankcaseHeaterControlTemp::Schedule: { if (!hpwhAlphaBlank[21 + nAlphaOffset]) { @@ -2403,8 +2403,8 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) } // Validate Heater Control Type - Tank.ControlType = static_cast( - getEnumerationValue(HeaterControlModeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(3)))); + Tank.ControlType = + static_cast(getEnumValue(HeaterControlModeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(3)))); switch (Tank.ControlType) { case HeaterControlMode::Cycle: { Tank.MinCapacity = Tank.MaxCapacity; @@ -2434,7 +2434,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.IgnitionDelay = state.dataIPShortCut->rNumericArgs(7); // Not yet implemented // Validate Heater Fuel Type - Tank.FuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(4))); + Tank.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(4))); switch (Tank.FuelType) { case Constant::eFuel::Invalid: { ShowSevereError(state, @@ -2496,7 +2496,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.OffCycParaLoad = state.dataIPShortCut->rNumericArgs(9); // Validate Off-Cycle Parasitic Fuel Type - Tank.OffCycParaFuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(6))); + Tank.OffCycParaFuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(6))); switch (Tank.OffCycParaFuelType) { case Constant::eFuel::Invalid: if (state.dataIPShortCut->cAlphaArgs(6).empty()) { // If blank, default to Fuel Type for heater @@ -2521,7 +2521,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.OnCycParaLoad = state.dataIPShortCut->rNumericArgs(11); // Validate On-Cycle Parasitic Fuel Type - Tank.OnCycParaFuelType = static_cast(getEnumerationValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(7))); + Tank.OnCycParaFuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(7))); switch (Tank.OnCycParaFuelType) { case Constant::eFuel::Invalid: if (state.dataIPShortCut->cAlphaArgs(7).empty()) { // If blank, default to Fuel Type for heater @@ -2543,8 +2543,8 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.OnCycParaFracToTank = state.dataIPShortCut->rNumericArgs(12); - Tank.AmbientTempIndicator = static_cast( - getEnumerationValue(TankAmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + Tank.AmbientTempIndicator = + static_cast(getEnumValue(TankAmbientTempNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { Tank.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); @@ -2772,7 +2772,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) if (!state.dataIPShortCut->lAlphaFieldBlanks(18)) { Tank.SourceSideControlMode = static_cast( - getEnumerationValue(SourceSideControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(18)))); + getEnumValue(SourceSideControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(18)))); if (Tank.SourceSideControlMode == SourceSideControl::Invalid) { ShowSevereError(state, format("{} = {}: Invalid Control Mode entered={}", @@ -2862,8 +2862,7 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.HeightWasAutoSized = true; } - Tank.Shape = - static_cast(getEnumerationValue(TankShapeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(3)))); + Tank.Shape = static_cast(getEnumValue(TankShapeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(3)))); switch (Tank.Shape) { case TankShape::HorizCylinder: case TankShape::VertCylinder: { @@ -2903,7 +2902,7 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) // Validate Heater Priority Control Tank.StratifiedControlMode = static_cast( - getEnumerationValue(PriorityControlModeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(4)))); + getEnumValue(PriorityControlModeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(4)))); if (Tank.StratifiedControlMode == PriorityControlMode::Invalid) { ShowSevereError(state, format("{} = {}: Invalid Heater Priority Control entered={}", @@ -3003,9 +3002,9 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) // Validate Heater Fuel Type Tank.FuelType = static_cast( - getEnumerationValue(Constant::eFuelNamesUC, - state.dataIPShortCut->cAlphaArgs( - 7))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported + getEnumValue(Constant::eFuelNamesUC, + state.dataIPShortCut->cAlphaArgs( + 7))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported if (Tank.FuelType == Constant::eFuel::Invalid) { ShowSevereError(state, format("{} = {}: Invalid Heater Fuel Type entered={}", @@ -3031,9 +3030,9 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) // Validate Off-Cycle Parasitic Fuel Type Tank.OffCycParaFuelType = static_cast( - getEnumerationValue(Constant::eFuelNamesUC, - state.dataIPShortCut->cAlphaArgs( - 8))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported + getEnumValue(Constant::eFuelNamesUC, + state.dataIPShortCut->cAlphaArgs( + 8))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported if (Tank.OffCycParaFuelType == Constant::eFuel::Invalid) { if (state.dataIPShortCut->cAlphaArgs(8).empty()) { Tank.OffCycParaFuelType = Tank.FuelType; @@ -3055,10 +3054,10 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.OnCycParaLoad = state.dataIPShortCut->rNumericArgs(15); // Validate On-Cycle Parasitic Fuel Type - Tank.OnCycParaFuelType = static_cast(getEnumerationValue( - Constant::eFuelNamesUC, - state.dataIPShortCut->cAlphaArgs( - 9))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported/empty + Tank.OnCycParaFuelType = static_cast( + getEnumValue(Constant::eFuelNamesUC, + state.dataIPShortCut->cAlphaArgs( + 9))); // returns all kinds of fuels including district heat and cool + steam, returns unassigned if unsupported/empty if (Tank.OnCycParaFuelType == Constant::eFuel::Invalid) { if (state.dataIPShortCut->cAlphaArgs(9).empty()) { Tank.OnCycParaFuelType = Tank.FuelType; @@ -3077,8 +3076,8 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.OnCycParaFracToTank = state.dataIPShortCut->rNumericArgs(16); Tank.OnCycParaHeight = state.dataIPShortCut->rNumericArgs(17); - Tank.AmbientTempIndicator = static_cast( - getEnumerationValue(TankAmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(10)))); + Tank.AmbientTempIndicator = + static_cast(getEnumValue(TankAmbientTempNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(10)))); switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { @@ -3371,8 +3370,8 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) } // Validate inlet mode - Tank.InletMode = static_cast( - getEnumerationValue(InletPositionModeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(20)))); + Tank.InletMode = + static_cast(getEnumValue(InletPositionModeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(20)))); Tank.Nodes = state.dataIPShortCut->rNumericArgs(32); int specifiedNodes = 0; @@ -3407,7 +3406,7 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) if (!state.dataIPShortCut->lAlphaFieldBlanks(21)) { Tank.SourceSideControlMode = static_cast( - getEnumerationValue(SourceSideControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(21)))); + getEnumValue(SourceSideControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(21)))); if (Tank.SourceSideControlMode == SourceSideControl::Invalid) { ShowSevereError(state, format("{} = {}: Invalid Control Mode entered={}", @@ -3530,8 +3529,8 @@ bool getWaterTankMixedInput(EnergyPlusData &state) Tank.OnCycParaFuelType = Constant::eFuel::Electricity; Tank.OnCycParaFracToTank = 0.0; - Tank.AmbientTempIndicator = static_cast( - getEnumerationValue(TankAmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(3)))); + Tank.AmbientTempIndicator = + static_cast(getEnumValue(TankAmbientTempNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(3)))); switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { @@ -3793,8 +3792,7 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) Tank.HeightWasAutoSized = true; } - Tank.Shape = - static_cast(getEnumerationValue(TankShapeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2)))); + Tank.Shape = static_cast(getEnumValue(TankShapeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); switch (Tank.Shape) { case TankShape::HorizCylinder: case TankShape::VertCylinder: { @@ -3867,8 +3865,8 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) Tank.OnCycParaFracToTank = 0.0; Tank.OnCycParaHeight = 0.0; - Tank.AmbientTempIndicator = static_cast( - getEnumerationValue(TankAmbientTempNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(4)))); + Tank.AmbientTempIndicator = + static_cast(getEnumValue(TankAmbientTempNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(4)))); switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { @@ -4112,8 +4110,8 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) } // Validate inlet mode - Tank.InletMode = static_cast( - getEnumerationValue(InletPositionModeNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(14)))); + Tank.InletMode = + static_cast(getEnumValue(InletPositionModeNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(14)))); Tank.Nodes = state.dataIPShortCut->rNumericArgs(18); Tank.AdditionalCond = state.dataIPShortCut->rNumericArgs(19); @@ -4405,7 +4403,7 @@ bool GetWaterThermalTankInput(EnergyPlusData &state) } else { DataLoopNode::ConnectionObjectType objType = static_cast( - getEnumerationValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::MakeUPPERCase(Tank.Type))); + getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, UtilityRoutines::makeUPPER(Tank.Type))); Tank.SourceInletNode = NodeInputManager::GetOnlySingleNode(state, HPWH.OutletNodeName1, @@ -4506,12 +4504,12 @@ bool GetWaterThermalTankInput(EnergyPlusData &state) int ZoneEquipListNum = state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).EquipListIndex; int TankCoolingPriority = 0; int TankHeatingPriority = 0; - for (int EquipmentTypeNum = 1; EquipmentTypeNum <= state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).NumOfEquipTypes; - ++EquipmentTypeNum) { - if (state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).EquipName(EquipmentTypeNum) != HPWH.Name) continue; + auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum); + for (int EquipmentTypeNum = 1; EquipmentTypeNum <= zoneEquipList.NumOfEquipTypes; ++EquipmentTypeNum) { + if (zoneEquipList.EquipName(EquipmentTypeNum) != HPWH.Name) continue; FoundTankInList = true; - TankCoolingPriority = state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).CoolingPriority(EquipmentTypeNum); - TankHeatingPriority = state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).HeatingPriority(EquipmentTypeNum); + TankCoolingPriority = zoneEquipList.CoolingPriority(EquipmentTypeNum); + TankHeatingPriority = zoneEquipList.HeatingPriority(EquipmentTypeNum); break; } // EquipmentTypeNum if (!FoundTankInList) { @@ -4524,13 +4522,12 @@ bool GetWaterThermalTankInput(EnergyPlusData &state) } // check that tank has lower priority than all other non-HPWH objects in Zone // Equipment List - for (int EquipmentTypeNum = 1; EquipmentTypeNum <= state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).NumOfEquipTypes; - ++EquipmentTypeNum) { - if (UtilityRoutines::SameString(state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).EquipType(EquipmentTypeNum), + for (int EquipmentTypeNum = 1; EquipmentTypeNum <= zoneEquipList.NumOfEquipTypes; ++EquipmentTypeNum) { + if (UtilityRoutines::SameString(zoneEquipList.EquipTypeName(EquipmentTypeNum), state.dataIPShortCut->cCurrentModuleObject)) continue; - if (TankCoolingPriority > state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).CoolingPriority(EquipmentTypeNum) || - TankHeatingPriority > state.dataZoneEquip->ZoneEquipList(ZoneEquipListNum).HeatingPriority(EquipmentTypeNum)) { + if (TankCoolingPriority > zoneEquipList.CoolingPriority(EquipmentTypeNum) || + TankHeatingPriority > zoneEquipList.HeatingPriority(EquipmentTypeNum)) { TankNotLowestPriority = true; } } // EquipmentTypeNum diff --git a/src/EnergyPlus/WaterToAirHeatPump.cc b/src/EnergyPlus/WaterToAirHeatPump.cc index 6c9a35b1a3a..1b63ea1c7cb 100644 --- a/src/EnergyPlus/WaterToAirHeatPump.cc +++ b/src/EnergyPlus/WaterToAirHeatPump.cc @@ -363,8 +363,7 @@ namespace WaterToAirHeatPump { heatPump.PowerLosses = NumArray(10); heatPump.LossFactor = NumArray(11); - heatPump.compressorType = - static_cast(getEnumerationValue(CompressTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(2)))); + heatPump.compressorType = static_cast(getEnumValue(CompressTypeNamesUC, UtilityRoutines::makeUPPER(AlphArray(2)))); switch (heatPump.compressorType) { case CompressorType::Reciprocating: { @@ -547,8 +546,7 @@ namespace WaterToAirHeatPump { heatPump.PowerLosses = NumArray(7); heatPump.LossFactor = NumArray(8); - heatPump.compressorType = - static_cast(getEnumerationValue(CompressTypeNamesUC, UtilityRoutines::MakeUPPERCase(AlphArray(2)))); + heatPump.compressorType = static_cast(getEnumValue(CompressTypeNamesUC, UtilityRoutines::makeUPPER(AlphArray(2)))); switch (heatPump.compressorType) { case CompressorType::Reciprocating: { heatPump.CompPistonDisp = NumArray(9); diff --git a/src/EnergyPlus/WaterUse.cc b/src/EnergyPlus/WaterUse.cc index 3cffe548d89..d55bb5eace3 100644 --- a/src/EnergyPlus/WaterUse.cc +++ b/src/EnergyPlus/WaterUse.cc @@ -501,8 +501,8 @@ namespace WaterUse { if ((!state.dataIPShortCut->lAlphaFieldBlanks(8)) && (state.dataIPShortCut->cAlphaArgs(8) != "NONE")) { waterConnection.HeatRecovery = true; - waterConnection.HeatRecoveryHX = static_cast( - getEnumerationValue(HeatRecoverHXNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(8)))); + waterConnection.HeatRecoveryHX = + static_cast(getEnumValue(HeatRecoverHXNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); if (waterConnection.HeatRecoveryHX == HeatRecovHX::Invalid) { ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8))); @@ -511,7 +511,7 @@ namespace WaterUse { } waterConnection.HeatRecoveryConfig = static_cast( - getEnumerationValue(HeatRecoveryConfigNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(9)))); + getEnumValue(HeatRecoveryConfigNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(9)))); if (waterConnection.HeatRecoveryConfig == HeatRecovConfig::Invalid) { ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index b43aff0248a..a5fa05b7970 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -5441,7 +5441,7 @@ namespace WeatherManager { // A2 , \field Day of Week for Start Day bool inputWeekday = false; if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { // Have input - int dayType = getEnumerationValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); + int dayType = getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); if (dayType < 1) { ShowWarningError(state, format("{}: object={}{} invalid (Day of Week) [{}] for Start is not valid, Sunday will be used.", @@ -5908,7 +5908,7 @@ namespace WeatherManager { static_cast(ScheduleManager::DayType::Monday); // Defaults to Monday } else { state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek = - getEnumerationValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); + getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); if (state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek < 1 || state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek == 8) { ShowWarningError(state, @@ -6107,7 +6107,7 @@ namespace WeatherManager { static_cast(ScheduleManager::DayType::Monday); // Defaults to Monday } else { state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek = - getEnumerationValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(3)); + getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(3)); if (state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek < static_cast(ScheduleManager::DayType::Sunday) || state.dataWeatherManager->RunPeriodDesignInput(Count).dayOfWeek == static_cast(ScheduleManager::DayType::Holiday)) { // Sunday-Saturday, SummerDesignDay, WinterDesignDay, CustomDay1, and CustomDay2 are all valid. Holiday is not valid. @@ -6262,7 +6262,7 @@ namespace WeatherManager { ErrorsFound = true; } - int DayType = getEnumerationValue(ScheduleManager::dayTypeNamesUC, AlphArray(3)); + int DayType = getEnumValue(ScheduleManager::dayTypeNamesUC, AlphArray(3)); if (DayType == 0) { ShowSevereError(state, format("{}: {} Invalid {}={}", @@ -7417,7 +7417,7 @@ namespace WeatherManager { // A2, \field Day Type state.dataWeatherManager->DesDayInput(EnvrnNum).DayType = - getEnumerationValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); + getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); if (state.dataWeatherManager->DesDayInput(EnvrnNum).DayType <= 0) { ShowSevereError(state, format("{}=\"{}\", invalid data.", @@ -7650,7 +7650,7 @@ namespace WeatherManager { std::string units; OutputProcessor::Unit unitType; state.dataWeatherManager->WPSkyTemperature(i).CalculationType = - static_cast(getEnumerationValue(WeatherManager::SkyTempModelInputNamesUC, state.dataIPShortCut->cAlphaArgs(2))); + static_cast(getEnumValue(WeatherManager::SkyTempModelInputNamesUC, state.dataIPShortCut->cAlphaArgs(2))); switch (state.dataWeatherManager->WPSkyTemperature(i).CalculationType) { case SkyTempCalcType::ScheduleValue: { @@ -7965,7 +7965,7 @@ namespace WeatherManager { state.dataIPShortCut->cNumericFieldNames); state.dataWeatherManager->WaterMainsTempsMethod = - static_cast(getEnumerationValue(waterMainsCalcMethodNamesUC, AlphArray(1))); + static_cast(getEnumValue(waterMainsCalcMethodNamesUC, AlphArray(1))); if (state.dataWeatherManager->WaterMainsTempsMethod == WaterMainsTempCalcMethod::Schedule) { state.dataWeatherManager->WaterMainsTempsScheduleName = AlphArray(2); state.dataWeatherManager->WaterMainsTempsSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); @@ -8611,7 +8611,7 @@ namespace WeatherManager { // Process periods to set up other values. for (int i = 1; i <= state.dataWeatherManager->NumEPWTypExtSets; ++i) { // JulianDay (Month,Day,LeapYearValue) - std::string const ExtremePeriodTitle = UtilityRoutines::MakeUPPERCase(state.dataWeatherManager->TypicalExtremePeriods(i).ShortTitle); + std::string const ExtremePeriodTitle = UtilityRoutines::makeUPPER(state.dataWeatherManager->TypicalExtremePeriods(i).ShortTitle); if (ExtremePeriodTitle == "SUMMER") { if (UtilityRoutines::SameString(state.dataWeatherManager->TypicalExtremePeriods(i).TEType, "EXTREME")) { state.dataWeatherManager->TypicalExtremePeriods(i).MatchValue = "SummerExtreme"; @@ -8949,7 +8949,7 @@ namespace WeatherManager { if (CurCount <= state.dataWeatherManager->NumDataPeriods) { state.dataWeatherManager->DataPeriods(CurCount).DayOfWeek = Line.substr(0, Pos); state.dataWeatherManager->DataPeriods(CurCount).WeekDay = - getEnumerationValue(ScheduleManager::dayTypeNamesUC, state.dataWeatherManager->DataPeriods(CurCount).DayOfWeek); + getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataWeatherManager->DataPeriods(CurCount).DayOfWeek); if (state.dataWeatherManager->DataPeriods(CurCount).WeekDay < 1 || state.dataWeatherManager->DataPeriods(CurCount).WeekDay > 7) { ShowSevereError(state, @@ -9641,7 +9641,7 @@ namespace WeatherManager { std::string::size_type pos = index(epwLine.data, ','); epwLine.data.erase(0, pos + 1); pos = index(epwLine.data, ','); - std::string LeapYear = UtilityRoutines::MakeUPPERCase(epwLine.data.substr(0, pos)); + std::string LeapYear = UtilityRoutines::makeUPPER(epwLine.data.substr(0, pos)); if (LeapYear[0] == 'Y') { epwHasLeapYear = true; } diff --git a/src/EnergyPlus/WindTurbine.cc b/src/EnergyPlus/WindTurbine.cc index ab52fc60ede..9225de5cdac 100644 --- a/src/EnergyPlus/WindTurbine.cc +++ b/src/EnergyPlus/WindTurbine.cc @@ -281,8 +281,8 @@ namespace WindTurbine { } } // Select rotor type - windTurbine.rotorType = static_cast( - getEnumerationValue(WindTurbine::RotorNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(3)))); + windTurbine.rotorType = + static_cast(getEnumValue(WindTurbine::RotorNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(3)))); if (windTurbine.rotorType == RotorType::Invalid) { if (state.dataIPShortCut->cAlphaArgs(3).empty()) { windTurbine.rotorType = RotorType::HorizontalAxis; @@ -298,8 +298,8 @@ namespace WindTurbine { } // Select control type - windTurbine.controlType = static_cast( - getEnumerationValue(WindTurbine::ControlNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(4)))); + windTurbine.controlType = + static_cast(getEnumValue(WindTurbine::ControlNamesUC, UtilityRoutines::makeUPPER(state.dataIPShortCut->cAlphaArgs(4)))); if (windTurbine.controlType == ControlType::Invalid) { if (state.dataIPShortCut->cAlphaArgs(4).empty()) { windTurbine.controlType = ControlType::VariableSpeedVariablePitch; diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index 93311ec2be3..296238c83d5 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -831,14 +831,13 @@ namespace WindowAC { } if (allocated(ZoneComp)) { + auto &availMgr = ZoneComp(DataZoneEquipment::ZoneEquipType::WindowAirConditioner).ZoneCompAvailMgrs(WindACNum); if (state.dataWindowAC->MyZoneEqFlag(WindACNum)) { // initialize the name of each availability manager list and zone number - ZoneComp(DataZoneEquipment::ZoneEquip::WindowAC).ZoneCompAvailMgrs(WindACNum).AvailManagerListName = - state.dataWindowAC->WindAC(WindACNum).AvailManagerListName; - ZoneComp(DataZoneEquipment::ZoneEquip::WindowAC).ZoneCompAvailMgrs(WindACNum).ZoneNum = ZoneNum; + availMgr.AvailManagerListName = state.dataWindowAC->WindAC(WindACNum).AvailManagerListName; + availMgr.ZoneNum = ZoneNum; state.dataWindowAC->MyZoneEqFlag(WindACNum) = false; } - state.dataWindowAC->WindAC(WindACNum).AvailStatus = - ZoneComp(DataZoneEquipment::ZoneEquip::WindowAC).ZoneCompAvailMgrs(WindACNum).AvailStatus; + state.dataWindowAC->WindAC(WindACNum).AvailStatus = availMgr.AvailStatus; } // need to check all Window AC units to see if they are on Zone Equipment List or issue warning diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index f11029b56b6..b6d8707b5dd 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -7937,7 +7937,7 @@ namespace WindowManager { state.dataMaterial->Screens(ScreenNum).ScreenDiameterToSpacingRatio = 1.0 - std::sqrt(thisMaterial->Trans); state.dataMaterial->Screens(ScreenNum).screenBeamReflectanceModel = static_cast( - getEnumerationValue(ScreenBeamReflectanceModelNamesUC, UtilityRoutines::MakeUPPERCase(thisMaterial->ReflectanceModeling))); + getEnumValue(ScreenBeamReflectanceModelNamesUC, UtilityRoutines::makeUPPER(thisMaterial->ReflectanceModeling))); // Reflectance of screen material only state.dataMaterial->Screens(ScreenNum).ReflectCylinder = thisMaterial->ReflectShade / (1 - thisMaterial->Trans); diff --git a/src/EnergyPlus/WindowModel.cc b/src/EnergyPlus/WindowModel.cc index d6c9b83d1e2..c4709f261e5 100644 --- a/src/EnergyPlus/WindowModel.cc +++ b/src/EnergyPlus/WindowModel.cc @@ -87,7 +87,7 @@ namespace WindowManager { if (numCurrModels > 0) { state.dataInputProcessing->inputProcessor->getObjectItem( state, objectName, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - // Please consider using getEnumerationValue pattern here. + // Please consider using getEnumValue pattern here. // Consider that you are creating an entire map for the // sole purpose of looking up a single element EnumParser aParser; diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index 5b7ab66f8c3..5418957db74 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -3084,7 +3084,7 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool zoneEqSizing.DesignSizeFromParent = false; } - const int ZoneEquipTypeNum = state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipTypeEnum; + DataZoneEquipment::ZoneEquipType zoneEquipType = state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).equipType; auto &zoneEquipList = state.dataZoneEquip->ZoneEquipList(state.dataSize->CurZoneEqNum); @@ -3092,25 +3092,25 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool bool ValidSAMComp = false; - if (ZoneEquipTypeNum <= NumValidSysAvailZoneComponents) ValidSAMComp = true; + if ((int)zoneEquipType <= NumValidSysAvailZoneComponents) ValidSAMComp = true; auto &ZoneComp = state.dataHVACGlobal->ZoneComp; if (ZoneCompNum > 0 && ValidSAMComp) { - SystemAvailabilityManager::GetZoneEqAvailabilityManager(state, ZoneEquipTypeNum, ZoneCompNum, ErrorFlag); + SystemAvailabilityManager::GetZoneEqAvailabilityManager(state, zoneEquipType, ZoneCompNum, ErrorFlag); - if (ZoneComp(ZoneEquipTypeNum).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::CycleOn) { + if (ZoneComp((int)zoneEquipType).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::CycleOn) { state.dataHVACGlobal->TurnFansOn = true; state.dataHVACGlobal->TurnFansOff = false; - } else if (ZoneComp(ZoneEquipTypeNum).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::ForceOff) { + } else if (ZoneComp((int)zoneEquipType).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::ForceOff) { state.dataHVACGlobal->TurnFansOn = false; state.dataHVACGlobal->TurnFansOff = true; } } - switch (ZoneEquipTypeNum) { - case ZoneEquip::AirDistUnit: { // 'ZoneHVAC:AirDistributionUnit' + switch (zoneEquipType) { + case ZoneEquipType::AirDistributionUnit: { // 'ZoneHVAC:AirDistributionUnit' // Air loop system availability manager status only applies to PIU and exhaust fans // Check to see if System Availability Managers are asking for fans to cycle on or shut off // and set fan on/off flags accordingly. @@ -3134,7 +3134,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += NonAirSysOutput; SysOutputProvided = NonAirSysOutput + AirSysOutput; } break; - case ZoneEquip::VRFTerminalUnit: { // 'ZoneHVAC:TerminalUnit:VariableRefrigerantFlow' + + case ZoneEquipType::VariableRefrigerantFlowTerminal: { // 'ZoneHVAC:TerminalUnit:VariableRefrigerantFlow' bool HeatingActive = false; bool CoolingActive = false; int constexpr OAUnitNum = 0; @@ -3153,7 +3154,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool SysOutputProvided, LatOutputProvided); } break; - case ZoneEquip::WindowAC: { // 'ZoneHVAC:WindowAirConditioner' + + case ZoneEquipType::WindowAirConditioner: { // 'ZoneHVAC:WindowAirConditioner' WindowAC::SimWindowAC(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3162,10 +3164,11 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::PkgTermHPAirToAir: // 'ZoneHVAC:PackagedTerminalHeatPump' - case ZoneEquip::PkgTermACAirToAir: // 'ZoneHVAC:PackagedTerminalAirConditioner' - case ZoneEquip::PkgTermHPWaterToAir: // 'ZoneHVAC:WaterToAirHeatPump' - case ZoneEquip::ZoneUnitarySys: { // 'AirloopHVAC:UnitarySystem' + + case ZoneEquipType::PackagedTerminalHeatPump: // 'ZoneHVAC:PackagedTerminalHeatPump' + case ZoneEquipType::PackagedTerminalAirConditioner: // 'ZoneHVAC:PackagedTerminalAirConditioner' + case ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: // 'ZoneHVAC:WaterToAirHeatPump' + case ZoneEquipType::UnitarySystem: { // 'AirloopHVAC:UnitarySystem' int AirLoopNum = 0; bool HeatingActive = false; bool CoolingActive = false; @@ -3185,7 +3188,7 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool SysOutputProvided, LatOutputProvided); } break; - case ZoneEquip::ZoneDXDehumidifier: { // 'ZoneHVAC:Dehumidifier:DX' + case ZoneEquipType::DehumidifierDX: { // 'ZoneHVAC:Dehumidifier:DX' ZoneDehumidifier::SimZoneDehumidifier(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3200,7 +3203,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool // temperature) SysOutputProvided amount was already sent above to // next Predict-Correct series of calcs via SysDepZoneLoads } break; - case ZoneEquip::FanCoil4Pipe: { // 'ZoneHVAC:FourPipeFanCoil' + + case ZoneEquipType::FourPipeFanCoil: { // 'ZoneHVAC:FourPipeFanCoil' FanCoilUnits::SimFanCoilUnit(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3209,7 +3213,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::UnitVentilator: { // 'ZoneHVAC:UnitVentilator' + + case ZoneEquipType::UnitVentilator: { // 'ZoneHVAC:UnitVentilator' UnitVentilator::SimUnitVentilator(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3218,7 +3223,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::UnitHeater: { // 'ZoneHVAC:UnitHeater' + + case ZoneEquipType::UnitHeater: { // 'ZoneHVAC:UnitHeater' UnitHeater::SimUnitHeater(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3227,7 +3233,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::PurchasedAir: { // 'ZoneHVAC:IdealLoadsAirSystem' + + case ZoneEquipType::PurchasedAir: { // 'ZoneHVAC:IdealLoadsAirSystem' PurchasedAirManager::SimPurchasedAir(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, SysOutputProvided, @@ -3236,7 +3243,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool ControlledZoneNum, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::BBWater: { // 'ZoneHVAC:Baseboard:RadiantConvective:Water' + + case ZoneEquipType::BaseboardWater: { // 'ZoneHVAC:Baseboard:RadiantConvective:Water' HWBaseboardRadiator::SimHWBaseboard(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3247,7 +3255,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::BBSteam: { // 'ZoneHVAC:Baseboard:RadiantConvective:Steam' + + case ZoneEquipType::BaseboardSteam: { // 'ZoneHVAC:Baseboard:RadiantConvective:Steam' SteamBaseboardRadiator::SimSteamBaseboard(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3258,7 +3267,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::BBWaterConvective: { // 'ZoneHVAC:Baseboard:Convective:Water' + + case ZoneEquipType::BaseboardConvectiveWater: { // 'ZoneHVAC:Baseboard:Convective:Water' BaseboardRadiator::SimBaseboard(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3269,7 +3279,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::BBElectricConvective: { // 'ZoneHVAC:Baseboard:Convective:Electric' + + case ZoneEquipType::BaseboardConvectiveElectric: { // 'ZoneHVAC:Baseboard:Convective:Electric' BaseboardElectric::SimElectricBaseboard(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3279,7 +3290,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::CoolingPanel: { // 'ZoneHVAC:CoolingPanel:RadiantConvective:Water' + + case ZoneEquipType::CoolingPanel: { // 'ZoneHVAC:CoolingPanel:RadiantConvective:Water' CoolingPanelSimple::SimCoolingPanel(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3290,7 +3302,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This cooling panel does not add/remove any latent heat } break; - case ZoneEquip::HiTempRadiant: { // 'ZoneHVAC:HighTemperatureRadiant' + + case ZoneEquipType::HighTemperatureRadiant: { // 'ZoneHVAC:HighTemperatureRadiant' HighTempRadiantSystem::SimHighTempRadiantSystem(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, FirstHVACIteration, @@ -3299,8 +3312,9 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided = 0.0; // This baseboard currently sends its latent heat gain directly to predictor/corrector // via SumLatentHTRadSys... so setting LatOutputProvided = 0.0 } break; - case ZoneEquip::LoTempRadiant: { // 'ZoneHVAC:LowTemperatureRadiant:VariableFlow', - // 'ZoneHVAC:LowTemperatureRadiant:ConstantFlow' + + case ZoneEquipType::LowTemperatureRadiant: { // 'ZoneHVAC:LowTemperatureRadiant:VariableFlow', + // 'ZoneHVAC:LowTemperatureRadiant:ConstantFlow' // 'ZoneHVAC:LowTemperatureRadiant:Electric' LowTempRadiantSystem::SimLowTempRadiantSystem(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, @@ -3309,7 +3323,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool zoneEquipList.EquipIndex(EquipPtr)); LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::ZoneExhaustFan: { // 'Fan:ZoneExhaust' + + case ZoneEquipType::ExhaustFan: { // 'Fan:ZoneExhaust' // Air loop system availability manager status only applies to PIU and exhaust fans // Check to see if System Availability Managers are asking for fans to cycle on or shut off // and set fan on/off flags accordingly. @@ -3327,14 +3342,16 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::HeatXchngr: { // 'HeatExchanger:AirToAir:FlatPlate' + + case ZoneEquipType::HeatExchanger: { // 'HeatExchanger:AirToAir:FlatPlate' HeatRecovery::SimHeatRecovery(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, FirstHVACIteration, zoneEquipList.EquipIndex(EquipPtr), DataHVACGlobals::ContFanCycCoil); } break; - case ZoneEquip::ERVStandAlone: { // 'ZoneHVAC:EnergyRecoveryVentilator' + + case ZoneEquipType::EnergyRecoveryVentilator: { // 'ZoneHVAC:EnergyRecoveryVentilator' HVACStandAloneERV::SimStandAloneERV(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3343,7 +3360,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::HPWaterHeater: { // 'WaterHeater:HeatPump:PumpedCondenser' + + case ZoneEquipType::HeatPumpWaterHeater: { // 'WaterHeater:HeatPump:PumpedCondenser' WaterThermalTanks::SimHeatPumpWaterHeater(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, FirstHVACIteration, @@ -3351,7 +3369,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, state.dataZoneEquip->ZoneEquipList(ControlledZoneNum).EquipIndex(EquipPtr)); } break; - case ZoneEquip::VentilatedSlab: { // 'ZoneHVAC:VentilatedSlab' + + case ZoneEquipType::VentilatedSlab: { // 'ZoneHVAC:VentilatedSlab' VentilatedSlab::SimVentilatedSlab(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3360,7 +3379,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::OutdoorAirUnit: { // 'ZoneHVAC:OutdoorAirUnit' + + case ZoneEquipType::OutdoorAirUnit: { // 'ZoneHVAC:OutdoorAirUnit' OutdoorAirUnit::SimOutdoorAirUnit(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3369,7 +3389,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::BBElectric: { // 'ZoneHVAC:Baseboard:RadiantConvective:Electric' + + case ZoneEquipType::BaseboardElectric: { // 'ZoneHVAC:Baseboard:RadiantConvective:Electric' ElectricBaseboardRadiator::SimElecBaseboard(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3380,7 +3401,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat } break; - case ZoneEquip::RefrigerationAirChillerSet: { // 'ZoneHVAC:RefrigerationChillerSet' + + case ZoneEquipType::RefrigerationChillerSet: { // 'ZoneHVAC:RefrigerationChillerSet' RefrigeratedCase::SimAirChillerSet(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3391,7 +3413,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool thisZoneHB.NonAirSystemResponse += SysOutputProvided; } break; - case ZoneEquip::UserDefinedZoneHVACForcedAir: { + + case ZoneEquipType::UserDefinedHVACForcedAir: { UserDefinedComponents::SimZoneAirUserDefined(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3399,7 +3422,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::ZoneEvaporativeCoolerUnit: { + + case ZoneEquipType::EvaporativeCooler: { EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, ControlledZoneNum, @@ -3407,7 +3431,8 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; - case ZoneEquip::ZoneHybridEvaporativeCooler: { + + case ZoneEquipType::HybridEvaporativeCooler: { HybridUnitaryAirConditioners::SimZoneHybridUnitaryAirConditioners( state, state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName, @@ -3416,6 +3441,7 @@ void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool LatOutputProvided, zoneEquipList.EquipIndex(EquipPtr)); } break; + default: break; } @@ -3526,9 +3552,9 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum) int const NumOfEquipTypes(zeq.NumOfEquipTypes); for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) { auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum)); - pso.EquipType = zeq.EquipType(EquipTypeNum); + pso.EquipTypeName = zeq.EquipTypeName(EquipTypeNum); pso.EquipName = zeq.EquipName(EquipTypeNum); - pso.EquipTypeEnum = zeq.EquipTypeEnum(EquipTypeNum); + pso.equipType = zeq.EquipType(EquipTypeNum); pso.CoolingPriority = zeq.CoolingPriority(EquipTypeNum); pso.HeatingPriority = zeq.HeatingPriority(EquipTypeNum); pso.EquipPtr = EquipTypeNum; @@ -3537,9 +3563,9 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum) EquipTypeNum <= EquipTypeNum_end; ++EquipTypeNum) { // Reset unused upper array portion auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum)); - pso.EquipType.clear(); + pso.EquipTypeName.clear(); pso.EquipName.clear(); - pso.EquipTypeEnum = 0; + pso.equipType = DataZoneEquipment::ZoneEquipType::Invalid; pso.EquipPtr = 0; } @@ -3558,10 +3584,10 @@ void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum) state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired >= 0.0)) { // Tuned C++ string swap avoids copying - pso.EquipType.swap(psc.EquipType); + pso.EquipTypeName.swap(psc.EquipTypeName); pso.EquipName.swap(psc.EquipName); std::swap(pso.EquipPtr, psc.EquipPtr); - std::swap(pso.EquipTypeEnum, psc.EquipTypeEnum); + std::swap(pso.equipType, psc.equipType); std::swap(pso.CoolingPriority, psc.CoolingPriority); std::swap(pso.HeatingPriority, psc.HeatingPriority); @@ -4825,9 +4851,9 @@ void CalcZoneLeavingConditions(EnergyPlusData &state, bool const FirstHVACIterat } // user defined room air model may feed temp that differs from zone node - if (allocated(state.dataRoomAirMod->AirPatternZoneInfo)) { - if ((state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).IsUsed) && (!state.dataGlobal->BeginEnvrnFlag)) { - TempZoneAir = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving; + if (allocated(state.dataRoomAir->AirPatternZoneInfo)) { + if ((state.dataRoomAir->AirPatternZoneInfo(ZoneNum).IsUsed) && (!state.dataGlobal->BeginEnvrnFlag)) { + TempZoneAir = state.dataRoomAir->AirPatternZoneInfo(ZoneNum).Tleaving; TempRetAir = TempZoneAir; } else { TempZoneAir = state.dataLoopNodes->Node(ZoneNode).Temp; @@ -6140,7 +6166,7 @@ void GetStandAloneERVNodes(EnergyPlusData &state, DataHeatBalance::ZoneAirBalanc thisZoneAirBalance.OneTimeFlag = true; if (state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes > 0) { for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++I) { - if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(I) == DataZoneEquipment::ZoneEquip::ERVStandAlone) { + if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipType(I) == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator) { ++thisZoneAirBalance.NumOfERVs; } } @@ -6149,7 +6175,7 @@ void GetStandAloneERVNodes(EnergyPlusData &state, DataHeatBalance::ZoneAirBalanc thisZoneAirBalance.ERVExhaustNode.allocate(thisZoneAirBalance.NumOfERVs); int j = 1; for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++I) { - if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(I) == DataZoneEquipment::ZoneEquip::ERVStandAlone) { + if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipType(I) == DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator) { thisZoneAirBalance.ERVInletNode(j) = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipIndex(I)); thisZoneAirBalance.ERVExhaustNode(j) = diff --git a/src/EnergyPlus/ZoneEquipmentManager.hh b/src/EnergyPlus/ZoneEquipmentManager.hh index 3f48b8979d6..ebb89d4cdbb 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.hh +++ b/src/EnergyPlus/ZoneEquipmentManager.hh @@ -70,9 +70,9 @@ namespace ZoneEquipmentManager { struct SimulationOrder { - std::string EquipType; - int EquipTypeEnum = 0; - std::string EquipName; + std::string EquipTypeName = ""; + DataZoneEquipment::ZoneEquipType equipType = DataZoneEquipment::ZoneEquipType::Invalid; + std::string EquipName = ""; int EquipPtr = 0; int CoolingPriority = 0; int HeatingPriority = 0; diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 2923aecd212..51803ea04d0 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -509,7 +509,7 @@ void GetZoneAirSetPoints(EnergyPlusData &state) if (!TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum).empty()) { DataHVACGlobals::ThermostatType ctrlType = static_cast( - getEnumerationValue(ValidControlTypesUC, TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum))); + getEnumValue(ValidControlTypesUC, TempControlledZone(TempControlledZoneNum).ControlType(ControlTypeNum))); TempControlledZone(TempControlledZoneNum).ControlTypeEnum(ControlTypeNum) = ctrlType; if (ctrlType == DataHVACGlobals::ThermostatType::Invalid) { ShowSevereError(state, @@ -1259,9 +1259,9 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)); ComfortControlledZone(ComfortControlledZoneNum).ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 5)); if (ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum) != "") { - CTIndex = getEnumerationValue( - ValidComfortControlTypesUC, - UtilityRoutines::MakeUPPERCase(ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum))); + CTIndex = + getEnumValue(ValidComfortControlTypesUC, + UtilityRoutines::makeUPPER(ComfortControlledZone(ComfortControlledZoneNum).ControlType(ControlTypeNum))); if (CTIndex == 0) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\"", @@ -3585,28 +3585,23 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( this->TempHistoryTerm = this->AirPowerCap * (3.0 * this->ZTM[0] - (3.0 / 2.0) * this->ZTM[1] + (1.0 / 3.0) * this->ZTM[2]); this->TempDepZnLd = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; this->TempIndZnLd = this->TempHistoryTerm + this->TempIndCoef; - if (state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { + if (state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { // RoomAirflowNetworkModel - make dynamic term independent of TimeStepSys - auto &thisRoomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum); - if (thisRoomAirflowNetworkZoneInfo.IsUsed) { - int RoomAirNode = thisRoomAirflowNetworkZoneInfo.ControlAirNodeID; - RoomAirModelAirflowNetwork::LoadPredictionRoomAirModelAirflowNetwork(state, zoneNum, RoomAirNode); - this->TempDepCoef = - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumHA + thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumLinkMCp; - this->TempIndCoef = thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumIntSensibleGain + - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumHATsurf - - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumHATref + - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SumLinkMCpT + - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).SysDepZoneLoadsLagged; - this->AirPowerCap = thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).AirVolume * - state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).RhoAir * - thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).CpAir / TimeStepSysSec; + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + if (afnZoneInfo.IsUsed) { + int RoomAirNode = afnZoneInfo.ControlAirNodeID; + RoomAir::LoadPredictionRoomAirModelAFN(state, zoneNum, RoomAirNode); + this->TempDepCoef = afnZoneInfo.Node(RoomAirNode).SumHA + afnZoneInfo.Node(RoomAirNode).SumLinkMCp; + this->TempIndCoef = afnZoneInfo.Node(RoomAirNode).SumIntSensibleGain + afnZoneInfo.Node(RoomAirNode).SumHATsurf - + afnZoneInfo.Node(RoomAirNode).SumHATref + afnZoneInfo.Node(RoomAirNode).SumLinkMCpT + + afnZoneInfo.Node(RoomAirNode).SysDepZoneLoadsLagged; + this->AirPowerCap = afnZoneInfo.Node(RoomAirNode).AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * + afnZoneInfo.Node(RoomAirNode).RhoAir * afnZoneInfo.Node(RoomAirNode).CpAir / TimeStepSysSec; this->TempHistoryTerm = this->AirPowerCap * (3.0 * this->ZTM[0] - (3.0 / 2.0) * this->ZTM[1] + (1.0 / 3.0) * this->ZTM[2]); this->TempDepZnLd = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; this->TempIndZnLd = this->TempHistoryTerm + this->TempIndCoef; - if (thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).HasHVACAssigned) - RAFNFrac = thisRoomAirflowNetworkZoneInfo.Node(RoomAirNode).HVAC(1).SupplyFraction; + if (afnZoneInfo.Node(RoomAirNode).HasHVACAssigned) RAFNFrac = afnZoneInfo.Node(RoomAirNode).HVAC(1).SupplyFraction; } } } @@ -3618,21 +3613,21 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { this->ZoneT1 = this->ZoneTM2; this->ZoneW1 = this->ZoneWM2; - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - auto &thisRoomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum); - for (int LoopNode = 1; LoopNode <= thisRoomAirflowNetworkZoneInfo.NumOfAirNodes; ++LoopNode) { - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTempT1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTempTM2; - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRatW1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRatWM2; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + for (auto &afnNode : afnZoneInfo.Node) { + afnNode.AirTempT1 = afnNode.AirTempT2; + afnNode.HumRatT1 = afnNode.HumRatT2; } } } else { this->ZoneT1 = this->ZoneTMX; this->ZoneW1 = this->ZoneWMX; - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - auto &thisRoomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum); - for (int LoopNode = 1; LoopNode <= thisRoomAirflowNetworkZoneInfo.NumOfAirNodes; ++LoopNode) { - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTempT1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTempTMX; - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRatW1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRatWMX; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + for (auto &afnNode : afnZoneInfo.Node) { + afnNode.AirTempT1 = afnNode.AirTempTX; + afnNode.HumRatT1 = afnNode.HumRatTX; } } } @@ -3640,11 +3635,11 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( } else { this->ZoneT1 = this->ZT; this->ZoneW1 = this->ZoneAirHumRat; - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - auto &thisRoomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum); - for (int LoopNode = 1; LoopNode <= thisRoomAirflowNetworkZoneInfo.NumOfAirNodes; ++LoopNode) { - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTempT1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).AirTemp; - thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRatW1 = thisRoomAirflowNetworkZoneInfo.Node(LoopNode).HumRat; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + for (auto &afnNode : afnZoneInfo.Node) { + afnNode.AirTempT1 = afnNode.AirTemp; + afnNode.HumRatT1 = afnNode.HumRat; } } } @@ -4119,8 +4114,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, } C = RhoAir * volume * thisZone.ZoneVolCapMultpMoist / TimeStepSysSec; - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - auto &roomAFNInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum); + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + auto &roomAFNInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); int RoomAirNode = roomAFNInfo.ControlAirNodeID; H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(roomAFNInfo.Node(RoomAirNode).HumRat, roomAFNInfo.Node(RoomAirNode).AirTemp); A = roomAFNInfo.Node(RoomAirNode).SumLinkM + roomAFNInfo.Node(RoomAirNode).SumHmARa; @@ -4292,7 +4287,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { - RoomAirModelManager::ManageAirModel(state, zoneNum); + RoomAir::ManageAirModel(state, zoneNum); } // Calculate the various heat balance sums @@ -4346,7 +4341,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } // Update zone node temperature and thermostat temperature unless already updated in Room Air Model, // calculate load correction factor - if (!state.dataRoomAirMod->anyNonMixingRoomAirModel) { + if (!state.dataRoomAir->anyNonMixingRoomAirModel) { // Fully mixed thisSystemNode.Temp = this->ZT; // SpaceHB TODO: What to do here if this is for space @@ -4355,8 +4350,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum) = 1.0; } else { - auto &thisAirModel = state.dataRoomAirMod->AirModel(zoneNum); - if ((thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::Mixing) || (!thisAirModel.SimAirModel)) { + auto &thisAirModel = state.dataRoomAir->AirModel(zoneNum); + if ((thisAirModel.AirModel == RoomAir::RoomAirModel::Mixing) || (!thisAirModel.SimAirModel)) { // Fully mixed thisSystemNode.Temp = this->ZT; // SpaceHB TODO: What to do here if this is for space @@ -4364,7 +4359,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( state.dataHeatBalFanSys->TempTstatAir(zoneNum) = this->ZT; } state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum) = 1.0; - } else if (state.dataRoomAirMod->IsZoneDV(zoneNum) || state.dataRoomAirMod->IsZoneUI(zoneNum)) { + } else if (state.dataRoomAir->IsZoneDispVent3Node(zoneNum) || state.dataRoomAir->IsZoneUFAD(zoneNum)) { // UCSDDV: Not fully mixed - calculate factor to correct load for fully mixed assumption // Space HB TODO: Space HB doesn't mix with DV etc. if (this->SumSysMCp > DataHVACGlobals::SmallMassFlow) { @@ -4382,8 +4377,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // Negligible flow, assume mixed - reasonable lagged starting value for first step time with significant flow state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum) = 1.0; } - } else if (thisAirModel.SimAirModel && ((thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UserDefined) || - (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::Mundt))) { + } else if (thisAirModel.SimAirModel && ((thisAirModel.AirModel == RoomAir::RoomAirModel::UserDefined) || + (thisAirModel.AirModel == RoomAir::RoomAirModel::DispVent1Node))) { if (this->SumSysMCp > DataHVACGlobals::SmallMassFlow) { Real64 TempSupplyAir = this->SumSysMCpT / this->SumSysMCp; // Non-negligible flow, calculate supply air temperature if (std::abs(TempSupplyAir - this->ZT) > state.dataHeatBal->TempConvergTol) { @@ -4399,11 +4394,9 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // Negligible flow, assume mixed - reasonable lagged starting value for first step time with significant flow state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum) = 1.0; } - } else if (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { + } else if (thisAirModel.AirModel == RoomAir::RoomAirModel::AirflowNetwork) { // Zone node used in the RoomAirflowNetwork model - this->ZT = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum) - .Node(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).ControlAirNodeID) - .AirTemp; + this->ZT = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(state.dataRoomAir->AFNZoneInfo(zoneNum).ControlAirNodeID).AirTemp; thisSystemNode.Temp = this->ZT; // SpaceHB TODO: What to do here if this is for space if (spaceNum == 0) { @@ -4461,11 +4454,9 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } // SpaceHB TODO: For now, room air model is only for zones - if (spaceNum == 0 && state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - this->ZT = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum) - .Node(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).ControlAirNodeID) - .AirTemp; + if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + this->ZT = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(state.dataRoomAir->AFNZoneInfo(zoneNum).ControlAirNodeID).AirTemp; } } @@ -4513,9 +4504,9 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // tempChange is used by HVACManager to determine if the timestep needs to be shortened. bool isMixed = true; // SpaceHB TODO: For now, room air model is only for zones - if (spaceNum == 0 && state.dataRoomAirMod->anyNonMixingRoomAirModel) { - isMixed = !((state.dataRoomAirMod->IsZoneDV(zoneNum) && !state.dataRoomAirMod->ZoneDVMixedFlag(zoneNum)) || - (state.dataRoomAirMod->IsZoneUI(zoneNum) && !state.dataRoomAirMod->ZoneUFMixedFlag(zoneNum))); + if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { + isMixed = !((state.dataRoomAir->IsZoneDispVent3Node(zoneNum) && !state.dataRoomAir->ZoneDispVent3NodeMixedFlag(zoneNum)) || + (state.dataRoomAir->IsZoneUFAD(zoneNum) && !state.dataRoomAir->ZoneUFADMixedFlag(zoneNum))); } switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { @@ -4523,8 +4514,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( tempChange = max(tempChange, std::abs(this->ZT - this->ZTM[0])); } else { tempChange = max(tempChange, - max(std::abs(state.dataRoomAirMod->ZTOC(zoneNum) - state.dataRoomAirMod->ZTM1OC(zoneNum)), - std::abs(state.dataRoomAirMod->ZTMX(zoneNum) - state.dataRoomAirMod->ZTM1MX(zoneNum)))); + max(std::abs(state.dataRoomAir->ZTOC(zoneNum) - state.dataRoomAir->ZTMOC(zoneNum)[0]), + std::abs(state.dataRoomAir->ZTMX(zoneNum) - state.dataRoomAir->ZTMMX(zoneNum)[0]))); } } break; case DataHeatBalance::SolutionAlgo::AnalyticalSolution: @@ -4533,8 +4524,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( tempChange = max(tempChange, std::abs(this->ZT - this->ZoneT1)); } else { tempChange = max(tempChange, - max(std::abs(state.dataRoomAirMod->ZTOC(zoneNum) - state.dataRoomAirMod->Zone1OC(zoneNum)), - std::abs(state.dataRoomAirMod->ZTMX(zoneNum) - state.dataRoomAirMod->Zone1MX(zoneNum)))); + max(std::abs(state.dataRoomAir->ZTOC(zoneNum) - state.dataRoomAir->Zone1OC(zoneNum)), + std::abs(state.dataRoomAir->ZTMX(zoneNum) - state.dataRoomAir->Zone1MX(zoneNum)))); } } break; default: @@ -4584,7 +4575,7 @@ void ZoneSpaceHeatBalanceData::pushZoneTimestepHistory(EnergyPlusData &state, in constexpr std::string_view routineName("pushTimestepHistories"); assert(zoneNum > 0); - auto &thisAirModel = state.dataRoomAirMod->AirModel(zoneNum); + auto &thisAirModel = state.dataRoomAir->AirModel(zoneNum); // Push the temperature and humidity ratio histories @@ -4601,41 +4592,39 @@ void ZoneSpaceHeatBalanceData::pushZoneTimestepHistory(EnergyPlusData &state, in // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { - if (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV || - thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI || - thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { - state.dataRoomAirMod->XM4TFloor(zoneNum) = state.dataRoomAirMod->XM3TFloor(zoneNum); - state.dataRoomAirMod->XM3TFloor(zoneNum) = state.dataRoomAirMod->XM2TFloor(zoneNum); - state.dataRoomAirMod->XM2TFloor(zoneNum) = state.dataRoomAirMod->XMATFloor(zoneNum); - state.dataRoomAirMod->XMATFloor(zoneNum) = state.dataRoomAirMod->ZTFloor(zoneNum); - state.dataRoomAirMod->MATFloor(zoneNum) = state.dataRoomAirMod->ZTFloor(zoneNum); - - state.dataRoomAirMod->XM4TOC(zoneNum) = state.dataRoomAirMod->XM3TOC(zoneNum); - state.dataRoomAirMod->XM3TOC(zoneNum) = state.dataRoomAirMod->XM2TOC(zoneNum); - state.dataRoomAirMod->XM2TOC(zoneNum) = state.dataRoomAirMod->XMATOC(zoneNum); - state.dataRoomAirMod->XMATOC(zoneNum) = state.dataRoomAirMod->ZTOC(zoneNum); - state.dataRoomAirMod->MATOC(zoneNum) = state.dataRoomAirMod->ZTOC(zoneNum); - - state.dataRoomAirMod->XM4TMX(zoneNum) = state.dataRoomAirMod->XM3TMX(zoneNum); - state.dataRoomAirMod->XM3TMX(zoneNum) = state.dataRoomAirMod->XM2TMX(zoneNum); - state.dataRoomAirMod->XM2TMX(zoneNum) = state.dataRoomAirMod->XMATMX(zoneNum); - state.dataRoomAirMod->XMATMX(zoneNum) = state.dataRoomAirMod->ZTMX(zoneNum); - state.dataRoomAirMod->MATMX(zoneNum) = state.dataRoomAirMod->ZTMX(zoneNum); + if (thisAirModel.AirModel == RoomAir::RoomAirModel::DispVent3Node || thisAirModel.AirModel == RoomAir::RoomAirModel::UFADInt || + thisAirModel.AirModel == RoomAir::RoomAirModel::UFADExt) { + state.dataRoomAir->XMATFloor(zoneNum)[3] = state.dataRoomAir->XMATFloor(zoneNum)[2]; + state.dataRoomAir->XMATFloor(zoneNum)[2] = state.dataRoomAir->XMATFloor(zoneNum)[1]; + state.dataRoomAir->XMATFloor(zoneNum)[1] = state.dataRoomAir->XMATFloor(zoneNum)[0]; + state.dataRoomAir->XMATFloor(zoneNum)[0] = state.dataRoomAir->ZTFloor(zoneNum); + state.dataRoomAir->MATFloor(zoneNum) = state.dataRoomAir->ZTFloor(zoneNum); + + state.dataRoomAir->XMATOC(zoneNum)[3] = state.dataRoomAir->XMATOC(zoneNum)[2]; + state.dataRoomAir->XMATOC(zoneNum)[2] = state.dataRoomAir->XMATOC(zoneNum)[1]; + state.dataRoomAir->XMATOC(zoneNum)[1] = state.dataRoomAir->XMATOC(zoneNum)[0]; + state.dataRoomAir->XMATOC(zoneNum)[0] = state.dataRoomAir->ZTOC(zoneNum); + state.dataRoomAir->MATOC(zoneNum) = state.dataRoomAir->ZTOC(zoneNum); + + state.dataRoomAir->XMATMX(zoneNum)[3] = state.dataRoomAir->XMATMX(zoneNum)[2]; + state.dataRoomAir->XMATMX(zoneNum)[2] = state.dataRoomAir->XMATMX(zoneNum)[1]; + state.dataRoomAir->XMATMX(zoneNum)[1] = state.dataRoomAir->XMATMX(zoneNum)[0]; + state.dataRoomAir->XMATMX(zoneNum)[0] = state.dataRoomAir->ZTMX(zoneNum); + state.dataRoomAir->MATMX(zoneNum) = state.dataRoomAir->ZTMX(zoneNum); } // for RoomAirflowNetwork model - if (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &roomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode); - roomAirflowNetworkZoneInfo.AirTempX4 = roomAirflowNetworkZoneInfo.AirTempX3; - roomAirflowNetworkZoneInfo.AirTempX3 = roomAirflowNetworkZoneInfo.AirTempX2; - roomAirflowNetworkZoneInfo.AirTempX2 = roomAirflowNetworkZoneInfo.AirTempX1; - roomAirflowNetworkZoneInfo.AirTempX1 = roomAirflowNetworkZoneInfo.AirTemp; + if (thisAirModel.AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (auto &afnNode : state.dataRoomAir->AFNZoneInfo(zoneNum).Node) { + afnNode.AirTempX[3] = afnNode.AirTempX[2]; + afnNode.AirTempX[2] = afnNode.AirTempX[1]; + afnNode.AirTempX[1] = afnNode.AirTempX[0]; + afnNode.AirTempX[0] = afnNode.AirTemp; - roomAirflowNetworkZoneInfo.HumRatX4 = roomAirflowNetworkZoneInfo.HumRatX3; - roomAirflowNetworkZoneInfo.HumRatX3 = roomAirflowNetworkZoneInfo.HumRatX2; - roomAirflowNetworkZoneInfo.HumRatX2 = roomAirflowNetworkZoneInfo.HumRatX1; - roomAirflowNetworkZoneInfo.HumRatX1 = roomAirflowNetworkZoneInfo.HumRat; + afnNode.HumRatX[3] = afnNode.HumRatX[2]; + afnNode.HumRatX[2] = afnNode.HumRatX[1]; + afnNode.HumRatX[1] = afnNode.HumRatX[0]; + afnNode.HumRatX[0] = afnNode.HumRat; } } } @@ -4647,25 +4636,23 @@ void ZoneSpaceHeatBalanceData::pushZoneTimestepHistory(EnergyPlusData &state, in this->ZoneWMX = this->ZoneAirHumRatAvg; // using average for whole zone time step. // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { - if (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV || - thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI || - thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { - state.dataRoomAirMod->ZoneM2Floor(zoneNum) = state.dataRoomAirMod->ZoneMXFloor(zoneNum); - state.dataRoomAirMod->ZoneMXFloor(zoneNum) = state.dataRoomAirMod->ZTFloor(zoneNum); // using average for whole zone time step. - state.dataRoomAirMod->ZoneM2OC(zoneNum) = state.dataRoomAirMod->ZoneMXOC(zoneNum); - state.dataRoomAirMod->ZoneMXOC(zoneNum) = state.dataRoomAirMod->ZTOC(zoneNum); // using average for whole zone time step. - state.dataRoomAirMod->ZoneM2MX(zoneNum) = state.dataRoomAirMod->ZoneMXMX(zoneNum); - state.dataRoomAirMod->ZoneMXMX(zoneNum) = state.dataRoomAirMod->ZTMX(zoneNum); // using average for whole zone time step. + if (thisAirModel.AirModel == RoomAir::RoomAirModel::DispVent3Node || thisAirModel.AirModel == RoomAir::RoomAirModel::UFADInt || + thisAirModel.AirModel == RoomAir::RoomAirModel::UFADExt) { + state.dataRoomAir->ZoneM2Floor(zoneNum) = state.dataRoomAir->ZoneMXFloor(zoneNum); + state.dataRoomAir->ZoneMXFloor(zoneNum) = state.dataRoomAir->ZTFloor(zoneNum); // using average for whole zone time step. + state.dataRoomAir->ZoneM2OC(zoneNum) = state.dataRoomAir->ZoneMXOC(zoneNum); + state.dataRoomAir->ZoneMXOC(zoneNum) = state.dataRoomAir->ZTOC(zoneNum); // using average for whole zone time step. + state.dataRoomAir->ZoneM2MX(zoneNum) = state.dataRoomAir->ZoneMXMX(zoneNum); + state.dataRoomAir->ZoneMXMX(zoneNum) = state.dataRoomAir->ZTMX(zoneNum); // using average for whole zone time step. } - if (thisAirModel.AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &roomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode); - roomAirflowNetworkZoneInfo.AirTempTM2 = roomAirflowNetworkZoneInfo.AirTempTMX; - roomAirflowNetworkZoneInfo.AirTempTMX = roomAirflowNetworkZoneInfo.AirTemp; + if (thisAirModel.AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (auto &afnNode : state.dataRoomAir->AFNZoneInfo(zoneNum).Node) { + afnNode.AirTempT2 = afnNode.AirTempTX; + afnNode.AirTempTX = afnNode.AirTemp; - roomAirflowNetworkZoneInfo.HumRatWM2 = roomAirflowNetworkZoneInfo.HumRatWMX; - roomAirflowNetworkZoneInfo.HumRatWMX = roomAirflowNetworkZoneInfo.HumRat; + afnNode.HumRatT2 = afnNode.HumRatTX; + afnNode.HumRatTX = afnNode.HumRat; } } } @@ -4703,35 +4690,34 @@ void ZoneSpaceHeatBalanceData::pushSystemTimestepHistory(EnergyPlusData &state, this->DSWPrevZoneTS[0] = this->ZoneAirHumRat; // SpaceHB TODO: For now, room air model is only for zones - if (spaceNum == 0 && state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(zoneNum) || state.dataRoomAirMod->IsZoneUI(zoneNum)) { - state.dataRoomAirMod->DSXM4TFloor(zoneNum) = state.dataRoomAirMod->DSXM3TFloor(zoneNum); - state.dataRoomAirMod->DSXM3TFloor(zoneNum) = state.dataRoomAirMod->DSXM2TFloor(zoneNum); - state.dataRoomAirMod->DSXM2TFloor(zoneNum) = state.dataRoomAirMod->DSXMATFloor(zoneNum); - state.dataRoomAirMod->DSXMATFloor(zoneNum) = state.dataRoomAirMod->MATFloor(zoneNum); - - state.dataRoomAirMod->DSXM4TOC(zoneNum) = state.dataRoomAirMod->DSXM3TOC(zoneNum); - state.dataRoomAirMod->DSXM3TOC(zoneNum) = state.dataRoomAirMod->DSXM2TOC(zoneNum); - state.dataRoomAirMod->DSXM2TOC(zoneNum) = state.dataRoomAirMod->DSXMATOC(zoneNum); - state.dataRoomAirMod->DSXMATOC(zoneNum) = state.dataRoomAirMod->MATOC(zoneNum); - - state.dataRoomAirMod->DSXM4TMX(zoneNum) = state.dataRoomAirMod->DSXM3TMX(zoneNum); - state.dataRoomAirMod->DSXM3TMX(zoneNum) = state.dataRoomAirMod->DSXM2TMX(zoneNum); - state.dataRoomAirMod->DSXM2TMX(zoneNum) = state.dataRoomAirMod->DSXMATMX(zoneNum); - state.dataRoomAirMod->DSXMATMX(zoneNum) = state.dataRoomAirMod->MATMX(zoneNum); - } - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &roomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode); - roomAirflowNetworkZoneInfo.AirTempDSX4 = roomAirflowNetworkZoneInfo.AirTempDSX3; - roomAirflowNetworkZoneInfo.AirTempDSX3 = roomAirflowNetworkZoneInfo.AirTempDSX2; - roomAirflowNetworkZoneInfo.AirTempDSX2 = roomAirflowNetworkZoneInfo.AirTempDSX1; - roomAirflowNetworkZoneInfo.AirTempDSX1 = roomAirflowNetworkZoneInfo.AirTemp; - - roomAirflowNetworkZoneInfo.HumRatDSX4 = roomAirflowNetworkZoneInfo.HumRatDSX3; - roomAirflowNetworkZoneInfo.HumRatDSX3 = roomAirflowNetworkZoneInfo.HumRatDSX2; - roomAirflowNetworkZoneInfo.HumRatDSX2 = roomAirflowNetworkZoneInfo.HumRatDSX1; - roomAirflowNetworkZoneInfo.HumRatDSX1 = roomAirflowNetworkZoneInfo.HumRat; + if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(zoneNum) || state.dataRoomAir->IsZoneUFAD(zoneNum)) { + state.dataRoomAir->DSXMATFloor(zoneNum)[3] = state.dataRoomAir->DSXMATFloor(zoneNum)[2]; + state.dataRoomAir->DSXMATFloor(zoneNum)[2] = state.dataRoomAir->DSXMATFloor(zoneNum)[1]; + state.dataRoomAir->DSXMATFloor(zoneNum)[1] = state.dataRoomAir->DSXMATFloor(zoneNum)[0]; + state.dataRoomAir->DSXMATFloor(zoneNum)[0] = state.dataRoomAir->MATFloor(zoneNum); + + state.dataRoomAir->DSXMATOC(zoneNum)[3] = state.dataRoomAir->DSXMATOC(zoneNum)[2]; + state.dataRoomAir->DSXMATOC(zoneNum)[2] = state.dataRoomAir->DSXMATOC(zoneNum)[1]; + state.dataRoomAir->DSXMATOC(zoneNum)[1] = state.dataRoomAir->DSXMATOC(zoneNum)[0]; + state.dataRoomAir->DSXMATOC(zoneNum)[0] = state.dataRoomAir->MATOC(zoneNum); + + state.dataRoomAir->DSXMATMX(zoneNum)[3] = state.dataRoomAir->DSXMATMX(zoneNum)[2]; + state.dataRoomAir->DSXMATMX(zoneNum)[2] = state.dataRoomAir->DSXMATMX(zoneNum)[1]; + state.dataRoomAir->DSXMATMX(zoneNum)[1] = state.dataRoomAir->DSXMATMX(zoneNum)[0]; + state.dataRoomAir->DSXMATMX(zoneNum)[0] = state.dataRoomAir->MATMX(zoneNum); + } + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (auto &afnNode : state.dataRoomAir->AFNZoneInfo(zoneNum).Node) { + afnNode.AirTempDSX[3] = afnNode.AirTempDSX[2]; + afnNode.AirTempDSX[2] = afnNode.AirTempDSX[1]; + afnNode.AirTempDSX[1] = afnNode.AirTempDSX[0]; + afnNode.AirTempDSX[0] = afnNode.AirTemp; + + afnNode.HumRatDSX[3] = afnNode.HumRatDSX[2]; + afnNode.HumRatDSX[2] = afnNode.HumRatDSX[1]; + afnNode.HumRatDSX[1] = afnNode.HumRatDSX[0]; + afnNode.HumRatDSX[0] = afnNode.HumRat; } } } @@ -4744,24 +4730,24 @@ void ZoneSpaceHeatBalanceData::pushSystemTimestepHistory(EnergyPlusData &state, // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV || - state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI || - state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { - state.dataRoomAirMod->ZoneM2Floor(zoneNum) = state.dataRoomAirMod->ZoneMXFloor(zoneNum); - state.dataRoomAirMod->ZoneMXFloor(zoneNum) = state.dataRoomAirMod->ZTFloor(zoneNum); // using average for whole zone time step. - state.dataRoomAirMod->ZoneM2OC(zoneNum) = state.dataRoomAirMod->ZoneMXOC(zoneNum); - state.dataRoomAirMod->ZoneMXOC(zoneNum) = state.dataRoomAirMod->ZTOC(zoneNum); // using average for whole zone time step. - state.dataRoomAirMod->ZoneM2MX(zoneNum) = state.dataRoomAirMod->ZoneMXMX(zoneNum); - state.dataRoomAirMod->ZoneMXMX(zoneNum) = state.dataRoomAirMod->ZTMX(zoneNum); // using average for whole zone time step. + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::DispVent3Node || + state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::UFADInt || + state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::UFADExt) { + state.dataRoomAir->ZoneM2Floor(zoneNum) = state.dataRoomAir->ZoneMXFloor(zoneNum); + state.dataRoomAir->ZoneMXFloor(zoneNum) = state.dataRoomAir->ZTFloor(zoneNum); // using average for whole zone time step. + state.dataRoomAir->ZoneM2OC(zoneNum) = state.dataRoomAir->ZoneMXOC(zoneNum); + state.dataRoomAir->ZoneMXOC(zoneNum) = state.dataRoomAir->ZTOC(zoneNum); // using average for whole zone time step. + state.dataRoomAir->ZoneM2MX(zoneNum) = state.dataRoomAir->ZoneMXMX(zoneNum); + state.dataRoomAir->ZoneMXMX(zoneNum) = state.dataRoomAir->ZTMX(zoneNum); // using average for whole zone time step. } - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &roomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode); - roomAirflowNetworkZoneInfo.AirTempTM2 = roomAirflowNetworkZoneInfo.AirTempTMX; - roomAirflowNetworkZoneInfo.AirTempTMX = roomAirflowNetworkZoneInfo.AirTemp; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (int LoopNode = 1; LoopNode <= state.dataRoomAir->AFNZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { + auto &afnNode = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(LoopNode); + afnNode.AirTempT2 = afnNode.AirTempTX; + afnNode.AirTempTX = afnNode.AirTemp; - roomAirflowNetworkZoneInfo.HumRatWM2 = roomAirflowNetworkZoneInfo.HumRatWMX; - roomAirflowNetworkZoneInfo.HumRatWMX = roomAirflowNetworkZoneInfo.HumRat; + afnNode.HumRatT2 = afnNode.HumRatTX; + afnNode.HumRatTX = afnNode.HumRat; } } } @@ -4798,33 +4784,32 @@ void ZoneSpaceHeatBalanceData::revertZoneTimestepHistory(EnergyPlusData &state, // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV || - state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI || - state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) { + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::DispVent3Node || + state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::UFADInt || + state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::UFADExt) { - state.dataRoomAirMod->XMATFloor(zoneNum) = state.dataRoomAirMod->XM2TFloor(zoneNum); - state.dataRoomAirMod->XM2TFloor(zoneNum) = state.dataRoomAirMod->XM3TFloor(zoneNum); - state.dataRoomAirMod->XM3TFloor(zoneNum) = state.dataRoomAirMod->XM4TFloor(zoneNum); + state.dataRoomAir->XMATFloor(zoneNum)[0] = state.dataRoomAir->XMATFloor(zoneNum)[1]; + state.dataRoomAir->XMATFloor(zoneNum)[1] = state.dataRoomAir->XMATFloor(zoneNum)[2]; + state.dataRoomAir->XMATFloor(zoneNum)[2] = state.dataRoomAir->XMATFloor(zoneNum)[3]; - state.dataRoomAirMod->XMATOC(zoneNum) = state.dataRoomAirMod->XM2TOC(zoneNum); - state.dataRoomAirMod->XM2TOC(zoneNum) = state.dataRoomAirMod->XM3TOC(zoneNum); - state.dataRoomAirMod->XM3TOC(zoneNum) = state.dataRoomAirMod->XM4TOC(zoneNum); + state.dataRoomAir->XMATOC(zoneNum)[0] = state.dataRoomAir->XMATOC(zoneNum)[1]; + state.dataRoomAir->XMATOC(zoneNum)[1] = state.dataRoomAir->XMATOC(zoneNum)[2]; + state.dataRoomAir->XMATOC(zoneNum)[2] = state.dataRoomAir->XMATOC(zoneNum)[3]; - state.dataRoomAirMod->XMATMX(zoneNum) = state.dataRoomAirMod->XM2TMX(zoneNum); - state.dataRoomAirMod->XM2TMX(zoneNum) = state.dataRoomAirMod->XM3TMX(zoneNum); - state.dataRoomAirMod->XM3TMX(zoneNum) = state.dataRoomAirMod->XM4TMX(zoneNum); + state.dataRoomAir->XMATMX(zoneNum)[0] = state.dataRoomAir->XMATMX(zoneNum)[1]; + state.dataRoomAir->XMATMX(zoneNum)[1] = state.dataRoomAir->XMATMX(zoneNum)[2]; + state.dataRoomAir->XMATMX(zoneNum)[3] = state.dataRoomAir->XMATMX(zoneNum)[3]; } - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &roomAirflowNetworkZoneInfo = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode); - roomAirflowNetworkZoneInfo.AirTempX1 = roomAirflowNetworkZoneInfo.AirTempX2; - roomAirflowNetworkZoneInfo.AirTempX2 = roomAirflowNetworkZoneInfo.AirTempX3; - roomAirflowNetworkZoneInfo.AirTempX3 = roomAirflowNetworkZoneInfo.AirTempX4; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (auto &afnNode : state.dataRoomAir->AFNZoneInfo(zoneNum).Node) { + afnNode.AirTempX[0] = afnNode.AirTempX[1]; + afnNode.AirTempX[1] = afnNode.AirTempX[2]; + afnNode.AirTempX[2] = afnNode.AirTempX[3]; - roomAirflowNetworkZoneInfo.HumRatX1 = roomAirflowNetworkZoneInfo.HumRatX2; - roomAirflowNetworkZoneInfo.HumRatX2 = roomAirflowNetworkZoneInfo.HumRatX3; - roomAirflowNetworkZoneInfo.HumRatX3 = roomAirflowNetworkZoneInfo.HumRatX4; + afnNode.HumRatX[0] = afnNode.HumRatX[1]; + afnNode.HumRatX[1] = afnNode.HumRatX[2]; + afnNode.HumRatX[2] = afnNode.HumRatX[3]; } } } @@ -4955,10 +4940,8 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo if (this->ZoneAirHumRatTemp > WZSat) this->ZoneAirHumRatTemp = WZSat; - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - this->ZoneAirHumRatTemp = state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum) - .Node(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).ControlAirNodeID) - .HumRat; + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + this->ZoneAirHumRatTemp = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(state.dataRoomAir->AFNZoneInfo(zoneNum).ControlAirNodeID).HumRat; } // HybridModel with measured humidity ratio begins @@ -7129,63 +7112,21 @@ void ZoneSpaceHeatBalanceData::updateTemperatures(EnergyPlusData &state, this->MAT = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, this->XMAT, this->DSXMAT); this->ZoneAirHumRat = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, this->WPrevZoneTS, this->DSWPrevZoneTS); - if (spaceNum == 0 && state.dataRoomAirMod->anyNonMixingRoomAirModel) { - if (state.dataRoomAirMod->IsZoneDV(zoneNum) || state.dataRoomAirMod->IsZoneUI(zoneNum)) { - - DownInterpolate4HistoryValues(PriorTimeStep, - TimeStepSys, - state.dataRoomAirMod->XMATFloor(zoneNum), - state.dataRoomAirMod->XM2TFloor(zoneNum), - state.dataRoomAirMod->XM3TFloor(zoneNum), - state.dataRoomAirMod->MATFloor(zoneNum), - state.dataRoomAirMod->DSXMATFloor(zoneNum), - state.dataRoomAirMod->DSXM2TFloor(zoneNum), - state.dataRoomAirMod->DSXM3TFloor(zoneNum), - state.dataRoomAirMod->DSXM4TFloor(zoneNum)); - DownInterpolate4HistoryValues(PriorTimeStep, - TimeStepSys, - state.dataRoomAirMod->XMATOC(zoneNum), - state.dataRoomAirMod->XM2TOC(zoneNum), - state.dataRoomAirMod->XM3TOC(zoneNum), - state.dataRoomAirMod->MATOC(zoneNum), - state.dataRoomAirMod->DSXMATOC(zoneNum), - state.dataRoomAirMod->DSXM2TOC(zoneNum), - state.dataRoomAirMod->DSXM3TOC(zoneNum), - state.dataRoomAirMod->DSXM4TOC(zoneNum)); - DownInterpolate4HistoryValues(PriorTimeStep, - TimeStepSys, - state.dataRoomAirMod->XMATMX(zoneNum), - state.dataRoomAirMod->XM2TMX(zoneNum), - state.dataRoomAirMod->XM3TMX(zoneNum), - state.dataRoomAirMod->MATMX(zoneNum), - state.dataRoomAirMod->DSXMATMX(zoneNum), - state.dataRoomAirMod->DSXM2TMX(zoneNum), - state.dataRoomAirMod->DSXM3TMX(zoneNum), - state.dataRoomAirMod->DSXM4TMX(zoneNum)); - } - if (state.dataRoomAirMod->AirModel(zoneNum).AirModelType == DataRoomAirModel::RoomAirModel::AirflowNetwork) { - for (int LoopNode = 1; LoopNode <= state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).NumOfAirNodes; ++LoopNode) { - auto &ThisRAFNNode(state.dataRoomAirMod->RoomAirflowNetworkZoneInfo(zoneNum).Node(LoopNode)); - DownInterpolate4HistoryValues(PriorTimeStep, - TimeStepSys, - ThisRAFNNode.AirTempX1, - ThisRAFNNode.AirTempX2, - ThisRAFNNode.AirTempX3, - ThisRAFNNode.AirTemp, - ThisRAFNNode.AirTempDSX1, - ThisRAFNNode.AirTempDSX2, - ThisRAFNNode.AirTempDSX3, - ThisRAFNNode.AirTempDSX4); - DownInterpolate4HistoryValues(PriorTimeStep, - TimeStepSys, - ThisRAFNNode.HumRatX1, - ThisRAFNNode.HumRatX2, - ThisRAFNNode.HumRatX3, - ThisRAFNNode.HumRat, - ThisRAFNNode.HumRatDSX1, - ThisRAFNNode.HumRatDSX2, - ThisRAFNNode.HumRatDSX3, - ThisRAFNNode.HumRatDSX4); + if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { + if (state.dataRoomAir->IsZoneDispVent3Node(zoneNum) || state.dataRoomAir->IsZoneUFAD(zoneNum)) { + + state.dataRoomAir->MATFloor(zoneNum) = DownInterpolate4HistoryValues( + PriorTimeStep, TimeStepSys, state.dataRoomAir->XMATFloor(zoneNum), state.dataRoomAir->DSXMATFloor(zoneNum)); + state.dataRoomAir->MATOC(zoneNum) = DownInterpolate4HistoryValues( + PriorTimeStep, TimeStepSys, state.dataRoomAir->XMATOC(zoneNum), state.dataRoomAir->DSXMATOC(zoneNum)); + state.dataRoomAir->MATMX(zoneNum) = DownInterpolate4HistoryValues( + PriorTimeStep, TimeStepSys, state.dataRoomAir->XMATMX(zoneNum), state.dataRoomAir->DSXMATMX(zoneNum)); + } + if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { + for (auto &afnNode : state.dataRoomAir->AFNZoneInfo(zoneNum).Node) { + afnNode.AirTemp = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, afnNode.AirTempX, afnNode.AirTempDSX); + + afnNode.HumRat = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, afnNode.HumRatX, afnNode.HumRatDSX); } } } diff --git a/src/EnergyPlus/api/datatransfer.cc b/src/EnergyPlus/api/datatransfer.cc index 138030879e6..ca11e2f7a2c 100644 --- a/src/EnergyPlus/api/datatransfer.cc +++ b/src/EnergyPlus/api/datatransfer.cc @@ -249,8 +249,8 @@ void freeObjectNames(const char **objectNames, unsigned int arraySize) int getNumNodesInCondFDSurfaceLayer(EnergyPlusState state, const char *surfName, const char *matName) { auto *thisState = reinterpret_cast(state); - std::string UCsurfName = EnergyPlus::UtilityRoutines::MakeUPPERCase(surfName); - std::string UCmatName = EnergyPlus::UtilityRoutines::MakeUPPERCase(matName); + std::string UCsurfName = EnergyPlus::UtilityRoutines::makeUPPER(surfName); + std::string UCmatName = EnergyPlus::UtilityRoutines::makeUPPER(matName); return EnergyPlus::HeatBalFiniteDiffManager::numNodesInMaterialLayer(*thisState, UCsurfName, UCmatName); } @@ -278,8 +278,8 @@ int getVariableHandle(EnergyPlusState state, const char *type, const char *key) // In this function, it is as simple as looping over both types and continuing to increment // the handle carefully. In the getValue function it is just a matter of checking array sizes. auto *thisState = reinterpret_cast(state); - std::string const typeUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(type); - std::string const keyUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(key); + std::string const typeUC = EnergyPlus::UtilityRoutines::makeUPPER(type); + std::string const keyUC = EnergyPlus::UtilityRoutines::makeUPPER(key); int handle = -1; // initialize to -1 as a flag if (thisState->dataOutputProcessor->RVariableTypes.allocated()) { handle = 0; // initialize to 0 to get a 1 based Array1D index @@ -347,7 +347,7 @@ Real64 getVariableValue(EnergyPlusState state, const int handle) int getMeterHandle(EnergyPlusState state, const char *meterName) { auto *thisState = reinterpret_cast(state); - std::string const meterNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(meterName); + std::string const meterNameUC = EnergyPlus::UtilityRoutines::makeUPPER(meterName); int i = EnergyPlus::GetMeterIndex(*thisState, meterNameUC); if (i == 0) { // inside E+, zero is meaningful, but through the API, I want to use negative one as a signal of a bad lookup @@ -381,16 +381,16 @@ Real64 getMeterValue(EnergyPlusState state, int handle) int getActuatorHandle(EnergyPlusState state, const char *componentType, const char *controlType, const char *uniqueKey) { int handle = 0; - std::string const typeUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(componentType); - std::string const keyUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(uniqueKey); - std::string const controlUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(controlType); + std::string const typeUC = EnergyPlus::UtilityRoutines::makeUPPER(componentType); + std::string const keyUC = EnergyPlus::UtilityRoutines::makeUPPER(uniqueKey); + std::string const controlUC = EnergyPlus::UtilityRoutines::makeUPPER(controlType); auto *thisState = reinterpret_cast(state); for (int ActuatorLoop = 1; ActuatorLoop <= thisState->dataRuntimeLang->numEMSActuatorsAvailable; ++ActuatorLoop) { auto &availActuator = thisState->dataRuntimeLang->EMSActuatorAvailable(ActuatorLoop); handle++; - std::string const actuatorTypeUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(availActuator.ComponentTypeName); - std::string const actuatorIDUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(availActuator.UniqueIDName); - std::string const actuatorControlUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(availActuator.ControlTypeName); + std::string const actuatorTypeUC = EnergyPlus::UtilityRoutines::makeUPPER(availActuator.ComponentTypeName); + std::string const actuatorIDUC = EnergyPlus::UtilityRoutines::makeUPPER(availActuator.UniqueIDName); + std::string const actuatorControlUC = EnergyPlus::UtilityRoutines::makeUPPER(availActuator.ControlTypeName); if (typeUC == actuatorTypeUC && keyUC == actuatorIDUC && controlUC == actuatorControlUC) { if (availActuator.handleCount > 0) { @@ -517,13 +517,13 @@ Real64 getActuatorValue(EnergyPlusState state, const int handle) int getInternalVariableHandle(EnergyPlusState state, const char *type, const char *key) { int handle = 0; - std::string const typeUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(type); - std::string const keyUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(key); + std::string const typeUC = EnergyPlus::UtilityRoutines::makeUPPER(type); + std::string const keyUC = EnergyPlus::UtilityRoutines::makeUPPER(key); auto *thisState = reinterpret_cast(state); for (auto const &availVariable : thisState->dataRuntimeLang->EMSInternalVarsAvailable) { // TODO: this should stop at numEMSInternalVarsAvailable handle++; - std::string const variableTypeUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(availVariable.DataTypeName); - std::string const variableIDUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(availVariable.UniqueIDName); + std::string const variableTypeUC = EnergyPlus::UtilityRoutines::makeUPPER(availVariable.DataTypeName); + std::string const variableIDUC = EnergyPlus::UtilityRoutines::makeUPPER(availVariable.UniqueIDName); if (typeUC == variableTypeUC && keyUC == variableIDUC) { return handle; } @@ -919,11 +919,11 @@ int kindOfSim(EnergyPlusState state) int getConstructionHandle(EnergyPlusState state, const char *constructionName) { int handle = 0; - std::string const nameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(constructionName); + std::string const nameUC = EnergyPlus::UtilityRoutines::makeUPPER(constructionName); auto *thisState = reinterpret_cast(state); for (auto const &construct : thisState->dataConstruction->Construct) { handle++; - std::string const thisNameUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(construct.Name); + std::string const thisNameUC = EnergyPlus::UtilityRoutines::makeUPPER(construct.Name); if (nameUC == thisNameUC) { return handle; } diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index cdbeefa47ec..73f6898296b 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -1172,7 +1172,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateHnModels) SurfNum = 1; state->dataSurface->Surface.allocate(SurfNum); state->dataSurface->Surface(SurfNum).Zone = 1; - state->dataRoomAirMod->AirModel.allocate(1); + state->dataRoomAir->AirModel.allocate(1); state->dataHeatBal->SurfTempEffBulkAir.allocate(1); state->dataHeatBal->SurfTempEffBulkAir(1) = 1.0; SurfTemp.allocate(1); @@ -1192,7 +1192,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateHnModels) state->dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state->dataSurface->surfIntConv(SurfNum).model = Convect::HcInt::SetByZone; state->dataSurface->surfIntConv(SurfNum).userModelNum = 0; - state->dataRoomAirMod->AirModel(state->dataSurface->Surface(SurfNum).Zone).AirModelType = DataRoomAirModel::RoomAirModel::UCSDDV; + state->dataRoomAir->AirModel(state->dataSurface->Surface(SurfNum).Zone).AirModel = RoomAir::RoomAirModel::DispVent3Node; state->dataSurface->Surface(SurfNum).CosTilt = 1.0; SurfTemp(1) = 0.0; HcIn(1) = 0.0; @@ -1204,7 +1204,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateHnModels) state->dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state->dataSurface->surfIntConv(SurfNum).model = Convect::HcInt::SetByZone; state->dataSurface->surfIntConv(SurfNum).userModelNum = 0; - state->dataRoomAirMod->AirModel(state->dataSurface->Surface(SurfNum).Zone).AirModelType = DataRoomAirModel::RoomAirModel::UCSDCV; + state->dataRoomAir->AirModel(state->dataSurface->Surface(SurfNum).Zone).AirModel = RoomAir::RoomAirModel::CrossVent; state->dataSurface->Surface(SurfNum).CosTilt = 1.0; SurfTemp(1) = 0.0; HcIn(1) = 0.0; diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index 2e208652db7..6ff4962d1d6 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -60,15 +60,13 @@ #include #include #include -#include #include #include #include #include using namespace EnergyPlus; -using namespace CrossVentMgr; -using namespace DataRoomAirModel; +using namespace RoomAir; TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) { @@ -77,13 +75,13 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) state->dataGlobal->NumOfZones = 2; int MaxSurf = 2; - state->dataRoomAirMod->RecInflowRatio.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->RecInflowRatio.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->AirflowNetworkSurfaceUCSDCV.allocate({0, MaxSurf}, state->dataGlobal->NumOfZones); - state->dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, 1) = 1; - state->dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, 1) = 1; - state->dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, 2) = 2; + state->dataRoomAir->AFNSurfaceCrossVent.allocate({0, MaxSurf}, state->dataGlobal->NumOfZones); + state->dataRoomAir->AFNSurfaceCrossVent(1, 1) = 1; + state->dataRoomAir->AFNSurfaceCrossVent(0, 1) = 1; + state->dataRoomAir->AFNSurfaceCrossVent(0, 2) = 2; state->afn->MultizoneSurfaceData.allocate(MaxSurf); state->afn->MultizoneSurfaceData(1).SurfNum = 6; @@ -125,7 +123,7 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) state->dataEnvrn->WindDir = 271.66666666666669; - state->dataRoomAirMod->AirModel.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); state->afn->AirflowNetworkLinkageData.allocate(2); state->afn->AirflowNetworkLinkageData(1).CompNum = 1; @@ -139,46 +137,46 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) state->afn->AirflowNetworkCompData(3).TypeNum = 2; state->afn->AirflowNetworkCompData(3).CompTypeNum = AirflowNetwork::iComponentTypeNum::SOP; - state->dataRoomAirMod->SurfParametersCVDV.allocate(2); - state->dataRoomAirMod->SurfParametersCVDV(1).Width = 22.715219999999999; - state->dataRoomAirMod->SurfParametersCVDV(1).Height = 1.3715999999999999; - state->dataRoomAirMod->SurfParametersCVDV(2).Width = 22.869143999999999; - state->dataRoomAirMod->SurfParametersCVDV(2).Height = 1.3715999999999999; - - state->dataRoomAirMod->CVJetRecFlows.allocate({0, MaxSurf}, 1); - - state->dataUCSDShared->PosZ_Wall.allocate(2); - state->dataUCSDShared->PosZ_Wall(1) = 1; - state->dataUCSDShared->PosZ_Wall(2) = 4; - - state->dataUCSDShared->APos_Wall.allocate(12); - state->dataUCSDShared->APos_Wall(1) = 5; - state->dataUCSDShared->APos_Wall(2) = 7; - state->dataUCSDShared->APos_Wall(3) = 8; - state->dataUCSDShared->APos_Wall(4) = 10; - - state->dataRoomAirMod->Droom.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Droom(1) = 13.631070390838719; - state->dataRoomAirMod->Dstar.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Ain.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->ZoneUCSDCV.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->ZoneUCSDCV(1).ZonePtr = 1; - state->dataRoomAirMod->JetRecAreaRatio.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Ujet.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Urec.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Qrec.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Qtot.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->Tin.allocate(state->dataGlobal->NumOfZones); - - EvolveParaUCSDCV(*state, 1); - - EXPECT_NEAR(27.14, state->dataRoomAirMod->CVJetRecFlows(1, 1).Fin, 0.01); - EXPECT_NEAR(0.871, state->dataRoomAirMod->CVJetRecFlows(1, 1).Uin, 0.001); - EXPECT_NEAR(0.000, state->dataRoomAirMod->CVJetRecFlows(1, 1).Vjet, 0.001); - EXPECT_NEAR(0.243, state->dataRoomAirMod->CVJetRecFlows(1, 1).Yjet, 0.001); - EXPECT_NEAR(0.279, state->dataRoomAirMod->CVJetRecFlows(1, 1).Ujet, 0.001); - EXPECT_NEAR(0.070, state->dataRoomAirMod->CVJetRecFlows(1, 1).Yrec, 0.001); - EXPECT_NEAR(0.080, state->dataRoomAirMod->CVJetRecFlows(1, 1).Urec, 0.001); - EXPECT_NEAR(0.466, state->dataRoomAirMod->CVJetRecFlows(1, 1).YQrec, 0.001); - EXPECT_NEAR(0.535, state->dataRoomAirMod->CVJetRecFlows(1, 1).Qrec, 0.001); + state->dataRoomAir->SurfParametersCrossDispVent.allocate(2); + state->dataRoomAir->SurfParametersCrossDispVent(1).Width = 22.715219999999999; + state->dataRoomAir->SurfParametersCrossDispVent(1).Height = 1.3715999999999999; + state->dataRoomAir->SurfParametersCrossDispVent(2).Width = 22.869143999999999; + state->dataRoomAir->SurfParametersCrossDispVent(2).Height = 1.3715999999999999; + + state->dataRoomAir->CrossVentJetRecFlows.allocate({0, MaxSurf}, 1); + + state->dataRoomAir->PosZ_Wall.allocate(1); + state->dataRoomAir->PosZ_Wall(1).beg = 1; + state->dataRoomAir->PosZ_Wall(1).end = 4; + + state->dataRoomAir->APos_Wall.allocate(12); + state->dataRoomAir->APos_Wall(1) = 5; + state->dataRoomAir->APos_Wall(2) = 7; + state->dataRoomAir->APos_Wall(3) = 8; + state->dataRoomAir->APos_Wall(4) = 10; + + state->dataRoomAir->Droom.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Droom(1) = 13.631070390838719; + state->dataRoomAir->Dstar.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Ain.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZoneCrossVent.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZoneCrossVent(1).ZonePtr = 1; + state->dataRoomAir->JetRecAreaRatio.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Ujet.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Urec.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Qrec.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Qtot.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->Tin.allocate(state->dataGlobal->NumOfZones); + + EvolveParaCrossVent(*state, 1); + + EXPECT_NEAR(27.14, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Fin, 0.01); + EXPECT_NEAR(0.871, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Uin, 0.001); + EXPECT_NEAR(0.000, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Vjet, 0.001); + EXPECT_NEAR(0.243, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Yjet, 0.001); + EXPECT_NEAR(0.279, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Ujet, 0.001); + EXPECT_NEAR(0.070, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Yrec, 0.001); + EXPECT_NEAR(0.080, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Urec, 0.001); + EXPECT_NEAR(0.466, state->dataRoomAir->CrossVentJetRecFlows(1, 1).YQrec, 0.001); + EXPECT_NEAR(0.535, state->dataRoomAir->CrossVentJetRecFlows(1, 1).Qrec, 0.001); } diff --git a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc index 7eea6d33b61..ce5263f05d1 100644 --- a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc +++ b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc @@ -403,24 +403,24 @@ TEST_F(EnergyPlusFixture, GetZoneEquipmentData_epJSON) EXPECT_TRUE(compare_enums(DataZoneEquipment::LoadDist::Sequential, thisZoneEquipList.LoadDistScheme)); EXPECT_EQ("FAN ZONE EXHAUST 1", thisZoneEquipList.EquipName(1)); - EXPECT_EQ("FAN:ZONEEXHAUST", thisZoneEquipList.EquipType(1)); - EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquip::ZoneExhaustFan, thisZoneEquipList.EquipTypeEnum(1))); + EXPECT_EQ("FAN:ZONEEXHAUST", thisZoneEquipList.EquipTypeName(1)); + EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquipType::ExhaustFan, thisZoneEquipList.EquipType(1))); EXPECT_EQ(1, thisZoneEquipList.CoolingPriority(1)); EXPECT_EQ(1, thisZoneEquipList.HeatingPriority(1)); EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(1)); EXPECT_EQ(-1, thisZoneEquipList.SequentialHeatingFractionSchedPtr(1)); EXPECT_EQ("ADU AIR TERMINAL SINGLE DUCT CONSTANT VOLUME NO REHEAT 1", thisZoneEquipList.EquipName(2)); - EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipType(2)); - EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquip::AirDistUnit, thisZoneEquipList.EquipTypeEnum(2))); + EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipTypeName(2)); + EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquipType::AirDistributionUnit, thisZoneEquipList.EquipType(2))); EXPECT_EQ(3, thisZoneEquipList.CoolingPriority(2)); EXPECT_EQ(2, thisZoneEquipList.HeatingPriority(2)); EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(2)); EXPECT_EQ(-1, thisZoneEquipList.SequentialHeatingFractionSchedPtr(2)); EXPECT_EQ("ADU AIR TERMINAL SINGLE DUCT VAV REHEAT 1", thisZoneEquipList.EquipName(3)); - EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipType(3)); - EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquip::AirDistUnit, thisZoneEquipList.EquipTypeEnum(3))); + EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipTypeName(3)); + EXPECT_TRUE(compare_enums(DataZoneEquipment::ZoneEquipType::AirDistributionUnit, thisZoneEquipList.EquipType(3))); EXPECT_EQ(2, thisZoneEquipList.CoolingPriority(3)); EXPECT_EQ(3, thisZoneEquipList.HeatingPriority(3)); EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(3)); diff --git a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc index 497effc4d67..88adf4b53c5 100644 --- a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc @@ -57,15 +57,13 @@ #include #include #include -#include #include #include using namespace EnergyPlus; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataHeatBalance; -using namespace EnergyPlus::DisplacementVentMgr; -using namespace EnergyPlus::DataRoomAirModel; +using namespace EnergyPlus::RoomAir; TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) { @@ -75,14 +73,14 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) state->dataGlobal->NumOfZones = 1; int TotSurfaces = 3; - state->dataRoomAirMod->IsZoneDV.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->IsZoneDV(1) = true; + state->dataRoomAir->IsZoneDispVent3Node.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->IsZoneDispVent3Node(1) = true; state->dataSurface->Surface.allocate(TotSurfaces); state->dataHeatBal->SurfTempEffBulkAir.allocate(TotSurfaces); state->dataHeatBalSurf->SurfTempIn.allocate(TotSurfaces); - state->dataRoomAirMod->DVHcIn.allocate(TotSurfaces); - state->dataRoomAirMod->ZTMX.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->ZTOC.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->DispVent3NodeHcIn.allocate(TotSurfaces); + state->dataRoomAir->ZTMX.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZTOC.allocate(state->dataGlobal->NumOfZones); // Surface 1 Vertical wall state->dataSurface->Surface(1).Name = "Class1_Wall_6_0_0_0_0_0_Subsurface"; @@ -164,111 +162,113 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) state->dataSurface->SurfTAirRef.dimension(TotSurfaces, 0); state->dataSurface->SurfTAirRefRpt.dimension(TotSurfaces, 0); - state->dataRoomAirMod->AirModel.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->AirModel(1).AirModelType = DataRoomAirModel::RoomAirModel::UCSDDV; + state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::DispVent3Node; - state->dataUCSDShared->APos_Wall.allocate(TotSurfaces); - state->dataUCSDShared->APos_Floor.allocate(TotSurfaces); - state->dataUCSDShared->APos_Ceiling.allocate(TotSurfaces); - state->dataUCSDShared->PosZ_Wall.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->PosZ_Floor.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->PosZ_Ceiling.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->APos_Window.allocate(TotSurfaces); - state->dataUCSDShared->APos_Door.allocate(TotSurfaces); - state->dataUCSDShared->APos_Internal.allocate(TotSurfaces); - state->dataUCSDShared->PosZ_Window.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->PosZ_Door.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->PosZ_Internal.allocate(state->dataGlobal->NumOfZones * 2); - state->dataUCSDShared->HCeiling.allocate(TotSurfaces); - state->dataUCSDShared->HWall.allocate(TotSurfaces); - state->dataUCSDShared->HFloor.allocate(TotSurfaces); - state->dataUCSDShared->HInternal.allocate(TotSurfaces); - state->dataUCSDShared->HWindow.allocate(TotSurfaces); - state->dataUCSDShared->HDoor.allocate(TotSurfaces); + state->dataRoomAir->APos_Wall.allocate(TotSurfaces); + state->dataRoomAir->APos_Floor.allocate(TotSurfaces); + state->dataRoomAir->APos_Ceiling.allocate(TotSurfaces); + state->dataRoomAir->PosZ_Wall.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->PosZ_Floor.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->PosZ_Ceiling.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->APos_Window.allocate(TotSurfaces); + state->dataRoomAir->APos_Door.allocate(TotSurfaces); + state->dataRoomAir->APos_Internal.allocate(TotSurfaces); + state->dataRoomAir->PosZ_Window.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->PosZ_Door.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->PosZ_Internal.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->HCeiling.allocate(TotSurfaces); + state->dataRoomAir->HWall.allocate(TotSurfaces); + state->dataRoomAir->HFloor.allocate(TotSurfaces); + state->dataRoomAir->HInternal.allocate(TotSurfaces); + state->dataRoomAir->HWindow.allocate(TotSurfaces); + state->dataRoomAir->HDoor.allocate(TotSurfaces); - state->dataRoomAirMod->ZoneCeilingHeight.allocate(state->dataGlobal->NumOfZones * 2); - state->dataRoomAirMod->ZoneCeilingHeight(1) = 4.9784; - state->dataRoomAirMod->ZoneCeilingHeight(2) = 4.9784; + state->dataRoomAir->ZoneCeilingHeight1.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZoneCeilingHeight2.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZoneCeilingHeight1(1) = 4.9784; + state->dataRoomAir->ZoneCeilingHeight2(1) = 4.9784; // Arrays initializations - state->dataUCSDShared->APos_Wall = 0; - state->dataUCSDShared->APos_Floor = 0; - state->dataUCSDShared->APos_Ceiling = 0; - state->dataUCSDShared->PosZ_Wall(1) = 1; - state->dataUCSDShared->PosZ_Wall(2) = 0; - state->dataUCSDShared->PosZ_Floor(1) = 1; - state->dataUCSDShared->PosZ_Floor(2) = 0; - state->dataUCSDShared->PosZ_Ceiling(1) = 1; - state->dataUCSDShared->PosZ_Ceiling(2) = 0; - state->dataUCSDShared->APos_Window = 0; - state->dataUCSDShared->APos_Door = 0; - state->dataUCSDShared->APos_Internal = 0; - state->dataUCSDShared->PosZ_Window(1) = 1; - state->dataUCSDShared->PosZ_Window(2) = 0; - state->dataUCSDShared->PosZ_Door(1) = 1; - state->dataUCSDShared->PosZ_Door(2) = 3; - state->dataUCSDShared->PosZ_Internal(1) = 1; - state->dataUCSDShared->PosZ_Internal(2) = 0; - state->dataUCSDShared->HCeiling = 0.0; - state->dataUCSDShared->HWall = 0.0; - state->dataUCSDShared->HFloor = 0.0; - state->dataUCSDShared->HInternal = 0.0; - state->dataUCSDShared->HWindow = 0.0; - state->dataUCSDShared->HDoor = 0.0; + state->dataRoomAir->APos_Wall = 0; + state->dataRoomAir->APos_Floor = 0; + state->dataRoomAir->APos_Ceiling = 0; + state->dataRoomAir->PosZ_Wall(1).beg = 1; + state->dataRoomAir->PosZ_Wall(1).end = 0; + state->dataRoomAir->PosZ_Floor(1).beg = 1; + state->dataRoomAir->PosZ_Floor(1).end = 0; + state->dataRoomAir->PosZ_Ceiling(1).beg = 1; + state->dataRoomAir->PosZ_Ceiling(1).end = 0; + state->dataRoomAir->APos_Window = 0; + state->dataRoomAir->APos_Door = 0; + state->dataRoomAir->APos_Internal = 0; + state->dataRoomAir->PosZ_Window(1).beg = 1; + state->dataRoomAir->PosZ_Window(1).end = 0; + state->dataRoomAir->PosZ_Door(1).beg = 1; + state->dataRoomAir->PosZ_Door(1).end = 3; + state->dataRoomAir->PosZ_Internal(1).beg = 1; + state->dataRoomAir->PosZ_Internal(1).end = 0; + state->dataRoomAir->HCeiling = 0.0; + state->dataRoomAir->HWall = 0.0; + state->dataRoomAir->HFloor = 0.0; + state->dataRoomAir->HInternal = 0.0; + state->dataRoomAir->HWindow = 0.0; + state->dataRoomAir->HDoor = 0.0; - state->dataRoomAirMod->ZoneUCSDCV.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->ZoneUCSDCV(1).ZonePtr = 1; - state->dataUCSDShared->PosZ_Door(1) = 1; - state->dataUCSDShared->PosZ_Door(2) = 3; - state->dataUCSDShared->APos_Door(1) = 1; - state->dataUCSDShared->APos_Door(2) = 2; - state->dataUCSDShared->APos_Door(3) = 3; + state->dataRoomAir->ZoneCrossVent.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->ZoneCrossVent(1).ZonePtr = 1; + state->dataRoomAir->PosZ_Door(1).beg = 1; + state->dataRoomAir->PosZ_Door(1).end = 3; + state->dataRoomAir->APos_Door(1) = 1; + state->dataRoomAir->APos_Door(2) = 2; + state->dataRoomAir->APos_Door(3) = 3; - state->dataRoomAirMod->ZTMX(1) = 20.0; - state->dataRoomAirMod->ZTOC(1) = 21.0; + state->dataRoomAir->ZTMX(1) = 20.0; + state->dataRoomAir->ZTOC(1) = 21.0; state->dataHeatBalSurf->SurfTempIn(1) = 23.0; state->dataHeatBalSurf->SurfTempIn(2) = 23.0; state->dataHeatBalSurf->SurfTempIn(3) = 23.0; - HcUCSDDV(*state, 1, 0.5); + HcDispVent3Node(*state, 1, 0.5); - EXPECT_NEAR(1.889346, state->dataRoomAirMod->DVHcIn(1), 0.0001); - EXPECT_NEAR(1.650496, state->dataRoomAirMod->DVHcIn(2), 0.0001); - EXPECT_NEAR(1.889346, state->dataRoomAirMod->DVHcIn(3), 0.0001); + EXPECT_NEAR(1.889346, state->dataRoomAir->DispVent3NodeHcIn(1), 0.0001); + EXPECT_NEAR(1.650496, state->dataRoomAir->DispVent3NodeHcIn(2), 0.0001); + EXPECT_NEAR(1.889346, state->dataRoomAir->DispVent3NodeHcIn(3), 0.0001); EXPECT_NEAR(379.614212, state->dataDispVentMgr->HAT_OC, 0.0001); EXPECT_NEAR(16.504965, state->dataDispVentMgr->HA_OC, 0.0001); EXPECT_NEAR(869.099591, state->dataDispVentMgr->HAT_MX, 0.0001); EXPECT_NEAR(37.786938, state->dataDispVentMgr->HA_MX, 0.0001); - state->dataRoomAirMod->IsZoneDV.deallocate(); + state->dataRoomAir->IsZoneDispVent3Node.deallocate(); state->dataSurface->Surface.deallocate(); state->dataHeatBal->SurfTempEffBulkAir.deallocate(); state->dataHeatBalSurf->SurfTempIn.deallocate(); - state->dataRoomAirMod->DVHcIn.deallocate(); - state->dataRoomAirMod->ZTMX.deallocate(); - state->dataRoomAirMod->ZTOC.deallocate(); - state->dataRoomAirMod->AirModel.deallocate(); + state->dataRoomAir->DispVent3NodeHcIn.deallocate(); + state->dataRoomAir->ZTMX.deallocate(); + state->dataRoomAir->ZTOC.deallocate(); + state->dataRoomAir->AirModel.deallocate(); - state->dataUCSDShared->APos_Wall.deallocate(); - state->dataUCSDShared->APos_Floor.deallocate(); - state->dataUCSDShared->APos_Ceiling.deallocate(); - state->dataUCSDShared->PosZ_Wall.deallocate(); - state->dataUCSDShared->PosZ_Floor.deallocate(); - state->dataUCSDShared->PosZ_Ceiling.deallocate(); - state->dataUCSDShared->APos_Window.deallocate(); - state->dataUCSDShared->APos_Door.deallocate(); - state->dataUCSDShared->APos_Internal.deallocate(); - state->dataUCSDShared->PosZ_Window.deallocate(); - state->dataUCSDShared->PosZ_Door.deallocate(); - state->dataUCSDShared->PosZ_Internal.deallocate(); - state->dataUCSDShared->HCeiling.deallocate(); - state->dataUCSDShared->HWall.deallocate(); - state->dataUCSDShared->HFloor.deallocate(); - state->dataUCSDShared->HInternal.deallocate(); - state->dataUCSDShared->HWindow.deallocate(); - state->dataUCSDShared->HDoor.deallocate(); - state->dataRoomAirMod->ZoneCeilingHeight.deallocate(); - state->dataRoomAirMod->ZoneUCSDCV.deallocate(); + state->dataRoomAir->APos_Wall.deallocate(); + state->dataRoomAir->APos_Floor.deallocate(); + state->dataRoomAir->APos_Ceiling.deallocate(); + state->dataRoomAir->PosZ_Wall.deallocate(); + state->dataRoomAir->PosZ_Floor.deallocate(); + state->dataRoomAir->PosZ_Ceiling.deallocate(); + state->dataRoomAir->APos_Window.deallocate(); + state->dataRoomAir->APos_Door.deallocate(); + state->dataRoomAir->APos_Internal.deallocate(); + state->dataRoomAir->PosZ_Window.deallocate(); + state->dataRoomAir->PosZ_Door.deallocate(); + state->dataRoomAir->PosZ_Internal.deallocate(); + state->dataRoomAir->HCeiling.deallocate(); + state->dataRoomAir->HWall.deallocate(); + state->dataRoomAir->HFloor.deallocate(); + state->dataRoomAir->HInternal.deallocate(); + state->dataRoomAir->HWindow.deallocate(); + state->dataRoomAir->HDoor.deallocate(); + state->dataRoomAir->ZoneCeilingHeight1.deallocate(); + state->dataRoomAir->ZoneCeilingHeight2.deallocate(); + state->dataRoomAir->ZoneCrossVent.deallocate(); } TEST_F(EnergyPlusFixture, DVThirdOrderFloorTempCalculation) diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index c7f69455351..36d7b794c43 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -484,19 +484,19 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ComputeEscalatedEnergyCosts) TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_GetMonthNumber) { - EXPECT_EQ(0, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("January"))); - EXPECT_EQ(1, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("February"))); - EXPECT_EQ(2, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("March"))); - EXPECT_EQ(3, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("April"))); - EXPECT_EQ(4, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("May"))); - EXPECT_EQ(5, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("June"))); - EXPECT_EQ(6, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("July"))); - EXPECT_EQ(7, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("August"))); - EXPECT_EQ(8, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("September"))); - EXPECT_EQ(9, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("October"))); - EXPECT_EQ(10, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("November"))); - EXPECT_EQ(11, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("December"))); - EXPECT_EQ(-1, getEnumerationValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::MakeUPPERCase("Hexember"))); + EXPECT_EQ(0, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("January"))); + EXPECT_EQ(1, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("February"))); + EXPECT_EQ(2, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("March"))); + EXPECT_EQ(3, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("April"))); + EXPECT_EQ(4, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("May"))); + EXPECT_EQ(5, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("June"))); + EXPECT_EQ(6, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("July"))); + EXPECT_EQ(7, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("August"))); + EXPECT_EQ(8, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("September"))); + EXPECT_EQ(9, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("October"))); + EXPECT_EQ(10, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("November"))); + EXPECT_EQ(11, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("December"))); + EXPECT_EQ(-1, getEnumValue(UtilityRoutines::MonthNamesUC, UtilityRoutines::makeUPPER("Hexember"))); } TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) diff --git a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc index d384be5a89e..25827ffed71 100644 --- a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc +++ b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc @@ -124,19 +124,19 @@ class CBVAVSys : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipList(1).Name = "ZONEEQUIPMENT"; int maxEquipCount = 1; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = maxEquipCount; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipType.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex = 1; state->dataZoneEquip->ZoneEquipList(1).EquipData.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).CoolingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).HeatingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = "ZONEHVAC:AIRDISTRIBUTIONUNIT"; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName(1) = "ZONEHVAC:AIRDISTRIBUTIONUNIT"; state->dataZoneEquip->ZoneEquipList(1).EquipName(1) = "ZONEREHEATTU"; state->dataZoneEquip->ZoneEquipList(1).CoolingPriority(1) = 1; state->dataZoneEquip->ZoneEquipList(1).HeatingPriority(1) = 1; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::AirDistUnit; + state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = DataZoneEquipment::ZoneEquipType::AirDistributionUnit; state->dataZoneEquip->ZoneEquipConfig(1).NumInletNodes = NumNodes; state->dataZoneEquip->ZoneEquipConfig(1).InletNode.allocate(NumNodes); state->dataZoneEquip->ZoneEquipConfig(1).AirDistUnitCool.allocate(NumNodes); diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 342c9f2b87f..5d49f0fd4ca 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -259,19 +259,19 @@ class AirLoopFixture : public EnergyPlusFixture thisZoneEqList.Name = "ZONE1EQUIPMENT"; int maxEquipCount1 = 1; thisZoneEqList.NumOfEquipTypes = maxEquipCount1; + thisZoneEqList.EquipTypeName.allocate(maxEquipCount1); thisZoneEqList.EquipType.allocate(maxEquipCount1); - thisZoneEqList.EquipTypeEnum.allocate(maxEquipCount1); thisZoneEqList.EquipName.allocate(maxEquipCount1); thisZoneEqList.EquipIndex.allocate(maxEquipCount1); thisZoneEqList.EquipIndex = 1; thisZoneEqList.EquipData.allocate(maxEquipCount1); thisZoneEqList.CoolingPriority.allocate(maxEquipCount1); thisZoneEqList.HeatingPriority.allocate(maxEquipCount1); - thisZoneEqList.EquipType(1) = "NOT A VRF TU"; + thisZoneEqList.EquipTypeName(1) = "NOT A VRF TU"; thisZoneEqList.EquipName(1) = "NO NAME"; thisZoneEqList.CoolingPriority(1) = 1; thisZoneEqList.HeatingPriority(1) = 1; - thisZoneEqList.EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::ZoneUnitarySys; + thisZoneEqList.EquipType(1) = DataZoneEquipment::ZoneEquipType::UnitarySystem; auto &finalZoneSizing(state->dataSize->FinalZoneSizing(zoneNum)); finalZoneSizing.DesCoolVolFlow = 1.5; diff --git a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc index 0919e9dbb12..49733bb43c3 100644 --- a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc @@ -506,17 +506,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest) state->dataViewFactor->EnclSolInfo.allocate(3); state->dataViewFactor->EnclRadInfo(1).Name = "Enclosure 1"; state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 1"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 1"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).Name = "Enclosure 2"; state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(3).Name = "Space 3"; state->dataViewFactor->EnclRadInfo(3).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); ErrorsFound = false; HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); @@ -608,17 +608,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest2) state->dataViewFactor->EnclSolInfo.allocate(3); state->dataViewFactor->EnclRadInfo(1).Name = "Enclosure 1"; state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).Name = "Enclosure 2"; state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(3).Name = "Space 3"; state->dataViewFactor->EnclRadInfo(3).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); ErrorsFound = false; HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); @@ -707,17 +707,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest3) state->dataViewFactor->EnclSolInfo.allocate(3); state->dataViewFactor->EnclRadInfo(1).Name = "Enclosure 1"; state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 1"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 1"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).Name = "Enclosure 2"; state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(3).Name = "Space 3"; state->dataViewFactor->EnclRadInfo(3).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); ErrorsFound = false; HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); @@ -809,17 +809,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest4) state->dataViewFactor->EnclSolInfo.allocate(3); state->dataViewFactor->EnclRadInfo(1).Name = "Enclosure 1"; state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 2"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(1).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).Name = "Enclosure 2"; state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 4"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(2).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 5"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); state->dataViewFactor->EnclRadInfo(3).Name = "Space 3"; state->dataViewFactor->EnclRadInfo(3).spaceNums.push_back( - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Space 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Space 3"), state->dataHeatBal->space, state->dataGlobal->numSpaces)); ErrorsFound = false; HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); diff --git a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc index 8df905cb567..41f13b20112 100644 --- a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc @@ -1814,7 +1814,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) EXPECT_EQ(state->dataHeatBal->TotConstructs, 2); - int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Grouped Air Boundary"), state->dataConstruction->Construct); + int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Grouped Air Boundary"), state->dataConstruction->Construct); EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Grouped Air Boundary")); EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); EXPECT_FALSE(state->dataConstruction->Construct(constrNum).IsUsedCTF); @@ -1825,7 +1825,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) EXPECT_EQ(state->dataHeatBal->NominalRforNominalUCalculation(constrNum), 0.0); constrNum = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Good Mixing Schedule"), state->dataConstruction->Construct); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Air Boundary with Good Mixing Schedule"), state->dataConstruction->Construct); EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Air Boundary with Good Mixing Schedule")); EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); EXPECT_FALSE(state->dataConstruction->Construct(constrNum).IsUsedCTF); @@ -1876,7 +1876,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) EXPECT_EQ(state->dataHeatBal->TotConstructs, 1); int constrNum = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Bad Mixing Schedule"), state->dataConstruction->Construct); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Air Boundary with Bad Mixing Schedule"), state->dataConstruction->Construct); EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Air Boundary with Bad Mixing Schedule")); EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); EXPECT_FALSE(state->dataConstruction->Construct(constrNum).IsUsedCTF); diff --git a/tst/EnergyPlus/unit/HybridModel.unit.cc b/tst/EnergyPlus/unit/HybridModel.unit.cc index f104ca71845..6cbf38e1c5e 100644 --- a/tst/EnergyPlus/unit/HybridModel.unit.cc +++ b/tst/EnergyPlus/unit/HybridModel.unit.cc @@ -93,7 +93,7 @@ using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::Psychrometrics; using namespace EnergyPlus::ScheduleManager; -using namespace EnergyPlus::DataRoomAirModel; +using namespace EnergyPlus::RoomAir; using namespace EnergyPlus::HybridModel; using namespace EnergyPlus::DataPrecisionGlobals; @@ -104,10 +104,10 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone.allocate(1); state->dataHybridModel->HybridModelZone.allocate(1); state->dataHybridModel->FlagHybridModel = true; - state->dataRoomAirMod->AirModel.allocate(1); - state->dataRoomAirMod->ZTOC.allocate(1); - state->dataRoomAirMod->ZTMX.allocate(1); - state->dataRoomAirMod->ZTM1MX.allocate(1); + state->dataRoomAir->AirModel.allocate(1); + state->dataRoomAir->ZTOC.allocate(1); + state->dataRoomAir->ZTMX.allocate(1); + state->dataRoomAir->ZTMMX.allocate(1); state->afn->exchangeData.allocate(1); state->dataLoopNodes->Node.allocate(1); state->dataHeatBalFanSys->TempTstatAir.allocate(1); @@ -125,11 +125,10 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataSurface->Surface.allocate(2); state->dataHeatBalSurf->SurfHConvInt.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); - state->dataRoomAirMod->IsZoneDV.dimension(1, false); - state->dataRoomAirMod->IsZoneCV.dimension(1, false); - state->dataRoomAirMod->IsZoneCV.dimension(1, false); - state->dataRoomAirMod->IsZoneUI.dimension(1, false); - state->dataRoomAirMod->ZoneDVMixedFlag.allocate(1); + state->dataRoomAir->IsZoneDispVent3Node.dimension(1, false); + state->dataRoomAir->IsZoneCrossVent.dimension(1, false); + state->dataRoomAir->IsZoneUFAD.dimension(1, false); + state->dataRoomAir->ZoneDispVent3NodeMixedFlag.allocate(1); state->dataHeatBal->ZnAirRpt.allocate(1); state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataHeatBal->ZoneIntGain.allocate(1); @@ -480,8 +479,8 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHeatBal->Zone.allocate(1); state->dataHybridModel->HybridModelZone.allocate(1); state->dataHybridModel->FlagHybridModel = true; - state->dataRoomAirMod->AirModel.allocate(1); - state->dataRoomAirMod->ZTOC.allocate(1); + state->dataRoomAir->AirModel.allocate(1); + state->dataRoomAir->ZTOC.allocate(1); state->afn->exchangeData.allocate(1); state->dataLoopNodes->Node.allocate(1); state->dataHeatBalFanSys->TempTstatAir.allocate(1); @@ -501,10 +500,10 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataSurface->SurfaceWindow.allocate(1); state->dataSurface->Surface.allocate(2); state->dataHeatBalSurf->SurfHConvInt.allocate(1); - state->dataRoomAirMod->IsZoneDV.dimension(1, false); - state->dataRoomAirMod->IsZoneCV.dimension(1, false); - state->dataRoomAirMod->IsZoneUI.dimension(1, false); - state->dataRoomAirMod->ZoneDVMixedFlag.allocate(1); + state->dataRoomAir->IsZoneDispVent3Node.dimension(1, false); + state->dataRoomAir->IsZoneCrossVent.dimension(1, false); + state->dataRoomAir->IsZoneUFAD.dimension(1, false); + state->dataRoomAir->ZoneDispVent3NodeMixedFlag.allocate(1); state->dataHeatBal->ZnAirRpt.allocate(1); state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataSize->ZoneEqSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/InputProcessor.unit.cc b/tst/EnergyPlus/unit/InputProcessor.unit.cc index 18645c418b4..7be536fd8ec 100644 --- a/tst/EnergyPlus/unit/InputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/InputProcessor.unit.cc @@ -4438,7 +4438,7 @@ TEST_F(InputProcessorFixture, epJSONgetObjectItem_minfields) // User inputs from above // Note even though choice keys are case-sensitive during epJSON processing, getObjectItem pushes Alphas to UPPERcase - EXPECT_EQ(state->dataIPShortCut->cAlphaArgs(1), UtilityRoutines::MakeUPPERCase(name2)); // Material Name field is NOT tagged with /retaincase + EXPECT_EQ(state->dataIPShortCut->cAlphaArgs(1), UtilityRoutines::makeUPPER(name2)); // Material Name field is NOT tagged with /retaincase EXPECT_EQ(state->dataIPShortCut->cAlphaArgs(2), "MEDIUMROUGH"); EXPECT_NEAR(state->dataIPShortCut->rNumericArgs(1), 2.0, 0.0001); EXPECT_NEAR(state->dataIPShortCut->rNumericArgs(3), 0.5, 0.0001); @@ -4672,7 +4672,7 @@ TEST_F(InputProcessorFixture, epJSONgetFieldValue_extensiblesFromIDF) auto &instancesValue = instances.value(); for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &objectFields = instance.value(); - std::string const &thisObjectName = UtilityRoutines::MakeUPPERCase(instance.key()); + std::string const &thisObjectName = UtilityRoutines::makeUPPER(instance.key()); EXPECT_EQ(thisObjectName, "SPACE EQUIPMENT"); // Fields before extensibles alphaFieldValue = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "load_distribution_scheme"); diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index 8b8e824e209..0468a5b4132 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -4990,7 +4990,7 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) int SysAvailNum = 1; int PriAirSysNum = 0; int AvailStatus = 0; - int constexpr ZoneEquipType = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir; + constexpr DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; int constexpr CompNum = 1; bool SimAir = false; // set this as zone equipment @@ -5023,7 +5023,7 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) state->dataHeatBalFanSys->TempTstatAir(1) = 21.1; sysAvailMgr.AvailStatus = 0; // run calc system availability requirement - SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, zoneEquipType, CompNum); // check that the fan is off EXPECT_EQ(DataHVACGlobals::NoAction, sysAvailMgr.AvailStatus); EXPECT_FALSE(state->dataHVACGlobal->TurnFansOn); @@ -5038,20 +5038,20 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) EXPECT_FALSE(state->dataHVACGlobal->TurnFansOff); // test 2: availability manager status to on - state->dataHVACGlobal->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs(1).StartTime = 0.0; - state->dataHVACGlobal->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs(1).StopTime = 4.0; + state->dataHVACGlobal->ZoneComp(zoneEquipType).ZoneCompAvailMgrs(1).StartTime = 0.0; + state->dataHVACGlobal->ZoneComp(zoneEquipType).ZoneCompAvailMgrs(1).StopTime = 4.0; state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 21.10; state->dataHeatBalFanSys->TempTstatAir(1) = 21.5; sysAvailMgr.AvailStatus = 0; state->dataScheduleMgr->Schedule(1).CurrentValue = 1; state->dataScheduleMgr->Schedule(2).CurrentValue = 0; // run calc system availability requirement - SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, zoneEquipType, CompNum); // check that the availability manager is cycling On EXPECT_EQ(DataHVACGlobals::CycleOn, sysAvailMgr.AvailStatus); EXPECT_FALSE(state->dataHVACGlobal->TurnFansOn); EXPECT_FALSE(state->dataHVACGlobal->TurnFansOff); - state->dataHVACGlobal->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs(1).AvailStatus = DataHVACGlobals::CycleOn; + state->dataHVACGlobal->ZoneComp(zoneEquipType).ZoneCompAvailMgrs(1).AvailStatus = DataHVACGlobals::CycleOn; // run to set zone night cycle manager ZoneEquipmentManager::SimZoneEquipment(*state, true, SimAir); // test global zone fan control variables are turned on diff --git a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc index 027324674ef..34294b0a4e8 100644 --- a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc +++ b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc @@ -312,14 +312,14 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) state->dataZoneEquip->ZoneEquipList.allocate(3); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).NumOfEquipTypes = 2; state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName.allocate(2); + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName.allocate(2); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType.allocate(2); - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum.allocate(2); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName(1) = "Zone 2 Fan Coil"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(1) = "ZoneHVAC:FourPipeFanCoil"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::FanCoil4Pipe; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName(1) = "ZoneHVAC:FourPipeFanCoil"; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(1) = DataZoneEquipment::ZoneEquipType::FourPipeFanCoil; state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName(2) = "Zone 2 Unit Heater"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(2) = "ZoneHVAC:UnitHeater"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum(2) = DataZoneEquipment::ZoneEquip::UnitHeater; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName(2) = "ZoneHVAC:UnitHeater"; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(2) = DataZoneEquipment::ZoneEquipType::UnitHeater; Real64 totGrossCap = 500.0; Real64 sensGrossCap = 500.0; @@ -572,14 +572,14 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoolingCoil) state->dataZoneEquip->ZoneEquipList.allocate(3); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).NumOfEquipTypes = 2; state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName.allocate(2); + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName.allocate(2); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType.allocate(2); - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum.allocate(2); state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName(1) = "Zone 2 DX Eq"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(1) = "ZoneHVAC:WindowAirConditioner"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::WindowAC; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName(1) = "ZoneHVAC:WindowAirConditioner"; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(1) = DataZoneEquipment::ZoneEquipType::WindowAirConditioner; state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipName(2) = "Zone 2 Unit Heater"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(2) = "ZoneHVAC:UnitHeater"; - state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeEnum(2) = DataZoneEquipment::ZoneEquip::UnitHeater; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipTypeName(2) = "ZoneHVAC:UnitHeater"; + state->dataZoneEquip->ZoneEquipList(curZoneEqNum).EquipType(2) = DataZoneEquipment::ZoneEquipType::UnitHeater; Real64 totGrossCap = 500.0; Real64 sensGrossCap = 400.0; @@ -820,11 +820,11 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_4PipeFCU_ElecHeatingCoil) zoneEquipList.NumOfEquipTypes = 1; zoneEquipList.EquipName.allocate(1); + zoneEquipList.EquipTypeName.allocate(1); zoneEquipList.EquipType.allocate(1); - zoneEquipList.EquipTypeEnum.allocate(1); zoneEquipList.EquipName(1) = "Zone 1 FCU"; - zoneEquipList.EquipType(1) = "ZoneHVAC:FourPipeFanCoil"; - zoneEquipList.EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::FanCoil4Pipe; + zoneEquipList.EquipTypeName(1) = "ZoneHVAC:FourPipeFanCoil"; + zoneEquipList.EquipType(1) = DataZoneEquipment::ZoneEquipType::FourPipeFanCoil; Real64 totGrossCap = 6206.4; Real64 sensGrossCap = 6206.4; diff --git a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc index e88dc5dff7a..6e103cce479 100644 --- a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc @@ -56,7 +56,7 @@ #include using namespace EnergyPlus; -using namespace EnergyPlus::RoomAirModelUserTempPattern; +using namespace EnergyPlus::RoomAir; TEST_F(EnergyPlusFixture, RoomAirModelUserTempPattern_OutdoorDryBulbGradTest) { diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 08aea591f9e..69768beea1c 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -83,11 +83,10 @@ using namespace DataEnvironment; using namespace EnergyPlus::DataSizing; using namespace EnergyPlus::DataHeatBalance; using namespace EnergyPlus::DataHVACGlobals; -using namespace DataRoomAirModel; +using namespace RoomAir; using namespace DataMoistureBalanceEMPD; using namespace DataSurfaces; using namespace DataHeatBalSurface; -using namespace EnergyPlus::RoomAirModelAirflowNetwork; using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::DataHeatBalFanSys; using namespace EnergyPlus::Psychrometrics; @@ -107,7 +106,7 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture state->dataLoopNodes->NumOfNodes = 5; state->dataGlobal->BeginEnvrnFlag = true; int NumOfSurfaces = 2; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->AFNZoneInfo.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->space.allocate(state->dataGlobal->numSpaces); state->dataZoneEquip->ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); @@ -133,7 +132,6 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture state->afn->AirflowNetworkLinkageData.allocate(5); state->afn->AirflowNetworkNodeSimu.allocate(6); state->afn->AirflowNetworkLinkSimu.allocate(5); - state->dataRoomAirflowNetModel->RAFN.allocate(state->dataGlobal->NumOfZones); } virtual void TearDown() @@ -152,67 +150,67 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) state->dataEnvrn->OutBaroPress = 101325.0; state->dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).IsUsed = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ActualZoneID = ZoneNum; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).NumOfAirNodes = NumOfAirNodes; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node.allocate(NumOfAirNodes); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).ControlAirNodeID = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).ZoneVolumeFraction = 0.2; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).ZoneVolumeFraction = 0.8; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).NumHVACs = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).NumHVACs = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyFraction = 0.4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyFraction = 0.6; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnFraction = 0.4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnFraction = 0.6; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "ZoneHVAC"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "ZoneHVAC"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyNodeName = "Supply"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyNodeName = "Supply"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnNodeName = "Return"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnNodeName = "Return"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "ZoneHVAC"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "ZoneHVAC"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).IntGainsDeviceIndices.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).IntGainsDeviceIndices.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).intGainsDeviceSpaces.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).intGainsDeviceSpaces.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).NumIntGains = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).NumIntGains = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).IntGainsDeviceIndices(1) = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).IntGainsDeviceIndices(1) = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).intGainsDeviceSpaces(1) = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).intGainsDeviceSpaces(1) = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).IntGainsFractions.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).IntGainsFractions.allocate(1); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).IntGainsFractions(1) = 0.4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).IntGainsFractions(1) = 0.6; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HasIntGainsAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HasIntGainsAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HasSurfacesAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HasSurfacesAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HasHVACAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HasHVACAssigned = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).SurfMask.allocate(2); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).SurfMask.allocate(2); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).SurfMask(1) = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).SurfMask(2) = false; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).SurfMask(1) = false; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).SurfMask(2) = true; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).NumOfAirflowLinks = 3; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).Link.allocate(3); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).Link(1).AirflowNetworkLinkSimuID = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).Link(2).AirflowNetworkLinkSimuID = 2; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).Link(3).AirflowNetworkLinkSimuID = 3; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).AirflowNetworkNodeID = 1; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).NumOfAirflowLinks = 3; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).Link.allocate(3); - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).Link(1).AirflowNetworkLinkSimuID = 3; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).Link(2).AirflowNetworkLinkSimuID = 4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).Link(3).AirflowNetworkLinkSimuID = 5; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).AirflowNetworkNodeID = 2; + state->dataRoomAir->AFNZoneInfo(ZoneNum).IsUsed = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).ActualZoneID = ZoneNum; + state->dataRoomAir->AFNZoneInfo(ZoneNum).NumOfAirNodes = NumOfAirNodes; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node.allocate(NumOfAirNodes); + state->dataRoomAir->AFNZoneInfo(ZoneNum).ControlAirNodeID = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).ZoneVolumeFraction = 0.2; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).ZoneVolumeFraction = 0.8; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).NumHVACs = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).NumHVACs = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyFraction = 0.4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyFraction = 0.6; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnFraction = 0.4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnFraction = 0.6; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "ZoneHVAC"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "ZoneHVAC"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyNodeName = "Supply"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyNodeName = "Supply"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnNodeName = "Return"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnNodeName = "Return"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "ZoneHVAC"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "ZoneHVAC"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).IntGainsDeviceIndices.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).IntGainsDeviceIndices.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).intGainsDeviceSpaces.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).intGainsDeviceSpaces.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).NumIntGains = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).NumIntGains = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).IntGainsDeviceIndices(1) = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).IntGainsDeviceIndices(1) = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).intGainsDeviceSpaces(1) = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).intGainsDeviceSpaces(1) = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).IntGainsFractions.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).IntGainsFractions.allocate(1); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).IntGainsFractions(1) = 0.4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).IntGainsFractions(1) = 0.6; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HasIntGainsAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HasIntGainsAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HasSurfacesAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HasSurfacesAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HasHVACAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HasHVACAssigned = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).SurfMask.allocate(2); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).SurfMask.allocate(2); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).SurfMask(1) = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).SurfMask(2) = false; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).SurfMask(1) = false; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).SurfMask(2) = true; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).NumOfAirflowLinks = 3; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).Link.allocate(3); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).Link(1).AFNSimuID = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).Link(2).AFNSimuID = 2; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).Link(3).AFNSimuID = 3; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).AFNNodeID = 1; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).NumOfAirflowLinks = 3; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).Link.allocate(3); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).Link(1).AFNSimuID = 3; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).Link(2).AFNSimuID = 4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).Link(3).AFNSimuID = 5; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).AFNNodeID = 2; state->afn->AirflowNetworkLinkageData(1).NodeNums[0] = 1; state->afn->AirflowNetworkLinkageData(2).NodeNums[0] = 1; @@ -250,8 +248,8 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) state->dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes = 1; state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipName.allocate(1); state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipName(1) = "ZoneHVAC"; - state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum.allocate(1); - state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir; + state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipType.allocate(1); + state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipType(1) = DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump; state->dataZoneEquip->ZoneEquipConfig(ZoneNum).NumInletNodes = 1; state->dataZoneEquip->ZoneEquipConfig(ZoneNum).InletNode.allocate(1); @@ -317,61 +315,58 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) PsyCpAirFnW(thisZoneHB.ZoneAirHumRat)); RoomAirNode = 1; - auto &thisRAFN(state->dataRoomAirflowNetModel->RAFN(ZoneNum)); - thisRAFN.ZoneNum = ZoneNum; - - thisRAFN.InitRoomAirModelAirflowNetwork(*state, RoomAirNode); - - EXPECT_NEAR(120.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); - EXPECT_NEAR(80.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); - EXPECT_NEAR(1.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHA, 0.00001); - EXPECT_NEAR(25.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHATsurf, 0.00001); - EXPECT_NEAR(0.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHATref, 0.00001); - EXPECT_NEAR(4.0268, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCp, 0.0001); - EXPECT_NEAR(80.536, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCpT, 0.001); - EXPECT_NEAR(0.004, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysM, 0.00001); - EXPECT_NEAR(4.0e-6, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMW, 0.00001); - EXPECT_NEAR(30.200968, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCp, 0.0001); - EXPECT_NEAR(744.95722, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCpT, 0.001); - EXPECT_NEAR(0.03, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkM, 0.00001); - EXPECT_NEAR(3.0e-5, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMW, 0.00001); - EXPECT_NEAR(-8.431365e-8, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmAW, 0.0000001); - EXPECT_NEAR(0.0009756833, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); - EXPECT_NEAR(9.0784549e-7, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); - - thisRAFN.CalcRoomAirModelAirflowNetwork(*state, RoomAirNode); - - EXPECT_NEAR(24.907085, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); - EXPECT_NEAR(0.00189601, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); - EXPECT_NEAR(9.770445, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); + InitRoomAirModelAFN(*state, ZoneNum, RoomAirNode); + + EXPECT_NEAR(120.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); + EXPECT_NEAR(80.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); + EXPECT_NEAR(1.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHA, 0.00001); + EXPECT_NEAR(25.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHATsurf, 0.00001); + EXPECT_NEAR(0.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHATref, 0.00001); + EXPECT_NEAR(4.0268, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCp, 0.0001); + EXPECT_NEAR(80.536, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCpT, 0.001); + EXPECT_NEAR(0.004, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysM, 0.00001); + EXPECT_NEAR(4.0e-6, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMW, 0.00001); + EXPECT_NEAR(30.200968, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCp, 0.0001); + EXPECT_NEAR(744.95722, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCpT, 0.001); + EXPECT_NEAR(0.03, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkM, 0.00001); + EXPECT_NEAR(3.0e-5, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMW, 0.00001); + EXPECT_NEAR(-8.431365e-8, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmAW, 0.0000001); + EXPECT_NEAR(0.0009756833, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); + EXPECT_NEAR(9.0784549e-7, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); + + CalcRoomAirModelAFN(*state, ZoneNum, RoomAirNode); + + EXPECT_NEAR(24.907085, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); + EXPECT_NEAR(0.00189601, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); + EXPECT_NEAR(9.770445, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); RoomAirNode = 2; - thisRAFN.InitRoomAirModelAirflowNetwork(*state, RoomAirNode); - - EXPECT_NEAR(180.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); - EXPECT_NEAR(120.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); - EXPECT_NEAR(2.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHA, 0.00001); - EXPECT_NEAR(60.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHATsurf, 0.00001); - EXPECT_NEAR(0.0, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHATref, 0.00001); - EXPECT_NEAR(6.04019, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCp, 0.0001); - EXPECT_NEAR(120.803874, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCpT, 0.00001); - EXPECT_NEAR(0.006, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysM, 0.00001); - EXPECT_NEAR(6.0e-6, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMW, 0.00001); - EXPECT_NEAR(20.14327, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCp, 0.0001); - EXPECT_NEAR(523.73441, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCpT, 0.001); - EXPECT_NEAR(0.02, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkM, 0.00001); - EXPECT_NEAR(2.5e-5, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMW, 0.00001); - EXPECT_NEAR(-3.5644894e-9, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmAW, 0.0000001); - EXPECT_NEAR(0.0019191284, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); - EXPECT_NEAR(1.98975381e-6, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); - - thisRAFN.CalcRoomAirModelAirflowNetwork(*state, RoomAirNode); - - EXPECT_NEAR(24.057841, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); - EXPECT_NEAR(0.0028697086, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); - EXPECT_NEAR(15.53486185, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); - - thisRAFN.UpdateRoomAirModelAirflowNetwork(*state); + InitRoomAirModelAFN(*state, ZoneNum, RoomAirNode); + + EXPECT_NEAR(180.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); + EXPECT_NEAR(120.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); + EXPECT_NEAR(2.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHA, 0.00001); + EXPECT_NEAR(60.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHATsurf, 0.00001); + EXPECT_NEAR(0.0, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHATref, 0.00001); + EXPECT_NEAR(6.04019, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCp, 0.0001); + EXPECT_NEAR(120.803874, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMCpT, 0.00001); + EXPECT_NEAR(0.006, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysM, 0.00001); + EXPECT_NEAR(6.0e-6, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumSysMW, 0.00001); + EXPECT_NEAR(20.14327, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCp, 0.0001); + EXPECT_NEAR(523.73441, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMCpT, 0.001); + EXPECT_NEAR(0.02, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkM, 0.00001); + EXPECT_NEAR(2.5e-5, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumLinkMW, 0.00001); + EXPECT_NEAR(-3.5644894e-9, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmAW, 0.0000001); + EXPECT_NEAR(0.0019191284, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); + EXPECT_NEAR(1.98975381e-6, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); + + CalcRoomAirModelAFN(*state, ZoneNum, RoomAirNode); + + EXPECT_NEAR(24.057841, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); + EXPECT_NEAR(0.0028697086, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); + EXPECT_NEAR(15.53486185, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); + + UpdateRoomAirModelAFN(*state, ZoneNum); EXPECT_NEAR(24.397538, state->dataLoopNodes->Node(2).Temp, 0.00001); EXPECT_NEAR(0.0024802305, state->dataLoopNodes->Node(2).HumRat, 0.000001); @@ -394,27 +389,27 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) ASSERT_TRUE(process_idf(idf_objects)); state->afn->get_input(); - state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::AirDistUnit; - state->dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlagConf = true; + state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipType(1) = DataZoneEquipment::ZoneEquipType::AirDistributionUnit; + state->dataRoomAirflowNetModel->OneTimeFlagConf = true; state->dataZoneAirLoopEquipmentManager->GetAirDistUnitsFlag = false; state->dataDefineEquipment->AirDistUnit.allocate(1); state->dataZoneEquip->ZoneEquipList(ZoneNum).EquipName(1) = "ADU"; state->dataDefineEquipment->AirDistUnit(1).Name = "ADU"; state->dataDefineEquipment->AirDistUnit(1).EquipName.allocate(1); state->dataDefineEquipment->AirDistUnit(1).EquipName(1) = "AirTerminal"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "AirTerminal"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyFraction = 0.4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnFraction = 0.4; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "AirTerminal"; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyFraction = 0.6; - state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnFraction = 0.6; - - thisRAFN.InitRoomAirModelAirflowNetwork(*state, RoomAirNode); + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).Name = "AirTerminal"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).SupplyFraction = 0.4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(1).HVAC(1).ReturnFraction = 0.4; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).Name = "AirTerminal"; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).SupplyFraction = 0.6; + state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(2).HVAC(1).ReturnFraction = 0.6; + + InitRoomAirModelAFN(*state, ZoneNum, RoomAirNode); // No errorfound - EXPECT_NEAR(1.1824296, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).RhoAir, 0.00001); - EXPECT_NEAR(1010.1746, state->dataRoomAirMod->RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).CpAir, 0.001); + EXPECT_NEAR(1.1824296, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).RhoAir, 0.00001); + EXPECT_NEAR(1010.1746, state->dataRoomAir->AFNZoneInfo(ZoneNum).Node(RoomAirNode).CpAir, 0.001); - state->dataRoomAirflowNetModel->InitRoomAirModelAirflowNetworkOneTimeFlagConf = false; + state->dataRoomAirflowNetModel->OneTimeFlagConf = false; } TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) { @@ -528,7 +523,7 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) "RoomAirSettings:AirflowNetwork,", " living_unit1, !- Name", " living_unit1, !- Zone Name", - " Node1, !- Control Point RoomAirflowNetwork : Node Name", + " Node1, !- Control Point AFN : Node Name", " Node1; !- RoomAirflowNetwork : Node Name 1", }); @@ -566,9 +561,9 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) InternalHeatGains::GetInternalHeatGainsInput(*state); ErrorsFound = false; - state->dataRoomAirMod->AirModel.allocate(1); - state->dataRoomAirMod->AirModel(1).AirModelType = DataRoomAirModel::RoomAirModel::AirflowNetwork; - RoomAirModelManager::GetRoomAirflowNetworkData(*state, ErrorsFound); + state->dataRoomAir->AirModel.allocate(1); + state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::AirflowNetwork; + RoomAir::GetRoomAirflowNetworkData(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index 128a6eebe1f..cd0bbaf6982 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -806,12 +806,12 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) ventilationData1->SchedPtr = 1; ventilationData1->DesignLevel = 2; - auto const roomAirModelData0 = std::make_unique(); - roomAirModelData0->AirModelName = "test roomAirModel 1"; - auto const roomAirModelData1 = std::make_unique(); - roomAirModelData1->AirModelName = "test roomAirModel 2"; - roomAirModelData1->AirModelType = DataRoomAirModel::RoomAirModel::Mundt; - roomAirModelData1->TempCoupleScheme = DataRoomAirModel::CouplingScheme::Direct; // hmm this was set to 3 which wasn't a valid option + auto const roomAirModelData0 = std::make_unique(); + roomAirModelData0->Name = "test roomAirModel 1"; + auto const roomAirModelData1 = std::make_unique(); + roomAirModelData1->Name = "test roomAirModel 2"; + roomAirModelData1->AirModel = RoomAir::RoomAirModel::DispVent1Node; + roomAirModelData1->TempCoupleScheme = RoomAir::CouplingScheme::Direct; // hmm this was set to 3 which wasn't a valid option roomAirModelData1->SimAirModel = true; std::string const alwaysOn("always on"); diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 6cb7d3fbd7a..f6741b4bcde 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -5740,13 +5740,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda EXPECT_EQ(state->dataHeatBal->space(3).solarEnclosureNum, 1); // Check surface order - int Zone1Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone1-Surface1"), state->dataSurface->Surface); - int Zone1Surface2 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone1-Surface2"), state->dataSurface->Surface); - int Zone2Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone2-Surface1"), state->dataSurface->Surface); - int Zone3Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone3-Surface1"), state->dataSurface->Surface); - int Zone1Floor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone1-Floor"), state->dataSurface->Surface); - int Zone2Floor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone2-Floor"), state->dataSurface->Surface); - int Zone3Floor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Zone3-Floor"), state->dataSurface->Surface); + int Zone1Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone1-Surface1"), state->dataSurface->Surface); + int Zone1Surface2 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone1-Surface2"), state->dataSurface->Surface); + int Zone2Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone2-Surface1"), state->dataSurface->Surface); + int Zone3Surface1 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone3-Surface1"), state->dataSurface->Surface); + int Zone1Floor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone1-Floor"), state->dataSurface->Surface); + int Zone2Floor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone2-Floor"), state->dataSurface->Surface); + int Zone3Floor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Zone3-Floor"), state->dataSurface->Surface); EXPECT_EQ(state->dataHeatBal->Zone(1).AllSurfaceFirst, Zone1Surface2); // air boundary surface EXPECT_EQ(state->dataHeatBal->Zone(1).AllSurfaceFirst + 1, Zone1Surface1); // air boundary surface @@ -8644,17 +8644,17 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) // Simulation Order (1-based): // SHADING SURFACES: int siteShadeShadeFlatShadeSurface = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("SiteShade:FlatShadeSurface"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("SiteShade:FlatShadeSurface"), state->dataSurface->Surface); int mirSiteShadeFlatShadeSurface = - UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::MakeUPPERCase("SiteShade:FlatShadeSurface"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::makeUPPER("SiteShade:FlatShadeSurface"), state->dataSurface->Surface); int buildingShadeTiltedShadeSurface = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("BuildingShade:TiltedShadeSurface"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("BuildingShade:TiltedShadeSurface"), state->dataSurface->Surface); int mirBuildingShadeTiltedShadeSurface = - UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::MakeUPPERCase("BuildingShade:TiltedShadeSurface"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::makeUPPER("BuildingShade:TiltedShadeSurface"), state->dataSurface->Surface); int zoneShadeLivingSouthShade001 = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("ZoneShade:Living:South:Shade001"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("ZoneShade:Living:South:Shade001"), state->dataSurface->Surface); int mirZoneShadeLivingSouthShade001 = - UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::MakeUPPERCase("ZoneShade:Living:South:Shade001"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList("Mir-" + UtilityRoutines::makeUPPER("ZoneShade:Living:South:Shade001"), state->dataSurface->Surface); EXPECT_EQ(siteShadeShadeFlatShadeSurface, 1); EXPECT_EQ(mirSiteShadeFlatShadeSurface, 2); EXPECT_EQ(buildingShadeTiltedShadeSurface, 3); @@ -8663,20 +8663,20 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_EQ(mirZoneShadeLivingSouthShade001, 6); // LIVING ZONE: - int wallLivingNorth = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:North"), state->dataSurface->Surface); - int wallLivingEast = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:East"), state->dataSurface->Surface); - int wallLivingSouth = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:South"), state->dataSurface->Surface); - int wallLivingWest = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:West"), state->dataSurface->Surface); - int wallLivingInterior = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:Interior"), state->dataSurface->Surface); - int floorLivingFloor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:Floor"), state->dataSurface->Surface); - int ceilingLivingCeiling = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Living:Ceiling"), state->dataSurface->Surface); - int doorWestDoor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("WestDoor"), state->dataSurface->Surface); + int wallLivingNorth = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:North"), state->dataSurface->Surface); + int wallLivingEast = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:East"), state->dataSurface->Surface); + int wallLivingSouth = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:South"), state->dataSurface->Surface); + int wallLivingWest = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:West"), state->dataSurface->Surface); + int wallLivingInterior = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:Interior"), state->dataSurface->Surface); + int floorLivingFloor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:Floor"), state->dataSurface->Surface); + int ceilingLivingCeiling = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Living:Ceiling"), state->dataSurface->Surface); + int doorWestDoor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("WestDoor"), state->dataSurface->Surface); int windowTubularDaylightingDiffuser1 = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("TubularDaylightingDiffuser1"), state->dataSurface->Surface); - int windowNorthWindow = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthWindow"), state->dataSurface->Surface); - int windowEastWindow = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("EastWindow"), state->dataSurface->Surface); - int windowSouthWindow = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("SouthWindow"), state->dataSurface->Surface); - int windowWestWindow = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("WestWindow"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("TubularDaylightingDiffuser1"), state->dataSurface->Surface); + int windowNorthWindow = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthWindow"), state->dataSurface->Surface); + int windowEastWindow = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("EastWindow"), state->dataSurface->Surface); + int windowSouthWindow = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("SouthWindow"), state->dataSurface->Surface); + int windowWestWindow = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("WestWindow"), state->dataSurface->Surface); EXPECT_EQ(wallLivingNorth, 7); EXPECT_EQ(wallLivingEast, 8); @@ -8699,13 +8699,13 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceLast, 19); // GARAGE ZONE: - int wallGarageInterior = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:Interior"), state->dataSurface->Surface); - int wallGarageEast = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:EastWall"), state->dataSurface->Surface); - int wallGarageWest = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:WestWall"), state->dataSurface->Surface); - int wallGarageFrontDoor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:FrontDoor"), state->dataSurface->Surface); - int floorGarageFloor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:Floor"), state->dataSurface->Surface); - int ceilingGarageInterior = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Garage:Ceiling"), state->dataSurface->Surface); - int intmassEVChargingStation = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("EVChargingStation"), state->dataSurface->Surface); + int wallGarageInterior = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:Interior"), state->dataSurface->Surface); + int wallGarageEast = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:EastWall"), state->dataSurface->Surface); + int wallGarageWest = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:WestWall"), state->dataSurface->Surface); + int wallGarageFrontDoor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:FrontDoor"), state->dataSurface->Surface); + int floorGarageFloor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:Floor"), state->dataSurface->Surface); + int ceilingGarageInterior = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Garage:Ceiling"), state->dataSurface->Surface); + int intmassEVChargingStation = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("EVChargingStation"), state->dataSurface->Surface); EXPECT_EQ(wallGarageInterior, 20); EXPECT_EQ(wallGarageEast, 21); @@ -8722,21 +8722,21 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_EQ(state->dataHeatBal->space(2).WindowSurfaceLast, -1); // ATTIC ZONE: - int wallEastGable = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("EastGable"), state->dataSurface->Surface); - int wallWestGable = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("WestGable"), state->dataSurface->Surface); - int wallNorthGable = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthGable"), state->dataSurface->Surface); - int floorAtticLivingFloor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Attic:LivingFloor"), state->dataSurface->Surface); - int floorAtticGarageFloor = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Attic:GarageFloor"), state->dataSurface->Surface); - int roofNorthRoof1 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthRoof1"), state->dataSurface->Surface); - int roofSouthRoof = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("SouthRoof"), state->dataSurface->Surface); - int roofNorthRoof2 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthRoof2"), state->dataSurface->Surface); - int roofNorthRoof3 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthRoof3"), state->dataSurface->Surface); - int roofNorthRoof4 = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("NorthRoof4"), state->dataSurface->Surface); - int roofEastRoof = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("EastRoof"), state->dataSurface->Surface); - int roofWestRoof = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("WestRoof"), state->dataSurface->Surface); + int wallEastGable = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("EastGable"), state->dataSurface->Surface); + int wallWestGable = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("WestGable"), state->dataSurface->Surface); + int wallNorthGable = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthGable"), state->dataSurface->Surface); + int floorAtticLivingFloor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Attic:LivingFloor"), state->dataSurface->Surface); + int floorAtticGarageFloor = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("Attic:GarageFloor"), state->dataSurface->Surface); + int roofNorthRoof1 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthRoof1"), state->dataSurface->Surface); + int roofSouthRoof = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("SouthRoof"), state->dataSurface->Surface); + int roofNorthRoof2 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthRoof2"), state->dataSurface->Surface); + int roofNorthRoof3 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthRoof3"), state->dataSurface->Surface); + int roofNorthRoof4 = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("NorthRoof4"), state->dataSurface->Surface); + int roofEastRoof = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("EastRoof"), state->dataSurface->Surface); + int roofWestRoof = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("WestRoof"), state->dataSurface->Surface); int nonwindowTubularDaylightingDome1 = - UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("TubularDaylightingDome1"), state->dataSurface->Surface); - int windowAtticSkylight = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("AtticSkylight"), state->dataSurface->Surface); + UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("TubularDaylightingDome1"), state->dataSurface->Surface); + int windowAtticSkylight = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER("AtticSkylight"), state->dataSurface->Surface); EXPECT_EQ(wallEastGable, 27); EXPECT_EQ(wallWestGable, 28); @@ -11074,7 +11074,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_ShadingSurfaceScheduleChecks) static constexpr std::array isTransparent{false, true, false, false, false, true, false, false}; for (int surf = 0; surf < 8; ++surf) { - int surfNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase(surfacenames[surf]), state->dataSurface->Surface); + int surfNum = UtilityRoutines::FindItemInList(UtilityRoutines::makeUPPER(surfacenames[surf]), state->dataSurface->Surface); EXPECT_EQ(state->dataSurface->Surface(surfNum).IsTransparent, isTransparent[surf]); } EXPECT_TRUE(state->dataSolarShading->anyScheduledShadingSurface); diff --git a/tst/EnergyPlus/unit/SystemReports.unit.cc b/tst/EnergyPlus/unit/SystemReports.unit.cc index 018c785d5eb..2c061664661 100644 --- a/tst/EnergyPlus/unit/SystemReports.unit.cc +++ b/tst/EnergyPlus/unit/SystemReports.unit.cc @@ -111,7 +111,7 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).EndUse_CompMode = SystemReports::EndUseType::CoolingOnly; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).CurMeterReading = 100.0; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase("NaturalGas"))); + static_cast(getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER("NaturalGas"))); state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "Main Gas Heating Coil"; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "COIL:HEATING:DESUPERHEATER"; @@ -122,7 +122,7 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).EndUse_CompMode = SystemReports::EndUseType::CoolingOnly; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).CurMeterReading = 100.0; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase("NaturalGas"))); + static_cast(getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER("NaturalGas"))); state->dataLoopNodes->Node(1).MassFlowRate = 1.0; state->dataLoopNodes->Node(2).MassFlowRate = 1.0; @@ -160,9 +160,9 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) state->dataSysRpts->SysLoadRepVars(1).TotNaturalGas = 0; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase("Propane"))); + static_cast(getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER("Propane"))); state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = - static_cast(getEnumerationValue(Constant::eResourceNamesUC, UtilityRoutines::MakeUPPERCase("Propane"))); + static_cast(getEnumValue(Constant::eResourceNamesUC, UtilityRoutines::makeUPPER("Propane"))); // Calculate SysHumidPropane ("Air System Humidifier Propane Energy" Output Variable) CalcSystemEnergyUse(*state, @@ -235,13 +235,13 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) int NumEquip1 = 9; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = NumEquip1; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum.allocate(NumEquip1); + state->dataZoneEquip->ZoneEquipList(1).EquipType.allocate(NumEquip1); state->dataZoneEquip->ZoneEquipList(1).EquipIndex.allocate(NumEquip1); // 1: WindowAC int equipNum = 1; int nodeNumOA = 1; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::WindowAC; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::WindowAirConditioner; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataWindowAC->GetWindowACInputFlag = false; state->dataWindowAC->WindAC.allocate(1); @@ -251,7 +251,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 2: VRF ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::VRFTerminalUnit; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataHVACVarRefFlow->GetVRFInputFlag = false; state->dataHVACVarRefFlow->NumVRFTU = 1; @@ -262,7 +262,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 3: PTAC ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::PkgTermACAirToAir; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; UnitarySystems::UnitarySys thisSys; thisSys.m_OAMixerNodes[0] = nodeNumOA; @@ -274,7 +274,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 4: FanCoil ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::FanCoil4Pipe; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::FourPipeFanCoil; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataFanCoilUnits->GetFanCoilInputFlag = false; state->dataFanCoilUnits->NumFanCoils = 1; @@ -285,7 +285,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 5: Unit Ventilator ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::UnitVentilator; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::UnitVentilator; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; state->dataUnitVentilators->NumOfUnitVents = 1; @@ -296,7 +296,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 6: Purchased Air (Ideal Loads) ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::PurchasedAir; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::PurchasedAir; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataPurchasedAirMgr->GetPurchAirInputFlag = false; state->dataPurchasedAirMgr->NumPurchAir = 1; @@ -306,7 +306,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 7: ERV ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::ERVStandAlone; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataHVACStandAloneERV->GetERVInputFlag = false; state->dataHVACStandAloneERV->NumStandAloneERVs = 1; @@ -317,7 +317,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 8: Outdoor air unit ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::OutdoorAirUnit; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::OutdoorAirUnit; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataOutdoorAirUnit->GetOutdoorAirUnitInputFlag = false; state->dataOutdoorAirUnit->NumOfOAUnits = 1; @@ -328,7 +328,7 @@ TEST_F(EnergyPlusFixture, ReportVentilationLoads_ZoneEquip) // 9: Zone Hybrid Unitary ++equipNum; ++nodeNumOA; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(equipNum) = DataZoneEquipment::ZoneEquip::ZoneHybridEvaporativeCooler; + state->dataZoneEquip->ZoneEquipList(1).EquipType(equipNum) = DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(equipNum) = 1; state->dataHybridUnitaryAC->GetInputZoneHybridEvap = false; state->dataHybridUnitaryAC->NumZoneHybridEvap = 1; diff --git a/tst/EnergyPlus/unit/ThermalComfort.unit.cc b/tst/EnergyPlus/unit/ThermalComfort.unit.cc index 408af6fb070..164841c7dc3 100644 --- a/tst/EnergyPlus/unit/ThermalComfort.unit.cc +++ b/tst/EnergyPlus/unit/ThermalComfort.unit.cc @@ -77,7 +77,7 @@ using namespace EnergyPlus::ThermalComfort; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::DataHeatBalance; using namespace EnergyPlus::DataHVACGlobals; -using namespace EnergyPlus::DataRoomAirModel; +using namespace EnergyPlus::RoomAir; using namespace EnergyPlus::DataHeatBalFanSys; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataHeatBalSurface; @@ -90,8 +90,8 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); state->dataThermalComforts->ThermalComfortSetPoint.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataRoomAirMod->AirModel.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->AirModel(1).AirModelType = DataRoomAirModel::RoomAirModel::Mixing; + state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::Mixing; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); @@ -925,8 +925,8 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); state->dataThermalComforts->ThermalComfortSetPoint.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataRoomAirMod->AirModel.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->AirModel(1).AirModelType = DataRoomAirModel::RoomAirModel::Mixing; + state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::Mixing; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); @@ -986,8 +986,8 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->ZoneMRT.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->IsZoneDV.allocate(state->dataGlobal->NumOfZones); - state->dataRoomAirMod->IsZoneUI.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->IsZoneDispVent3Node.allocate(state->dataGlobal->NumOfZones); + state->dataRoomAir->IsZoneUFAD.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneQdotRadHVACToPerson.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneQHTRadSysToPerson.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneQCoolingPanelToPerson.allocate(state->dataGlobal->NumOfZones); @@ -1011,7 +1011,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataHeatBal->People(1).WorkEffPtr = 0; state->dataHeatBal->People(1).clothingType = ClothingType::InsulationSchedule; - state->dataRoomAirMod->IsZoneDV(1) = state->dataRoomAirMod->IsZoneUI(1) = false; + state->dataRoomAir->IsZoneDispVent3Node(1) = state->dataRoomAir->IsZoneUFAD(1) = false; state->dataHeatBalFanSys->ZoneQHTRadSysToPerson(1) = 0.0; state->dataHeatBalFanSys->ZoneQCoolingPanelToPerson(1) = 0.0; state->dataHeatBalFanSys->ZoneQHWBaseboardToPerson(1) = 0.0; diff --git a/tst/EnergyPlus/unit/UnitHeater.unit.cc b/tst/EnergyPlus/unit/UnitHeater.unit.cc index b0f19307b40..721b90add77 100644 --- a/tst/EnergyPlus/unit/UnitHeater.unit.cc +++ b/tst/EnergyPlus/unit/UnitHeater.unit.cc @@ -2463,11 +2463,11 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) EXPECT_EQ(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes, 2); // first priority zone equipment is zone ADU - EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipType, "ZONEHVAC:AIRDISTRIBUTIONUNIT"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipTypeName, "ZONEHVAC:AIRDISTRIBUTIONUNIT"); EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipName, "MAIN ZONE ATU"); EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(1).Name, "MAIN ZONE REHEAT COIL"); // second priority zone equipment is unit heater - EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipType, "ZONEHVAC:UNITHEATER"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipTypeName, "ZONEHVAC:UNITHEATER"); EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipName, "UNITHEATER"); EXPECT_EQ(state->dataHeatingCoils->HeatingCoil(2).Name, "UNITHEATER_ELECTRICHEATER"); // check the reheat coil output diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 1f1d20baafb..f6ac876a73d 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -140,19 +140,19 @@ class ZoneUnitarySysTest : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipList(1).Name = "ZONE2EQUIPMENT"; int maxEquipCount = 1; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = maxEquipCount; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipType.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex = 1; state->dataZoneEquip->ZoneEquipList(1).EquipData.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).CoolingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).HeatingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = "AIRLOOPHVAC:UNITARYSYSTEM"; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName(1) = "AIRLOOPHVAC:UNITARYSYSTEM"; state->dataZoneEquip->ZoneEquipList(1).EquipName(1) = "UNITARY SYSTEM MODEL"; state->dataZoneEquip->ZoneEquipList(1).CoolingPriority(1) = 1; state->dataZoneEquip->ZoneEquipList(1).HeatingPriority(1) = 1; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::ZoneUnitarySys; + state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = DataZoneEquipment::ZoneEquipType::UnitarySystem; state->dataZoneEquip->ZoneEquipConfig(1).NumInletNodes = NumNodes; state->dataZoneEquip->ZoneEquipConfig(1).InletNode.allocate(NumNodes); state->dataZoneEquip->ZoneEquipConfig(1).AirDistUnitCool.allocate(NumNodes); diff --git a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc index b0cf64b1a84..af6bef670c9 100644 --- a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc +++ b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc @@ -122,18 +122,18 @@ class ZoneHVACEvapCoolerUnitTest : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipList(1).Name = "ZONEHVACEVAPEQUIPMENT"; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = 1; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipType.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipName.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).EquipIndex = 1; state->dataZoneEquip->ZoneEquipList(1).EquipData.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).CoolingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); state->dataZoneEquip->ZoneEquipList(1).HeatingPriority.allocate(state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes); - state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = "ZoneHVAC:EvaporativeCoolerUnit"; + state->dataZoneEquip->ZoneEquipList(1).EquipTypeName(1) = "ZoneHVAC:EvaporativeCoolerUnit"; state->dataZoneEquip->ZoneEquipList(1).CoolingPriority(1) = 1; state->dataZoneEquip->ZoneEquipList(1).HeatingPriority(1) = 1; - state->dataZoneEquip->ZoneEquipList(1).EquipTypeEnum(1) = DataZoneEquipment::ZoneEquip::ZoneEvaporativeCoolerUnit; + state->dataZoneEquip->ZoneEquipList(1).EquipType(1) = DataZoneEquipment::ZoneEquipType::EvaporativeCooler; } virtual void TearDown() diff --git a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc index 3a5d786ec40..90abe9da4af 100644 --- a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc @@ -94,7 +94,7 @@ using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::Psychrometrics; using namespace EnergyPlus::ScheduleManager; -using namespace EnergyPlus::DataRoomAirModel; +using namespace EnergyPlus::RoomAir; using namespace EnergyPlus::HybridModel; using namespace SimulationManager; @@ -151,7 +151,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataHeatBal->ZoneAirSolutionAlgo = DataHeatBalance::SolutionAlgo::EulerMethod; - state->dataRoomAirMod->AirModel.allocate(1); + state->dataRoomAir->AirModel.allocate(1); state->dataHeatBal->ZoneIntGain.allocate(1); // Case 1 - All flows at the same humrat