diff --git a/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex b/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex index 77c3ccd7dc2..7b9837014d3 100644 --- a/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex +++ b/doc/input-output-reference/src/overview/group-thermal-zone-description-geometry.tex @@ -2239,13 +2239,13 @@ \subsection{Window Modeling Options}\label{window-modeling-options} % table 8 \begin{longtable}[c]{p{2.0in}p{2.0in}p{2.0in}} \caption{Window Modeling Options \label{table:window-modeling-options}} \tabularnewline -\toprule +\toprule Option & Object/Field or Output Variable & Input File (distributed with install) \tabularnewline \midrule \endfirsthead \caption[]{Window Modeling Options} \tabularnewline -\toprule +\toprule Option & Object/Field or Output Variable & Input File (distributed with install) \tabularnewline \midrule \endhead @@ -2409,7 +2409,7 @@ \subsection{Surface Output Variables/Reports}\label{surface-output-variablesrepo Zone,Average,Surface Outside Face Incident Sky Diffuse Surface Reflected Solar Radiation Rate per Area[W/m2] Zone,Average,Surface Outside Face Incident Beam To Beam Surface Reflected Solar Radiation Rate per Area[W/m2] Zone,Average,Surface Outside Face Incident Beam To Diffuse Surface Reflected Solar Radiation Rate per Area[W/m2] -Zone,Average,Surface Outside Face Beam Solar Incident Angle Cosine Value[] +Zone,Average,Surface Outside Face Beam Solar Incident Angle Cosine Value[] Zone,Average,Surface Anisotropic Sky Multiplier [] Zone,Average,Surface Window BSDF Beam Direction Number [] Zone,Average,Surface Window BSDF Beam Theta Angle [rad] @@ -2499,6 +2499,8 @@ \subsection{Window Output Variables}\label{window-output-variables} Zone,Sum,Surface Window Heat Gain Energy [J] Zone,Average,Surface Window Heat Loss Rate [W] Zone,Sum,Surface Window Heat Loss Energy [J] +Zone,Average,Surface Window Net Heat Transfer Rate [W] +Zone,Sum,Surface Window Net Heat Transfer Energy [J] Zone,Average,Surface Window Glazing Beam to Beam Solar Transmittance[] Zone,Average,Surface Window Glazing Beam to Diffuse Solar Transmittance [] Zone,Average,Surface Window Glazing Diffuse to Diffuse Solar Transmittance[] @@ -3043,34 +3045,31 @@ \subsubsection{Surface Window Heat Gain Rate {[}W{]}}\label{surface-window-heat- \subsubsection{Surface Window Heat Gain Energy {[}J{]}}\label{surface-window-heat-gain-energy-j} -The total heat flow to the zone from the glazing, frame and divider of an exterior window when the total heat flow is positive. +The total heat flow \emph{to the zone} from the glazing, frame and divider of an exterior window when the total heat flow is positive. For a window \emph{without an interior shading device}, this heat flow is equal to: -{[}Surface Window Transmitted Solar Radiation Rate (see definition, above){]} - \begin{itemize} +\item + {[}Surface Window Transmitted Solar Radiation Rate (see definition, above){]} \item {[}Convective heat flow to the zone from the zone side of the glazing{]} \item {[}Net IR heat flow to the zone from zone side of the glazing{]} -\end{itemize} - --- {[}Short-wave radiation from zone transmitted back out the window{]} - -\begin{itemize} -\tightlist \item - {[}Conduction to zone from window frame and divider, if present{]} + {[}Short-wave radiation from zone transmitted back out the window{]} +\item + {[}Convection to zone from window frame and divider, if present{]} \end{itemize} Here, short-wave radiation is that from lights and diffuse interior solar radiation. For a window \emph{with an interior shading device}, this heat flow is equal to: -{[}Surface Window Transmitted Solar Radiation Rate{]} \begin{itemize} +\item + {[}Surface Window Transmitted Solar Radiation Rate{]} \item {[}Convective heat flow to the zone from the air flowing through the gap between glazing and shading device{]} \item @@ -3079,23 +3078,64 @@ \subsubsection{Surface Window Heat Gain Energy {[}J{]}}\label{surface-window-hea {[}Net IR heat flow to the zone from the zone side of the glazing{]} \item {[}Net IR heat flow to the zone from the zone side of the shading device{]} +\item + {[}Short-wave radiation from zone transmitted back out the window{]} +\item + {[}Convection to zone from window frame and divider, if present{]} \end{itemize} --- {[}Short-wave radiation from zone transmitted back out the window{]} +The total window heat flow can also be thought of as the sum of the solar and conductive gain \emph{to the zone} from the window. + +\subsubsection{Surface Window Heat Loss Rate {[}W{]}}\label{surface-window-heat-loss-rate-w} + +\subsubsection{Surface Window Heat Loss Energy {[}J{]}}\label{surface-window-heat-loss-energy-j} + +The absolute value of the total heat flow through an exterior window when the total heat flow is negative. (See definition of ``total heat flow'' under ``Surface Window Heat Gain Rate,'' above.) + +\subsubsection{Surface Window Net Heat Transfer Rate {[}W{]}}\label{surface-window-net-heat-transfer-rate-w} + +\subsubsection{Surface Window Net Heat Transfer Energy {[}J{]}}\label{surface-window-net-heat-transfer-rate-j} + +The total heat flow through the glazing, frame and divider of an exterior window. Negative values imply heat flow to the exterior. + +The important distinction between this output variable and those for ``Surface Window Heat Gain/Loss'' is that this represents the net heat flow through the window and not the heat flow \emph{to the zone}. The only difference is the heat flow \emph{to the zone} does not account for radiation from the opaque frame and divider components. This is because these components, as a simplification, do not participate in the overall radiative exchange with other surfaces in the zone. + +For a window \emph{without an interior shading device}, this heat flow is equal to: \begin{itemize} -\tightlist \item - {[}Conduction to zone from window frame and divider, if present{]} + {[}Surface Window Transmitted Solar Radiation Rate (see definition, above){]} +\item + {[}Convective heat flow from the zone side of the glazing{]} +\item + {[}Net IR heat flow from the zone side of the glazing{]} +\item + {[}Short-wave radiation from zone transmitted back out the window{]} +\item + {[}Conduction through window frame and divider, if present{]} \end{itemize} -The total window heat flow can also be thought of as the sum of the solar and conductive gain from the window glazing. +Here, short-wave radiation is that from lights and diffuse interior solar radiation. -\subsubsection{Surface Window Heat Loss Rate {[}W{]}}\label{surface-window-heat-loss-rate-w} +For a window \emph{with an interior shading device}, this heat flow is equal to: -\subsubsection{Surface Window Heat Loss Energy {[}J{]}}\label{surface-window-heat-loss-energy-j} -The absolute value of the total heat flow through an exterior window when the total heat flow is negative. (See definition of ``total heat flow'' under ``Surface Window Heat Gain Rate,'' above.) +\begin{itemize} +\item + {[}Surface Window Transmitted Solar Radiation Rate{]} +\item + {[}Convective heat flow from the air flowing through the gap between glazing and shading device{]} +\item + {[}Convective heat flow from the zone side of the shading device{]} +\item + {[}Net IR heat flow from the zone side of the glazing{]} +\item + {[}Net IR heat flow from the zone side of the shading device{]} +\item + {[}Short-wave radiation from zone transmitted back out the window{]} +\item + {[}Conduction through the window frame and divider, if present{]} +\end{itemize} \subsubsection{\texorpdfstring{Surface Window Glazing Beam to Beam Solar Transmittance {[]}}{Surface Window Glazing Beam to Beam Solar Transmittance }}\label{surface-window-glazing-beam-to-beam-solar-transmittance} diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 37ad5e394e8..65a2d762f99 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -422,6 +422,8 @@ namespace DataSurfaces { // zone-side of shade plus gap air convection to zone) + (IR and // convection from frame) + (IR and convection from divider if no // interior shade) (W) + Array1D< Real64 > WinHeatTransfer; // Total heat transfer through the window = WinTransSolar + conduction + // through glazing and frame Array1D< Real64 > WinHeatGainRep; // Equals WinHeatGain when WinHeatGain >= 0.0 Array1D< Real64 > WinHeatLossRep; // Equals -WinHeatGain when WinHeatGain < 0.0 @@ -471,6 +473,7 @@ namespace DataSurfaces { Array1D< Real64 > WinHeatLossRepEnergy; // Energy of WinHeatLossRep [J] Array1D< Real64 > WinShadingAbsorbedSolarEnergy; // Energy of WinShadingAbsorbedSolar [J] Array1D< Real64 > WinGapConvHtFlowRepEnergy; // Energy of WinGapConvHtFlowRep [J] + Array1D< Real64 > WinHeatTransferRepEnergy; // Energy of WinHeatTransfer [J] // SUBROUTINE SPECIFICATIONS FOR MODULE DataSurfaces: @@ -842,6 +845,7 @@ namespace DataSurfaces { WinDifSolar.deallocate(); WinDirSolTransAtIncAngle.deallocate(); WinHeatGain.deallocate(); + WinHeatTransfer.deallocate(); WinHeatGainRep.deallocate(); WinHeatLossRep.deallocate(); WinGainConvGlazToZoneRep.deallocate(); @@ -876,6 +880,7 @@ namespace DataSurfaces { WinHeatLossRepEnergy.deallocate(); WinShadingAbsorbedSolarEnergy.deallocate(); WinGapConvHtFlowRepEnergy.deallocate(); + WinHeatTransferRepEnergy.deallocate(); Surface.deallocate(); SurfaceWindow.deallocate(); FrameDivider.deallocate(); @@ -900,11 +905,11 @@ namespace DataSurfaces { } void - CheckSurfaceOutBulbTempAt() + CheckSurfaceOutBulbTempAt() { // Using/Aliasing using DataEnvironment::SetOutBulbTempAt_error; - + Real64 minBulb = 0.0; for ( auto & surface : Surface ) { minBulb = min( minBulb, surface.OutDryBulbTemp, surface.OutWetBulbTemp ); diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index 2671273c1d0..b9e2e7a365e 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -423,6 +423,8 @@ namespace DataSurfaces { // zone-side of shade plus gap air convection to zone) + (IR and // convection from frame) + (IR and convection from divider if no // interior shade) (W) + extern Array1D< Real64 > WinHeatTransfer; // Total heat transfer through the window = WinTransSolar + conduction + // through glazing and frame extern Array1D< Real64 > WinHeatGainRep; // Equals WinHeatGain when WinHeatGain >= 0.0 extern Array1D< Real64 > WinHeatLossRep; // Equals -WinHeatGain when WinHeatGain < 0.0 @@ -472,6 +474,7 @@ namespace DataSurfaces { extern Array1D< Real64 > WinHeatLossRepEnergy; // Energy of WinHeatLossRep [J] extern Array1D< Real64 > WinShadingAbsorbedSolarEnergy; // Energy of WinShadingAbsorbedSolar [J] extern Array1D< Real64 > WinGapConvHtFlowRepEnergy; // Energy of WinGapConvHtFlowRep [J] + extern Array1D< Real64 > WinHeatTransferRepEnergy; // Energy of WinHeatTransfer [J] // SUBROUTINE SPECIFICATIONS FOR MODULE DataSurfaces: @@ -1038,7 +1041,6 @@ namespace DataSurfaces { Real64 ConvHeatFlowNatural; // Convective heat flow from gap between glass and interior shade or blind (W) Real64 ConvHeatGainToZoneAir; // Convective heat gain to zone air from window gap airflow (W) Real64 RetHeatGainToZoneAir; // Convective heat gain to return air sent to zone [W] - Real64 DividerConduction; // Conduction through divider from outside to inside face (W) Real64 OtherConvHeatGain; // other convective = total conv - standard model prediction for EQL window model (W) int BlindNumber; // Blind number for a window with a blind Array1D< Real64 > EffShBlindEmiss; // Effective emissivity of interior blind or shade @@ -1235,7 +1237,6 @@ namespace DataSurfaces { ConvHeatFlowNatural( 0.0 ), ConvHeatGainToZoneAir( 0.0 ), RetHeatGainToZoneAir( 0.0 ), - DividerConduction( 0.0 ), OtherConvHeatGain( 0.0 ), BlindNumber( 0 ), EffShBlindEmiss( MaxSlatAngs, 0.0 ), @@ -1340,7 +1341,7 @@ namespace DataSurfaces { ConvHeatFlowNatural = 0.0; ConvHeatGainToZoneAir = 0.0; RetHeatGainToZoneAir = 0.0; - DividerConduction = 0.0; + DividerHeatGain = 0.0; BlTsolBmBm = 0.0; BlTsolBmDif = 0.0; BlTsolDifDif = 0.0; diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index e202b5d252b..3cbf825ee3d 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -1912,7 +1912,7 @@ namespace HeatBalanceSurfaceManager { window.ConvHeatFlowNatural = 0.0; window.ConvHeatGainToZoneAir = 0.0; window.RetHeatGainToZoneAir = 0.0; - window.DividerConduction = 0.0; + window.DividerHeatGain = 0.0; window.BlTsolBmBm = 0.0; window.BlTsolBmDif = 0.0; window.BlTsolDifDif = 0.0; @@ -1951,6 +1951,7 @@ namespace HeatBalanceSurfaceManager { } WinHeatGain = 0.0; + WinHeatTransfer = 0.0; WinHeatGainRep = 0.0; WinHeatLossRep = 0.0; WinGainConvGlazToZoneRep = 0.0; @@ -1994,6 +1995,7 @@ namespace HeatBalanceSurfaceManager { WinHeatGainRepEnergy = 0.0; WinHeatLossRepEnergy = 0.0; WinGapConvHtFlowRepEnergy = 0.0; + WinHeatTransferRepEnergy = 0.0; ZoneWinHeatGainRepEnergy = 0.0; ZoneWinHeatLossRepEnergy = 0.0; ZnOpqSurfInsFaceCondGnRepEnrg = 0.0; @@ -5140,6 +5142,7 @@ CalcHeatBalanceInsideSurf( Optional_int_const ZoneToResimulate ) // if passed in if ( PartialResimulate ) { WinHeatGain( SurfNum ) = 0.0; + WinHeatTransfer( SurfNum ) = 0.0; WinHeatGainRep( SurfNum ) = 0.0; WinHeatLossRep( SurfNum ) = 0.0; WinGainConvGlazToZoneRep( SurfNum ) = 0.0; @@ -5202,6 +5205,7 @@ CalcHeatBalanceInsideSurf( Optional_int_const ZoneToResimulate ) // if passed in // CalcWindowHeatBalance. if ( ! PartialResimulate ) { WinHeatGain = 0.0; + WinHeatTransfer = 0.0; WinHeatGainRep = 0.0; WinHeatLossRep = 0.0; WinGainConvGlazToZoneRep = 0.0; @@ -5448,6 +5452,7 @@ CalcHeatBalanceInsideSurf( Optional_int_const ZoneToResimulate ) // if passed in // Calculate window heat gain for TDD:DIFFUSER since this calculation is usually done in WindowManager WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + HConvIn_surf * surface.Area * ( TempSurfIn( SurfNum ) - RefAirTemp( SurfNum ) ) + Construct( surface.Construction ).InsideAbsorpThermal * surface.Area * ( Sigma_Temp_4 - ( SurfaceWindow( SurfNum ).IRfromParentZone + QHTRadSysSurf( SurfNum ) + QHWBaseboardSurf( SurfNum ) + QSteamBaseboardSurf( SurfNum ) + QElecBaseboardSurf( SurfNum ) ) ) - QS( surface.Zone ) * surface.Area * Construct( surface.Construction ).TransDiff; // Transmitted solar | Convection | IR exchange | IR // Zone diffuse interior shortwave reflected back into the TDD + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); // fill out report vars for components of Window Heat Gain WinGainConvGlazToZoneRep( SurfNum ) = HConvIn_surf * surface.Area * ( TempSurfIn( SurfNum ) - RefAirTemp( SurfNum ) ); @@ -5460,6 +5465,7 @@ CalcHeatBalanceInsideSurf( Optional_int_const ZoneToResimulate ) // if passed in WinHeatLossRep( SurfNum ) = -WinHeatGain( SurfNum ); WinHeatLossRepEnergy( SurfNum ) = WinHeatLossRep( SurfNum ) * TimeStepZoneSec; } + WinHeatTransferRepEnergy( SurfNum ) = WinHeatGain( SurfNum ) * TimeStepZoneSec; TDDPipe( PipeNum ).HeatGain = WinHeatGainRep( SurfNum ); TDDPipe( PipeNum ).HeatLoss = WinHeatLossRep( SurfNum ); @@ -5528,6 +5534,8 @@ CalcHeatBalanceInsideSurf( Optional_int_const ZoneToResimulate ) // if passed in WinHeatLossRepEnergy( SurfNum ) = WinHeatLossRep( SurfNum ) * TimeStepZoneSec; } + WinHeatTransferRepEnergy( SurfNum ) = WinHeatGain( SurfNum ) * TimeStepZoneSec; + TempSurfIn( SurfNum ) = TempSurfInTmp( SurfNum ); } } diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index 235456d9b91..f7087b6c2c4 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -1043,7 +1043,7 @@ namespace RoomAirModelAirflowNetwork { if ( SurfaceWindow( SurfNum ).ShadingFlag == IntShadeOn || SurfaceWindow( SurfNum ).ShadingFlag == IntBlindOn ) { // The shade area covers the area of the glazing plus the area of the dividers. Area += SurfaceWindow( SurfNum ).DividerArea; - SumIntGain += SurfaceWindow( SurfNum ).DividerConduction; + SumIntGain += SurfaceWindow( SurfNum ).DividerHeatGain; } // Convective heat gain from natural convection in gap between glass and interior shade or blind @@ -1056,6 +1056,7 @@ namespace RoomAirModelAirflowNetwork { if ( Zone( ZoneNum ).NoHeatToReturnAir ) { SumIntGain += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; WinHeatGain( SurfNum ) += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; + WinHeatTransfer( SurfNum ) += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; if ( WinHeatGain( SurfNum ) >= 0.0 ) { WinHeatGainRep( SurfNum ) = WinHeatGain( SurfNum ); WinHeatGainRepEnergy( SurfNum ) = WinHeatGainRep( SurfNum ) * TimeStepZone * SecInHour; @@ -1063,6 +1064,8 @@ namespace RoomAirModelAirflowNetwork { WinHeatLossRep( SurfNum ) = -WinHeatGain( SurfNum ); WinHeatLossRepEnergy( SurfNum ) = WinHeatLossRep( SurfNum ) * TimeStepZone * SecInHour; } + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); + WinHeatTransferRepEnergy( SurfNum ) = WinHeatGain( SurfNum ) * TimeStepZone * SecInHour; } } diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index d25bc5e054a..6a7c62b5aea 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -450,6 +450,7 @@ namespace SolarShading { WinDifSolar = 0.0; WinDirSolTransAtIncAngle = 0.0; WinHeatGain = 0.0; + WinHeatTransfer = 0.0; WinHeatGainRep = 0.0; WinHeatLossRep = 0.0; WinGainConvGlazToZoneRep = 0.0; @@ -514,6 +515,7 @@ namespace SolarShading { WinHeatGainRepEnergy = 0.0; WinHeatLossRepEnergy = 0.0; WinGapConvHtFlowRepEnergy = 0.0; + WinHeatTransferRepEnergy = 0.0; WinShadingAbsorbedSolarEnergy = 0.0; ZoneTransSolarEnergy = 0.0; ZoneBmSolFrExtWinsRepEnergy = 0.0; @@ -779,6 +781,7 @@ namespace SolarShading { WinDifSolar.dimension( TotSurfaces, 0.0 ); WinDirSolTransAtIncAngle.dimension( TotSurfaces, 0.0 ); WinHeatGain.dimension( TotSurfaces, 0.0 ); + WinHeatTransfer.dimension( TotSurfaces, 0.0 ); WinHeatGainRep.dimension( TotSurfaces, 0.0 ); WinHeatLossRep.dimension( TotSurfaces, 0.0 ); WinGainConvGlazToZoneRep.dimension( TotSurfaces, 0.0 ); @@ -880,6 +883,7 @@ namespace SolarShading { WinHeatGainRepEnergy.dimension( TotSurfaces, 0.0 ); WinHeatLossRepEnergy.dimension( TotSurfaces, 0.0 ); WinGapConvHtFlowRepEnergy.dimension( TotSurfaces, 0.0 ); + WinHeatTransferRepEnergy.dimension( TotSurfaces, 0.0 ); ZoneTransSolarEnergy.dimension( NumOfZones, 0.0 ); ZoneBmSolFrExtWinsRepEnergy.dimension( NumOfZones, 0.0 ); ZoneBmSolFrIntWinsRepEnergy.dimension( NumOfZones, 0.0 ); @@ -1001,6 +1005,7 @@ namespace SolarShading { SetupOutputVariable( "Surface Window Heat Loss Rate [W]", WinHeatLossRep( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window Gap Convective Heat Transfer Rate [W]", WinGapConvHtFlowRep( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window Shading Device Absorbed Solar Radiation Rate [W]", WinShadingAbsorbedSolar( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); + SetupOutputVariable( "Surface Window Net Heat Transfer Rate [W]", WinHeatTransfer( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); if ( DisplayAdvancedReportVariables ) { // CurrentModuleObject='Windows/GlassDoors(Advanced)' @@ -1063,6 +1068,7 @@ namespace SolarShading { SetupOutputVariable( "Surface Window Heat Loss Energy [J]", WinHeatLossRepEnergy( SurfLoop ), "Zone", "Sum", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window Gap Convective Heat Transfer Energy [J]", WinGapConvHtFlowRepEnergy( SurfLoop ), "Zone", "Sum", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window Shading Device Absorbed Solar Radiation Energy [J]", WinShadingAbsorbedSolarEnergy( SurfLoop ), "Zone", "Sum", Surface( SurfLoop ).Name ); + SetupOutputVariable( "Surface Window Net Heat Transfer Energy [J]", WinHeatTransferRepEnergy( SurfLoop ), "Zone", "Sum", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window System Solar Transmittance []", WinSysSolTransmittance( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); SetupOutputVariable( "Surface Window System Solar Reflectance []", WinSysSolReflectance( SurfLoop ), "Zone", "Average", Surface( SurfLoop ).Name ); diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index b83da4f59b9..b233794f7f8 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -3770,6 +3770,7 @@ namespace WindowComplexManager { NetIRHeatGainGlass = ShadeArea * ( emis( 2 * ngllayer ) * TauShIR / ShGlReflFacIR ) * ( sigma * pow_4( theta( 2 * ngllayer ) ) - rmir ); ConvHeatGainFrZoneSideOfShade = ShadeArea * hcin * ( theta( nglfacep ) - tind ); WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + ConvHeatFlowNatural + ConvHeatGainFrZoneSideOfShade + NetIRHeatGainGlass + NetIRHeatGainShade; + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); // store components for reporting WinGainConvGlazShadGapToZoneRep( SurfNum ) = ConvHeatFlowNatural; // result is in [W] WinGainConvShadeToZoneRep( SurfNum ) = ConvHeatGainFrZoneSideOfShade; @@ -3781,6 +3782,7 @@ namespace WindowComplexManager { NetIRHeatGainGlass = Surface( SurfNum ).Area * emis( 2 * nlayer ) * ( sigma * pow_4( theta( 2 * nlayer ) ) - rmir ); ConvHeatGainFrZoneSideOfGlass = Surface( SurfNum ).Area * hcin * ( theta( 2 * nlayer ) - tind ); WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + ConvHeatGainFrZoneSideOfGlass + NetIRHeatGainGlass; + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); // store components for reporting WinGainConvGlazToZoneRep( SurfNum ) = ConvHeatGainFrZoneSideOfGlass; WinGainIRGlazToZoneRep( SurfNum ) = NetIRHeatGainGlass; @@ -3823,6 +3825,7 @@ namespace WindowComplexManager { if ( SurfaceWindow( SurfNum ).AirflowDestination == AirFlowWindow_Destination_IndoorAir ) { SurfaceWindow( SurfNum ).ConvHeatGainToZoneAir = ConvHeatGainToZoneAir; WinHeatGain( SurfNum ) += ConvHeatGainToZoneAir; + WinHeatTransfer( SurfNum ) += ConvHeatGainToZoneAir; } else { SurfaceWindow( SurfNum ).RetHeatGainToZoneAir = ConvHeatGainToZoneAir; } @@ -3851,6 +3854,7 @@ namespace WindowComplexManager { // Construct(ConstrNumSh)%TransDiff) //END IF WinHeatGain( SurfNum ) -= QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; + WinHeatTransfer( SurfNum ) -= QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; WinLossSWZoneToOutWinRep( SurfNum ) = QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; if ( ShadeFlag == IntShadeOn || ShadeFlag == ExtShadeOn ) { diff --git a/src/EnergyPlus/WindowEquivalentLayer.cc b/src/EnergyPlus/WindowEquivalentLayer.cc index 5fb808d17ee..7b9b2105733 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.cc +++ b/src/EnergyPlus/WindowEquivalentLayer.cc @@ -1001,6 +1001,7 @@ namespace WindowEquivalentLayer { ConvHeatGainWindow = Surface( SurfNum ).Area * HcIn * ( SurfInsideTemp - TaIn ); // Window heat gain (or loss) is calculated here WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + ConvHeatGainWindow + NetIRHeatGainWindow + ConvHeatFlowNatural; + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); SurfaceWindow( SurfNum ).ConvHeatFlowNatural = ConvHeatFlowNatural; // store for component reporting WinGainConvGlazShadGapToZoneRep( SurfNum ) = ConvHeatFlowNatural; diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 2fad955c088..55651a677af 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -3536,6 +3536,7 @@ namespace WindowManager { NetIRHeatGainGlass = ShadeArea * ( emis( 2 * ngllayer ) * TauShIR / ShGlReflFacIR ) * ( sigma * pow_4( thetas( 2 * ngllayer ) ) - Rmir ); ConvHeatGainFrZoneSideOfShade = ShadeArea * hcin * ( thetas( nglfacep ) - tin ); WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + ConvHeatFlowNatural + ConvHeatGainFrZoneSideOfShade + NetIRHeatGainGlass + NetIRHeatGainShade; + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); // store components for reporting WinGainConvGlazShadGapToZoneRep( SurfNum ) = ConvHeatFlowNatural; WinGainConvShadeToZoneRep( SurfNum ) = ConvHeatGainFrZoneSideOfShade; @@ -3547,6 +3548,7 @@ namespace WindowManager { NetIRHeatGainGlass = Surface( SurfNum ).Area * emis( 2 * ngllayer ) * ( sigma * pow_4( thetas( 2 * ngllayer ) ) - Rmir ); ConvHeatGainFrZoneSideOfGlass = Surface( SurfNum ).Area * hcin * ( thetas( 2 * ngllayer ) - tin ); WinHeatGain( SurfNum ) = WinTransSolar( SurfNum ) + ConvHeatGainFrZoneSideOfGlass + NetIRHeatGainGlass; + WinHeatTransfer( SurfNum ) = WinHeatGain( SurfNum ); // store components for reporting WinGainConvGlazToZoneRep( SurfNum ) = ConvHeatGainFrZoneSideOfGlass; WinGainIRGlazToZoneRep( SurfNum ) = NetIRHeatGainGlass; @@ -3579,6 +3581,7 @@ namespace WindowManager { if ( SurfaceWindow( SurfNum ).AirflowDestination == AirFlowWindow_Destination_IndoorAir ) { SurfaceWindow( SurfNum ).ConvHeatGainToZoneAir = ConvHeatGainToZoneAir; WinHeatGain( SurfNum ) += ConvHeatGainToZoneAir; + WinHeatTransfer( SurfNum ) += ConvHeatGainToZoneAir; } else { SurfaceWindow( SurfNum ).RetHeatGainToZoneAir = ConvHeatGainToZoneAir; } @@ -3607,6 +3610,7 @@ namespace WindowManager { TransDiff = InterpSw( SurfaceWindow( SurfNum ).SwitchingFactor, Construct( ConstrNum ).TransDiff, Construct( ConstrNumSh ).TransDiff ); } WinHeatGain( SurfNum ) -= QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; + WinHeatTransfer( SurfNum ) -= QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; // shouldn't this be + outward flowing fraction of absorbed SW? -- do not know whose comment this is? LKL (9/2012) WinLossSWZoneToOutWinRep( SurfNum ) = QS( Surface( SurfNum ).Zone ) * Surface( SurfNum ).Area * TransDiff; @@ -6193,12 +6197,11 @@ namespace WindowManager { int TotLayers; // Total number of layers in unshaded construction Real64 DivTempOut; // Outside surface divider temperature (K) Real64 FrameHeatGain; // Heat gain to zone from frame (W) + Real64 FrameHeatTransfer; // Heat tansfer through frame (W) Real64 ProjCorrWinHeatGain; // Inside projection correction to IR from divider to zone // for window heat gain calculation - Real64 DividerConduction; // Conduction through divider from outside to inside face (W) - Real64 DividerConvHeatGain; // Convective heat gain from divider to zone (W) - Real64 DividerRadHeatGain; // Convective IR radiative gain from divider to zone (W) - Real64 DividerHeatGain; // Heat gain from divider to zone (W) + Real64 DividerHeatGain; // Heat gain to zone from divider (W) + Real64 DividerHeatTransfer; // Heat transfer through divider (W) TInRad = root_4( SurfaceWindow( SurfNum ).IRfromParentZone / sigma ); TOutRad = root_4( Outir / sigma ); @@ -6209,7 +6212,7 @@ namespace WindowManager { EmisGlassOut = Material( Construct( ConstrNum ).LayerPoint( 1 ) ).AbsorpThermalFront; EmisGlassIn = Material( Construct( ConstrNum ).LayerPoint( TotLayers ) ).AbsorpThermalBack; FrameHeatGain = 0.0; - DividerConduction = 0.0; + DividerHeatGain = 0.0; SurfaceWindow( SurfNum ).FrameHeatGain = 0.0; SurfaceWindow( SurfNum ).FrameHeatLoss = 0.0; SurfaceWindow( SurfNum ).DividerHeatGain = 0.0; @@ -6224,7 +6227,7 @@ namespace WindowManager { TInRadFr = TInRad * root_4( ( 1.0 + 0.5 * ProjCorrFrIn ) / ( 1.0 + ProjCorrFrIn ) ); FrameCon = SurfaceWindow( SurfNum ).FrameConductance; HInRad = 0.5 * SurfaceWindow( SurfNum ).FrameEmis * sigma * pow_3( TInRadFr + SurfaceWindow( SurfNum ).FrameTempSurfIn + TKelvin ); - HInConvFr = 0.0; + HInConvFr = HInConv; HOutRad = 0.5 * SurfaceWindow( SurfNum ).FrameEmis * sigma * pow_3( TOutRadFr + SurfaceWindow( SurfNum ).FrameTempSurfOut + TKelvin ); HOutConvFr = HOutConv; if ( FrameDivider( FrDivNum ).FrameProjectionOut > 0.0 ) { @@ -6247,11 +6250,8 @@ namespace WindowManager { SurfaceWindow( SurfNum ).FrameTempSurfOut = Afac + Bfac * ( SurfaceWindow( SurfNum ).FrameTempSurfIn + TKelvin ) - TKelvin; // Heat gain to zone from frame - // FrameHeatGain = SurfaceWindow(SurfNum)%FrameArea * (1.0d0+SurfaceWindow(SurfNum)%ProjCorrFrIn) * & - // ( SurfaceWindow(SurfNum)%FrameEmis*(sigma*(SurfaceWindow(SurfNum)%FrameTempSurfIn+TKelvin)**4 - rmir) + & - // hcin*(SurfaceWindow(SurfNum)%FrameTempSurfIn+TKelvin - tin) ) - - FrameHeatGain = SurfaceWindow( SurfNum ).FrameArea * ( 1.0 + SurfaceWindow( SurfNum ).ProjCorrFrIn ) * ( hcin * ( SurfaceWindow( SurfNum ).FrameTempSurfIn + TKelvin - tin ) ); + FrameHeatTransfer = SurfaceWindow( SurfNum ).FrameArea * FrameCon * ( SurfaceWindow( SurfNum ).FrameTempSurfOut - SurfaceWindow( SurfNum ).FrameTempSurfIn ); + FrameHeatGain = SurfaceWindow( SurfNum ).FrameArea * ( 1.0 + SurfaceWindow( SurfNum ).ProjCorrFrIn ) * ( HInConvFr * ( SurfaceWindow( SurfNum ).FrameTempSurfIn + TKelvin - tin ) ); if ( FrameHeatGain > 0.0 ) { SurfaceWindow( SurfNum ).FrameHeatGain = FrameHeatGain; @@ -6260,6 +6260,7 @@ namespace WindowManager { } WinHeatGain( SurfNum ) += FrameHeatGain; + WinHeatTransfer( SurfNum ) += FrameHeatTransfer; WinGainFrameDividerToZoneRep( SurfNum ) = FrameHeatGain; } // End of check if window has a frame @@ -6310,23 +6311,23 @@ namespace WindowManager { SurfaceWindow( SurfNum ).DividerTempSurfOut = Afac + Bfac * ( SurfaceWindow( SurfNum ).DividerTempSurfIn + TKelvin ) - TKelvin; // Contribution of divider to window heat gain ProjCorrWinHeatGain = 1.0 + 2.0 * SurfaceWindow( SurfNum ).ProjCorrDivIn; - DividerConduction = SurfaceWindow( SurfNum ).DividerArea * DivCon * ( SurfaceWindow( SurfNum ).DividerTempSurfOut - SurfaceWindow( SurfNum ).DividerTempSurfIn ); - if ( DividerConduction > 0.0 ) { - SurfaceWindow( SurfNum ).DividerHeatGain = DividerConduction; + + DividerHeatGain = SurfaceWindow( SurfNum ).DividerArea * ( 1.0 + SurfaceWindow( SurfNum ).ProjCorrDivIn ) * ( HInConvDiv * ( SurfaceWindow( SurfNum ).DividerTempSurfIn + TKelvin - tin ) ); + DividerHeatTransfer = SurfaceWindow( SurfNum ).DividerArea * DivCon * ( SurfaceWindow( SurfNum ).DividerTempSurfOut - SurfaceWindow( SurfNum ).DividerTempSurfIn ); + + if ( DividerHeatGain > 0.0 ) { + SurfaceWindow( SurfNum ).DividerHeatGain = DividerHeatGain; } else { - SurfaceWindow( SurfNum ).DividerHeatLoss = std::abs( DividerConduction ); - } - WinHeatGain( SurfNum ) += DividerConduction; - WinGainFrameDividerToZoneRep( SurfNum ) += DividerConduction; - // The following three statements are for debugging purposes only - DividerConvHeatGain = SurfaceWindow( SurfNum ).DividerArea * HInConvDiv * ( SurfaceWindow( SurfNum ).DividerTempSurfIn + TKelvin - tin ); - DividerRadHeatGain = SurfaceWindow( SurfNum ).DividerArea * HInRad * ( SurfaceWindow( SurfNum ).DividerTempSurfIn + TKelvin - TInRadDiv ) - SurfaceWindow( SurfNum ).DividerArea * SurfaceWindow( SurfNum ).DividerQRadInAbs; - DividerHeatGain = DividerConvHeatGain + DividerRadHeatGain; + SurfaceWindow( SurfNum ).DividerHeatLoss = std::abs( DividerHeatGain ); + } + WinHeatGain( SurfNum ) += DividerHeatGain; + WinHeatTransfer( SurfNum ) += DividerHeatTransfer; + WinGainFrameDividerToZoneRep( SurfNum ) += DividerHeatGain; // If interior shade is present it is assumed that both the convective and IR radiative gain // from the inside surface of the divider goes directly into the zone air -- i.e., the IR radiative // interaction between divider and shade is ignored due to the difficulty of calculating this interaction // at the same time that the interaction between glass and shade is calculated. - if ( SurfaceWindow( SurfNum ).ShadingFlag == IntShadeOn || SurfaceWindow( SurfNum ).ShadingFlag == IntBlindOn ) SurfaceWindow( SurfNum ).DividerConduction = DividerConduction; + if ( SurfaceWindow( SurfNum ).ShadingFlag == IntShadeOn || SurfaceWindow( SurfNum ).ShadingFlag == IntBlindOn ) SurfaceWindow( SurfNum ).DividerHeatGain = DividerHeatGain; DivTempOut = SurfaceWindow( SurfNum ).DividerTempSurfOut + TKelvin; } // End of check if window has dividers diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 5a8865c27f9..731cd53b434 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -4954,7 +4954,7 @@ namespace ZoneTempPredictorCorrector { // from the inside surface of the divider goes directly into the zone air -- i.e., the IR radiative // interaction between divider and shade or blind is ignored due to the difficulty of calculating this interaction // at the same time that the interaction between glass and shade is calculated. - SumIntGain += SurfaceWindow( SurfNum ).DividerConduction; + SumIntGain += SurfaceWindow( SurfNum ).DividerHeatGain; } // Other convection term is applicable to equivalent layer window (ASHWAT) model @@ -4969,6 +4969,7 @@ namespace ZoneTempPredictorCorrector { if ( Zone( ZoneNum ).NoHeatToReturnAir ) { SumIntGain += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; WinHeatGain( SurfNum ) += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; + WinHeatTransfer( SurfNum ) += SurfaceWindow( SurfNum ).RetHeatGainToZoneAir; if ( WinHeatGain( SurfNum ) >= 0.0 ) { WinHeatGainRep( SurfNum ) = WinHeatGain( SurfNum ); WinHeatGainRepEnergy( SurfNum ) = WinHeatGainRep( SurfNum ) * TimeStepZoneSec; @@ -4976,6 +4977,7 @@ namespace ZoneTempPredictorCorrector { WinHeatLossRep( SurfNum ) = -WinHeatGain( SurfNum ); WinHeatLossRepEnergy( SurfNum ) = WinHeatLossRep( SurfNum ) * TimeStepZoneSec; } + WinHeatTransferRepEnergy( SurfNum ) = WinHeatTransfer( SurfNum ) * TimeStepZoneSec; } } @@ -5322,7 +5324,7 @@ namespace ZoneTempPredictorCorrector { // from the inside surface of the divider goes directly into the zone air -- i.e., the IR radiative // interaction between divider and shade or blind is ignored due to the difficulty of calculating this interaction // at the same time that the interaction between glass and shade is calculated. - SumIntGains += SurfaceWindow( SurfNum ).DividerConduction; + SumIntGains += SurfaceWindow( SurfNum ).DividerHeatGain; } // Other convection term is applicable to equivalent layer window (ASHWAT) model diff --git a/tst/EnergyPlus/unit/CMakeLists.txt b/tst/EnergyPlus/unit/CMakeLists.txt index ab616d389b3..7c9e28a5ef4 100644 --- a/tst/EnergyPlus/unit/CMakeLists.txt +++ b/tst/EnergyPlus/unit/CMakeLists.txt @@ -106,6 +106,7 @@ set( test_src WaterThermalTanks.unit.cc WaterToAirHeatPumpSimple.unit.cc WeatherManager.unit.cc + WindowManager.unit.cc XingGroundTemperatureModel.unit.cc ZoneEquipmentManager.unit.cc ZonePlenum.unit.cc diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc new file mode 100644 index 00000000000..6801fe909da --- /dev/null +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -0,0 +1,255 @@ +// EnergyPlus::WindowManager unit tests + +// C++ Headers +#include + +// Google Test Headers +#include + +// ObjexxFCL Headers +#include + +// EnergyPlus Headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Fixtures/EnergyPlusFixture.hh" + +using namespace EnergyPlus; + +TEST_F(EnergyPlusFixture, WindowFrameTest ) +{ + + bool ErrorsFound( false ); + + std::string const idf_objects = delimited_string({ + "Version,8.4;", + "Material,", + " Concrete Block, !- Name", + " MediumRough, !- Roughness", + " 0.1014984, !- Thickness {m}", + " 0.3805070, !- Conductivity {W/m-K}", + " 608.7016, !- Density {kg/m3}", + " 836.8000; !- Specific Heat {J/kg-K}", + "Construction,", + " WallConstruction, !- Name", + " Concrete Block; !- Outside Layer", + "WindowMaterial:SimpleGlazingSystem,", + " WindowMaterial, !- Name", + " 5.778, !- U-Factor {W/m2-K}", + " 0.819, !- Solar Heat Gain Coefficient", + " 0.881; !- Visible Transmittance", + "Construction,", + " WindowConstruction, !- Name", + " WindowMaterial; !- Outside Layer", + "WindowProperty:FrameAndDivider,", + " WindowFrame, !- Name", + " 0.05, !- Frame Width {m}", + " 0.00, !- Frame Outside Projection {m}", + " 0.00, !- Frame Inside Projection {m}", + " 5.0, !- Frame Conductance {W/m2-K}", + " 1.2, !- Ratio of Frame-Edge Glass Conductance to Center-Of-Glass Conductance", + " 0.8, !- Frame Solar Absorptance", + " 0.8, !- Frame Visible Absorptance", + " 0.9, !- Frame Thermal Hemispherical Emissivity", + " DividedLite, !- Divider Type", + " 0.02, !- Divider Width {m}", + " 2, !- Number of Horizontal Dividers", + " 2, !- Number of Vertical Dividers", + " 0.00, !- Divider Outside Projection {m}", + " 0.00, !- Divider Inside Projection {m}", + " 5.0, !- Divider Conductance {W/m2-K}", + " 1.2, !- Ratio of Divider-Edge Glass Conductance to Center-Of-Glass Conductance", + " 0.8, !- Divider Solar Absorptance", + " 0.8, !- Divider Visible Absorptance", + " 0.9; !- Divider Thermal Hemispherical Emissivity", + "FenestrationSurface:Detailed,", + " FenestrationSurface, !- Name", + " Window, !- Surface Type", + " WindowConstruction, !- Construction Name", + " Wall, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Shading Control Name", + " WindowFrame, !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 0.200000,0.000000,9.900000, !- X,Y,Z ==> Vertex 1 {m}", + " 0.200000,0.000000,0.1000000, !- X,Y,Z ==> Vertex 2 {m}", + " 9.900000,0.000000,0.1000000, !- X,Y,Z ==> Vertex 3 {m}", + " 9.900000,0.000000,9.900000; !- X,Y,Z ==> Vertex 4 {m}", + "BuildingSurface:Detailed," + " Wall, !- Name", + " Wall, !- Surface Type", + " WallConstruction, !- Construction Name", + " Zone, !- Zone Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0.000000,0.000000,10.00000, !- X,Y,Z ==> Vertex 1 {m}", + " 0.000000,0.000000,0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.00000,0.000000,0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.00000,0.000000,10.00000; !- X,Y,Z ==> Vertex 4 {m}", + "BuildingSurface:Detailed," + " Floor, !- Name", + " Floor, !- Surface Type", + " WallConstruction, !- Construction Name", + " Zone, !- Zone Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 1.0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0.000000,0.000000,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0.000000,10.000000,0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.00000,10.000000,0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.00000,0.000000,0; !- X,Y,Z ==> Vertex 4 {m}", + "Zone," + " Zone, !- Name", + " 0, !- Direction of Relative North {deg}", + " 6.000000, !- X Origin {m}", + " 6.000000, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " autocalculate; !- Volume {m3}" + }); + + + ASSERT_FALSE(process_idf(idf_objects)); + + DataHeatBalance::ZoneIntGain.allocate(1); + + createFacilityElectricPowerServiceObject(); + HeatBalanceManager::SetPreConstructionInputParameters(); + HeatBalanceManager::GetProjectControlData( ErrorsFound ); + HeatBalanceManager::GetFrameAndDividerData( ErrorsFound ); + HeatBalanceManager::GetMaterialData( ErrorsFound ); + HeatBalanceManager::GetConstructData( ErrorsFound ); + HeatBalanceManager::GetBuildingData( ErrorsFound ); + + Psychrometrics::InitializePsychRoutines(); + + DataGlobals::TimeStep = 1; + DataGlobals::TimeStepZone = 1; + DataGlobals::HourOfDay = 1; + DataGlobals::NumOfTimeStepInHour = 1; + DataGlobals::BeginSimFlag = true; + DataGlobals::BeginEnvrnFlag = true; + DataEnvironment::OutBaroPress = 100000; + + HeatBalanceManager::ManageHeatBalance(); + + // This test will emulate NFRC 100 U-factor test + int winNum; + + for (size_t i = 1; i <= DataSurfaces::Surface.size_; ++i) { + if (DataSurfaces::Surface( i ).Class == DataSurfaces::SurfaceClass_Window) { + winNum = i; + } + } + + int cNum; + + for (size_t i = 1; i <= DataHeatBalance::Construct.size_; ++i) { + if (DataHeatBalance::Construct( i ).TypeIsWindow) { + cNum = i; + } + } + + Real64 T_in = 21.0; + Real64 T_out = -18.0; + Real64 I_s = 0.0; + Real64 v_ws = 5.5; + + // Overrides for testing + DataHeatBalance::CosIncAng.dimension( 1, 1, 3, 1.0 ); + DataHeatBalance::SunlitFrac.dimension( 1, 1, 3, 1.0 ); + DataHeatBalance::SunlitFracWithoutReveal.dimension( 1, 1, 3, 1.0 ); + + DataSurfaces::Surface( winNum ).OutDryBulbTemp = T_out; + DataHeatBalance::TempEffBulkAir( winNum ) = T_in; + DataSurfaces::SurfaceWindow( winNum ).IRfromParentZone = DataGlobals::StefanBoltzmann*std::pow(T_in + DataGlobals::KelvinConv,4); + DataHeatBalFanSys::ZoneAirHumRatAvg.dimension(1, 0.01); + DataHeatBalFanSys::ZoneAirHumRat.dimension(1, 0.01); + DataHeatBalFanSys::MAT.dimension(1, T_in); + + // initial guess temperatures + int numTemps = 2 + 2*DataHeatBalance::Construct( cNum ).TotGlassLayers; + Real64 inSurfTemp = T_in - (1.0/(numTemps-1))*(T_in - T_out); + Real64 outSurfTemp = T_out + (1.0/(numTemps-1))*(T_in - T_out); + + Real64 h_exterior_f = 4 + v_ws*4; + Real64 h_exterior; + + DataEnvironment::BeamSolarRad = I_s; + + if ( I_s > 0.0 ) { + DataEnvironment::SunIsUp = true; + } + + HeatBalanceSurfaceManager::InitSolarHeatGains(); + SolarShading::CalcInteriorSolarDistribution(); + + // Calculate heat balance (iteratively solve for surface temperatures) + Real64 outSurfTempPrev = outSurfTemp; + Real64 inSurfTempPrev = inSurfTemp; + + Real64 outSurfTempDiff; + Real64 inSurfTempDiff; + + int maxIterations = 20; + Real64 tolerance = 0.1; // deg C + + // Save tilt information for natural convection calculations + Real64 tiltSave = DataSurfaces::Surface( winNum ).Tilt; + + for (int i = 0; i < maxIterations; i++) { + + // Use complementary angle for exterior natural convection calculations + DataSurfaces::Surface( 1 ).Tilt = 180 - tiltSave; + DataSurfaces::Surface( 1 ).CosTilt = cos(DataSurfaces::Surface( winNum ).Tilt*DataGlobals::Pi/180); + DataSurfaces::Surface( 1 ).SinTilt = sin(DataSurfaces::Surface( winNum ).Tilt*DataGlobals::Pi/180); + ConvectionCoefficients::CalcISO15099WindowIntConvCoeff( winNum, outSurfTemp, T_out); // This subroutine sets the global HConvIn( 1 ) variable. We will use it to set the exterior natural convection. + h_exterior = h_exterior_f + DataHeatBalance::HConvIn( winNum ); // add natural convection + + // revert tilt for interior natural convection calculations + DataSurfaces::Surface( 1 ).Tilt = tiltSave; + DataSurfaces::Surface( 1 ).CosTilt = cos(tiltSave*DataGlobals::Pi/180); + DataSurfaces::Surface( 1 ).SinTilt = sin(tiltSave*DataGlobals::Pi/180); + ConvectionCoefficients::CalcISO15099WindowIntConvCoeff( winNum, inSurfTemp, T_in); // This time it's actually being used as intended. HConvIn( 1 ) is referenced from the actual heat balance calculation. + + WindowManager::CalcWindowHeatBalance( winNum, h_exterior, inSurfTemp, outSurfTemp ); + + outSurfTempDiff = std::fabs(outSurfTemp - outSurfTempPrev); + inSurfTempDiff = std::fabs(inSurfTemp - inSurfTempPrev); + + if ( (outSurfTempDiff < tolerance) && (inSurfTempDiff < tolerance) ) { + break; + } + + outSurfTempPrev = outSurfTemp; + inSurfTempPrev = inSurfTemp; + + } + + EXPECT_GT(DataSurfaces::WinHeatLossRep( winNum ), DataSurfaces::WinHeatTransfer( winNum )); + +}