From 013c03bd2eaf2b2c456b64656820ed82fa393aa0 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 20:42:58 -0400 Subject: [PATCH 01/11] reduce, unused, clean --- src/EnergyPlus/ScheduleManager.cc | 60 +++++-------------------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 83184a58b25..dd22b14e98b 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -199,8 +199,6 @@ namespace ScheduleManager { bool ErrorsFound(false); bool NumErrorFlag; int SchedTypePtr; - std::string CFld; // Character field for error message - // CHARACTER(len=20) CFld1 ! Character field for error message int NumHrDaySchedules; // Number of "hourly" dayschedules int NumIntDaySchedules; // Number of "interval" dayschedules int NumExternalInterfaceSchedules; // Number of "PtolemyServer ExternalInterface" "compact" Schedules @@ -229,8 +227,6 @@ namespace ScheduleManager { int CurMinute; int MinutesPerItem; int NumExpectedItems; - int MaxNums; - int MaxAlps; int AddWeekSch; int AddDaySch; Array1D_bool AllDays(maxDayTypes); @@ -252,14 +248,12 @@ namespace ScheduleManager { int kdy; // for SCHEDULE:FILE int rowCnt; - std::string subString; int iDay; int hDay; int jHour; int kDayType; Real64 curHrVal; std::string::size_type sPos; - std::string CurrentModuleObject; // for ease in getting objects int MaxNums1; char ColumnSep; bool FileIntervalInterpolated; @@ -276,10 +270,10 @@ namespace ScheduleManager { } state.dataScheduleMgr->ScheduleInputProcessed = true; - MaxNums = 1; // Need at least 1 number because it's used as a local variable in the Schedule Types loop - MaxAlps = 0; + int MaxNums = 1; // Need at least 1 number because it's used as a local variable in the Schedule Types loop + int MaxAlps = 0; - CurrentModuleObject = "ScheduleTypeLimits"; + std::string CurrentModuleObject = "ScheduleTypeLimits"; state.dataScheduleMgr->NumScheduleTypes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); if (state.dataScheduleMgr->NumScheduleTypes > 0) { state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); @@ -531,7 +525,7 @@ namespace ScheduleManager { if (rowCnt != rowLimitCount) { if (rowCnt < rowLimitCount) { ShowSevereError(state, format("{}{}=\"{}\" {} data values read.", RoutineName, CurrentModuleObject, Alphas(1), rowCnt)); - } else if (rowCnt > rowLimitCount) { + } else { ShowSevereError(state, format("{}{}=\"{}\" too many data values read.", RoutineName, CurrentModuleObject, Alphas(1))); } ShowContinueError( @@ -1847,14 +1841,6 @@ namespace ScheduleManager { "{}{}=\"{}\" less than {} hourly values read from file.", RoutineName, CurrentModuleObject, Alphas(1), numHourlyValues)); ShowContinueError(state, format("..Number read={}.", (rowCnt * 60) / MinutesPerItem)); } - if (rowCnt < rowLimitCount) { - ShowWarningError( - state, format("{}{}=\"{}\" less than specified hourly values read from file.", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - format("..Specified Number of Hourly Values={} Actual number of hourly values included={}", - numHourlyValues, - (rowCnt * 60) / MinutesPerItem)); - } // process the data into the normal schedule data structures // note -- schedules are ALWAYS 366 days so some special measures have to be done at 29 Feb "day of year" (60) @@ -3786,7 +3772,6 @@ namespace ScheduleManager { SetScheduleMinMax(state, ScheduleIndex); } MinValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; - MinValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; } // Min/max for schedule has been set. Test. @@ -4133,8 +4118,6 @@ namespace ScheduleManager { // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 MinValue(0.0); // For total minimum Real64 MaxValue(0.0); // For total maximum - bool MinValueOk; - bool MaxValueOk; if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { MinValue = 1.0; @@ -4152,8 +4135,8 @@ namespace ScheduleManager { } // Min/max for schedule has been set. Test. - MinValueOk = true; - MaxValueOk = true; + bool MinValueOk; + bool MaxValueOk; if (exclusiveMin) { MinValueOk = (MinValue > Minimum); @@ -4181,8 +4164,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function checks the indicated schedule values for validity. Uses the ScheduleIndex @@ -4193,29 +4174,8 @@ namespace ScheduleManager { // looks up minimum and maximum values for the schedule and then sets result of function based on // requested minimum/maximum checks. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool CheckDayScheduleValueMinMax; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); // For total minimum + Real64 MinValue = 0.0; // For total minimum bool MinValueOk; if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { @@ -4231,17 +4191,13 @@ namespace ScheduleManager { } // Min/max for schedule has been set. Test. - MinValueOk = true; - if (exclusiveMin) { MinValueOk = (MinValue > Minimum); } else { MinValueOk = (FLT_EPSILON >= Minimum - MinValue); } - CheckDayScheduleValueMinMax = MinValueOk; - - return CheckDayScheduleValueMinMax; + return MinValueOk; } bool HasFractionalScheduleValue(EnergyPlusData &state, int const ScheduleIndex) // Which Schedule being tested From 7d43f6db1611d84dc071b29b85296d0978cf83ab Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 20:52:49 -0400 Subject: [PATCH 02/11] reduce and clean --- src/EnergyPlus/ScheduleManager.cc | 77 ++++--------------------------- 1 file changed, 9 insertions(+), 68 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index dd22b14e98b..b0c6a3b6b65 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -2840,8 +2840,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the internal pointer to Schedule "ScheduleName". @@ -2849,10 +2847,6 @@ namespace ScheduleManager { // Return value int GetScheduleIndex; - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int DayCtr; - int WeekCtr; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { ProcessScheduleInput(state); state.dataScheduleMgr->ScheduleInputProcessed = true; @@ -2863,11 +2857,11 @@ namespace ScheduleManager { if (GetScheduleIndex > 0) { if (!state.dataScheduleMgr->Schedule(GetScheduleIndex).Used) { state.dataScheduleMgr->Schedule(GetScheduleIndex).Used = true; - for (WeekCtr = 1; WeekCtr <= 366; ++WeekCtr) { + for (int WeekCtr = 1; WeekCtr <= 366; ++WeekCtr) { if (state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr) > 0) { state.dataScheduleMgr->WeekSchedule(state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr)).Used = true; - for (DayCtr = 1; DayCtr <= maxDayTypes; ++DayCtr) { + for (int DayCtr = 1; DayCtr <= maxDayTypes; ++DayCtr) { state.dataScheduleMgr ->DaySchedule(state.dataScheduleMgr ->WeekSchedule(state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr)) @@ -2890,45 +2884,20 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN July 2007 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the internal pointer to Schedule "ScheduleName" (actually, it doesn't do that) - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // Return value std::string TypeOfSchedule; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int curSchType; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { ProcessScheduleInput(state); state.dataScheduleMgr->ScheduleInputProcessed = true; } if ((ScheduleIndex > 0) && (ScheduleIndex <= state.dataScheduleMgr->NumSchedules)) { - curSchType = state.dataScheduleMgr->Schedule(ScheduleIndex).ScheduleTypePtr; + int curSchType = state.dataScheduleMgr->Schedule(ScheduleIndex).ScheduleTypePtr; if ((curSchType > 0) && (curSchType <= state.dataScheduleMgr->NumScheduleTypes)) { TypeOfSchedule = state.dataScheduleMgr->ScheduleType(curSchType).Name; } else { @@ -3364,43 +3333,13 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda K Lawrie // DATE WRITTEN January 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine decodes a hhmm date field input as part of the "until" time in a schedule - // representation. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 rRetHH; // real Returned "hour" - Real64 rRetMM; // real Returned "minute" - bool nonIntegral; - std::string hHour; - std::string mMinute; + // This subroutine decodes a hhmm date field input as part of the "until" time in a schedule representation. std::string String = stripped(FieldValue); std::string::size_type const Pos = index(String, ':'); - nonIntegral = false; + bool nonIntegral = false; if (Pos == std::string::npos) { ShowSevereError(state, format("ProcessScheduleInput: DecodeHHMMField, Invalid \"until\" field submitted (no : separator in hh:mm)={}", @@ -3412,7 +3351,7 @@ namespace ScheduleManager { RetHH = 0; } else { bool error = false; - rRetHH = Util::ProcessNumber(String.substr(0, Pos), error); + Real64 rRetHH = Util::ProcessNumber(String.substr(0, Pos), error); RetHH = int(rRetHH); if (double(RetHH) != rRetHH || error || rRetHH < 0.0) { if (double(RetHH) != rRetHH && rRetHH >= 0.0) { @@ -3435,7 +3374,7 @@ namespace ScheduleManager { String.erase(0, Pos + 1); bool error = false; - rRetMM = Util::ProcessNumber(String, error); + Real64 rRetMM = Util::ProcessNumber(String, error); RetMM = int(rRetMM); if (double(RetMM) != rRetMM || error || rRetMM < 0.0) { if (double(RetMM) != rRetMM && rRetMM >= 0.0) { @@ -3456,6 +3395,8 @@ namespace ScheduleManager { } if (nonIntegral) { + std::string hHour; // these haven't been initialized? + std::string mMinute; ShowContinueError(state, format("Until value to be used will be: {:2.2F}:{:2.2F}", hHour, mMinute)); } if (interpolationKind == ScheduleInterpolation::No) { From 00365e5bf8f1fc2dcce79db1631d8498507845f6 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 20:58:45 -0400 Subject: [PATCH 03/11] reduce and clean --- src/EnergyPlus/ScheduleManager.cc | 53 ++++++------------------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index b0c6a3b6b65..83bfd4cc095 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -3463,7 +3463,6 @@ namespace ScheduleManager { // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int DayT; bool OneValid; bool DupAssignment; @@ -3612,7 +3611,7 @@ namespace ScheduleManager { OneValid = true; } if (has(ForDayField, "ALLOTHERDAY")) { - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { + for (int DayT = 1; DayT <= maxDayTypes; ++DayT) { if (AlReady(DayT)) continue; TheseDays(DayT) = true; AlReady(DayT) = true; @@ -4237,43 +4236,13 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function returns the minimum value used by a schedule over - // the entire year. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - Real64 MinimumValue; // Minimum value for schedule - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + // This function returns the minimum value used by a schedule over the entire year. // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); - Real64 MaxValue(0.0); - int WkSch; - int DayT; - int Loop; + Real64 MinValue = 0.0; + Real64 MaxValue = 0.0; if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { MinValue = 1.0; @@ -4287,10 +4256,10 @@ namespace ScheduleManager { if (ScheduleIndex > 0) { if (!state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet) { // Set Minimum/Maximums for this schedule - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); + int WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); MinValue = minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); MaxValue = maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - for (DayT = 2; DayT <= maxDayTypes; ++DayT) { + for (int DayT = 2; DayT <= maxDayTypes; ++DayT) { MinValue = min(MinValue, minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); @@ -4299,10 +4268,10 @@ namespace ScheduleManager { maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); } int prevWkSch = -999; // set to a value that would never occur - for (Loop = 2; Loop <= 366; ++Loop) { + for (int Loop = 2; Loop <= 366; ++Loop) { WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); if (WkSch != prevWkSch) { // skip if same as previous week (very common) - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { + for (int DayT = 1; DayT <= maxDayTypes; ++DayT) { MinValue = min( MinValue, minval( @@ -4321,12 +4290,10 @@ namespace ScheduleManager { } // Min/max for schedule has been set. - MinimumValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; + return state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; } else { - MinimumValue = MinValue; + return MinValue; } - - return MinimumValue; } Real64 GetScheduleMaxValue(EnergyPlusData &state, int const ScheduleIndex) // Which Schedule being tested From e1dc26df2fec3513f3b0088a8c666fba7f0dfd31 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 21:05:07 -0400 Subject: [PATCH 04/11] reduce and clean --- src/EnergyPlus/ScheduleManager.cc | 50 ++++++------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 83bfd4cc095..9688424a1dd 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -4301,43 +4301,13 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function returns the maximum value used by a schedule over - // the entire year. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - Real64 MaximumValue; // Maximum value for schedule - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + // This function returns the maximum value used by a schedule over the entire year. // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); - Real64 MaxValue(0.0); - int WkSch; - int DayT; - int Loop; + Real64 MinValue = 0.0; + Real64 MaxValue = 0.0; if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { MinValue = 1.0; @@ -4351,10 +4321,10 @@ namespace ScheduleManager { if (ScheduleIndex > 0) { if (!state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet) { // Set Minimum/Maximums for this schedule - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); + int WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); MinValue = minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); MaxValue = maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - for (DayT = 2; DayT <= maxDayTypes; ++DayT) { + for (int DayT = 2; DayT <= maxDayTypes; ++DayT) { MinValue = min(MinValue, minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); @@ -4363,10 +4333,10 @@ namespace ScheduleManager { maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); } int prevWkSch = -999; // set to a value that would never occur - for (Loop = 2; Loop <= 366; ++Loop) { + for (int Loop = 2; Loop <= 366; ++Loop) { WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); if (WkSch != prevWkSch) { // skip if same as previous week (very common) - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { + for (int DayT = 1; DayT <= maxDayTypes; ++DayT) { MinValue = min( MinValue, minval( @@ -4386,12 +4356,10 @@ namespace ScheduleManager { // Min/max for schedule has been set. - MaximumValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MaxValue; + return state.dataScheduleMgr->Schedule(ScheduleIndex).MaxValue; } else { - MaximumValue = MaxValue; + return MaxValue; } - - return MaximumValue; } std::pair getScheduleMinMaxByDayType(EnergyPlusData &state, int const ScheduleIndex, DayTypeGroup const days) From db632fc9982f2fb76c326e4d87245963803b73e6 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 21:13:51 -0400 Subject: [PATCH 05/11] reduce, clean and shadow --- src/EnergyPlus/ScheduleManager.cc | 44 +++++++------------------------ 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 9688424a1dd..4bd2f466af7 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -3430,44 +3430,18 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine processes a field "For: day types" and returns // those day types (can be multiple) from field. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Argument array dimensioning EP_SIZE_CHECK(TheseDays, maxDayTypes); EP_SIZE_CHECK(AlReady, maxDayTypes); - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool OneValid; - bool DupAssignment; - - OneValid = false; - DupAssignment = false; + bool OneValid = false; + bool DupAssignment = false; // Just test for specific days if (has(ForDayField, "WEEKDAY")) { TheseDays({2, 6}) = true; @@ -3650,19 +3624,19 @@ namespace ScheduleManager { Real64 MinValue = daySched.TSValMin; Real64 MaxValue = daySched.TSValMax; for (int DayT = 2; DayT <= maxDayTypes; ++DayT) { - auto const &daySched = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(DayT)); - MinValue = min(MinValue, daySched.TSValMin); - MaxValue = max(MaxValue, daySched.TSValMax); + auto const &daySched2 = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(DayT)); + MinValue = min(MinValue, daySched2.TSValMin); + MaxValue = max(MaxValue, daySched2.TSValMax); } int prevWkSch = -999; // set to a value that would never occur for (int Loop = 2; Loop <= 366; ++Loop) { int WkSch = sched.WeekSchedulePointer(Loop); if (WkSch != prevWkSch) { // skip if same as previous week (very common) - auto const &wkSched = state.dataScheduleMgr->WeekSchedule(WkSch); + auto const &wkSched2 = state.dataScheduleMgr->WeekSchedule(WkSch); for (int DayT = 1; DayT <= maxDayTypes; ++DayT) { - auto const &daySched = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(DayT)); - MinValue = min(MinValue, daySched.TSValMin); - MaxValue = max(MaxValue, daySched.TSValMax); + auto const &daySched3 = state.dataScheduleMgr->DaySchedule(wkSched2.DaySchedulePointer(DayT)); + MinValue = min(MinValue, daySched3.TSValMin); + MaxValue = max(MaxValue, daySched3.TSValMax); } prevWkSch = WkSch; } From e4c5a04abffe8686236e81314ae37c6e2f186d70 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 21:42:43 -0400 Subject: [PATCH 06/11] const arg and clean --- src/EnergyPlus/ScheduleManager.cc | 31 +++---------------------------- src/EnergyPlus/ScheduleManager.hh | 2 +- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 4bd2f466af7..97309dd43ec 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -3050,14 +3050,12 @@ namespace ScheduleManager { void ExternalInterfaceSetSchedule(EnergyPlusData &state, int &ScheduleIndex, - Real64 &Value // The new value for the schedule + Real64 const Value // The new value for the schedule ) { // FUNCTION INFORMATION: // AUTHOR Michael Wetter // DATE WRITTEN February 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine sets all values of the schedule referenced by 'ScheduleIndex' @@ -3067,32 +3065,9 @@ namespace ScheduleManager { // for supervisory controls or internal gains obtained from real-time occupancy // measurements. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int TS; // Counter for Num Of Time Steps in Hour - int Hr; // Hour Counter - // Assign the value of the variable - for (Hr = 1; Hr <= 24; ++Hr) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (int Hr = 1; Hr <= 24; ++Hr) { + for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { state.dataScheduleMgr->DaySchedule(ScheduleIndex).TSValue(TS, Hr) = Value; } } diff --git a/src/EnergyPlus/ScheduleManager.hh b/src/EnergyPlus/ScheduleManager.hh index 72343930f4a..1ff21fadb33 100644 --- a/src/EnergyPlus/ScheduleManager.hh +++ b/src/EnergyPlus/ScheduleManager.hh @@ -253,7 +253,7 @@ namespace ScheduleManager { void ExternalInterfaceSetSchedule(EnergyPlusData &state, int &ScheduleIndex, - Real64 &Value // The new value for the schedule + Real64 const Value // The new value for the schedule ); void ProcessIntervalFields(EnergyPlusData &state, From 72c2e346cea07b0b6d9ea5c598b2f69f19578374 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 21:46:53 -0400 Subject: [PATCH 07/11] unused, const and clean --- src/EnergyPlus/ScheduleManager.cc | 39 +++---------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 97309dd43ec..057cf26ef23 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -223,7 +223,6 @@ namespace ScheduleManager { int NumFields; int SCount; // LOGICAL RptSchedule - int RptLevel; int CurMinute; int MinutesPerItem; int NumExpectedItems; @@ -2316,7 +2315,6 @@ namespace ScheduleManager { NumFields = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); // RptSchedule=.FALSE. - RptLevel = 1; for (Count = 1; Count <= NumFields; ++Count) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, Status); @@ -3720,7 +3718,7 @@ namespace ScheduleManager { MinValueOk = (Minimum == 0.0); MaxValueOk = (Maximum == 0.0); } else if (schedNum > 0 && schedNum <= state.dataScheduleMgr->NumSchedules) { - auto &sched = state.dataScheduleMgr->Schedule(schedNum); + auto const &sched = state.dataScheduleMgr->Schedule(schedNum); if (!sched.MaxMinSet) { SetScheduleMinMax(state, schedNum); } @@ -4359,7 +4357,7 @@ namespace ScheduleManager { auto &weekSch = state.dataScheduleMgr->WeekSchedule(WkSch); for (int jType = 1; jType <= maxDayTypes; ++jType) { if (dayTypeFilter[jType - 1]) { - auto &daySch = state.dataScheduleMgr->DaySchedule(weekSch.DaySchedulePointer(jType)); + auto const &daySch = state.dataScheduleMgr->DaySchedule(weekSch.DaySchedulePointer(jType)); // use precalcuated min and max from SetScheduleMinMax MinValue = min(MinValue, daySch.TSValMin); MaxValue = max(MaxValue, daySch.TSValMax); @@ -4700,42 +4698,11 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Greg Stark // DATE WRITTEN September 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the number of schedules. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - int NumberOfSchedules; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - NumberOfSchedules = state.dataScheduleMgr->NumSchedules; - - return NumberOfSchedules; + return state.dataScheduleMgr->NumSchedules; } } // namespace ScheduleManager From 895df00cd9baab69abf319a57b9b35447e5f56e7 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 22:01:27 -0400 Subject: [PATCH 08/11] const --- src/EnergyPlus/ScheduleManager.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/ScheduleManager.hh b/src/EnergyPlus/ScheduleManager.hh index 1ff21fadb33..009aa5d5966 100644 --- a/src/EnergyPlus/ScheduleManager.hh +++ b/src/EnergyPlus/ScheduleManager.hh @@ -380,7 +380,7 @@ namespace ScheduleManager { bool const isItLeapYear // true if it is a leap year containing February 29 ); - int GetNumberOfSchedules(EnergyPlusData &state); + int GetNumberOfSchedules(EnergyPlusData const &state); } // namespace ScheduleManager From 4b723497f5f127a118cf482c0b38517ae4be7484 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 22:40:47 -0400 Subject: [PATCH 09/11] const arg --- src/EnergyPlus/ScheduleManager.cc | 254 ++---------------------------- src/EnergyPlus/ScheduleManager.hh | 2 +- 2 files changed, 10 insertions(+), 246 deletions(-) diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 057cf26ef23..b11ffe98c98 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -151,7 +151,6 @@ namespace ScheduleManager { // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 // MODIFIED Rui Zhang February 2010 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine processes the schedules input for EnergyPlus. @@ -2663,7 +2662,6 @@ namespace ScheduleManager { // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 // MODIFIED August 2011; adapt Autodesk changes (time reduction) - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the hourly schedule value for the current day. @@ -2673,29 +2671,6 @@ namespace ScheduleManager { // input will equate to 0 indices in arrays -- which has been set up to return legally with // 0.0 values. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - // Checking if valid index is passed is necessary if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { return 1.0; @@ -2714,8 +2689,6 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN August 2011; adapted from Autodesk (time reduction) - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine calculates all the scheduled values as a time reduction measure and @@ -2723,28 +2696,7 @@ namespace ScheduleManager { // METHODOLOGY EMPLOYED: // Use internal Schedule data structure to calculate current value. Note that missing values in - // input will equate to 0 indices in arrays -- which has been set up to return legally with - // 0.0 values. - - // REFERENCES: - // na - - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + // input will equate to 0 indices in arrays -- which has been set up to return legally with 0.0 values. if (!state.dataScheduleMgr->ScheduleInputProcessed) { ProcessScheduleInput(state); @@ -2912,8 +2864,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN August 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the internal pointer to Day Schedule "ScheduleName". @@ -2947,8 +2897,6 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine returns an entire day's worth of schedule values. @@ -3005,38 +2953,10 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN August 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine returns an entire day's worth of schedule values for a specified Day Schedule Index item. - // METHODOLOGY EMPLOYED: - // Use internal data to fill DayValues array. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Argument array dimensioning - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - if (!state.dataScheduleMgr->ScheduleInputProcessed) { ProcessScheduleInput(state); state.dataScheduleMgr->ScheduleInputProcessed = true; @@ -3087,38 +3007,14 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR // DATE WRITTEN - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine processes the "interval" fields with/without optional "until" in front of - // time (hh:mm). - - // METHODOLOGY EMPLOYED: - // na. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na + // This subroutine processes the "interval" fields with/without optional "until" in front of time (hh:mm). // Argument array dimensioning MinuteValue.dim(60, 24); SetMinuteValue.dim(60, 24); - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Count; std::string::size_type Pos; @@ -3126,22 +3022,17 @@ namespace ScheduleManager { int MMField; int Hr; int Min; - int SHr; // starting hour - int SMin; // starting minute - int EHr; // ending hour - int EMin; // ending minute - std::string::size_type sFld; int totalMinutes; Real64 incrementPerMinute; Real64 curValue; MinuteValue = 0.0; SetMinuteValue = false; - SHr = 1; - SMin = 1; - EHr = 0; - EMin = 0; - sFld = 0; + int SHr = 1; + int SMin = 1; + int EHr = 0; + int EMin = 0; + std::string::size_type sFld = 0; Real64 StartValue = 0; Real64 EndValue = 0; @@ -3628,8 +3519,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function checks the indicated schedule values for validity. Uses the ScheduleIndex @@ -3822,8 +3711,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN November 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function checks the indicated schedule value for validity. Uses the ScheduleIndex @@ -3833,27 +3720,9 @@ namespace ScheduleManager { // This routine is best used with "discrete" schedules. The routine must traverse all values // in the schedule and compares by equality. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckScheduleValue; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: int Loop; // Loop Control variable int DayT; // Day Type Loop control @@ -3895,8 +3764,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN November 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function checks the indicated schedule value for validity. Uses the ScheduleIndex @@ -3906,27 +3773,9 @@ namespace ScheduleManager { // This routine is best used with "discrete" schedules. The routine must traverse all values // in the schedule and compares by equality. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckScheduleValue; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: int Loop; // Loop Control variable int DayT; // Day Type Loop control @@ -3969,8 +3818,6 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function checks the indicated schedule values for validity. Uses the ScheduleIndex @@ -3981,27 +3828,9 @@ namespace ScheduleManager { // looks up minimum and maximum values for the schedule and then sets result of function based on // requested minimum/maximum checks. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value bool CheckDayScheduleValueMinMax; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 MinValue(0.0); // For total minimum Real64 MaxValue(0.0); // For total maximum @@ -4092,37 +3921,13 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function returns true if the schedule contains fractional - // values [>0, <1]. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na + // This function returns true if the schedule contains fractional values [>0, <1]. // Return value bool HasFractions; // True if the schedule has fractional values - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: int WkSch; int DayT; @@ -4394,39 +4199,13 @@ namespace ScheduleManager { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the schedule name from the Schedule Index. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Return value std::string ScheduleName; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - if (!state.dataScheduleMgr->ScheduleInputProcessed) { ProcessScheduleInput(state); state.dataScheduleMgr->ScheduleInputProcessed = true; @@ -4450,8 +4229,6 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts the proper current schedule values into the "reporting" @@ -4486,8 +4263,6 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN April 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // In response to CR7498, report orphan (unused) schedule items. @@ -4623,13 +4398,9 @@ namespace ScheduleManager { // AUTHOR Linda K. Lawrie // DATE WRITTEN August 2006 // MODIFIED September 2012; Glazer - CR8849 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function returns the "average" hours per week for a schedule over - // the entire year. - - // Return value + // This function returns the "average" hours per week for a schedule over the entire year. Real64 WeeksInYear; @@ -4695,13 +4466,6 @@ namespace ScheduleManager { int GetNumberOfSchedules(EnergyPlusData &state) { - // FUNCTION INFORMATION: - // AUTHOR Greg Stark - // DATE WRITTEN September 2008 - - // PURPOSE OF THIS FUNCTION: - // This function returns the number of schedules. - return state.dataScheduleMgr->NumSchedules; } diff --git a/src/EnergyPlus/ScheduleManager.hh b/src/EnergyPlus/ScheduleManager.hh index 009aa5d5966..1ff21fadb33 100644 --- a/src/EnergyPlus/ScheduleManager.hh +++ b/src/EnergyPlus/ScheduleManager.hh @@ -380,7 +380,7 @@ namespace ScheduleManager { bool const isItLeapYear // true if it is a leap year containing February 29 ); - int GetNumberOfSchedules(EnergyPlusData const &state); + int GetNumberOfSchedules(EnergyPlusData &state); } // namespace ScheduleManager From 6d509519c97ccd101d61d9932e38905d29e060af Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 23:38:13 -0400 Subject: [PATCH 10/11] reduce --- src/EnergyPlus/SimAirServingZones.cc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index 5a8ccc20e53..3edf04c50b6 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -172,7 +172,7 @@ void ManageAirLoops(EnergyPlusData &state, // Call the AirLoop Simulation if (state.dataGlobal->SysSizingCalc) { SizeAirLoops(state); - } else if (!state.dataGlobal->SysSizingCalc) { + } else { SimAirLoops(state, FirstHVACIteration, SimZoneEquipment); } @@ -285,16 +285,15 @@ void GetAirPathData(EnergyPlusData &state) int NumParams; int MaxNumbers; int MaxAlphas; - Array1D_string Alphas; // alpha strings returned by GetObjectItem - Array1D_string cAlphaFields; // Alpha field names - Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. - std::string CurrentModuleObject; // Object type for getting and error messages - int NumNodes; // number of nodes returned by GetNodeNums - Array1D_int NodeNums; // node numbers returned by GetNodeNums - int NodeNum; // a node number - int AirSysNum; // an air system (air loop) number - int OANum; // outside air system index - int NumInList; + Array1D_string Alphas; // alpha strings returned by GetObjectItem + Array1D_string cAlphaFields; // Alpha field names + Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. + std::string CurrentModuleObject; // Object type for getting and error messages + int NumNodes; // number of nodes returned by GetNodeNums + Array1D_int NodeNums; // node numbers returned by GetNodeNums + int NodeNum; // a node number + int AirSysNum; // an air system (air loop) number + int OANum; // outside air system index int OAMixNum; // outside air mixer index int IOStat; // status number returned by GetObjectItem int NumControllers; // number of controllers @@ -1348,7 +1347,7 @@ void GetAirPathData(EnergyPlusData &state) OANum = GetNumOASystems(state); for (int OASysNum = 1; OASysNum <= OANum; ++OASysNum) { - NumInList = GetOACompListNumber(state, OASysNum); + int NumInList = GetOACompListNumber(state, OASysNum); for (int OACompNum = 1; OACompNum <= NumInList; ++OACompNum) { CompType_Num = GetOACompTypeNum(state, OASysNum, OACompNum); if (CompType_Num == CompType::WaterCoil_DetailedCool || CompType_Num == CompType::WaterCoil_SimpleHeat || From 8a9483a3b9b6a77260b2f6f77b2c977f3397ba6e Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 21 Sep 2024 23:50:11 -0400 Subject: [PATCH 11/11] reduce and clean --- src/EnergyPlus/SimAirServingZones.cc | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index 3edf04c50b6..37bf2c27046 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -128,8 +128,7 @@ namespace EnergyPlus::SimAirServingZones { // air systems. // METHODOLOGY EMPLOYED: -// Successive iteration forward from the return air inlet -// to the supply air outlets. +// Successive iteration forward from the return air inlet to the supply air outlets. using namespace DataLoopNode; using namespace DataAirLoop; @@ -2778,7 +2777,6 @@ void SolveAirLoopControllers( // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: // RE-ENGINEERED: This is reengineered code that used to be in SimAirLoops() // PURPOSE OF THIS SUBROUTINE: @@ -2792,8 +2790,6 @@ void SolveAirLoopControllers( // (2) The controllers and their actions are simulated. // (3) Steps 2 and 3 are repeated until the control criteria are satisfied. - // REFERENCES: None - // Using/Aliasing using namespace DataHVACControllers; using General::CreateSysTimeIntervalString; @@ -2813,10 +2809,6 @@ void SolveAirLoopControllers( // Maximum iterations of an air system/controllers simulation sequence int constexpr MaxIter(50); - // INTERFACE BLOCK DEFINITIONS: None - - // DERIVED TYPE DEFINITIONS: None - // SUBROUTINE LOCAL VARIABLE DEFINITIONS // TRUE if controller supports speculative warm restart bool AllowWarmRestartFlag; @@ -3224,7 +3216,6 @@ void ReSolveAirLoopControllers( // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: // RE-ENGINEERED: This is new code // PURPOSE OF THIS SUBROUTINE: @@ -3336,8 +3327,6 @@ void SimAirLoopComponents(EnergyPlusData &state, // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: - // RE-ENGINEERED: // PURPOSE OF THIS SUBROUTINE: // This simulates all components on a particular air loop in the primary air system. @@ -3353,16 +3342,9 @@ void SimAirLoopComponents(EnergyPlusData &state, // Sets duct type of current branch to CurDuctType defined in MODULE DataSizing // Upon exiting, resets both counters to 0. - // SUBROUTINE LOCAL VARIABLE DEFINITIONS: None - int BranchNum; // Branch DO loop index - int CompNum; // Component DO loop index - // std::string CompType; // Component type - // std::string CompName; // Component name - CompType CompType_Num; // Numeric equivalent for CompType - auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; - for (BranchNum = 1; BranchNum <= PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { // loop over all branches in air system + for (int BranchNum = 1; BranchNum <= PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { // loop over all branches in air system UpdateBranchConnections(state, AirLoopNum, BranchNum, BeforeBranchSim); @@ -3370,10 +3352,10 @@ void SimAirLoopComponents(EnergyPlusData &state, state.dataSize->CurDuctType = PrimaryAirSystems(AirLoopNum).Branch(BranchNum).DuctType; // Loop over components in branch - for (CompNum = 1; CompNum <= PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { + for (int CompNum = 1; CompNum <= PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { // CompType = PrimaryAirSystem( AirLoopNum ).Branch( BranchNum ).Comp( CompNum ).TypeOf; // CompName = PrimaryAirSystem( AirLoopNum ).Branch( BranchNum ).Comp( CompNum ).Name; - CompType_Num = PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompType_Num; + CompType CompType_Num = PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompType_Num; // Simulate each component on PrimaryAirSystem(AirLoopNum)%Branch(BranchNum)%Name SimAirLoopComponent(state,