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
24 changes: 21 additions & 3 deletions doc/src/docs/input-data/accumulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ Generalizing what is illustrated, probing @accumulator[ ].H yields statistics fo

A complete list of the available statistics for each interval is found in the ACCUMULATOR probe documentation.

Note: The initial version of ACCUMULATOR contains unresolved bugs related to the timing of the determination of acmValue. In some cases, acmValue is set to the expression value from the prior substep. This is being investigated.


### acmName

Name of ACCUMULATOR: required for referencing in reports.
Expand Down Expand Up @@ -77,6 +74,27 @@ The value being accumulated. Generally expression with subhourly variability.
})
}}

### acmCond

Type: expression

Conditional accumulation flag. If given, accumulation occurs only when the expression value is non-0. This permits selective accumulation according to any condition that can be expressed as a CSE expression.

For example, the following would track RSYS supply cooling supply temperature when and only when the system is cooling.

ACCUMULATOR ClgTSupply acmValue=@RSYS[ 1].asSup.tDb acmCond=@RSYS[ 1].mode == 2

The acmCond prevents accumulation of values during heating or idle operation so the derived min, mean, and max values reflect only cooling.

{{
member_table({
"units": "",
"legal_range": "*any numeric expression*",
"default": "1 (accumulation enabled)",
"required": "No",
"variability": "subhour end of interval"
})
}}

### endACCUMULATOR

Expand Down
16 changes: 16 additions & 0 deletions doc/src/docs/input-data/exportcol.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ Note: Due to quirk (or bug?) in CSE parsing, setting *colHead* equal to "sum", "
})
}}

### colGap

Type: int

colGap is supported for compatibility with REPORTCOL -- this allows e.g. dual-purpose macros to be constructed that describe columns destined for either REPORT or EXPORT. colGap is ignored and has no effected when used in the EXPORTCOL context.

{{
member_table({
"units": "",
"legal_range": "*x* ≥ 0",
"default": "1",
"required": "No",
"variability": "constant"
})
}}

### colWid

Type: int
Expand Down
9 changes: 5 additions & 4 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -3453,7 +3453,7 @@ RECORD RSYS "RSYS" *RAT // residential HVAC system
*declare "float rs_PerfASHP( int ashpModel, float tdbOut, float speedF, float& COP, float fanHAdj=0.f);"
*declare "float rs_PerfASHP2( int ashpModel, float tdbOut, float speedF, float fanHAdj, float& capHtGross, float& inpHtGross, float& capDfHt, float COPAdjF=1.f);"
*declare "float rs_CapEffASHP( float tdbout=-999.f, float speedF=-1.f, int ashpModel=0, float fanHRtd=-1.f, float fanHOpr=-1.f, float COPAdjF=-1.f);"
*declare "void rs_CapEffASHP2( float& capHtGross, float& inpHtGross, float& capDfHt);"
*declare "float rs_CapEffASHP2( float& capHtGross, float& inpHtGross, float& capDfHt);"
*declare "float rs_DefrostAdjustCapInp( float tdbOut, float& capGrossHt, float& inpGrossHt) const;"
*declare "int rs_IsASHP() const { return rs_type == C_RSYSTY_ASHP || rs_type == C_RSYSTY_ASHPPKGRM || rs_IsASHPHydronic() || rs_IsASHPPM(); }"
*declare "int rs_IsASHPHydronic() const { return rs_type == C_RSYSTY_ASHPHYD; }"
Expand Down Expand Up @@ -5547,6 +5547,7 @@ RECORD GAIN "gain" *RAT // (zone internal) Gain input and runtime
RECORD ACCUMULATOR_IVL "accumulator interval sub" *SUBSTRUCT // substruct for one accumulator for one interval
*prefix acm_

*declare "void acm_Clear();"
*declare "void acm_Copy( const ACCUMULATOR_IVL* src);"
*declare "void acm_PopulateSubhr( float value);"
*declare "void acm_Accum( const ACCUMULATOR_IVL* sIvl, bool firstFlg, bool lastFlg, int options=0);"
Expand Down Expand Up @@ -5579,16 +5580,16 @@ SI acmMaxSubhour // subhour within hour at which min occurs, 0 - Top.tp_n

*END // ACCUMULATOR_IVL
//=============================================================================
RECORD ACCUMULATOR "accumulator" *RAT
*prefix acm_
RECORD ACCUMULATOR "accumulator" *RAT

*declare "RC acm_CkF( int options);"

