Skip to content
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
8 changes: 4 additions & 4 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -5593,10 +5593,10 @@ RECORD ACCUMULATOR "accumulator" *RAT
*s *e FLOAT acmValue; // value being accumulated
// generally set via probe

*y *e *nest ACCUMULATOR_IVL Y // run (aka year or annual)
*m *e *nest ACCUMULATOR_IVL M // current month
*d *e *nest ACCUMULATOR_IVL D // current day
*h *e *nest ACCUMULATOR_IVL H // current hour
*y *p *nest ACCUMULATOR_IVL Y // run (aka year or annual)
*m *p *nest ACCUMULATOR_IVL M // current month
*d *p *nest ACCUMULATOR_IVL D // current day
*h *p *nest ACCUMULATOR_IVL H // current hour
*END // ACCUMULATOR
//=============================================================================
RECORD MTR_IVL "meter interval sub" *SUBSTRUCT // substruct for one meter for one interval for entire building
Expand Down
2 changes: 1 addition & 1 deletion src/cncult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ static CULT accumT[] = //------ ACCUMULATOR cmd RAT Entry table
// id cs fn f uc evf ty b dfls p2 ckf
//---------------- ----- ----------------- ------- -- ------ ----- ------ ------ ---- ----
CULT("*", STAR, 0, 0, 0, 0, 0, 0, 0.f, N, accumStarCkf),
CULT( "acmValue", DAT, ACCUMULATOR_ACMVALUE,0, 0, VSUBHRLY|EVPSTIVL,
CULT( "acmValue", DAT, ACCUMULATOR_ACMVALUE,0, 0, VSUBHRLY|EVENDIVL,
TYFL, 0, 0.f, N, N),

CULT("endACCUMULATOR", ENDER, 0, 0, 0, 0, 0, 0, 0.f, N, N),
Expand Down
31 changes: 14 additions & 17 deletions src/cnguts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ LOCAL RC FC doEndIvl() // simulation run end-of-interval processing: results a
SubMeterSeq.smsq_AccumHour( MTR::ACCUMOPT::BATTERYONLY);
}

doIvlFinalize(); // finalize meters etc
doIvlFinalize(); // finalize meters and ACCUMULATORs

CSE_EF( doIvlExprs( EVPSTIVL)) // do all post load management expressions for this interval

Expand Down Expand Up @@ -1639,8 +1639,6 @@ LOCAL void FC doIvlAccum()
pLM->lmt_Accum(C_IVLCH_H, Top.isBegHour, Top.isEndHour);
}

accumulatorsAccum( C_IVLCH_H, Top.isBegHour, Top.isEndHour); // ACCUMULATORs subhour->hour

if (Top.ivl > C_IVLCH_H) // if subhour call, done
return;

Expand Down Expand Up @@ -1789,8 +1787,6 @@ LOCAL void FC doIvlAccum()

mtrsAccum( C_IVLCH_D, Top.isBegDay, Top.isEndDay); // Meters: finish hour (including submeters), sum to day

accumulatorsAccum( C_IVLCH_D, Top.isBegDay, Top.isEndDay); // ACCUMULATORs hour->day

if (Top.ivl > C_IVLCH_D) // if hour call, done
return;

Expand All @@ -1807,8 +1803,6 @@ LOCAL void FC doIvlAccum()
accumAhr( &ahres->D, &ahres->M, Top.isBegMonth, Top.isEndMonth); // accumulate day ah results to month
mtrsAccum( C_IVLCH_M, Top.isBegMonth, Top.isEndMonth); // accum METERs, DHWMETERs, AFMETERS, LOADMTRs: day to month

accumulatorsAccum( C_IVLCH_M, Top.isBegMonth, Top.isEndMonth); // ACCUMULATORs day->month

