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 SolarShading, Deglobalizing ICEngineElectricGenerator #8662

Merged
merged 7 commits into from
Mar 26, 2021
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