// NOTE: visible prefix used, not *prefix
// WHY: the name "sum" is treated as reserved and rejected.
// Visible "acm" prefixes solve avoid that
*s *e FLOAT acmValue; // value being accumulated
// generally set via probe
// generally set via probe
*s *e INT acmCond // condition: if given, accumulation omitted when FALSE (INT used to hold NAN)

*y *p *nest ACCUMULATOR_IVL Y // run (aka year or annual)
*m *p *nest ACCUMULATOR_IVL M // current month
Expand Down
5 changes: 4 additions & 1 deletion src/cncult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ static CULT exColT[] = //----------- EXPORTCOL cmd table, used from cnTopCult an
CULT( "*", STAR, 0, 0, 0, 0, 0, 0, N, 0.f, N, N),
CULT( "colExport", DAT, COL_OWNTI, RDFLIN, 0, VEOI, TYREF, &XiB, N, 0.f, N, N),
CULT( "colHead", DAT, COL_COLHEAD, 0, 0, VEOI, TYSTR, 0, N, 0.f, N, N),
CULT( "colGap", DAT, COL_COLGAP, 0, 0, VEOI, TYSI, 0, v 1, 0.f, N, N),
CULT( "colWid", DAT, COL_COLWID, 0, 0, VEOI, TYSI, 0, N, 0.f, N, N),
CULT( "colDec", DAT, COL_COLDEC, 0, 0, VEOI, TYSI, 0, v -1, 0.f, N, N),
CULT( "colJust", DAT, COL_COLJUST, 0, 0, VEOI, TYCH, 0, N, 0.f, N, N),
Expand Down Expand Up @@ -1756,7 +1757,9 @@ static CULT accumT[] = //------ ACCUMULATOR cmd RAT Entry table
CULT("*", STAR, 0, 0, 0, 0, 0, 0, 0.f, N, accumStarCkf),
CULT( "acmValue", DAT, ACCUMULATOR_ACMVALUE,0, 0, VSUBHRLY|EVENDIVL,
TYFL, 0, 0.f, N, N),

CULT("acmCond", DAT, ACCUMULATOR_ACMCOND,0, 0, VSUBHRLY|EVPSTIVL, // ok if evaluated at end interval
TYINT, // condition, dflt TRUE, in INT for NAN
0, v 1L, N, N),
CULT("endACCUMULATOR", ENDER, 0, 0, 0, 0, 0, 0, 0.f, N, N),
CULT()
}; // accumT
Expand Down
17 changes: 14 additions & 3 deletions src/cnguts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,10 @@ void LOCAL accumulatorsAccum(
if (ivl == C_IVLCH_H)
{ // construct temporary subhour ACCUMULATOR_IVL
ACCUMULATOR_IVL tempSubhr;
tempSubhr.acm_PopulateSubhr(pACM->acmValue);
if (pACM->acmCond)
tempSubhr.acm_PopulateSubhr(pACM->acmValue);
else
tempSubhr.acm_Clear();
pDst->acm_Accum(&tempSubhr, firstFlg, lastFlg);
#if 0 && defined( _DEBUG)
// re lagged value investigation
Expand Down Expand Up @@ -2189,6 +2192,12 @@ void ACCUMULATOR_IVL::acm_Copy( // copy to this

} // ACCUMULATOR_IVL::acm_Copy
//-----------------------------------------------------------------------------
void ACCUMULATOR_IVL::acm_Clear() // 0 this
{
memset(this, 0, sizeof(ACCUMULATOR_IVL));

} // ACCUMULATOR_IVL::acm_Clear
//-----------------------------------------------------------------------------
void ACCUMULATOR_IVL::acm_PopulateSubhr( // make full subhr object
float value)
{
Expand All @@ -2215,7 +2224,7 @@ void ACCUMULATOR_IVL::acm_Accum( // accumulate to this
{
if (firstFlg)
acm_Copy( pSrc);
else
else if (pSrc->acmCount > 0)
{
if (pSrc->acmMin < acmMin)
{
Expand All @@ -2238,8 +2247,10 @@ void ACCUMULATOR_IVL::acm_Accum( // accumulate to this
acmSum += pSrc->acmSum;
acmCount += pSrc->acmCount;
}
// else pSrc->acmCount <= 0, do nothing

if (lastFlg)
acmMean = acmSum / acmCount;
acmMean = acmSum / max(1, acmCount);

} // ACCUMULATOR_IVL::amc_Accum
//=============================================================================
Expand Down
Loading