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

Continued Grounding of EnergyPlus #8652

Merged
merged 21 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,13 @@ \subsubsection{Capacity degradation}
During the second half of the battery life cycle degradation is dominated by the charge discharge cycles. The battery capacity during this period is expressed as shown below.
\begin{equation}
Q_{max}^{neg}=\sqrt{(c_0^2-2c_2 c_0 N)}
\label{Equation: b2_computation}
\label{Equation: qmax_computation_a}
\end{equation}
As in the case with the calendar life degradation, the parameters $c_0$ and $c_2$ were determined experimentally.

The description of the model parameters, and constants can be found in (Smith, 2017), and the corresponding values can be found in (Mishra, 2020).

\subsubsection{References}\label{references-022}
\subsubsection{References}\label{references-022-b}

N. DiOrio et al. Technoeconomic modeling of battery energy storage in SAM. Tech. rep. National Renewable Energy Lab. (NREL), Golden, CO (United States), 2015.

Expand Down
11 changes: 11 additions & 0 deletions src/EnergyPlus/DataGenerators.hh
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ struct GeneratorsData : BaseGlobalStruct {
Array1D<DataGenerators::GeneratorFuelSupplyDataStruct> FuelSupply; // fuel supply (reused across various)
Array1D<DataGenerators::GeneratorDynamicsManagerStruct> GeneratorDynamics;

int InletCWnode = 0; // cooling water inlet node ID
bool InternalFlowControl = false;
Real64 TcwIn = 0.0; // inlet cooling water temperature (C)
Real64 TrialMdotcw = 0.0; // test or estimate of what the plant flows are going to be (kg/s)
Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s)

void clear_state() override
{
NumFuelConstit = 0;
Expand All @@ -328,6 +334,11 @@ struct GeneratorsData : BaseGlobalStruct {
GasPhaseThermoChemistryData.deallocate();
FuelSupply.deallocate();
GeneratorDynamics.deallocate();
this->InletCWnode = 0;
this->InternalFlowControl = false;
this->TcwIn = 0.0;
this->TrialMdotcw = 0.0;
this->LimitMinMdotcw = 0.0;
}
};

