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

Round2 init state use #10662

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion src/EnergyPlus/CurveManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ namespace Curve {
bool GetInputErrorsFound = false;

GetCurveInputData(state, GetInputErrorsFound);
state.dataCurveManager->GetCurvesInputFlag = false;

if (GetInputErrorsFound) {
ShowFatalError(state, "GetCurveInput: Errors found in getting Curve Objects. Preceding condition(s) cause termination.");
Expand Down Expand Up @@ -610,6 +609,8 @@ namespace Curve {
int IOStatus; // Used in GetObjectItem
std::string CurrentModuleObject; // for ease in renaming.

if (!state.dataCurveManager->GetCurvesInputFlag) return;
state.dataCurveManager->GetCurvesInputFlag = false;
Copy link
Contributor Author

@rraustad rraustad Aug 16, 2024

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

😆 🤣 😄 This is excellent @rraustad !

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow.

// Find the number of each type of curve (note: Current Module object not used here, must rename manually)

int const NumBiQuad = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Curve:Biquadratic");
Expand Down
4 changes: 4 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ void EnergyPlusData::clear_state()
void EnergyPlusData::init_state(EnergyPlusData &state)
{
if (this->init_state_called) return;

state.dataGlobal->InputsFlag = true;
this->init_state_called = true;
// The order in which we do this matters. We're going to try to
// do this in "topological" order meaning the first to go are the
Expand Down Expand Up @@ -826,6 +828,8 @@ void EnergyPlusData::init_state(EnergyPlusData &state)
this->dataZoneEquipmentManager->init_state(state);
this->dataZonePlenum->init_state(state);
this->dataZoneTempPredictorCorrector->init_state(state);

state.dataGlobal->InputsFlag = false;
}

} // namespace EnergyPlus
2 changes: 2 additions & 0 deletions src/EnergyPlus/DataErrorTracking.hh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ struct ErrorTrackingData : BaseGlobalStruct
int NumRecurringErrors = 0; // Number of stored recurring error messages
int TotalSevereErrors = 0; // Counter
int TotalWarningErrors = 0; // Counter
int TotalSevereErrorsDuringInputs = 0; // Counter
int TotalWarningErrorsDuringInputs = 0; // Counter
int TotalSevereErrorsDuringWarmup = 0; // Counter
int TotalWarningErrorsDuringWarmup = 0; // Counter
int TotalSevereErrorsDuringSizing = 0; // Counter
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/DataGlobals.hh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct DataGlobal : BaseGlobalStruct
int numSpaceTypes = 0; // Number of unique space types
int TimeStep = 0; // Counter for time steps (fractional hours)
Real64 TimeStepZone = 0.0; // Zone time step in fractional hours
bool InputsFlag = false; // True during the init_state portion of a simulation
bool WarmupFlag = false; // True during the warmup portion of a simulation
Int64 StdOutputRecordCount = 0; // Count of Standard output records
Int64 StdMeterRecordCount = 0; // Count of Meter output records
Expand Down
8 changes: 6 additions & 2 deletions src/EnergyPlus/UtilityRoutines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,10 @@ int AbortEnergyPlus(EnergyPlusData &state)
CloseMiscOpenFiles(state);
NumWarnings = fmt::to_string(state.dataErrTracking->TotalWarningErrors);
NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors);
NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup);
NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup);
NumWarningsDuringWarmup =
fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputs);
NumSevereDuringWarmup =
fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputs);
NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing);
NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing);

Expand Down Expand Up @@ -928,6 +930,7 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt
}

++state.dataErrTracking->TotalSevereErrors;
if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalSevereErrorsDuringInputs;
if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation &&
!state.dataErrTracking->AbortProcessing)
++state.dataErrTracking->TotalSevereErrorsDuringWarmup;
Expand Down Expand Up @@ -1129,6 +1132,7 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op
}

++state.dataErrTracking->TotalWarningErrors;
if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalWarningErrorsDuringInputs;
if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation &&
!state.dataErrTracking->AbortProcessing)
++state.dataErrTracking->TotalWarningErrorsDuringWarmup;
Expand Down