Skip to content

Commit

Permalink
Merge pull request #8662 from NREL/removestatics
Browse files Browse the repository at this point in the history
Grounding SolarShading, Deglobalizing ICEngineElectricGenerator
  • Loading branch information
Myoldmopar authored Mar 26, 2021
2 parents 686d7e2 + be483d7 commit 72c72db
Show file tree
Hide file tree
Showing 5 changed files with 427 additions and 355 deletions.
32 changes: 8 additions & 24 deletions src/EnergyPlus/ICEngineElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,16 @@ namespace ICEngineElectricGenerator {
// is available to meet an electric load demand, it calls SimICEngineGenerator
// which in turn calls the ICEngine Generator model.

Real64 const ReferenceTemp(25.0); // Reference temperature by which lower heating
// value is reported. This should be subtracted
// off of when calculated exhaust energies.

bool getICEInput(true); // When TRUE, calls subroutine to read input file.
int NumICEngineGenerators(0); // number of IC ENGINE Generators specified in input

// Object Data
Array1D<ICEngineGeneratorSpecs> ICEngineGenerator; // dimension to number of machines

void clear_state()
{
getICEInput = true;
NumICEngineGenerators = 0;
ICEngineGenerator.deallocate();
}

PlantComponent *ICEngineGeneratorSpecs::factory(EnergyPlusData &state, std::string const &objectName)
{
// Process the input data for ICEGen if it hasn't been done already
if (getICEInput) {
if (state.dataICEngElectGen->getICEInput) {
GetICEngineGeneratorInput(state);
getICEInput = false;
state.dataICEngElectGen->getICEInput = false;
}

// Now look for this particular generator in the list
for (auto &thisICE : ICEngineGenerator) {
for (auto &thisICE : state.dataICEngElectGen->ICEngineGenerator) {
if (thisICE.Name == objectName) {
return &thisICE;
}
Expand Down Expand Up @@ -143,20 +126,21 @@ namespace ICEngineElectricGenerator {
Array1D<Real64> NumArray(11); // numeric data
bool ErrorsFound(false); // error flag

auto &ICEngineGenerator(state.dataICEngElectGen->ICEngineGenerator);

state.dataIPShortCut->cCurrentModuleObject = "Generator:InternalCombustionEngine";
NumICEngineGenerators = inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject);
state.dataICEngElectGen->NumICEngineGenerators = inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject);

if (NumICEngineGenerators <= 0) {
if (state.dataICEngElectGen->NumICEngineGenerators <= 0) {
ShowSevereError(state, "No " + state.dataIPShortCut->cCurrentModuleObject + " equipment specified in input file");
ErrorsFound = true;
}

// ALLOCATE ARRAYS
ICEngineGenerator.allocate(NumICEngineGenerators);
ICEngineGenerator.allocate(state.dataICEngElectGen->NumICEngineGenerators);

// LOAD ARRAYS WITH IC ENGINE Generator CURVE FIT DATA
for (genNum = 1; genNum <= NumICEngineGenerators; ++genNum) {
for (genNum = 1; genNum <= state.dataICEngElectGen->NumICEngineGenerators; ++genNum) {
inputProcessor->getObjectItem(state,
state.dataIPShortCut->cCurrentModuleObject,
genNum,
Expand Down
15 changes: 8 additions & 7 deletions src/EnergyPlus/ICEngineElectricGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,10 @@ struct EnergyPlusData;

namespace ICEngineElectricGenerator {

extern Real64 const ReferenceTemp; // Reference temperature by which lower heating
Real64 constexpr ReferenceTemp(25.0); // Reference temperature by which lower heating
// value is reported. This should be subtracted
// off of when calculated exhaust energies.

extern int NumICEngineGenerators; // number of IC ENGINE Generators specified in input
extern bool getICEInput; // When TRUE, calls subroutine to read input file.

struct ICEngineGeneratorSpecs : PlantComponent
{
// Members
Expand Down Expand Up @@ -170,17 +167,21 @@ namespace ICEngineElectricGenerator {
static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
};

extern Array1D<ICEngineGeneratorSpecs> ICEngineGenerator; // dimension to number of machines

void GetICEngineGeneratorInput(EnergyPlusData &state);

} // namespace ICEngineElectricGenerator

struct ICEngineElectricGeneratorData : BaseGlobalStruct {

int NumICEngineGenerators = 0; // number of IC ENGINE Generators specified in input
bool getICEInput = true; // When TRUE, calls subroutine to read input file.
Array1D<ICEngineElectricGenerator::ICEngineGeneratorSpecs> ICEngineGenerator; // dimension to number of machines

void clear_state() override
{

this->getICEInput = true;
this->NumICEngineGenerators = 0;
this->ICEngineGenerator.deallocate();
}
};

Expand Down
Loading

1 comment on commit 72c72db

@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 (2349 of 2349 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.