diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 7e128de3ee8..8615d8596a6 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -327,7 +327,12 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S SumSysMCpT += MassFlowRate * CpAir * NodeTemp; } // a weighted average of the inlet temperatures. - RefAirTemp = SumSysMCpT / SumSysMCp; + if (SumSysMCp > 0.0) { + // a weighted average of the inlet temperatures. + RefAirTemp = SumSysMCpT / SumSysMCp; + } else { + RefAirTemp = state.dataHeatBalFanSys->MAT(Zone); + } } else { // currently set to mean air temp but should add error warning here RefAirTemp = state.dataHeatBalFanSys->MAT(Zone); diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 3ddf1e3c072..d99087d3b82 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -6614,54 +6614,12 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, // determine reference air temperatures for (int SurfNum : HTSurfs) { - int ZoneNum = Surface(SurfNum).Zone; // These conditions are not used in every SurfNum loop here so we don't use them to skip surfaces if (Surface(SurfNum).Class == SurfaceClass::TDD_Dome) continue; // Skip TDD:DOME objects. Inside temp is handled by TDD:DIFFUSER. - - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = state.dataHeatBalFanSys->MAT(ZoneNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataHeatBalFanSys->MAT(ZoneNum); // for reporting surf adjacent air temp - } else if (SELECT_CASE_var == AdjacentAirTemp) { - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - int ZoneEquipConfigNum = ZoneNum; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(ZoneNum).Name); - return; - } - // determine supply air conditions - Real64 SumSysMCp = 0.0; - Real64 SumSysMCpT = 0.0; - Real64 const CpAir = Psychrometrics::PsyCpAirFnW(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNum)); - for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { - Real64 NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; - Real64 MassFlowRate = - state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - // Real64 CpAir2 = PsyCpAirFnW(ZoneAirHumRat(ZoneNum), NodeTemp); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { // protect div by zero - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = SumSysMCpT / SumSysMCp; // BG changed 02-16-2005 to add index (SurfNum) - } else { - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = state.dataHeatBalFanSys->MAT(ZoneNum); - } - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum); // for reporting surf adjacent air temp - } else { - // currently set to mean air temp but should add error warning here - state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = state.dataHeatBalFanSys->MAT(ZoneNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataHeatBalFanSys->MAT(ZoneNum); // for reporting surf adjacent air temp - } - } + Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); + state.dataHeatBalSurfMgr->RefAirTemp(SurfNum) = RefAirTemp; + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataHeatBalSurfMgr->RefAirTemp(SurfNum); } // Following variables must be reset due to possible recall of this routine by radiant and Resimulate routines. @@ -7544,46 +7502,9 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, state.dataHeatBalSurf->SurfIsOperatingPool(surfNum) = 0; } } - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(surfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = state.dataHeatBalFanSys->MAT(zoneNum); - state.dataHeatBal->SurfTempEffBulkAir(surfNum) = state.dataHeatBalFanSys->MAT(zoneNum); // for reporting surf adjacent air temp - } else if (SELECT_CASE_var == AdjacentAirTemp) { - state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = state.dataHeatBal->SurfTempEffBulkAir(surfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - int ZoneEquipConfigNum = zoneNum; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(zoneNum).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(zoneNum).Name); - return; - } - // determine supply air conditions - Real64 SumSysMCp = 0.0; - Real64 SumSysMCpT = 0.0; - Real64 const CpAir = Psychrometrics::PsyCpAirFnW(state.dataHeatBalFanSys->ZoneAirHumRat(zoneNum)); - for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { - Real64 NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; - Real64 MassFlowRate = - state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { // protect div by zero - state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = SumSysMCpT / SumSysMCp; // BG changed 02-16-2005 to add index (SurfNum) - } else { - state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = state.dataHeatBalFanSys->MAT(zoneNum); - } - state.dataHeatBal->SurfTempEffBulkAir(surfNum) = - state.dataHeatBalSurfMgr->RefAirTemp(surfNum); // for reporting surf adjacent air temp - } else { - // currently set to mean air temp but should add error warning here - state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = state.dataHeatBalFanSys->MAT(zoneNum); - state.dataHeatBal->SurfTempEffBulkAir(surfNum) = state.dataHeatBalFanSys->MAT(zoneNum); // for reporting surf adjacent air temp - } + Real64 RefAirTemp = state.dataSurface->Surface(surfNum).getInsideAirTemperature(state, surfNum); + state.dataHeatBalSurfMgr->RefAirTemp(surfNum) = RefAirTemp; + state.dataHeatBal->SurfTempEffBulkAir(surfNum) = state.dataHeatBalSurfMgr->RefAirTemp(surfNum); } // Following variables must be reset due to possible recall of this routine by radiant and Resimulate routines. diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index b29ff280654..a26787d03d8 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include @@ -2617,19 +2618,11 @@ namespace WindowComplexManager { int TotLay; // Total number of layers in a construction // (sum of solid layers and gap layers) - int Lay; // Layer number - int LayPtr; // Material number for a layer - int IGlass; // glass layer number (1,2,3,...) - int IGap; // Gap layer number (1,2,...) - int TotGlassLay; // Total number of glass layers in a construction - int ZoneEquipConfigNum; - int NodeNum; - Real64 SumSysMCp; // Zone sum of air system MassFlowRate*Cp - Real64 SumSysMCpT; // Zone sum of air system MassFlowRate*Cp*T - Real64 MassFlowRate; - Real64 NodeTemp; - Real64 CpAir; - Real64 RefAirTemp; // reference air temperatures + int Lay; // Layer number + int LayPtr; // Material number for a layer + int IGlass; // glass layer number (1,2,3,...) + int IGap; // Gap layer number (1,2,...) + int TotGlassLay; // Total number of glass layers in a construction int k; // Layer counter int SurfNumAdj; // An interzone surface's number in the adjacent zone int ZoneNumAdj; // An interzone surface's adjacent zone number @@ -2736,100 +2729,14 @@ namespace WindowComplexManager { if (CalcCondition == DataBSDFWindow::Condition::Unassigned) { ZoneNum = state.dataSurface->Surface(SurfNum).Zone; - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - // ControlledZoneAirFlag = .FALSE. - ZoneEquipConfigNum = ZoneNum; - // DO ZoneEquipConfigNum = 1, NumOfControlledZones - // IF (ZoneEquipConfig(ZoneEquipConfigNum)%ActualZoneNum /= ZoneNum) CYCLE - // ControlledZoneAirFlag = .TRUE. - // EXIT - // END DO ! ZoneEquipConfigNum - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(ZoneNum).Name); - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNum)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } - } - + Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); tind = RefAirTemp + DataGlobalConstants::KelvinConv; // Inside air temperature // now get "outside" air temperature if (SurfNumAdj > 0) { // Interzone window ZoneNumAdj = state.dataSurface->Surface(SurfNumAdj).Zone; - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNumAdj)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - ZoneEquipConfigNum = ZoneNum; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(ZoneNum).Name); - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNumAdj)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } - } - + RefAirTemp = state.dataSurface->Surface(SurfNumAdj).getInsideAirTemperature(state, SurfNumAdj); tout = RefAirTemp + DataGlobalConstants::KelvinConv; // outside air temperature tsky = state.dataHeatBal->ZoneMRT(ZoneNumAdj) + diff --git a/src/EnergyPlus/WindowEquivalentLayer.cc b/src/EnergyPlus/WindowEquivalentLayer.cc index 2d75bc999d7..b91f7a58639 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.cc +++ b/src/EnergyPlus/WindowEquivalentLayer.cc @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -689,18 +690,10 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, int ZoneNum; // Zone number corresponding to SurfNum int ConstrNum; // Construction number - int ZoneEquipConfigNum; - int NodeNum; - Real64 SumSysMCp; // Zone sum of air system MassFlowRate*Cp - Real64 SumSysMCpT; // Zone sum of air system MassFlowRate*Cp*T - Real64 MassFlowRate; - Real64 NodeTemp; - Real64 CpAir; - Real64 RefAirTemp; // reference air temperatures - int SurfNumAdj; // An interzone surface's number in the adjacent zone - int ZoneNumAdj; // An interzone surface's adjacent zone number - Real64 LWAbsIn; // effective long wave absorptance/emissivity back side - Real64 LWAbsOut; // effective long wave absorptance/emissivity front side + int SurfNumAdj; // An interzone surface's number in the adjacent zone + int ZoneNumAdj; // An interzone surface's adjacent zone number + Real64 LWAbsIn; // effective long wave absorptance/emissivity back side + Real64 LWAbsOut; // effective long wave absorptance/emissivity front side Real64 outir(0); Real64 rmir; Real64 Ebout; @@ -731,42 +724,7 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, if (CalcCondition == DataBSDFWindow::Condition::Unassigned) { ZoneNum = state.dataSurface->Surface(SurfNum).Zone; SurfNumAdj = state.dataSurface->Surface(SurfNum).ExtBoundCond; - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - ZoneEquipConfigNum = ZoneNum; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNum)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } - } + Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); TaIn = RefAirTemp; TIN = TaIn + DataGlobalConstants::KelvinConv; // Inside air temperature, K @@ -775,44 +733,7 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, // this is interzone window. the outside condition is determined from the adjacent zone // condition ZoneNumAdj = state.dataSurface->Surface(SurfNumAdj).Zone; - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNumAdj)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - ZoneEquipConfigNum = ZoneNum; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNumAdj)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } - } - + RefAirTemp = state.dataSurface->Surface(SurfNumAdj).getInsideAirTemperature(state, SurfNumAdj); Tout = RefAirTemp + DataGlobalConstants::KelvinConv; // outside air temperature tsky = state.dataHeatBal->ZoneMRT(ZoneNumAdj) + DataGlobalConstants::KelvinConv; // TODO this misses IR from sources such as high temp radiant and baseboards diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 4dabc34c4b0..21fedb1603d 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -2285,15 +2286,6 @@ namespace WindowManager { Real64 InsideGlassTemp; // Temperature of room side of innermost glass layer (C) Real64 Tleft; // For airflow windows, temperature of the glass faces adjacent Real64 Tright; - // to the airflow gap (C) - int ZoneEquipConfigNum; - int NodeNum; - Real64 SumSysMCp; // Zone sum of air system MassFlowRate*Cp - Real64 SumSysMCpT; // Zone sum of air system MassFlowRate*Cp*T - Real64 MassFlowRate; - Real64 NodeTemp; - Real64 CpAir; - Real64 RefAirTemp; // reference air temperatures int SrdSurfsNum; // Surrounding surfaces list number int SrdSurfNum; // Surrounding surface number DO loop counter @@ -2422,57 +2414,8 @@ namespace WindowManager { state.dataWindowManager->tiltr = state.dataWindowManager->tilt * DataGlobalConstants::DegToRadians; SurfNumAdj = surface.ExtBoundCond; state.dataWindowManager->hcin = state.dataHeatBalSurf->SurfHConvInt(SurfNum); // Room-side surface convective film conductance - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = RefAirTemp; - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - // ControlledZoneAirFlag = .FALSE. - ZoneEquipConfigNum = ZoneNum; - // DO ZoneEquipConfigNum = 1, NumOfControlledZones - // IF (ZoneEquipConfig(ZoneEquipConfigNum)%ActualZoneNum /= ZoneNum) CYCLE - // ControlledZoneAirFlag = .TRUE. - // EXIT - // END DO ! ZoneEquipConfigNum - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(ZoneNum).Name); - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNum)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - // a weighted average of the inlet temperatures. - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - } - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = RefAirTemp; - - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNum); - state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = RefAirTemp; - } - } - + Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); + state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = RefAirTemp; state.dataWindowManager->tin = RefAirTemp + state.dataWindowManager->TKelvin; // Inside air temperature // Reset hcin if necessary since too small a value sometimes causes non-convergence @@ -2693,50 +2636,8 @@ namespace WindowManager { if (SurfNumAdj > 0) { // Interzone window ZoneNumAdj = state.dataSurface->Surface(SurfNumAdj).Zone; - - // determine reference air temperature for this surface - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNumAdj)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj) = RefAirTemp; - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // determine ZoneEquipConfigNum for this zone - ZoneEquipConfigNum = ZoneNumAdj; - // check whether this zone is a controlled zone or not - if (!state.dataHeatBal->Zone(ZoneNumAdj).IsControlled) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + - state.dataHeatBal->Zone(ZoneNum).Name); - return; - } - // determine supply air conditions - SumSysMCp = 0.0; - SumSysMCpT = 0.0; - for (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(state.dataHeatBalFanSys->ZoneAirHumRat(ZoneNumAdj)); - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - } - if (SumSysMCp > 0.0) { - // a weighted average of the inlet temperatures. - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - } - state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj) = RefAirTemp; - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = state.dataHeatBalFanSys->MAT(ZoneNumAdj); - state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj) = RefAirTemp; - } - } - + Real64 RefAirTemp = state.dataSurface->Surface(SurfNumAdj).getInsideAirTemperature(state, SurfNumAdj); + state.dataHeatBal->SurfTempEffBulkAir(SurfNumAdj) = RefAirTemp; state.dataWindowManager->tout = RefAirTemp + state.dataWindowManager->TKelvin; // outside air temperature // Add long-wave radiation from adjacent zone absorbed by glass layer closest to the adjacent zone. diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index ca15128cd90..eda7e7e365e 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -6876,16 +6877,13 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, bool ZoneRetPlenumAirFlag; bool ZoneSupPlenumAirFlag; Real64 RhoAir; - Real64 CpAir; // Specific heat of air - int SurfNum; // Surface number - Real64 Area; // Effective surface area - Real64 RefAirTemp; // Reference air temperature for surface convection calculations + Real64 CpAir; // Specific heat of air + int SurfNum; // Surface number + Real64 Area; // Effective surface area int ADUListIndex; int ADUNum; int ADUInNode; int ADUOutNode; - Real64 SumSysMCp; - Real64 SumSysMCpT; Real64 Threshold; Real64 SumRetAirGains; Real64 ADUHeatAddRate; @@ -6901,8 +6899,6 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, imBalance = 0.0; SumEnthalpyM = 0.0; SumEnthalpyH = 0.0; - SumSysMCp = 0.0; - SumSysMCpT = 0.0; ADUHeatAddRate = 0.0; ADUNum = 0; QSensRate = 0; @@ -7033,44 +7029,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, for (SurfNum = Zone(ZoneNum).HTSurfaceFirst; SurfNum <= Zone(ZoneNum).HTSurfaceLast; ++SurfNum) { Area = state.dataSurface->Surface(SurfNum).Area; // For windows, this is the glazing area - // determine reference air temperature for this surface's convective heat transfer model - { - auto const SELECT_CASE_var(state.dataSurface->SurfTAirRef(SurfNum)); - if (SELECT_CASE_var == ZoneMeanAirTemp) { - // The zone air is the reference temperature - RefAirTemp = MAT(ZoneNum); - } else if (SELECT_CASE_var == AdjacentAirTemp) { - RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum); - } else if (SELECT_CASE_var == ZoneSupplyAirTemp) { - // check whether this zone is a controlled zone or not - if (!ControlledZoneAirFlag) { - ShowFatalError(state, - "Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone " + Zone(ZoneNum).Name); - return; - } - // determine supply air temperature as a weighted average of the inlet temperatures. - for (NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { - // Get node conditions - NodeTemp = Node(ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; - MassFlowRate = Node(ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - CpAir = PsyCpAirFnW(ZoneAirHumRat(ZoneNum)); - - SumSysMCp += MassFlowRate * CpAir; - SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - - } // NodeNum - if (SumSysMCp > 0.0) { - RefAirTemp = SumSysMCpT / SumSysMCp; - } else { - // no system flow (yet) so just use last value for zone air temp - RefAirTemp = MAT(ZoneNum); - } - - } else { - // currently set to mean air temp but should add error warning here - RefAirTemp = MAT(ZoneNum); - } - } + Real64 RefAirTemp = state.dataSurface->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) {