Skip to content

Commit

Permalink
Merge branch 'develop' into plantCompUsrDefRefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Dec 10, 2019
2 parents c06d2b0 + 2b0aa8c commit cee9750
Show file tree
Hide file tree
Showing 11 changed files with 3,418 additions and 5,198 deletions.
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

6 comments on commit cee9750

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

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

plantCompUsrDefRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2628 of 2631 tests passed, 4 test warnings)

Messages:\n

  • 1 test had: BND diffs.
  • 1 test had: EDD diffs.
  • 4 tests had: ESO small diffs.
  • 6 tests had: MTR small diffs.
  • 4 tests had: EIO diffs.
  • 3 tests had: ESO big diffs.
  • 2 tests had: Table small diffs.
  • 1 test had: MTR big diffs.
  • 2 tests had: Table big diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 687
  • Failed: 3

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

plantCompUsrDefRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

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

plantCompUsrDefRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (11 of 11 tests passed, 0 test warnings)

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

plantCompUsrDefRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1249 of 1249 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.

plantCompUsrDefRefactor (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (674 of 675 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 674
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.