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

Fuel Cell Generator Plant Comp Refactor #7573

Merged
merged 33 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
43e6036
cleanup comments
mitchute Oct 21, 2019
997856b
partial cleanup usings
mitchute Oct 21, 2019
9ddc8e1
partial cleanup usings
mitchute Nov 11, 2019
205bbbe
partial cleanup usings
mitchute Nov 11, 2019
7257c70
partial cleanup usings
mitchute Nov 11, 2019
4b3d81b
partial cleanup usings
mitchute Nov 11, 2019
32e1360
partial cleanup usings
mitchute Nov 11, 2019
d51fc01
partial cleanup usings
mitchute Nov 11, 2019
319d54a
partial cleanup usings
mitchute Nov 11, 2019
57d735a
partial cleanup local var
mitchute Nov 11, 2019
b40504b
partial cleanup local vars
mitchute Nov 11, 2019
896bfe3
partial cleanup local vars
mitchute Nov 11, 2019
5f5cd12
partial cleanup locals
mitchute Nov 12, 2019
daf46ad
cleanup local vars
mitchute Nov 12, 2019
843bd5f
partial remove statics
mitchute Nov 12, 2019
6cd202a
cleanup statics
mitchute Nov 12, 2019
beea145
move counter to fuelCell struct
mitchute Nov 12, 2019
cf04ef4
move FCGen struct to the right .hh file
mitchute Nov 12, 2019
7e4b515
partial functions to members
mitchute Nov 12, 2019
c77ead6
partial functions to members
mitchute Nov 12, 2019
ce50b27
functions to members
mitchute Nov 12, 2019
9d0f150
Merge branch 'develop' into fuelCellGenPlantCompRefactor
mitchute Nov 13, 2019
741e42a
Merge branch 'develop' into fuelCellGenPlantCompRefactor
mitchute Nov 13, 2019
3680e43
move setupOutputVars to standalone. still called from inputs
mitchute Nov 13, 2019
ca780b1
delete unused MicroCHP structs that got missed in PR #7568
mitchute Nov 13, 2019
146b005
inherit plant component
mitchute Nov 13, 2019
1865241
factory and integrate into elecPowerServiceMgr
mitchute Nov 14, 2019
64596ec
integrate plantCompPtr
mitchute Nov 14, 2019
eec171b
Merge branch 'develop' into fuelCellGenPlantCompRefactor
mitchute Nov 14, 2019
5188f93
fixing reporting errors
mitchute Nov 18, 2019
cd8c96c
fix output vars
mitchute Nov 19, 2019
ef95f91
apply formatting
mitchute Nov 22, 2019
78e3fe8
Merge branch 'develop' into fuelCellGenPlantCompRefactor
mitchute Nov 26, 2019
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
18 changes: 10 additions & 8 deletions src/EnergyPlus/DataGenerators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ namespace DataGenerators {
// to the Fuel cell and Micro CHP modeling in EnergyPlus
// the data for the older BLAST generators are in those component's modules

// METHODOLOGY EMPLOYED:

// REFERENCES:
// na

// OTHER NOTES:
// na

// Using/Aliasing
using namespace DataPrecisionGlobals;

// Data
Expand Down Expand Up @@ -135,17 +144,11 @@ namespace DataGenerators {

Real64 const ImBalanceTol(0.00001); // used as fraction of electrical power at power module

// DERIVED TYPE DEFINITIONS

// MODULE VARIABLE DECLARATIONS:

int NumFuelConstit(0);
int NumGeneratorFuelSups(0);
int NumFuelCellGenerators(0); // number of SOFC Generators specified in input
int NumGensWDynamics(0); // number of dynamics controls for generators

// Object Data
Array1D<FCDataStruct> FuelCell; // dimension to number of machines
Array1D<GasPropertyDataStruct> GasPhaseThermoChemistryData;
Array1D<GeneratorFuelSupplyDataStruct> FuelSupply; // fuel supply (reused across various)
Array1D<GeneratorDynamicsManagerStruct> GeneratorDynamics;
Expand All @@ -154,11 +157,10 @@ namespace DataGenerators {
{
NumFuelConstit = 0;
NumGeneratorFuelSups = 0;
NumFuelCellGenerators = 0;
NumGensWDynamics = 0;
FuelCell.deallocate();
GasPhaseThermoChemistryData.deallocate();
FuelSupply.deallocate();
GeneratorDynamics.deallocate();
}

} // namespace DataGenerators
Expand Down
511 changes: 8 additions & 503 deletions src/EnergyPlus/DataGenerators.hh

Large diffs are not rendered by default.

48 changes: 32 additions & 16 deletions src/EnergyPlus/ElectricPowerServiceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,6 @@ GeneratorController::GeneratorController(std::string const &objectName,
{

std::string const routineName = "GeneratorController constructor ";
bool errorsFound = false;

name = objectName;
typeOfName = objectType;
Expand Down Expand Up @@ -2012,7 +2011,8 @@ GeneratorController::GeneratorController(std::string const &objectName,
// exhaust gas HX is required and it assumed that it has more thermal capacity and is used for control
compPlantTypeOf_Num = DataPlant::TypeOf_Generator_FCExhaust;
// and the name of plant component is not the same as the generator because of child object references, so fetch that name
FuelCellElectricGenerator::getFuelCellGeneratorHeatRecoveryInfo(name, compPlantName);
auto thisFC = FuelCellElectricGenerator::FCDataStruct::factory(name);
compPlantName = dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->ExhaustHX.Name;
} else if (UtilityRoutines::SameString(objectType, "Generator:MicroCHP")) {
generatorType = GeneratorType::microCHP;
compGenTypeOf_Num = DataGlobalConstants::iGeneratorMicroCHP;
Expand All @@ -2025,7 +2025,6 @@ GeneratorController::GeneratorController(std::string const &objectName,
} else {
ShowSevereError(routineName + DataIPShortCuts::cCurrentModuleObject + " invalid entry.");
ShowContinueError("Invalid " + objectType + " associated with generator = " + objectName);
errorsFound = true;
}

availSched = availSchedName;
Expand All @@ -2037,7 +2036,6 @@ GeneratorController::GeneratorController(std::string const &objectName,
ShowSevereError(routineName + DataIPShortCuts::cCurrentModuleObject + ", invalid entry.");
ShowContinueError("Invalid availability schedule = " + availSchedName);
ShowContinueError("Schedule was not found ");
errorsFound = true;
} else {
if (generatorType == GeneratorType::pvWatts) {
ShowWarningError(routineName + DataIPShortCuts::cCurrentModuleObject + ", Availability Schedule for Generator:PVWatts '" + objectName + "' will be be ignored (runs all the time).");
Expand Down Expand Up @@ -2109,8 +2107,12 @@ void GeneratorController::simGeneratorGetPowerOutput(bool const runFlag,
dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->InitICEngineGenerators(runFlag, FirstHVACIteration);
dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->CalcICEngineGeneratorModel(runFlag, tempLoad);
dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->update();
electricPowerOutput = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->ElecPowerGenerated;
thermalPowerOutput = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->QTotalHeatRecovered;
electProdRate = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->ElecPowerGenerated;
electricityProd = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->ElecEnergyGenerated;
thermProdRate = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->QTotalHeatRecovered;
thermalProd = dynamic_cast<ICEngineElectricGenerator::ICEngineGeneratorSpecs*> (thisICE)->TotalHeatEnergyRec;
electricPowerOutput = electProdRate;
thermalPowerOutput = thermProdRate;
break;
}
case GeneratorType::combTurbine: {
Expand All @@ -2124,8 +2126,12 @@ void GeneratorController::simGeneratorGetPowerOutput(bool const runFlag,
thisCTE->simulate(L, FirstHVACIteration, tempLoad, runFlag);
dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->InitCTGenerators(runFlag, FirstHVACIteration);
dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->CalcCTGeneratorModel(runFlag, tempLoad, FirstHVACIteration);
electricPowerOutput = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->ElecPowerGenerated;
thermalPowerOutput = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->QTotalHeatRecovered;
electProdRate = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->ElecPowerGenerated;
electricityProd = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->ElecEnergyGenerated;
thermProdRate = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->QTotalHeatRecovered;
thermalProd = dynamic_cast<CTElectricGenerator::CTGeneratorData*> (thisCTE)->TotalHeatEnergyRec;
electricPowerOutput = electProdRate;
thermalPowerOutput = thermProdRate;
break;
}
case GeneratorType::pV: {
Expand All @@ -2145,10 +2151,12 @@ void GeneratorController::simGeneratorGetPowerOutput(bool const runFlag,
break;
}
case GeneratorType::fuelCell: {
FuelCellElectricGenerator::SimFuelCellGenerator(
DataGlobalConstants::iGeneratorFuelCell, name, generatorIndex, runFlag, myElecLoadRequest, FirstHVACIteration);
FuelCellElectricGenerator::GetFuelCellGeneratorResults(
DataGlobalConstants::iGeneratorFuelCell, generatorIndex, electProdRate, electricityProd, thermProdRate, thermalProd);
auto thisFC = FuelCellElectricGenerator::FCDataStruct::factory(name);
dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->SimFuelCellGenerator(runFlag, myElecLoadRequest, FirstHVACIteration);
electProdRate = dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->Report.ACPowerGen;
electricityProd = dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->Report.ACEnergyGen;
thermProdRate = dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->Report.qHX;
thermalProd = dynamic_cast<FuelCellElectricGenerator::FCDataStruct*> (thisFC)->Report.HXenergy;
electricPowerOutput = electProdRate;
thermalPowerOutput = thermProdRate;
break;
Expand All @@ -2169,8 +2177,12 @@ void GeneratorController::simGeneratorGetPowerOutput(bool const runFlag,
dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->CalcUpdateHeatRecovery();
dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->UpdateMicroCHPGeneratorRecords();

thermalPowerOutput = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.ACPowerGen;
thermalPowerOutput = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.QdotHR;
electProdRate = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.ACPowerGen;
electricityProd = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.ACEnergyGen;
thermProdRate = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.QdotHR;
thermalProd = dynamic_cast<MicroCHPElectricGenerator::MicroCHPDataStruct*> (thisMCHP)->A42Model.TotalHeatEnergyRec;
electricPowerOutput = electProdRate;
thermalPowerOutput = thermProdRate;
break;
}
case GeneratorType::microturbine: {
Expand All @@ -2184,8 +2196,12 @@ void GeneratorController::simGeneratorGetPowerOutput(bool const runFlag,
dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->InitMTGenerators(runFlag, tempLoad, FirstHVACIteration);
dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->CalcMTGeneratorModel(runFlag, tempLoad);
dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->UpdateMTGeneratorRecords();
electricPowerOutput = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->ElecPowerGenerated;
thermalPowerOutput = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->QHeatRecovered;
electProdRate = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->ElecPowerGenerated;
electricityProd = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->EnergyGen;
thermProdRate = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->QHeatRecovered;
thermalProd = dynamic_cast<MicroturbineElectricGenerator::MTGeneratorSpecs*> (thisMTG)->ExhaustEnergyRec;
electricPowerOutput = electProdRate;
thermalPowerOutput = thermProdRate;
break;
}
case GeneratorType::windTurbine: {
Expand Down
Loading