Skip to content

Commit

Permalink
moving constants to DataGlobalConstants
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 9, 2020
1 parent c8596fb commit 0ceaa6f
Show file tree
Hide file tree
Showing 134 changed files with 860 additions and 961 deletions.
6 changes: 3 additions & 3 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->HWLoopNum).FluidName,
DataGlobals::HWInitConvTemp,
DataGlobalConstants::HWInitConvTemp(),
DataPlant::PlantLoop(this->HWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand All @@ -831,7 +831,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->CWLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->CWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand All @@ -848,7 +848,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->CWLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->CWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

#ifndef TOKELVIN
#include "../../../DataGlobals.hh"
#define TOKELVIN(T) (T + DataGlobals::KelvinConv)
#define TOKELVIN(T) (T + DataGlobalConstants::KelvinConv())
#else
// Need a fallback
#endif
Expand Down
9 changes: 4 additions & 5 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ namespace AirflowNetwork {
using DataEnvironment::OutDryBulbTemp;
using DataEnvironment::OutHumRat;
using DataEnvironment::StdBaroPress;
using DataGlobals::KelvinConv;
using DataSurfaces::Surface;

//std::vector<AirProperties> properties;
Expand Down Expand Up @@ -1110,11 +1109,11 @@ namespace AirflowNetwork {
if (LFLAG) {
// Initialization by linear relation.
if (PDROP >= 0.0) {
RhoCor = (propN.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propN.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propN.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
DF[0] = coef * propN.density / propN.viscosity * Ctl;
} else {
RhoCor = (propM.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propM.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propM.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
DF[0] = coef * propM.density / propM.viscosity * Ctl;
}
Expand All @@ -1124,7 +1123,7 @@ namespace AirflowNetwork {
if (PDROP >= 0.0) {
// Flow in positive direction.
// Laminar flow.
RhoCor = (propN.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propN.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propN.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
CDM = coef * propN.density / propN.viscosity * Ctl;
FL = CDM * PDROP;
Expand All @@ -1137,7 +1136,7 @@ namespace AirflowNetwork {
} else {
// Flow in negative direction.
// Laminar flow.
RhoCor = (propM.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propM.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propM.density / RhoCor, 2.0 * expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
CDM = coef * propM.density / propM.viscosity * Ctl;
FL = CDM * PDROP;
Expand Down
20 changes: 8 additions & 12 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6598,8 +6598,6 @@ namespace AirflowNetworkBalanceManager {
// ASTM C1340

using DataEnvironment::WindSpeed;
using DataGlobals::KelvinConv;

Real64 k = airThermConductivity(Ts);

Real64 hOut_final = 0;
Expand All @@ -6609,7 +6607,7 @@ namespace AirflowNetworkBalanceManager {
// Free convection
Real64 Pr = airPrandtl((Ts + Tamb) / 2, Wamb, Pamb);
Real64 KinVisc = airKinematicVisc((Ts + Tamb) / 2, Wamb, Pamb);
Real64 Beta = 2.0 / ((Tamb + KelvinConv) + (Ts + KelvinConv));
Real64 Beta = 2.0 / ((Tamb + DataGlobalConstants::KelvinConv()) + (Ts + DataGlobalConstants::KelvinConv()));
Real64 Gr = DataGlobalConstants::GravityConstant() * Beta * std::abs(Ts - Tamb) * pow_3(Dh) / pow_2(KinVisc);
Real64 Ra = Gr * Pr;
Real64 Nu_free(0);
Expand Down Expand Up @@ -6681,8 +6679,6 @@ namespace AirflowNetworkBalanceManager {
// USE STATEMENTS:
using DataEnvironment::OutBaroPress;
using DataEnvironment::OutHumRat;
using DataGlobals::KelvinConv;
using DataGlobals::StefanBoltzmann;
using DataHeatBalFanSys::QRadSurfAFNDuct;
using DataHeatBalSurface::TH;
using DataHVACGlobals::TimeStepSys;
Expand Down Expand Up @@ -6771,10 +6767,10 @@ namespace AirflowNetworkBalanceManager {
Real64 UThermal(10); // Initialize. This will get updated.
Real64 UThermal_iter = 0;
Real64 Tsurr = Tamb;
Real64 Tsurr_K = Tsurr + KelvinConv;
Real64 Tsurr_K = Tsurr + DataGlobalConstants::KelvinConv();
Real64 Tin = AirflowNetworkNodeSimu(LF).TZ;
Real64 TDuctSurf = (Tamb + Tin) / 2.0;
Real64 TDuctSurf_K = TDuctSurf + KelvinConv;
Real64 TDuctSurf_K = TDuctSurf + DataGlobalConstants::KelvinConv();
Real64 DuctSurfArea = DisSysCompDuctData(TypeNum).L * DisSysCompDuctData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi();

// If user defined view factors not present, calculate air-to-air heat transfer
Expand Down Expand Up @@ -6866,7 +6862,7 @@ namespace AirflowNetworkBalanceManager {
int ZoneSurfNum = VFObj.LinkageSurfaceData(j).SurfaceNum;

Real64 TSurfj = TH(1, 1, ZoneSurfNum);
Real64 TSurfj_K = TSurfj + KelvinConv;
Real64 TSurfj_K = TSurfj + DataGlobalConstants::KelvinConv();

Real64 ZoneSurfEmissivity = state.dataConstruction->Construct(Surface(ZoneSurfNum).Construction).InsideAbsorpThermal;
Real64 ZoneSurfArea = Surface(ZoneSurfNum).Area;
Expand All @@ -6880,7 +6876,7 @@ namespace AirflowNetworkBalanceManager {
Real64 ZoneSurfResistance = (1 - ZoneSurfEmissivity) / (ZoneSurfArea * ZoneSurfEmissivity);

VFObj.LinkageSurfaceData(j).SurfaceResistanceFactor =
StefanBoltzmann / (DuctSurfResistance + SpaceResistance + ZoneSurfResistance);
DataGlobalConstants::StefanBoltzmann() / (DuctSurfResistance + SpaceResistance + ZoneSurfResistance);

Real64 hrj = VFObj.LinkageSurfaceData(j).SurfaceResistanceFactor * (TDuctSurf_K + TSurfj_K) *
(pow_2(TDuctSurf_K) + pow_2(TSurfj_K)) / DuctSurfArea;
Expand All @@ -6890,7 +6886,7 @@ namespace AirflowNetworkBalanceManager {
}

Tsurr = (hOut * Tamb + hrjTj_sum) / (hOut + hrj_sum); // Surroundings temperature [C]
Tsurr_K = Tsurr + KelvinConv;
Tsurr_K = Tsurr + DataGlobalConstants::KelvinConv();

Real64 RThermTotal = RThermConvIn + RThermConduct + 1 / (hOut + hrj_sum);
UThermal = pow(RThermTotal, -1);
Expand All @@ -6899,13 +6895,13 @@ namespace AirflowNetworkBalanceManager {
Tin_ave = Tsurr + (Tin - Tsurr) * (1 / NTU) * (1 - exp(-NTU));

TDuctSurf = Tin_ave - UThermal * (RThermConvIn + RThermConduct) * (Tin_ave - Tsurr);
TDuctSurf_K = TDuctSurf + KelvinConv;
TDuctSurf_K = TDuctSurf + DataGlobalConstants::KelvinConv();
}

for (int j = 1; j <= VFObj.LinkageSurfaceData.u(); ++j) {
int ZoneSurfNum = VFObj.LinkageSurfaceData(j).SurfaceNum;
Real64 TSurfj = TH(1, 1, ZoneSurfNum);
Real64 TSurfj_K = TSurfj + KelvinConv;
Real64 TSurfj_K = TSurfj + DataGlobalConstants::KelvinConv();
VFObj.LinkageSurfaceData(j).SurfaceRadLoad = VFObj.LinkageSurfaceData(j).SurfaceResistanceFactor *
(pow_4(TDuctSurf_K) - pow_4(TSurfj_K)); // Radiant load for this surface [W]
int SurfNum = VFObj.LinkageSurfaceData(j).SurfaceNum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ Real64 CoolingWaterDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _or
if (this->termUnitIU) {
Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
Real64 rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
Real64 DesCoilLoad = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizCoolDeltaT * Cp * rho;
Expand Down
12 changes: 6 additions & 6 deletions src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue,
this->dataWaterCoilSizCoolDeltaT > 0.0) {
Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
Real64 rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
this->autoSizedValue = DesCoilLoad / (CoilDesWaterDeltaT * Cp * rho);
Expand All @@ -122,12 +122,12 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue,
if (this->dataWaterLoopNum > 0 && this->dataWaterLoopNum <= (int)DataPlant::PlantLoop.size() && CoilDesWaterDeltaT > 0.0) {
Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
Real64 rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->dataWaterLoopNum).FluidIndex,
this->callingRoutine);
this->autoSizedValue = this->dataCapacityUsedForSizing / (CoilDesWaterDeltaT * Cp * rho);
Expand Down Expand Up @@ -168,8 +168,8 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue,
coilSelectionReportObj->setCoilEntWaterTemp(this->compName, this->compType, this->dataDesInletWaterTemp);
coilSelectionReportObj->setCoilLvgWaterTemp(this->compName, this->compType, this->dataDesInletWaterTemp + CoilDesWaterDeltaT);
} else {
coilSelectionReportObj->setCoilEntWaterTemp(this->compName, this->compType, DataGlobals::CWInitConvTemp);
coilSelectionReportObj->setCoilLvgWaterTemp(this->compName, this->compType, DataGlobals::CWInitConvTemp + CoilDesWaterDeltaT);
coilSelectionReportObj->setCoilEntWaterTemp(this->compName, this->compType, DataGlobalConstants::CWInitConvTemp());
coilSelectionReportObj->setCoilLvgWaterTemp(this->compName, this->compType, DataGlobalConstants::CWInitConvTemp() + CoilDesWaterDeltaT);
}
}
return this->autoSizedValue;
Expand Down
Loading

5 comments on commit 0ceaa6f

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataGlobals_2_again (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2983 of 2984 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 718
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataGlobals_2_again (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3023 of 3024 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 721
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataGlobals_2_again (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1548 of 1548 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataGlobals_2_again (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2240 of 2240 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataGlobals_2_again (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 722 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 721
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.