Skip to content

Commit

Permalink
cleanup statics
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Nov 12, 2019
1 parent 843bd5f commit 6cd202a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 47 deletions.
12 changes: 8 additions & 4 deletions src/EnergyPlus/DataGenerators.hh
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ namespace DataGenerators {
std::string NameFCAirSup; // name of air supply module for fuel cell
FCAirSupplyDataStruct AirSup; // data for air supply module
std::string NameFCFuelSup; // name of fuel supply module
int FuelSupNum; // indes for fuel supply module structure
int FuelSupNum; // index for fuel supply module structure
std::string NameFCWaterSup; // name of water supply module
FCWaterSupplyDataStruct WaterSup; // data for water supply module
std::string NameFCAuxilHeat; // name of auxiliary heating module
Expand All @@ -612,9 +612,9 @@ namespace DataGenerators {
std::string NameElecStorage; // name of Battery module
FCElecStorageDataStruct ElecStorage; // data for Battery module
std::string NameInverter; // name of Inverter Module
FCInverterDataStruct Inverter; // data for INverter module
FCInverterDataStruct Inverter; // data for Inverter module
std::string NameStackCooler; // name of Inverter Module
FCStackCoolerDataStruct StackCooler; // data for INverter module
FCStackCoolerDataStruct StackCooler; // data for Inverter module
int CWLoopNum; // cooling water plant loop index number
int CWLoopSideNum; // cooling water plant loop side index
int CWBranchNum; // cooling water plant loop branch index
Expand All @@ -626,11 +626,15 @@ namespace DataGenerators {
Real64 QradZone; // radiative heat lost to surrounding zone
int DynamicsControlID;
Real64 TimeElapsed; // used to track when timestep has changed
bool InitGenerator;
bool MyEnvrnFlag_Init;
bool MyWarmupFlag_Init;
bool MyPlantScanFlag_Init;

// Default Constructor
FCDataStruct()
: FuelSupNum(0), CWLoopNum(0), CWLoopSideNum(0), CWBranchNum(0), CWCompNum(0), ACPowerGen(0.0), QconvZone(0.0), QradZone(0.0),
DynamicsControlID(0), TimeElapsed(0.0)
DynamicsControlID(0), TimeElapsed(0.0), InitGenerator(true), MyEnvrnFlag_Init(true), MyWarmupFlag_Init(false), MyPlantScanFlag_Init(true)
{
}
};
Expand Down
30 changes: 10 additions & 20 deletions src/EnergyPlus/FuelCellElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3194,24 +3194,14 @@ namespace FuelCellElectricGenerator {

static std::string const RoutineName("InitFuelCellGenerators");

static bool InitGeneratorOnce(true); // flag for 1 time initialization
static Array1D_bool MyEnvrnFlag; // flag for init once at start of environment
static Array1D_bool MyWarmupFlag; // flag for init after warmup complete
static Array1D_bool MyPlantScanFlag;
bool errFlag;

// Do the one time initializations
if (InitGeneratorOnce) {
MyEnvrnFlag.allocate(DataGenerators::NumFuelCellGenerators);
MyWarmupFlag.allocate(DataGenerators::NumFuelCellGenerators);
MyPlantScanFlag.allocate(DataGenerators::NumFuelCellGenerators);
MyEnvrnFlag = true;
MyWarmupFlag = false;
InitGeneratorOnce = false;
MyPlantScanFlag = true;
if (DataGenerators::FuelCell(FCnum).InitGenerator) {
DataGenerators::FuelCell(FCnum).InitGenerator = false;
} // end one time setups and inits

if (MyPlantScanFlag(FCnum) && allocated(DataPlant::PlantLoop)) {
if (DataGenerators::FuelCell(FCnum).MyPlantScanFlag_Init && allocated(DataPlant::PlantLoop)) {
errFlag = false;

PlantUtilities::ScanPlantLoopsForObject(DataGenerators::FuelCell(FCnum).NameExhaustHX,
Expand All @@ -3232,11 +3222,11 @@ namespace FuelCellElectricGenerator {
if (errFlag) {
ShowFatalError("InitFuelCellGenerators: Program terminated due to previous condition(s).");
}
MyPlantScanFlag(FCnum) = false;
DataGenerators::FuelCell(FCnum).MyPlantScanFlag_Init = false;
}

// Do the Begin Environment initializations
if (DataGlobals::BeginEnvrnFlag && MyEnvrnFlag(FCnum) && !MyPlantScanFlag(FCnum)) {
if (DataGlobals::BeginEnvrnFlag && DataGenerators::FuelCell(FCnum).MyEnvrnFlag_Init && !DataGenerators::FuelCell(FCnum).MyPlantScanFlag_Init) {

DataGenerators::FuelSupply(DataGenerators::FuelCell(FCnum).FuelSupNum).PfuelCompEl = 0.0;
DataGenerators::FuelSupply(DataGenerators::FuelCell(FCnum).FuelSupNum).TfuelIntoFCPM = 0.0;
Expand Down Expand Up @@ -3309,19 +3299,19 @@ namespace FuelCellElectricGenerator {
DataGenerators::FuelCell(FCnum).CWBranchNum,
DataGenerators::FuelCell(FCnum).CWCompNum);

MyEnvrnFlag(FCnum) = false;
MyWarmupFlag(FCnum) = true;
DataGenerators::FuelCell(FCnum).MyEnvrnFlag_Init = false;
DataGenerators::FuelCell(FCnum).MyWarmupFlag_Init = true;
} // end environmental inits

if (!DataGlobals::BeginEnvrnFlag) {
MyEnvrnFlag(FCnum) = true;
DataGenerators::FuelCell(FCnum).MyEnvrnFlag_Init = true;
}

if (MyWarmupFlag(FCnum) && (!DataGlobals::WarmupFlag)) {
if (DataGenerators::FuelCell(FCnum).MyWarmupFlag_Init && (!DataGlobals::WarmupFlag)) {
// need to reset initial state of charge at beginning of environment but after warm up is complete
DataGenerators::FuelCell(FCnum).ElecStorage.LastTimeStepStateOfCharge = DataGenerators::FuelCell(FCnum).ElecStorage.StartingEnergyStored;
DataGenerators::FuelCell(FCnum).ElecStorage.ThisTimeStepStateOfCharge = DataGenerators::FuelCell(FCnum).ElecStorage.StartingEnergyStored;
MyWarmupFlag(FCnum) = false;
DataGenerators::FuelCell(FCnum).MyWarmupFlag_Init = false;
}

// using and elapsed time method rather than FirstHVACIteration here
Expand Down
23 changes: 0 additions & 23 deletions src/EnergyPlus/FuelCellElectricGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,18 @@ namespace EnergyPlus {

namespace FuelCellElectricGenerator {

// Data
// MODULE PARAMETER DEFINITIONS

// DERIVED TYPE DEFINITIONS

// MODULE VARIABLE DECLARATIONS:
extern bool GetFuelCellInput; // When TRUE, calls subroutine to read input file.
extern Array1D_bool CheckEquipName;

// SUBROUTINE SPECIFICATIONS FOR MODULE FuelCell ElectricGenerator

// PRIVATE SetupFuelAndAirConstituentData ! hardwired data for gas phase thermochemistry calcs

// Functions

void SimFuelCellGenerator(int GeneratorType, // type of Generator
std::string const &GeneratorName, // user specified name of Generator
int &GeneratorIndex,
bool RunFlag, // simulate Generator when TRUE
Real64 MyLoad, // demand on electric generator
bool FirstHVACIteration);

// End FuelCell Generator Module Driver Subroutines
//******************************************************************************

// Beginning of FuelCell Generator Module Get Input subroutines
//******************************************************************************

void GetFuelCellGeneratorInput();

// End of Get Input subroutines for the FuelCell Generator Module

// Beginning of Generator model Subroutines
// *****************************************************************************

void CalcFuelCellGeneratorModel(int GeneratorNum, // Generator number
bool RunFlag, // TRUE when Generator operating
Real64 MyLoad, // Generator demand
Expand Down

0 comments on commit 6cd202a

Please sign in to comment.