Expand Down
24 changes: 12 additions & 12 deletions src/EnergyPlus/General.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ namespace EnergyPlus::General {
int JulianDay;

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static Array1D_int EndDayofMonth(12, {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365});
static Array1D_int const EndDayofMonth(12, {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365});
// End day numbers of each month (without Leap Year)

if (Month == 1) {
Expand Down Expand Up @@ -2163,7 +2163,7 @@ namespace EnergyPlus::General {
// string but in this case the output string is a fixed size so this is more
// clear for formatting and faster. If formatted string changes, make sure to
// add more to buffer.
static char buffer[11];
char buffer[11];
int cx = snprintf(buffer, 11, "%02d:%02d:%04.1f", Hours, Minutes, Seconds);

// Make sure output string is only between 0 and 10 characters so string is
Expand Down Expand Up @@ -2267,16 +2267,16 @@ namespace EnergyPlus::General {
int NumNames;
int NumNumbers;
int IOStat;
static std::string DXFOption1;
static std::string DXFOption2;
static std::string DXFWFOption1;
static std::string DXFWFOption2;
static std::string VRMLOption1;
static std::string VRMLOption2;
static std::string ViewRptOption1;
static std::string LineRptOption1;
static std::string VarDictOption1;
static std::string VarDictOption2;
auto & DXFOption1 = state.dataGeneral->DXFOption1;
auto & DXFOption2 = state.dataGeneral->DXFOption2;
auto & DXFWFOption1 = state.dataGeneral->DXFWFOption1;
auto & DXFWFOption2 = state.dataGeneral->DXFWFOption2;
auto & VRMLOption1 = state.dataGeneral->VRMLOption1;
auto & VRMLOption2 = state.dataGeneral->VRMLOption2;
auto & ViewRptOption1 = state.dataGeneral->ViewRptOption1;
auto & LineRptOption1 = state.dataGeneral->LineRptOption1;
auto & VarDictOption1 = state.dataGeneral->VarDictOption1;
auto & VarDictOption2 = state.dataGeneral->VarDictOption2;
auto & cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;

if (state.dataGeneral->GetReportInput) {
Expand Down
22 changes: 22 additions & 0 deletions src/EnergyPlus/General.hh
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,17 @@ struct GeneralData : BaseGlobalStruct {
bool LineRpt = false;
bool VarDict = false;
bool EMSoutput = false;
Real64 XNext = 0.0; // used in root finder
std::string DXFOption1;
std::string DXFOption2;
std::string DXFWFOption1;
std::string DXFWFOption2;
std::string VRMLOption1;
std::string VRMLOption2;
std::string ViewRptOption1;
std::string LineRptOption1;
std::string VarDictOption1;
std::string VarDictOption2;

void clear_state() override
{
Expand All @@ -389,6 +400,17 @@ struct GeneralData : BaseGlobalStruct {
this->LineRpt = false;
this->VarDict = false;
this->EMSoutput = false;
this->XNext = 0.0;
this->DXFOption1.clear();
this->DXFOption2.clear();
this->DXFWFOption1.clear();
this->DXFWFOption2.clear();
this->VRMLOption1.clear();
this->VRMLOption2.clear();
this->ViewRptOption1.clear();
this->LineRptOption1.clear();
this->VarDictOption1.clear();
this->VarDictOption2.clear();
}
};

Expand Down
66 changes: 4 additions & 62 deletions src/EnergyPlus/GeneralRoutines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void ControlCompOutput(EnergyPlusData &state, std::string const &CompName,
// Interval Half Type used for Controller

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static int Iter(0); // Iteration limit for the interval halving process
int Iter(0); // Iteration limit for the interval halving process
Real64 CpAir; // specific heat of air (J/kg-C)
bool Converged;
Real64 Denom; // the denominator of the control signal
Expand All @@ -198,70 +198,12 @@ void ControlCompOutput(EnergyPlusData &state, std::string const &CompName,
// INTEGER, SAVE :: ErrCount1=0 ! for recurring error
bool WaterCoilAirFlowControl; // True if controlling air flow through water coil, water flow fixed
int SimCompNum; // internal number for case statement
static Real64 HalvingPrec(0.0); // precision of halving algorithm
Real64 HalvingPrec(0.0); // precision of halving algorithm
bool BBConvergeCheckFlag; // additional check on convergence specifically for radiant/convective baseboard units

struct IntervalHalf
{
// Members
Real64 MaxFlow;
Real64 MinFlow;
Real64 MaxResult;
Real64 MinResult;
Real64 MidFlow;
Real64 MidResult;
bool MaxFlowCalc;
bool MinFlowCalc;
bool MinFlowResult;
bool NormFlowCalc;

// Default Constructor
IntervalHalf() = default;

// Member Constructor
IntervalHalf(Real64 const MaxFlow,
Real64 const MinFlow,
Real64 const MaxResult,
Real64 const MinResult,
Real64 const MidFlow,
Real64 const MidResult,
bool const MaxFlowCalc,
bool const MinFlowCalc,
bool const MinFlowResult,
bool const NormFlowCalc)
: MaxFlow(MaxFlow), MinFlow(MinFlow), MaxResult(MaxResult), MinResult(MinResult), MidFlow(MidFlow), MidResult(MidResult),
MaxFlowCalc(MaxFlowCalc), MinFlowCalc(MinFlowCalc), MinFlowResult(MinFlowResult), NormFlowCalc(NormFlowCalc)
{
}
};

struct ZoneEquipControllerProps
{
// Members
Real64 SetPoint; // Desired setpoint;
Real64 MaxSetPoint; // The maximum setpoint; either user input or reset per time step by simulation
Real64 MinSetPoint; // The minimum setpoint; either user input or reset per time step by simulation
Real64 SensedValue; // The sensed control variable of any type
Real64 CalculatedSetPoint; // The Calculated SetPoint or new control actuated value

// Default Constructor
ZoneEquipControllerProps() = default;

// Member Constructor
ZoneEquipControllerProps(Real64 const SetPoint, // Desired setpoint;
Real64 const MaxSetPoint, // The maximum setpoint; either user input or reset per time step by simulation
Real64 const MinSetPoint, // The minimum setpoint; either user input or reset per time step by simulation
Real64 const SensedValue, // The sensed control variable of any type
Real64 const CalculatedSetPoint // The Calculated SetPoint or new control actuated value
)
: SetPoint(SetPoint), MaxSetPoint(MaxSetPoint), MinSetPoint(MinSetPoint), SensedValue(SensedValue), CalculatedSetPoint(CalculatedSetPoint)
{
}
};

// Object Data
static IntervalHalf ZoneInterHalf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false);
static ZoneEquipControllerProps ZoneController(0.0, 0.0, 0.0, 0.0, 0.0);
auto & ZoneInterHalf = state.dataGeneralRoutines->ZoneInterHalf;
auto & ZoneController = state.dataGeneralRoutines->ZoneController;

if (ControlCompTypeNum != 0) {
SimCompNum = ControlCompTypeNum;
Expand Down
60 changes: 60 additions & 0 deletions src/EnergyPlus/GeneralRoutines.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,64 @@ namespace EnergyPlus {
// Forward declarations
struct EnergyPlusData;

struct IntervalHalf
{
// Members
Real64 MaxFlow;
Real64 MinFlow;
Real64 MaxResult;
Real64 MinResult;
Real64 MidFlow;
Real64 MidResult;
bool MaxFlowCalc;
bool MinFlowCalc;
bool MinFlowResult;
bool NormFlowCalc;

// Default Constructor
IntervalHalf() = default;

// Member Constructor
IntervalHalf(Real64 const MaxFlow,
Real64 const MinFlow,
Real64 const MaxResult,
Real64 const MinResult,
Real64 const MidFlow,
Real64 const MidResult,
bool const MaxFlowCalc,
bool const MinFlowCalc,
bool const MinFlowResult,
bool const NormFlowCalc)
: MaxFlow(MaxFlow), MinFlow(MinFlow), MaxResult(MaxResult), MinResult(MinResult), MidFlow(MidFlow), MidResult(MidResult),
MaxFlowCalc(MaxFlowCalc), MinFlowCalc(MinFlowCalc), MinFlowResult(MinFlowResult), NormFlowCalc(NormFlowCalc)
{
}
};

struct ZoneEquipControllerProps
{
// Members
Real64 SetPoint; // Desired setpoint;
Real64 MaxSetPoint; // The maximum setpoint; either user input or reset per time step by simulation
Real64 MinSetPoint; // The minimum setpoint; either user input or reset per time step by simulation
Real64 SensedValue; // The sensed control variable of any type
Real64 CalculatedSetPoint; // The Calculated SetPoint or new control actuated value

// Default Constructor
ZoneEquipControllerProps() = default;

// Member Constructor
ZoneEquipControllerProps(Real64 const SetPoint, // Desired setpoint;
Real64 const MaxSetPoint, // The maximum setpoint; either user input or reset per time step by simulation
Real64 const MinSetPoint, // The minimum setpoint; either user input or reset per time step by simulation
Real64 const SensedValue, // The sensed control variable of any type
Real64 const CalculatedSetPoint // The Calculated SetPoint or new control actuated value
)
: SetPoint(SetPoint), MaxSetPoint(MaxSetPoint), MinSetPoint(MinSetPoint), SensedValue(SensedValue), CalculatedSetPoint(CalculatedSetPoint)
{
}
};

void ControlCompOutput(EnergyPlusData &state,
std::string const &CompName, // the component Name
std::string const &CompType, // Type of component
Expand Down Expand Up @@ -193,6 +251,8 @@ void CalcZoneSensibleOutput(Real64 const MassFlow, // air mass flow rate, {kg/s}
struct GeneralRoutinesData : BaseGlobalStruct {

bool MyICSEnvrnFlag = true;
IntervalHalf ZoneInterHalf = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false};
ZoneEquipControllerProps ZoneController = {0.0, 0.0, 0.0, 0.0, 0.0};

void clear_state() override
{
Expand Down
12 changes: 5 additions & 7 deletions src/EnergyPlus/GeneratorDynamicsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ namespace GeneratorDynamicsManager {
Real64 Pel;
DataGenerators::OperatingMode newOpMode(DataGenerators::OperatingMode::Unassigned);
Real64 SchedVal;
// REAL(r64) :: PelDiff
Real64 ElectLoadForThermalRequest;
bool ConstrainedMaxP; // true if request was altered because of max power limit
bool ConstrainedMinP; // true if request was altered because of min power limit
Expand All @@ -252,12 +251,11 @@ namespace GeneratorDynamicsManager {
bool ConstrainedByPlant; // true if request was altered because of cooling water problem
bool PLRStartUp; // true if subtimestep issue involving startup
bool PLRShutDown;
// INTEGER :: OutletCWnode = 0 ! cooling water outlet node ID
static int InletCWnode(0); // cooling water inlet node ID
static bool InternalFlowControl(false);
static Real64 TcwIn(0.0); // inlet cooling water temperature (C)
static Real64 TrialMdotcw(0.0); // test or estimate of what the plant flows are going to be (kg/s)
static Real64 LimitMinMdotcw(0.0); // lower limit for cooling water flow for generatior operation (kg/s)
auto & InletCWnode = state.dataGenerator->InletCWnode;
auto & InternalFlowControl = state.dataGenerator->InternalFlowControl;
auto & TcwIn = state.dataGenerator->TcwIn;
auto & TrialMdotcw = state.dataGenerator->TrialMdotcw;
auto & LimitMinMdotcw = state.dataGenerator->LimitMinMdotcw;

// inits
PLRforSubtimestepStartUp = 1.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1131,19 +1131,19 @@ void FiniteDiffGroundTempsModel::evaluateSoilRhoCp(Optional<int const> cell, Opt
// Evaluates the soil properties

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static Real64 Theta_ice;
static Real64 Theta_liq;
static Real64 Theta_sat;
static Real64 rho_ice;
static Real64 rho_liq;
static Real64 rhoCp_soil_liq_1;
static Real64 CP_liq;
static Real64 CP_ice;
static Real64 Lat_fus;
static Real64 Cp_transient;
static Real64 rhoCP_soil_liq;
static Real64 rhoCP_soil_transient;
static Real64 rhoCP_soil_ice;
Real64 Theta_ice;
Real64 Theta_liq;
Real64 Theta_sat;
Real64 rho_ice;
Real64 rho_liq;
Real64 rhoCp_soil_liq_1;
Real64 CP_liq;
Real64 CP_ice;
Real64 Lat_fus;
Real64 Cp_transient;
Real64 rhoCP_soil_liq;
Real64 rhoCP_soil_transient;
Real64 rhoCP_soil_ice;
// other variables
Real64 frzAllIce;
Real64 frzIceTrans;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Real64 XingGroundTempsModel::getGroundTemp(EnergyPlusData &state)
// USE STATEMENTS:
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int n;
Real64 static tp(state.dataWeatherManager->NumDaysInYear); // Period of soil temperature cycle
Real64 tp = state.dataWeatherManager->NumDaysInYear; // Period of soil temperature cycle
Real64 Ts_1; // Amplitude of surface temperature
Real64 Ts_2; // Amplitude of surface temperature
Real64 PL_1; // Phase shift of surface temperature
Expand Down
10 changes: 5 additions & 5 deletions src/EnergyPlus/HVACSingleDuctInduc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ namespace HVACSingleDuctInduc {
// These are purposefully not in the header file as an extern variable. No one outside of this should
// use these. They are cleared by clear_state() for use by unit tests, but normal simulations should be unaffected.
// This is purposefully in an anonymous namespace so nothing outside this implementation file can use it.
static bool MyOneTimeFlag(true);
static Array1D_bool MyEnvrnFlag;
static Array1D_bool MySizeFlag;
static Array1D_bool MyPlantScanFlag;
static Array1D_bool MyAirDistInitFlag;
bool MyOneTimeFlag(true);
Array1D_bool MyEnvrnFlag;
Array1D_bool MySizeFlag;
Array1D_bool MyPlantScanFlag;
Array1D_bool MyAirDistInitFlag;
} // namespace

// SUBROUTINE SPECIFICATIONS FOR MODULE HVACSingleDuctInduc:
Expand Down
Loading