Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global DataGlobals: Part 2 #8342

Merged
merged 19 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
18 changes: 7 additions & 11 deletions src/EnergyPlus/AirflowNetwork/src/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,6 @@ namespace AirflowNetwork {
// Lawrence Berkeley National Laboratory, Berkeley, CA, May 1990

// USE STATEMENTS:
using DataGlobals::PiOvr2;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:

Expand Down Expand Up @@ -1958,7 +1956,7 @@ namespace AirflowNetwork {
DpZeroOffset = DifLim * 1e-3;
// New definition for opening factors for LVO type 2: opening angle = 90 degrees --> opening factor = 1.0
// should be PIOvr2 in below?
alpha = Fact * PiOvr2;
alpha = Fact * DataGlobalConstants::PiOvr2();
Real64 const cos_alpha(std::cos(alpha));
Real64 const tan_alpha(std::tan(alpha));
h2 = Axishght * (1.0 - cos_alpha);
Expand Down Expand Up @@ -2500,7 +2498,7 @@ namespace AirflowNetwork {
// ed = Rough / DisSysCompCoilData(CompNum).hydraulicDiameter;
ed = Rough / hydraulicDiameter;

area = square(hydraulicDiameter) * DataGlobals::Pi;
area = square(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2658,7 +2656,7 @@ namespace AirflowNetwork {
// ed = Rough / DisSysCompCoilData(CompNum).hydraulicDiameter;
ed = Rough / hydraulicDiameter;

area = square(hydraulicDiameter) * DataGlobals::Pi;
area = square(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2810,7 +2808,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2975,7 +2973,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -3121,7 +3119,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -3475,8 +3473,6 @@ namespace AirflowNetwork {
// NISTIR 89-4052, National Institute of Standards and Technology, Gaithersburg, MD

// USE STATEMENTS:
using DataGlobals::Pi;

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 RhozAver;
Real64 expn;
Expand Down Expand Up @@ -3509,7 +3505,7 @@ namespace AirflowNetwork {
// Slope = MultizoneCompHorOpeningData(CompNum).Slope;
// DischCoeff = MultizoneCompHorOpeningData(CompNum).DischCoeff;
Cshape = 0.942 * Width / Height;
OpenArea = Width * Height * Fact * std::sin(Slope * Pi / 180.0) * (1.0 + std::cos(Slope * Pi / 180.0));
OpenArea = Width * Height * Fact * std::sin(Slope * DataGlobalConstants::Pi() / 180.0) * (1.0 + std::cos(Slope * DataGlobalConstants::Pi() / 180.0));
DH = 4.0 * (Width * Height) / 2.0 / (Width + Height) * Fact;

// Check which zone is higher
Expand Down
20 changes: 7 additions & 13 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ namespace AirflowNetwork {
using DataEnvironment::OutDryBulbTemp;
using DataEnvironment::OutHumRat;
using DataEnvironment::StdBaroPress;
using DataGlobals::DegToRadians;
using DataGlobals::KelvinConv;
using DataGlobals::Pi;
using DataGlobals::rTinyValue;
using DataSurfaces::Surface;

//std::vector<AirProperties> properties;
Expand Down Expand Up @@ -787,7 +783,7 @@ namespace AirflowNetwork {
C = CCF(n) * CEF(n);
} else {
// IF (CCF(N) .EQ. 0.0d0) CCF(N)=TINY(CCF(N)) ! 1.0E-40
if (CCF(n) == 0.0) CCF(n) = rTinyValue; // 1.0E-40 (Epsilon)
if (CCF(n) == 0.0) CCF(n) = DataGlobalConstants::rTinyValue(); // 1.0E-40 (Epsilon)
PCF(n) = CCF(n);
C = CCF(n);
}
Expand Down Expand Up @@ -1113,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 @@ -1127,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 @@ -1140,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 Expand Up @@ -1214,7 +1210,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
Real64 ed = Rough / Diameter;
Real64 area = Diameter * Diameter * Pi / 4.0;
Real64 area = Diameter * Diameter * DataGlobalConstants::Pi() / 4.0;
Real64 ld = Length / Diameter;
Real64 g = 1.14 - 0.868589 * std::log(ed);
Real64 AA1 = g;
Expand Down Expand Up @@ -1966,8 +1962,6 @@ namespace AirflowNetwork {
// Lawrence Berkeley National Laboratory, Berkeley, CA, May 1990

// USE STATEMENTS:
using DataGlobals::Pi;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// na
Expand Down Expand Up @@ -2039,7 +2033,7 @@ namespace AirflowNetwork {
// FLOW:
RhoREF = AIRDENSITY(PSea, OutDryBulbTemp, OutHumRat);

CONV = Latitude * 2.0 * Pi / 360.0;
CONV = Latitude * 2.0 * DataGlobalConstants::Pi() / 360.0;
G = 9.780373 * (1.0 + 0.0052891 * pow_2(std::sin(CONV)) - 0.0000059 * pow_2(std::sin(2.0 * CONV)));

Hfl = 1.0;
Expand Down
Loading