#ifdef BINRES
if (brf) // if outputting binary results for this run
//if (!Top.tp_autoSizing) // not for ausz yet 6-95: tested above, and brf is off.
Expand Down Expand Up @@ -1852,8 +1846,6 @@ LOCAL void FC doIvlAccum()
pWSR->Y.wsr_Accum(&pWSR->M, Top.isFirstMon, Top.isLastDay);
mtrsAccum( C_IVLCH_Y, Top.isFirstMon, Top.isLastDay); // accumulate metered energy use: month to year

accumulatorsAccum( C_IVLCH_Y, Top.isFirstMon, Top.isLastDay); // ACCUMULATORs month->year

#ifdef BINRES
if (brf) // if outputting any binary results this run
{
Expand All @@ -1872,32 +1864,37 @@ LOCAL void FC doIvlAccum()
//-----------------------------------------------------------------------------------------------------------
LOCAL void FC doIvlFinalize()

// finalize meters (and ?) after load management (battery, ) stage at end of interval
// finalize MTRs and ACCUMULATORs after load management (battery, ) stage at end of interval

// uses: Top.ivl: interval subhour, hour, day, month, year. Coinciding shorter intervals also done.

// always accum during warmup / autosize re possible expression use and prior values

{
// always accum during warmup / autosize
// re possible expression use and prior values
accumulatorsAccum(C_IVLCH_H, Top.isBegHour, Top.isEndHour); // ACCUMULATORs subhour->hour

if (Top.ivl > C_IVLCH_H) // if subhour call, done
return;

mtrsFinalize( C_IVLCH_D, Top.isBegDay); // sum energy uses to hour's total, and accumulate hour meter use to day. local.
mtrsFinalize( C_IVLCH_D, Top.isBegDay); // finalize MTRs hour's totals, then hour->day

accumulatorsAccum(C_IVLCH_D, Top.isBegDay, Top.isEndDay); // ACCUMULATORs hour->day

if (Top.ivl > C_IVLCH_D) // if hour call, done
return;

mtrsFinalize( C_IVLCH_M, Top.isBegMonth); // accum metered energy: day to month. local,below.
mtrsFinalize( C_IVLCH_M, Top.isBegMonth); // MTRs: day->month

accumulatorsAccum(C_IVLCH_M, Top.isBegMonth, Top.isEndMonth); // ACCUMULATORs day->month

if (Top.ivl > C_IVLCH_M) // if day call, done.
return;

// accumulate month results to year
mtrsFinalize( C_IVLCH_Y, Top.isFirstMon); // MTRs: month->year

mtrsFinalize( C_IVLCH_Y, Top.isFirstMon); // accumulate metered energy use: month to year
accumulatorsAccum( C_IVLCH_Y, Top.isFirstMon, Top.isLastDay); // ACCUMULATORs month->year

//if (Top.ivl > C_IVLCH_Y) // if month call, done
// if (Top.ivl > C_IVLCH_Y) // if month call, done
// return;
// year (end of run) accumulation: nothing to do
} // doIvlFinalize
Expand Down
15 changes: 11 additions & 4 deletions test/accumulator.cse
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,29 @@ ACMON( "M1", "Accum1")



SHREP1( mar 7, mar 9)
SHREP1( mar 6, mar 9)

ACHOUR( "BH", "AccumBeam", mar 8)

ACDAY( "BD", "AccumBeam", mar 1, mar 31)

ACMON("BM", "AccumBeam")

ACHOUR( "QH", "AccumQSrf", mar 8)
ACHOUR( "QH6", "AccumQSrf", mar 6)

ACHOUR( "QH8", "AccumQSrf", mar 8)

ACDAY( "QD", "AccumQSrf", mar 1, mar 31)

ACMON("QM", "AccumQSrf")

// accumulate subhour surface heat flow: tests for lag
// ACCUMULATOR AccumQSrf acmValue = @xsurf[ "South Vertical Wall"].sbcO.qSrf
ACHOUR( "ZH6", "AccumQsMech", mar 6)

ACHOUR( "ZH8", "AccumQsMech", mar 8)

ACDAY( "ZD", "AccumQsMech", mar 1, mar 31)

ACMON("ZM", "AccumQSMech")



Expand Down
Loading