@@ -1660,8 +1660,8 @@ LOCAL void FC NEAR doIvlAccum()
16601660 RLUP ( RSysResR, pRSR) // loop RSYS simulation results incl sum_of.
16611661 { pRSR->H .rsr_Accum ( &pRSR->D , Top.isBegDay , Top.isEndDay ); // accumulate hour results to day. local
16621662#if 0
1663- if (pRSR->ss < RSysResR.n) // if not the sum record (last)
1664- pRSR->H.rsr_Accum( &allRsysRes->H, pRSR->ss==1, pRSR->ss==RsR.n); // also accumulate each hour to sum_of_RSYS
1663+ 0 if (pRSR->ss < RSysResR.n) // if not the sum record (last)
1664+ 0 pRSR->H.rsr_Accum( &allRsysRes->H, pRSR->ss==1, pRSR->ss==RsR.n); // also accumulate each hour to sum_of_RSYS
16651665#endif
16661666 }
16671667
@@ -1983,15 +1983,17 @@ LOCAL void FC NEAR accumAhr( // Accumulate air handler simulation results
19831983LOCAL void FC NEAR mtrsAccum ( // Accumulate metered energy use results: add interval to next, + tot and sum.
19841984
19851985 IVLCH ivl, // destination interval: day/month/year. Accumulates from hour/day/month. Not Top.ivl!
1986- int firstflg ) // If TRUE, destination will be initialized before values are accumulated into it
1987-
1986+ int firstflg) // If TRUE, destination will be initialized before values are accumulated into it
19881987{
19891988 MTR* mtr; // a meter record
19901989 int firstRec = 1 ;
1991- RLUP ( MtrB, mtr) // loop (good) meter records
1992- { int bTrc = 0 ; // strMatch( mtr->name, "ElecMtrInitNo");
1990+ RLUP ( MtrB, mtr) // loop (good) meter records
1991+ {
1992+ #if defined( _DEBUG)
1993+ int bTrc = 0 ; // strMatch( mtr->name, "ElecMtrInitNo");
19931994 if (bTrc)
19941995 printf ( " \n Accum Day=%d hr=%d mtr='%s' ivl=%d ff=%d" , Top.jDay , Top.iHr , mtr->name , ivl, firstflg);
1996+ #endif
19951997
19961998 MTR_IVL_SUB* mtrSub2 = &mtr->Y + (ivl - C_IVLCH_Y); // point destination meter interval substruct for interval
19971999 // ASSUMES MTR interval members ordered like DTIVLCH choices
@@ -2002,37 +2004,20 @@ LOCAL void FC NEAR mtrsAccum( // Accumulate metered energy use results: add int
20022004 if (ivl==C_IVLCH_D)
20032005 {
20042006 // compute hour's total load in each record. .allEU then propogates to D, M, Y.
2005- // / sum members .clg .. usr2 to .allEU, exclude .pv and .bt
2007+ // sum members .clg .. usr2 to .allEU, exclude .pv and .bt
20062008 mtrSub1->allEU = VSum<float ,double >( &mtrSub1->clg , NENDUSES-2 );
20072009
20082010 // compute sum of uses record (last record). .sum record then propogates to D, M, Y.
20092011 if (mtr->ss < MtrB.n ) // don't add the sum record into itself
20102012 { MTR_IVL_SUB& mtrSum = MtrB.p [MtrB.n ].H ;
2011- mtrSum.mtr_Accum1 ( mtrSub1, ivl, 0 +(firstflg!=0 ));
2012- #if 0
2013- if (firstRec)
2014- memcpy( &mtrSum, mtrSub1, sizeof(MTR_IVL_SUB)); // copy first record
2015- else // additional records: accumulate ...
2016- mtrSum.mtr_Accum1( mtrSub1, ivl); // treatment of demand not necessarily sensible.
2017- #endif
2013+ mtrSum.mtr_Accum1 ( mtrSub1, ivl, 0 +(firstRec!=0 ));
20182014 }
20192015 firstRec = 0 ;
20202016 }
20212017
20222018 // accumulate: copy on first call (in lieu of 0'ing destination).
20232019 // Note: doHourGains 0's MTR hour info at start hour.
2024- #if 1
20252020 mtrSub2->mtr_Accum1 ( mtrSub1, ivl, 0 + (firstflg!=0 ));
2026- #else
2027- if (firstflg) // if first call for destination interval
2028- { // copy selected members
2029- VCopy( &mtrSub2->clg, NENDUSES-2, &mtrSub1->clg);
2030- mtrSub2->pv = mtrSub1->pv;
2031- mtrSub2->allEU = mtrSub1->allEU;
2032- }
2033- else // additional calls in interval use accumulation subr (next)
2034- mtrSub2->mtr_Accum1( mtrSub1, ivl); // adds up uses w/o bt or tot
2035- #endif
20362021 }
20372022
20382023 // DHWMTRs
@@ -2050,9 +2035,11 @@ LOCAL void FC NEAR mtrsFinalize( // Finalize meters (after post-stage calcs e.g
20502035 int firstRec = 1 ;
20512036 RLUP ( MtrB, mtr) // loop (good) meter records
20522037 {
2038+ #if defined( _DEBUG)
20532039 int bTrc = 0 ; // strMatch( mtr->name, "ElecMtrInitNo");
20542040 if (bTrc)
20552041 printf ( " \n Final Day=%d hr=%d mtr='%s' ivl=%d ff=%d" , Top.jDay , Top.iHr , mtr->name , ivl, firstflg);
2042+ #endif
20562043
20572044 MTR_IVL_SUB* mtrSub2 = &mtr->Y + (ivl - C_IVLCH_Y); // point destination meter interval substruct for interval
20582045 // ASSUMES MTR interval members ordered like DTIVLCH choices
@@ -2113,17 +2100,10 @@ LOCAL void FC NEAR mtrsFinalize( // Finalize meters (after post-stage calcs e.g
21132100
21142101#endif
21152102
2116- // accumulate: copy on first call (in lieu of 0'ing destination). Note: doHourGains 0's MTR hour info at start hour.
2117- # if 1
2118- // accumulate to next level, handles dmd
2103+ // accumulate: copy on first call (in lieu of 0'ing destination).
2104+ // handles dmd
2105+ // Note: doHourGains 0's MTR hour info at start hour.
21192106 mtrSub2->mtr_Accum1 ( mtrSub1, ivl, 2 + (firstflg!=0 ));
2120- #else
2121- if (firstflg) // if first call for destination interval
2122- memcpy( mtrSub2, mtrSub1, sizeof(MTR_IVL_SUB) ); // copy whole subrecord
2123- else // additional calls in interval use accumulation subr (next)
2124- mtrSub2->mtr_Accum1( mtrSub1, ivl, 2); // finalizes totals, handles dmd
2125- #endif
2126-
21272107
21282108#if defined( _DEBUG)
21292109 if (1 || bTrc)
@@ -2147,7 +2127,6 @@ void MTR_IVL_SUB::mtr_Accum1( // accumulate of one submeter-interval into anoth
21472127 // else end-of-calc
21482128// accums/copies mtrSub1 into *this
21492129{
2150- #if 1
21512130 bool bCopy = (options & 1 ) != 0 ;
21522131 bool bFinalize = (options & 2 ) != 0 ;
21532132
@@ -2171,17 +2150,7 @@ void MTR_IVL_SUB::mtr_Accum1( // accumulate of one submeter-interval into anoth
21712150 { // after load management (e.g. battery)
21722151 // handle all mbrs w/ *p variability
21732152 if (bCopy)
2174- { memcpy ( this , mtrSub1, sizeof ( MTR_IVL_SUB));
2175-
2176- #if 0
2177- tot = mtrSub1->tot;
2178- bt = mtrSub1->bt;
2179- cost = mtrSub1->cost;
2180- dmd = mtrSub1->dmd;
2181- dmdCost = mtrSub1->dmdCost;
2182- dmdShoy = mtrSub1->dmdShoy;
2183- #endif
2184- }
2153+ memcpy ( this , mtrSub1, sizeof ( MTR_IVL_SUB));
21852154 else
21862155 { tot += mtrSub1->tot ;
21872156 bt += mtrSub1->bt ;
@@ -2191,7 +2160,6 @@ void MTR_IVL_SUB::mtr_Accum1( // accumulate of one submeter-interval into anoth
21912160 dmdCost += mtrSub1->dmdCost ;
21922161
21932162 // keep peak demand, and its cost thru month level
2194-
21952163 if (mtrSub1->dmd > dmd) // if source demand (peak use) greater
21962164 { dmd = mtrSub1->dmd ; // update largest hourly demand in destination
21972165 dmdShoy = mtrSub1->dmdShoy ; // update peak date & time (subhr of year)
@@ -2200,28 +2168,6 @@ void MTR_IVL_SUB::mtr_Accum1( // accumulate of one submeter-interval into anoth
22002168 }
22012169 }
22022170 }
2203- #else
2204-
2205- // Add up uses and cost, and demand cost if month to year
2206-
2207- VAccum( &tot, // add 2nd arg float vector to 1st arg
2208- NENDUSES // vector length: # end uses
2209- + 1 // plus .tot, assumed to precede end uses,
2210- + 1 // plus .cost, assumed to immed follow end uses
2211- + (ivl==C_IVLCH_Y), // plus .dmdCost if month-to-year (thru month, largest
2212- // dmdCost is used, not sum, by code just below).
2213- &mtrSub1->tot);
2214- // Keep peak demand, and its cost thru month level
2215-
2216- if (mtrSub1->dmd > dmd) // if source demand (peak use) greater
2217- {
2218- dmd = mtrSub1->dmd; // update largest hourly demand in destination
2219- dmdShoy = mtrSub1->dmdShoy; // update peak date & time (subhr of year)
2220- if (ivl != C_IVLCH_Y) // thru month level, keep largest demand cost
2221- dmdCost = mtrSub1->dmdCost; // .. (but for month to year, dmdCost is summed, above).
2222- }
2223-
2224- #endif
22252171} // MTR_IVL_SUB::mtr_Accum1
22262172// -----------------------------------------------------------------------------------------------------------
22272173double MTR_IVL_SUB::mtr_NetBldgLoad () const // building load (includes PV, excludes BT)
@@ -2362,7 +2308,7 @@ void TOPRAT::tp_DoDateDowStuff() // do date, day of week, and holiday stuff for
23622308
23632309// allocate date string storage once. Small, error unlikely, abort ok. dmpak.cpp.
23642310 if (!dateStr)
2365- dmal ( DMPP ( dateStr), max ( TDDATELENMAX+1U , strlen (" ddd Jan xxx cooling design day xx" )), ABT); // small, error unlikely, let program abort.
2311+ dmal ( DMPP ( dateStr), max ( TDDATELENMAX+1U , strlen (" ddd Jan xxx cooling design day xx" )), ABT); // small, error unlikely, let program abort.
23662312
23672313 if (tp_autoSizing) // set at start setup, cncult2.cpp
23682314 {
0 commit comments