Skip to content

Commit

Permalink
move extern'd dataConstruction to state
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 6, 2020
1 parent 7072843 commit 86ba9a5
Show file tree
Hide file tree
Showing 88 changed files with 2,809 additions and 2,761 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6872,7 +6872,7 @@ namespace AirflowNetworkBalanceManager {
Real64 TSurfj = TH(1, 1, ZoneSurfNum);
Real64 TSurfj_K = TSurfj + KelvinConv;

Real64 ZoneSurfEmissivity = dataConstruction.Construct(Surface(ZoneSurfNum).Construction).InsideAbsorpThermal;
Real64 ZoneSurfEmissivity = state.dataConstruction->Construct(Surface(ZoneSurfNum).Construction).InsideAbsorpThermal;
Real64 ZoneSurfArea = Surface(ZoneSurfNum).Area;

Real64 DuctEmissivity = VFObj.DuctEmittance;
Expand Down
6 changes: 2 additions & 4 deletions src/EnergyPlus/Construction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@

namespace EnergyPlus {

ConstructionData dataConstruction;

namespace Construction {

void ConstructionProps::calculateTransferFunction(bool & ErrorsFound, bool & DoCTFErrorReport) {
void ConstructionProps::calculateTransferFunction(EnergyPlusData &state, bool & ErrorsFound, bool & DoCTFErrorReport) {

// SUBROUTINE INFORMATION:
// AUTHOR Russ Taylor
Expand Down Expand Up @@ -410,7 +408,7 @@ namespace Construction {
// previously this loop would go from 1..currentConstructionIndex-1
// instead of that, we'll loop through the list and stop when we get to the current construction
// should be the same behavior, we're just checking it by address
for (auto & otherConstruction : dataConstruction.Construct) {
for (auto & otherConstruction : state.dataConstruction->Construct) {
if (&otherConstruction == this) break;

// If a source or sink is present in this construction, do not allow any
Expand Down
5 changes: 1 addition & 4 deletions src/EnergyPlus/Construction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ namespace EnergyPlus {

// Forward declarations
struct EnergyPlusData;
struct ConstructionData;

namespace Construction {

Expand Down Expand Up @@ -312,7 +311,7 @@ namespace Construction {
s0.allocate(3, 4);
}

void calculateTransferFunction(bool & ErrorsFound, bool & DoCTFErrorReport);
void calculateTransferFunction(EnergyPlusData &state, bool & ErrorsFound, bool & DoCTFErrorReport);

void calculateExponentialMatrix(); // Time step of the resulting CTFs

Expand Down Expand Up @@ -341,8 +340,6 @@ namespace Construction {
}
};

extern ConstructionData dataConstruction;

} // namespace EnergyPlus

#endif
66 changes: 35 additions & 31 deletions src/EnergyPlus/ConvectionCoefficients.cc

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/EnergyPlus/ConvectionCoefficients.hh
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ namespace ConvectionCoefficients {

void GetUserConvectionCoefficients(EnergyPlusData &state);

void ApplyConvectionValue(std::string const &SurfaceTypes, std::string const &ConvectionType, int Value);
void ApplyConvectionValue(EnergyPlusData &state, std::string const &SurfaceTypes, std::string const &ConvectionType, int Value);

Real64 CalcASHRAESimpExtConvectCoeff(int Roughness, // Integer index for roughness, relates to parameter array indices
Real64 SurfWindSpeed // Current wind speed, m/s
Expand Down Expand Up @@ -485,20 +485,22 @@ namespace ConvectionCoefficients {

Real64 CalcCeilingDiffuserACH(int ZoneNum);

Real64 CalcCeilingDiffuserIntConvCoeff(Real64 ACH, // [1/hr] air system air change rate
Real64 CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state,
Real64 ACH, // [1/hr] air system air change rate
Real64 Tsurf,
Real64 Tair,
Real64 cosTilt,
Real64 humRat,
Real64 height,
bool isWindow=false);

void CalcCeilingDiffuserIntConvCoeff(int ZoneNum, const Array1D<Real64> &SurfaceTemperatures); // zone number for which coefficients are being calculated
void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state, int ZoneNum, const Array1D<Real64> &SurfaceTemperatures); // zone number for which coefficients are being calculated

// CalcCeilingDiffuserInletCorr should replace CalcCeilingDiffuser (above), if ZoneTempPredictorCorrector can
// ever be made to work correctly with the inlet air temperature.

void CalcCeilingDiffuserInletCorr(int ZoneNum, // Zone number
void CalcCeilingDiffuserInletCorr(EnergyPlusData &state,
int ZoneNum, // Zone number
Array1D<Real64> &SurfaceTemperatures // For CalcASHRAEDetailed, if called
);

Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/CostEstimateManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ namespace CostEstimateManager {
}

ThisConstructStr = state.dataCostEstimateManager->CostLineItem(Item).ParentObjName;
ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, dataConstruction.Construct);
ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, state.dataConstruction->Construct);
if (ThisConstructID == 0) { // do any surfaces have the specified construction? If not issue warning.
ShowWarningError("ComponentCost:LineItem: \"" + state.dataCostEstimateManager->CostLineItem(Item).LineName + "\" Construction=\"" +
state.dataCostEstimateManager->CostLineItem(Item).ParentObjName + "\", no surfaces have the Construction specified");
Expand Down Expand Up @@ -540,7 +540,7 @@ namespace CostEstimateManager {
} else if (SELECT_CASE_var == "CONSTRUCTION") {

ThisConstructStr = state.dataCostEstimateManager->CostLineItem(Item).ParentObjName;
ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, dataConstruction.Construct);
ThisConstructID = UtilityRoutines::FindItem(ThisConstructStr, state.dataConstruction->Construct);
// need to determine unique surfacs... some surfaces are shared by zones and hence doubled
uniqueSurfMask.dimension(TotSurfaces, true); // init to true and change duplicates to false
SurfMultipleARR.dimension(TotSurfaces, 1.0);
Expand Down
20 changes: 10 additions & 10 deletions src/EnergyPlus/DElightManagerF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace DElightManagerF {
// Is this Surface exposed to the exterior?
if (surf.ExtSolar) {
// Get the index for the outside (i.e., 1st) Material Layer for this Construction
iMatlLayer = dataConstruction.Construct(iconstruct).LayerPoint(1);
iMatlLayer = state.dataConstruction->Construct(iconstruct).LayerPoint(1);
// Get the outside visible reflectance of this material layer
// (since Construct(iconstruct)%ReflectVisDiffFront always appears to == 0.0)
rExtVisRefl = 1.0 - dataMaterial.Material(iMatlLayer).AbsorpVisible;
Expand All @@ -349,7 +349,7 @@ namespace DElightManagerF {
cNameWOBlanks,
surf.Azimuth,
surf.Tilt,
dataConstruction.Construct(iconstruct).ReflectVisDiffBack,
state.dataConstruction->Construct(iconstruct).ReflectVisDiffBack,
rExtVisRefl,
surf.Sides);

Expand Down Expand Up @@ -650,14 +650,14 @@ namespace DElightManagerF {
print(delightInFile,
Format_921,
iWndoConstIndexes(iconst) + 10000,
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransDiffVis,
dataConstruction.Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack,
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1),
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2),
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3),
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4),
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5),
dataConstruction.Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6));
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransDiffVis,
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack,
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1),
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2),
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3),
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4),
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5),
state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6));

} // Glass Type loop

Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/Data/CommonIncludes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <EnergyPlus/ChillerIndirectAbsorption.hh>
#include <EnergyPlus/ChillerReformulatedEIR.hh>
#include <EnergyPlus/CondenserLoopTowers.hh>
#include <EnergyPlus/Construction.hh>
#include <EnergyPlus/ConvectionCoefficients.hh>
#include <EnergyPlus/CoolTower.hh>
#include <EnergyPlus/CostEstimateManager.hh>
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace EnergyPlus {
this->dataChillerIndirectAbsorption = std::unique_ptr<ChillerIndirectAbsoprtionData>(new ChillerIndirectAbsoprtionData);
this->dataChillerReformulatedEIR = std::unique_ptr<ChillerReformulatedEIRData>(new ChillerReformulatedEIRData);
this->dataCondenserLoopTowers = std::unique_ptr<CondenserLoopTowersData>(new CondenserLoopTowersData);
this->dataConstruction = std::unique_ptr<ConstructionData>(new ConstructionData);
this->dataConvectionCoefficient = std::unique_ptr<ConvectionCoefficientsData>(new ConvectionCoefficientsData);
this->dataCoolTower = std::unique_ptr<CoolTowerData>(new CoolTowerData);
this->dataCostEstimateManager = std::unique_ptr<CostEstimateManagerData>(new CostEstimateManagerData);
Expand Down Expand Up @@ -120,6 +121,7 @@ namespace EnergyPlus {
this->dataChillerIndirectAbsorption->clear_state();
this->dataChillerReformulatedEIR->clear_state();
this->dataCondenserLoopTowers->clear_state();
this->dataConstruction->clear_state();
this->dataConvectionCoefficient->clear_state();
this->dataCoolTower->clear_state();
this->dataCostEstimateManager->clear_state();
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ChillerGasAbsorptionData;
struct ChillerIndirectAbsoprtionData;
struct ChillerReformulatedEIRData;
struct CondenserLoopTowersData;
struct ConstructionData;
struct ConvectionCoefficientsData;
struct CoolTowerData;
struct CostEstimateManagerData;
Expand Down Expand Up @@ -131,6 +132,7 @@ struct EnergyPlusData : BaseGlobalStruct {
std::unique_ptr<ChillerIndirectAbsoprtionData> dataChillerIndirectAbsorption;
std::unique_ptr<ChillerReformulatedEIRData> dataChillerReformulatedEIR;
std::unique_ptr<CondenserLoopTowersData> dataCondenserLoopTowers;
std::unique_ptr<ConstructionData> dataConstruction;
std::unique_ptr<ConvectionCoefficientsData> dataConvectionCoefficient;
std::unique_ptr<CoolTowerData> dataCoolTower;
std::unique_ptr<CostEstimateManagerData> dataCostEstimateManager;
Expand Down
Loading

4 comments on commit 86ba9a5

@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_dataConstruction (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-2
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (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-2b
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (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-2
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (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.