Skip to content

Commit

Permalink
Merge branch 'develop' into ghe_mods
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Feb 2, 2021
2 parents 2410d71 + aaa65d1 commit bea5023
Show file tree
Hide file tree
Showing 51 changed files with 1,784 additions and 2,233 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

0 comments on commit bea5023

Please sign in to comment.