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

Grounding EnergyPlus (removing the static), Cont'd #8649

Merged
merged 18 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -961,12 +961,10 @@ namespace AirLoopHVACDOAS {

int const summerDesignDayTypeIndex(9);
int const winterDesignDayTypeIndex(10);
bool static SummerDesignDayFlag = true;
bool static WinterDesignDayFlag = true;

for (size_t i = 1; i <= state.dataWeatherManager->DesDayInput.size(); i++) {
// Summer design day
if (state.dataWeatherManager->DesDayInput(i).DayType == summerDesignDayTypeIndex && SummerDesignDayFlag) {
if (state.dataWeatherManager->DesDayInput(i).DayType == summerDesignDayTypeIndex && state.dataAirLoopHVACDOAS->SummerDesignDayFlag) {
this->SizingCoolOATemp = state.dataWeatherManager->DesDayInput(i).MaxDryBulb;
if (state.dataWeatherManager->DesDayInput(i).HumIndType == WeatherManager::DDHumIndType::WetBulb) { // wet bulb temperature
this->SizingCoolOAHumRat =
Expand All @@ -976,10 +974,10 @@ namespace AirLoopHVACDOAS {
} else if (state.dataWeatherManager->DesDayInput(i).HumIndType == WeatherManager::DDHumIndType::HumRatio) {
this->SizingCoolOAHumRat = state.dataWeatherManager->DesDayInput(i).HumIndValue;
} // else { // What about other cases?
SummerDesignDayFlag = false;
state.dataAirLoopHVACDOAS->SummerDesignDayFlag = false;
}
// Winter design day
if (state.dataWeatherManager->DesDayInput(i).DayType == winterDesignDayTypeIndex && WinterDesignDayFlag) {
if (state.dataWeatherManager->DesDayInput(i).DayType == winterDesignDayTypeIndex && state.dataAirLoopHVACDOAS->WinterDesignDayFlag) {
this->HeatOutTemp = state.dataWeatherManager->DesDayInput(i).MaxDryBulb;
if (state.dataWeatherManager->DesDayInput(i).HumIndType == WeatherManager::DDHumIndType::WetBulb) { // wet bulb temperature
this->HeatOutHumRat =
Expand All @@ -989,7 +987,7 @@ namespace AirLoopHVACDOAS {
} else if (state.dataWeatherManager->DesDayInput(i).HumIndType == WeatherManager::DDHumIndType::HumRatio) {
this->HeatOutHumRat = state.dataWeatherManager->DesDayInput(i).HumIndValue;
} // else { // What about other cases?
WinterDesignDayFlag = false;
state.dataAirLoopHVACDOAS->WinterDesignDayFlag = false;
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/EnergyPlus/AirLoopHVACDOAS.hh
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ namespace AirLoopHVACDOAS {
std::vector<AirLoopHVACDOAS::AirLoopDOAS> airloopDOAS;
std::vector<AirLoopHVACDOAS::AirLoopMixer> airloopMixer;
std::vector<AirLoopHVACDOAS::AirLoopSplitter> airloopSplitter;

bool SummerDesignDayFlag = true;
bool WinterDesignDayFlag = true;
void clear_state() override
{
this->GetInputOnceFlag = true;
Expand All @@ -226,6 +227,8 @@ namespace AirLoopHVACDOAS {
this->airloopDOAS.clear();
this->airloopMixer.clear();
this->airloopSplitter.clear();
this->SummerDesignDayFlag = true;
this->WinterDesignDayFlag = true;
}
};

Expand Down
155 changes: 71 additions & 84 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion src/EnergyPlus/AirflowNetworkBalanceManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,21 @@ namespace AirflowNetworkBalanceManager {
Array1D<AirflowNetwork::AirflowNetworkNodeReportData> nodeReport;
Array1D<AirflowNetwork::AirflowNetworkLinkReportData> linkReport1;

// used to be statics
int ErrCountVar = 0;
int ErrCountHighPre = 0;
int ErrCountLowPre = 0;
int ErrIndexHighPre = 0;
int ErrIndexVar = 0;
int ErrIndexLowPre = 0;
Array1D<bool> onceZoneFlag;
Array1D<bool> onceSurfFlag;
bool onetime = false;
int HybridGlobalErrIndex = 0;
int HybridGlobalErrCount = 0;
int AFNNumOfExtOpenings = 0; // Total number of external openings in the model
int OpenNuminZone = 0; // Counts which opening this is in the zone, 1 or 2

void clear_state() override
{
this->OccupantVentilationControl.deallocate();
Expand Down Expand Up @@ -366,7 +381,19 @@ namespace AirflowNetworkBalanceManager {
this->linkReport.deallocate();
this->nodeReport.deallocate();
this->linkReport1.deallocate();

this->ErrCountVar = 0;
this->ErrCountHighPre = 0;
this->ErrCountLowPre = 0;
this->ErrIndexHighPre = 0;
this->ErrIndexVar = 0;
this->ErrIndexLowPre = 0;
this->onceZoneFlag.clear();
this->onceSurfFlag.clear();
this->onetime = false;
this->HybridGlobalErrIndex = 0;
this->HybridGlobalErrCount = 0;
this->AFNNumOfExtOpenings = 0;
this->OpenNuminZone = 0;
solver.clear();
}
};
Expand Down
5 changes: 2 additions & 3 deletions src/EnergyPlus/BaseboardElectric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,14 @@ namespace BaseboardElectric {
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int ZoneNode;
int Loop;
static Array1D_bool MyEnvrnFlag;

auto & baseboard = state.dataBaseboardElectric;

// Do the one time initializations
if (baseboard->MyOneTimeFlag) {
// initialize the environment and sizing flags
MyEnvrnFlag.allocate(baseboard->NumBaseboards);
MyEnvrnFlag = true;
state.dataBaseboardElectric->MyEnvrnFlag.allocate(baseboard->NumBaseboards);
state.dataBaseboardElectric->MyEnvrnFlag = true;

baseboard->MyOneTimeFlag = false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/BaseboardElectric.hh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ namespace BaseboardElectric {
Array1D<BaseboardElectric::BaseboardNumericFieldData> BaseboardNumericFields;
bool MyOneTimeFlag = true;
bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
Array1D_bool MyEnvrnFlag;

void clear_state() override
{
Expand All @@ -132,6 +133,7 @@ namespace BaseboardElectric {
this->BaseboardNumericFields.deallocate();
this->MyOneTimeFlag = true;
this->ZoneEquipmentListChecked = false;
this->MyEnvrnFlag.clear();
}
};

Expand Down
23 changes: 10 additions & 13 deletions src/EnergyPlus/BranchInputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,11 @@ namespace BranchInputManager {
int Count; // Loop Counter
int MinCompsAllowed;

// Object Data
static Array1D<ComponentData> BComponents; // Component data to be returned

// NumComps now defined on input

BComponents.allocate(NumComps);
state.dataBranchInputManager->BComponents.allocate(NumComps);

GetInternalBranchData(state, LoopName, BranchName, PressCurveType, PressCurveIndex, NumComps, BComponents, ErrorsFound);
GetInternalBranchData(state, LoopName, BranchName, PressCurveType, PressCurveIndex, NumComps, state.dataBranchInputManager->BComponents, ErrorsFound);

MinCompsAllowed = min(
size(CompType), size(CompName), size(CompInletNodeNames), size(CompInletNodeNums), size(CompOutletNodeNames), size(CompOutletNodeNums));
Expand All @@ -272,14 +269,14 @@ namespace BranchInputManager {
}

for (Count = 1; Count <= NumComps; ++Count) {
CompType(Count) = BComponents(Count).CType;
CompName(Count) = BComponents(Count).Name;
CompInletNodeNames(Count) = BComponents(Count).InletNodeName;
CompInletNodeNums(Count) = BComponents(Count).InletNode;
CompOutletNodeNames(Count) = BComponents(Count).OutletNodeName;
CompOutletNodeNums(Count) = BComponents(Count).OutletNode;
}
BComponents.deallocate();
CompType(Count) = state.dataBranchInputManager->BComponents(Count).CType;
CompName(Count) = state.dataBranchInputManager->BComponents(Count).Name;
CompInletNodeNames(Count) = state.dataBranchInputManager->BComponents(Count).InletNodeName;
CompInletNodeNums(Count) = state.dataBranchInputManager->BComponents(Count).InletNode;
CompOutletNodeNames(Count) = state.dataBranchInputManager->BComponents(Count).OutletNodeName;
CompOutletNodeNums(Count) = state.dataBranchInputManager->BComponents(Count).OutletNode;
}
state.dataBranchInputManager->BComponents.deallocate();
}

int NumCompsInBranch(EnergyPlusData &state, std::string const &BranchName)
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/BranchInputManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ namespace BranchInputManager {
Array1D<BranchInputManager::ConnectorData> ConnectorLists; // Connector List data for each Connector List
Array1D<BranchInputManager::SplitterData> Splitters; // Splitter Data for each Splitter
Array1D<BranchInputManager::MixerData> Mixers; // Mixer Data for each Mixer
Array1D<BranchInputManager::ComponentData> BComponents; // Component data to be returned

void clear_state() override
{
Expand All @@ -386,6 +387,7 @@ namespace BranchInputManager {
this->ConnectorLists.deallocate();
this->Splitters.deallocate();
this->Mixers.deallocate();
this->BComponents.deallocate();
}
};

Expand Down
11 changes: 5 additions & 6 deletions src/EnergyPlus/ChilledCeilingPanelSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ namespace EnergyPlus::CoolingPanelSimple {
static std::string const RoutineName("ChilledCeilingPanelSimple:InitCoolingPanel");

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static Array1D_bool MyEnvrnFlag;
int Loop;
int ZoneNode;
int ZoneNum;
Expand All @@ -725,7 +724,7 @@ namespace EnergyPlus::CoolingPanelSimple {
if (state.dataChilledCeilingPanelSimple->MyOneTimeFlag) {

// Initialize the environment and sizing flags
MyEnvrnFlag.allocate(state.dataChilledCeilingPanelSimple->NumCoolingPanels);
state.dataChilledCeilingPanelSimple->MyEnvrnFlag.allocate(state.dataChilledCeilingPanelSimple->NumCoolingPanels);
state.dataChilledCeilingPanelSimple->ZeroSourceSumHATsurf.allocate(state.dataGlobal->NumOfZones);
state.dataChilledCeilingPanelSimple->ZeroSourceSumHATsurf = 0.0;
state.dataChilledCeilingPanelSimple->CoolingPanelSource.allocate(state.dataChilledCeilingPanelSimple->NumCoolingPanels);
Expand All @@ -741,7 +740,7 @@ namespace EnergyPlus::CoolingPanelSimple {
state.dataChilledCeilingPanelSimple->SetLoopIndexFlag.allocate(state.dataChilledCeilingPanelSimple->NumCoolingPanels);
state.dataChilledCeilingPanelSimple->MySizeFlagCoolPanel.allocate(state.dataChilledCeilingPanelSimple->NumCoolingPanels);
state.dataChilledCeilingPanelSimple->MySizeFlagCoolPanel = true;
MyEnvrnFlag = true;
state.dataChilledCeilingPanelSimple->MyEnvrnFlag = true;
state.dataChilledCeilingPanelSimple->MyOneTimeFlag = false;
state.dataChilledCeilingPanelSimple->SetLoopIndexFlag = true;
}
Expand Down Expand Up @@ -798,7 +797,7 @@ namespace EnergyPlus::CoolingPanelSimple {
}

// Do the Begin Environment initializations
if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(CoolingPanelNum)) {
if (state.dataGlobal->BeginEnvrnFlag && state.dataChilledCeilingPanelSimple->MyEnvrnFlag(CoolingPanelNum)) {
// Initialize

rho = GetDensityGlycol(state, state.dataPlnt->PlantLoop(ThisCP.LoopNum).FluidName, DataGlobalConstants::InitConvTemp, state.dataPlnt->PlantLoop(ThisCP.LoopNum).FluidIndex, RoutineName);
Expand Down Expand Up @@ -831,11 +830,11 @@ namespace EnergyPlus::CoolingPanelSimple {
state.dataChilledCeilingPanelSimple->LastSysTimeElapsed = 0.0;
state.dataChilledCeilingPanelSimple->LastTimeStepSys = 0.0;

MyEnvrnFlag(CoolingPanelNum) = false;
state.dataChilledCeilingPanelSimple->MyEnvrnFlag(CoolingPanelNum) = false;
}

if (!state.dataGlobal->BeginEnvrnFlag) {
MyEnvrnFlag(CoolingPanelNum) = true;
state.dataChilledCeilingPanelSimple->MyEnvrnFlag(CoolingPanelNum) = true;
}

if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) {
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/ChilledCeilingPanelSimple.hh
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace CoolingPanelSimple {
Array1D<CoolingPanelSimple::CoolingPanelSysNumericFieldData> CoolingPanelSysNumericFields;

bool ZoneEquipmentListChecked = false;

Array1D_bool MyEnvrnFlag;
void clear_state() override
{
this->GetInputFlag = true;
Expand All @@ -239,6 +239,7 @@ namespace CoolingPanelSimple {
this->CoolingPanel.deallocate();
this->CoolingPanelSysNumericFields.deallocate();
this->ZoneEquipmentListChecked = false;
this->MyEnvrnFlag.clear();
}
};

Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/ChillerElectricEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,6 @@ namespace EnergyPlus::ChillerElectricEIR {
// should be the actual load. Instead the minimum PLR * RefCap is
// passed in. [W]
Real64 CurrentEndTime = 0.0; // end time of time step for current simulation time step
static std::string OutputChar; // character string for warning messages

// Set module level inlet and outlet nodes and initialize other local variables
this->CondMassFlowRate = 0.0;
Expand Down
53 changes: 9 additions & 44 deletions src/EnergyPlus/ConvectionCoefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3432,56 +3432,12 @@ namespace EnergyPlus::ConvectionCoefficients {
std::string YesNo1;
std::string YesNo2;

struct FacadeGeoCharactisticsStruct
{
// Members
Real64 AzimuthRangeLow;
Real64 AzimuthRangeHi;
Real64 Zmax;
Real64 Zmin;
Real64 Ymax;
Real64 Ymin;
Real64 Xmax;
Real64 Xmin;
Real64 Area;
Real64 Perimeter;
Real64 Height;

// Default Constructor
FacadeGeoCharactisticsStruct() = default;

// Member Constructor
FacadeGeoCharactisticsStruct(Real64 const AzimuthRangeLow,
Real64 const AzimuthRangeHi,
Real64 const Zmax,
Real64 const Zmin,
Real64 const Ymax,
Real64 const Ymin,
Real64 const Xmax,
Real64 const Xmin,
Real64 const Area,
Real64 const Perimeter,
Real64 const Height)
: AzimuthRangeLow(AzimuthRangeLow), AzimuthRangeHi(AzimuthRangeHi), Zmax(Zmax), Zmin(Zmin), Ymax(Ymax), Ymin(Ymin), Xmax(Xmax),
Xmin(Xmin), Area(Area), Perimeter(Perimeter), Height(Height)
{
}
};

// Object Data
Vector BoundNewellVec;
Vector BoundNewellAreaVec;
Vector dummy1;
Vector dummy2;
Vector dummy3;
static FacadeGeoCharactisticsStruct NorthFacade(332.5, 22.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct NorthEastFacade(22.5, 67.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct EastFacade(67.5, 112.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct SouthEastFacade(112.5, 157.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct SouthFacade(157.5, 202.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct SouthWestFacade(202.5, 247.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct WestFacade(247.5, 287.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
static FacadeGeoCharactisticsStruct NorthWestFacade(287.5, 332.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

auto &Zone(state.dataHeatBal->Zone);
auto &Surface(state.dataSurface->Surface);
Expand Down Expand Up @@ -3569,6 +3525,15 @@ namespace EnergyPlus::ConvectionCoefficients {

state.dataConvectionCoefficient->CubeRootOfOverallBuildingVolume = std::pow(BldgVolumeSum, OneThird);

auto & NorthFacade = state.dataConvectionCoefficient->NorthFacade;
auto & NorthEastFacade = state.dataConvectionCoefficient->NorthEastFacade;
auto & EastFacade = state.dataConvectionCoefficient->EastFacade;
auto & SouthEastFacade = state.dataConvectionCoefficient->SouthEastFacade;
auto & SouthFacade = state.dataConvectionCoefficient->SouthFacade;
auto & SouthWestFacade = state.dataConvectionCoefficient->SouthWestFacade;
auto & WestFacade = state.dataConvectionCoefficient->WestFacade;
auto & NorthWestFacade = state.dataConvectionCoefficient->NorthWestFacade;

// first pass over surfaces for outside face params
for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) {
if (Surface(SurfLoop).ExtBoundCond != ExternalEnvironment) continue;
Expand Down
Loading