Skip to content

Commit

Permalink
Merge pull request #8493 from energy-plus/global-state-plantPipingSys…
Browse files Browse the repository at this point in the history
…temsMgr

Global PlantPipingSystemsMgr
  • Loading branch information
Myoldmopar authored Feb 2, 2021
2 parents e4523cb + 69611b1 commit aaa65d1
Show file tree
Hide file tree
Showing 49 changed files with 1,657 additions and 2,228 deletions.
211 changes: 96 additions & 115 deletions src/EnergyPlus/FluidCoolers.cc

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions src/EnergyPlus/FluidCoolers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,12 @@ namespace EnergyPlus {

namespace FluidCoolers {

// MODULE PARAMETER DEFINITIONS:
extern std::string const cFluidCooler_SingleSpeed;
extern std::string const cFluidCooler_TwoSpeed;

enum class PerfInputMethod
{
NOMINAL_CAPACITY,
U_FACTOR
};

extern int NumSimpleFluidCoolers; // Number of similar fluid coolers

struct FluidCoolerspecs : PlantComponent
{
// Members
Expand Down Expand Up @@ -204,11 +198,9 @@ namespace FluidCoolers {

void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;

static PlantComponent *factory(EnergyPlusData &state, int typeOf, std::string objectName);
static PlantComponent *factory(EnergyPlusData &state, int typeOf, std::string const &objectName);
};

extern Array1D<FluidCoolerspecs> SimpleFluidCooler; // dimension to number of machines

void GetFluidCoolerInput(EnergyPlusData &state);

void CalcFluidCoolerOutlet(EnergyPlusData &state, int FluidCoolerNum, Real64 _WaterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign, Real64 &_OutletWaterTemp);
Expand All @@ -218,15 +210,21 @@ namespace FluidCoolers {
Array1D<Real64> const &Par // par(1) = design fluid cooler load [W]
);

void clear_state();

} // namespace FluidCoolers

struct FluidCoolersData : BaseGlobalStruct {

bool GetFluidCoolerInputFlag = true;
int NumSimpleFluidCoolers = 0;
Array1D<FluidCoolers::FluidCoolerspecs> SimpleFluidCooler;
std::unordered_map<std::string, std::string> UniqueSimpleFluidCoolerNames;

void clear_state() override
{

this->GetFluidCoolerInputFlag = true;
this->NumSimpleFluidCoolers = 0;
this->SimpleFluidCooler.deallocate();
this->UniqueSimpleFluidCoolerNames.clear();
}
};

Expand Down
548 changes: 266 additions & 282 deletions src/EnergyPlus/FuelCellElectricGenerator.cc

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions src/EnergyPlus/FuelCellElectricGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -608,24 +608,25 @@ namespace FuelCellElectricGenerator {
void UpdateFuelCellGeneratorRecords(EnergyPlusData &state);
};

void clear_state();

void getFuelCellInput(EnergyPlusData &state);

void FigureFuelCellZoneGains(EnergyPlusData &state);

extern bool getFuelCellInputFlag;
extern int NumFuelCellGenerators;
extern Array1D_bool CheckEquipName;
extern Array1D<FCDataStruct> FuelCell;

} // namespace FuelCellElectricGenerator

struct FuelCellElectricGeneratorData : BaseGlobalStruct {

int NumFuelCellGenerators = 0;
bool getFuelCellInputFlag = true;
bool MyEnvrnFlag = true;
Array1D<FuelCellElectricGenerator::FCDataStruct> FuelCell;

void clear_state() override
{

this->NumFuelCellGenerators = 0;
this->getFuelCellInputFlag = true;
this->MyEnvrnFlag = true;
this->FuelCell.deallocate();
}
};

Expand Down
10 changes: 2 additions & 8 deletions src/EnergyPlus/GeneratorFuelSupply.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ namespace GeneratorFuelSupply {
// Using/Aliasing
using namespace DataGenerators;

static bool MyOneTimeFlag(true);

void clear_state() {
MyOneTimeFlag = true;
}

void GetGeneratorFuelSupplyInput(EnergyPlusData &state)
{

Expand Down Expand Up @@ -134,7 +128,7 @@ namespace GeneratorFuelSupply {
std::string ObjMSGName;
int ConstitNum;

if (MyOneTimeFlag) {
if (state.dataGeneratorFuelSupply->MyOneTimeFlag) {
cCurrentModuleObject = "Generator:FuelSupply";
state.dataGenerator->NumGeneratorFuelSups = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);

Expand Down Expand Up @@ -238,7 +232,7 @@ namespace GeneratorFuelSupply {
ShowFatalError(state, "Problem found processing input for " + cCurrentModuleObject);
}

MyOneTimeFlag = false;
state.dataGeneratorFuelSupply->MyOneTimeFlag = false;
} // MyOneTimeFlag
}

Expand Down
26 changes: 4 additions & 22 deletions src/EnergyPlus/GeneratorFuelSupply.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,19 @@ struct EnergyPlusData;

namespace GeneratorFuelSupply {

// Data
// MODULE PARAMETER DEFINITIONS:
// na

// DERIVED TYPE DEFINITIONS:
// na

// MODULE VARIABLE DECLARATIONS:
// na

// SUBROUTINE SPECIFICATIONS FOR MODULE

// <name Public routines, optionally name Private routines within this module>

// Functions

void clear_state();

void GetGeneratorFuelSupplyInput(EnergyPlusData &state);

//******************************************************************************

void SetupFuelConstituentData(EnergyPlusData &state, int const FuelSupplyNum, bool &ErrorsFound);
void SetupFuelConstituentData(EnergyPlusData &state, int FuelSupplyNum, bool &ErrorsFound);

} // namespace GeneratorFuelSupply

struct GeneratorFuelSupplyData : BaseGlobalStruct {

bool MyOneTimeFlag = true;

void clear_state() override
{

this->MyOneTimeFlag = true;
}
};

Expand Down
114 changes: 26 additions & 88 deletions src/EnergyPlus/GlobalNames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@
// POSSIBILITY OF SUCH DAMAGE.

// EnergyPlus Headers
#include <EnergyPlus/Data/EnergyPlusData.hh>
#include <EnergyPlus/GlobalNames.hh>
#include <EnergyPlus/UtilityRoutines.hh>

namespace EnergyPlus {

namespace GlobalNames {
namespace EnergyPlus::GlobalNames {

// Module containing the routines dealing with matching and assuring that
// various component types are unique by name (e.g. Chillers).
Expand All @@ -66,44 +65,6 @@ namespace GlobalNames {
// This module allows for verification of uniqueness (by name) across
// certain component names (esp. Chillers, Boilers)

// METHODOLOGY EMPLOYED:
// na

// REFERENCES:
// na

// OTHER NOTES:
// na

// Using/Aliasing
// Data
// MODULE PARAMETER DEFINITIONS:
// na

// DERIVED TYPE DEFINITIONS:

// MODULE VARIABLE DECLARATIONS:
int NumChillers(0);
int NumBoilers(0);
int NumBaseboards(0);
int NumCoils(0);
int numAirDistUnits(0);
int CurMaxChillers(0);
int CurMaxBoilers(0);
int CurMaxBaseboards(0);
int CurMaxCoils(0);

// SUBROUTINE SPECIFICATIONS FOR MODULE GlobalNames:

// Object Data
std::unordered_map<std::string, std::string> ChillerNames;
std::unordered_map<std::string, std::string> BoilerNames;
std::unordered_map<std::string, std::string> BaseboardNames;
std::unordered_map<std::string, std::string> CoilNames;
std::unordered_map<std::string, std::string> aDUNames;

// Functions

void IntraObjUniquenessCheck(EnergyPlusData &state,
std::string &NameToVerify,
std::string const &CurrentModuleObject,
Expand Down Expand Up @@ -185,17 +146,17 @@ namespace GlobalNames {
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// This subroutine verifys that a new name will be unique in the list of
// This subroutine verifies that a new name will be unique in the list of
// chillers. If not found in the list, it is added before returning.

auto const iter = ChillerNames.find(NameToVerify);
if (iter != ChillerNames.end()) {
auto const iter = state.dataGlobalNames->ChillerNames.find(NameToVerify);
if (iter != state.dataGlobalNames->ChillerNames.end()) {
ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Chiller Type=\"" + iter->second + "\".");
ShowContinueError(state, "...Current entry is Chiller Type=\"" + TypeToVerify + "\".");
ErrorsFound = true;
} else {
ChillerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
NumChillers = static_cast<int>(ChillerNames.size());
state.dataGlobalNames->ChillerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
state.dataGlobalNames->NumChillers = static_cast<int>(state.dataGlobalNames->ChillerNames.size());
}
}

Expand All @@ -210,17 +171,17 @@ namespace GlobalNames {
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// This subroutine verifys that a new name will be unique in the list of
// This subroutine verifies that a new name will be unique in the list of
// Baseboards. If not found in the list, it is added before returning.

auto const iter = BaseboardNames.find(NameToVerify);
if (iter != BaseboardNames.end()) {
auto const iter = state.dataGlobalNames->BaseboardNames.find(NameToVerify);
if (iter != state.dataGlobalNames->BaseboardNames.end()) {
ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Baseboard Type=\"" + iter->second + "\".");
ShowContinueError(state, "...Current entry is Baseboard Type=\"" + TypeToVerify + "\".");
ErrorsFound = true;
} else {
BaseboardNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
NumBaseboards = static_cast<int>(BaseboardNames.size());
state.dataGlobalNames->BaseboardNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
state.dataGlobalNames->NumBaseboards = static_cast<int>(state.dataGlobalNames->BaseboardNames.size());
}
}

Expand All @@ -235,17 +196,17 @@ namespace GlobalNames {
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// This subroutine verifys that a new name will be unique in the list of
// This subroutine verifies that a new name will be unique in the list of
// Boilers. If not found in the list, it is added before returning.

auto const iter = BoilerNames.find(NameToVerify);
if (iter != BoilerNames.end()) {
auto const iter = state.dataGlobalNames->BoilerNames.find(NameToVerify);
if (iter != state.dataGlobalNames->BoilerNames.end()) {
ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Boiler Type=\"" + iter->second + "\".");
ShowContinueError(state, "...Current entry is Boiler Type=\"" + TypeToVerify + "\".");
ErrorsFound = true;
} else {
BoilerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
NumBoilers = static_cast<int>(BoilerNames.size());
state.dataGlobalNames->BoilerNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
state.dataGlobalNames->NumBoilers = static_cast<int>(state.dataGlobalNames->BoilerNames.size());
}
}

Expand All @@ -259,7 +220,7 @@ namespace GlobalNames {
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// This subroutine verifys that a new name will be unique in the list of
// This subroutine verifies that a new name will be unique in the list of
// Coils. If not found in the list, it is added before returning.

if (NameToVerify.empty()) {
Expand All @@ -269,51 +230,28 @@ namespace GlobalNames {
return;
}

auto const iter = CoilNames.find(NameToVerify);
if (iter != CoilNames.end()) {
auto const iter = state.dataGlobalNames->CoilNames.find(NameToVerify);
if (iter != state.dataGlobalNames->CoilNames.end()) {
ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", Coil Type=\"" + iter->second + "\".");
ShowContinueError(state, "...Current entry is Coil Type=\"" + TypeToVerify + "\".");
ErrorsFound = true;
} else {
CoilNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
NumCoils = static_cast<int>(CoilNames.size());
state.dataGlobalNames->CoilNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
state.dataGlobalNames->NumCoils = static_cast<int>(state.dataGlobalNames->CoilNames.size());
}
}

void VerifyUniqueADUName(EnergyPlusData &state, std::string const &TypeToVerify, std::string const &NameToVerify, bool &ErrorsFound, std::string const &StringToDisplay)
{
auto const iter = aDUNames.find(NameToVerify);
if (iter != aDUNames.end()) {
auto const iter = state.dataGlobalNames->aDUNames.find(NameToVerify);
if (iter != state.dataGlobalNames->aDUNames.end()) {
ShowSevereError(state, StringToDisplay + ", duplicate name=" + NameToVerify + ", ADU Type=\"" + iter->second + "\".");
ShowContinueError(state, "...Current entry is Air Distribution Unit Type=\"" + TypeToVerify + "\".");
ErrorsFound = true;
} else {
aDUNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
numAirDistUnits = static_cast<int>(aDUNames.size());
state.dataGlobalNames->aDUNames.emplace(NameToVerify, UtilityRoutines::MakeUPPERCase(TypeToVerify));
state.dataGlobalNames->numAirDistUnits = static_cast<int>(state.dataGlobalNames->aDUNames.size());
}
}

// Clears the global data in GlobalNames.
// Needed for unit tests, should not be normally called.
void clear_state()
{
NumChillers = 0;
NumBoilers = 0;
NumBaseboards = 0;
NumCoils = 0;
numAirDistUnits = 0;
CurMaxChillers = 0;
CurMaxBoilers = 0;
CurMaxBaseboards = 0;
CurMaxCoils = 0;

ChillerNames.clear();
BoilerNames.clear();
BaseboardNames.clear();
CoilNames.clear();
aDUNames.clear();
}

} // namespace GlobalNames

} // namespace EnergyPlus
Loading

11 comments on commit aaa65d1

@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.

develop (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2274 of 2276 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1092
  • Failed: 2

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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2296 of 2296 tests passed, 0 test warnings)

Build Badge Test 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.

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2249 of 2249 tests passed, 0 test warnings)

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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1557 of 1557 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

develop (Myoldmopar) - 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
  • Timeout: 1

Build Badge Test Badge Coverage Badge

@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.

test_branch_windows (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2993 of 2993 tests passed, 54 test warnings)

Messages:\n

  • 54 tests had: AUD diffs.
  • 30 tests had: EDD diffs.
  • 2 tests had: ERR diffs.

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.

test_branch_windows (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3032 of 3033 tests passed, 56 test warnings)

Messages:\n

  • 56 tests had: AUD diffs.
  • 32 tests had: EDD diffs.
  • 2 tests had: ERR diffs.
  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 736
  • Failed: 1

Build Badge Test 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.

test_branch_windows (Myoldmopar) - Win64-Windows-10-VisualStudio-16: Tests Failed (2 of 2249 tests passed, 0 test warnings)

Failures:\n

API Test Summary

  • Exit code 0xc0000135
    : 3
  • Failed: 1

integration Test Summary

  • Passed: 2
  • Failed: 717

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.

test_branch_windows (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1557 of 1557 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

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

Build Badge Test Badge Coverage Badge

@Myoldmopar
Copy link
Member Author

Choose a reason for hiding this comment

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

OK, so CI just built this commit a few days ago just fine but now it is failing. Which means, yay!, our code is OK! But also, boo!, the CI machine is having an issue. Anyway, carry on with reviews and merges ignoring any of these crazy Windows results. I'm on the CI machine attempting a manual build and run. (FYI @mitchute @mjwitte)

Please sign in to comment.