Skip to content

Weather statistics #554

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 1 addition & 4 deletions src/CNDTYPES.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,9 @@ XFILEP -- "XFILE *"
WFLOC -- "char[32]" // weather file location string (+ \0 + fill byte)
WFLID -- "char[18]" // weather file location id string ( + \0 + fill byte)

WFileFormat -- "enum WFileFormat { UNK=-1,BSGS=1,BSGSdemo,ET1,ET2,CSW,T24DLL,EPW }"
WFileFormat -- "enum WFileFormat { UNK=-1,BSGS=1,BSGSdemo,ET1,ET2,CSW,EPW }"
// open wthr file type (comments: wfpak.h)
WFLOC2 -- "char[22]" // "location 2" field in ET1 weather files
YACAMP -- "class YACAM *"
WDYEARP -- "class WDYEAR *"


// for radiant internal gains 11-95
// Radiant internal gains distribution table entry
Expand Down
2 changes: 0 additions & 2 deletions src/CNFIELDS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ WFLID WFLID LMNONE UNNONE // ..

WFileFormat WFileFormat LMNONE UNNONE // open weather file type (see wfpak.h)
WFLOC2 WFLOC2 LMNONE UNNONE // "location 2" field in E10v1+ weather files
YACAMP YACAMP LMNONE UNNONE
WDYEARP WDYEARP LMNONE UNNONE

RIGTARG RIGTARG LMNONE UNNONE // radiant internal gain target (accumulator)
RIGDISTP RIGDISTP LMNONE UNNONE // ptr to array of above, for ZNR::rIgDist
Expand Down
61 changes: 55 additions & 6 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ RECORD WFILE "weatherFile" *RAT // weather file info, one static instance "Wfile
*declare "RC wf_EtDecodeHdr( char* hdr, int erOp, float* clrnss, float* turbid, float* atmois);"
*declare "RC wf_DecodeHdrFields( char* hdr, struct WFHTAB* wfht0, int erOp);"
*declare "RC wf_FillWDYEAR( int erOp=WRN);"
*declare "RC wf_InitStatRATs() const;"
*declare "enum { gshrFILEDAY, gshrDSDAY, gshrDSDAY0 };"
*declare "RC wf_GenSubhrRad( SLRINTERPMETH slrInterpMeth, int dayTy, int jDay);"
*declare "RC wf_GetSubhrRad( int jDay, int iHrST, int iSh, float& radBeamAv, float& radDiffAv);"
Expand All @@ -778,8 +779,6 @@ RECORD WFILE "weatherFile" *RAT // weather file info, one static instance "Wfile
*declare "RC wf_CSWHdrVal( const char* key, const char* val, float& v, RC& rcAll, int erOp=WRN);"
*declare "RC wf_CSWHdrVal( const char* key, const char* val, int& v, RC& rcAll, int erOp=WRN);"
*declare "RC wf_CSWPosHr1( int erOp=WRN);"
*declare "RC wf_T24DLLOpen( const char* wfName, int erOp);"
*declare "RC wf_T24DLLRead( WDHR* pwd, int jDay, int iHr, int erOp);"
*declare "RC wf_EPWOpen( const char* wfName, int erOp );"
*declare "RC wf_EPWPosHr1( int erOp=WRN);"
*declare "RC wf_EPWRead( WDHR* pwd, int jDay, int iHr, int erOp );"
Expand Down Expand Up @@ -839,10 +838,10 @@ RECORD WFILE "weatherFile" *RAT // weather file info, one static instance "Wfile
*r *hide SI hdrBytes // # header bytes before first record (used in wfread for file positioning)
*r *hide SI hourBytes // # bytes per hour
*r *hide INT csvCols // # of columns in comma separated formats (e.g. CSW)
*r *hide YACAMP yac // pointer to "Yet Another Char Access Method" subobject for buffering & decoding weather file
*r *hide YACAMP yacTDV // ditto TDV file
*r INT wf_TDVFileJHr; // last hour (row) in file that has read (1 based)
*r *hide WDYEARP wf_pWDY // pointer to entire year weather data pre-read from file
*declare "class YACAM* yac;" // pointer to "Yet Another Char Access Method" subobject for buffering & decoding weather file
*declare "class YACAM* yacTDV;" // ditto TDV file
*declare "class WDYEAR* wf_pWDY;" // pointer to entire year weather data pre-read from file
*r *hide INT wf_TDVFileJHr; // last hour (row) in file that has read (1 based)
*END // WFILE
//========================================================================================================
RECORD WDHR "wfdata sub" *SUBSTRUCT // hourly data substructure for WFDATA
Expand All @@ -865,6 +864,8 @@ RECORD WDHR "wfdata sub" *SUBSTRUCT // hourly data substructure for WFDATA
*declare "void wd_FillFromDESCOND( const DESCOND& dc, int iHr);"
*declare "void wd_SetDayValues( const class WDDAY& wdd);"
*declare "void wd_SetDayValuesIfMissing( const class WDDAY& wdd);"
*declare "void wd_SetDayValues( const class WFSTATSDAY& wxd);"
*declare "void wd_SetDayValuesIfMissing( const class WFSTATSDAY& wxd);"
*declare "void wd_SetTdvElecHrRank( const class WDDAY& wdd);"
*declare "void wd_ShiftTdvElecHrRankForDST();"
*declare "bool wd_HasTdvData() const;"
Expand Down Expand Up @@ -954,6 +955,54 @@ RECORD WFDATA "weather" *RAT // hourly weather data, one static instance "Wthr",
// WDHR used elsewhere (e.g. whole file pre-read)
*END // WFDATA
//========================================================================================================
RECORD WFSTATSSUB "wfstatssub" *SUBSTRUCT // aggregated weather file statistics (day, month, year)
*prefix wx_
*declare "void wx_Accum( const WFSTATSSUB& wxSrc, bool bFirst, bool bLast);"

FLOAT wx_taDbMin; // min air dry bulb temp, F
FLOAT wx_taDbAvg; // mean air dry bulb temp, F
FLOAT wx_taDbMax; // max air dry bulb temp, F
FLOAT wx_tGrnd; // ground temp, F. Calculated with Kusuda model
// depth=10 ft, soilDiff = per user input
FLOAT wx_tMains; // cold water mains temp, F. calc'd per
// CEC 2013 methods, see CalcTMainsCEC()
FLOAT wx_GHI;
FLOAT wx_DHI;
FLOAT wx_DNI;

#if 0
// TDV elect statistics
FLOAT wx_tdvElecPk; // peak for cur day
int wx_tdvElecPkRank; // rank within year of wx_tdvElecPk (1-366)
FLOAT wx_tdvElecAvg; // avg for cur day
FLOAT wx_tdvElecPvPk; // peak for prior day
FLOAT wx_tdvElecAvg01; // avg for print day
UCH wx_tdvElecHrSTRank[ 24]; // TDV hr ranking (*standard time*)
// [ 0] = hour (1-24) with highest TDVElec
// [ 1] = hour (1-24) with 2nd highest TDVElec
// [ 2 .. 23] etc
#endif


*END // WFSTATSSUB
//========================================================================================================
RECORD WFSTATSDAY "wfstatsday" *RAT // aggregated weather file statistics for one day

*prefix wx_
*declare "void wx_Set24( WDHR* wdHr, int options=0) const;"

*d *noname *nest WFSTATSSUB d

// mean dry bulb temp over recent days, F
// *not* including current day
*d FLOAT wx_taDbAvg01; // 1 day
*d FLOAT wx_taDbAvg07; // 7 day
*d FLOAT wx_taDbAvg14; // 14 day
*d FLOAT wx_taDbAvg31; // 31 day


*END // WFSTATSDAY
//========================================================================================================
RECORD DESCOND "DESCOND" *RAT // cooling design conditions
*prefix dc_
*declare "RC dc_CkF();"
Expand Down
6 changes: 5 additions & 1 deletion src/cncult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cnculti.h: cncult internal functions shared only amoung cncult,2,3,4,5,6.cpp */
#include "rccn.h" // TOPRATstr ZNRstr SFIstr SDIstr
#include "msghans.h" // MH_S0400

#include "cnguts.h" // Top CTWINDOW
#include "cnguts.h" // Top
#include "vrpak.h" // isUsedVrFile 7-13-92

#include "cuparse.h" // TYFL TYSTR evfTx
Expand Down Expand Up @@ -3101,6 +3101,10 @@ WFDATA Wthr((anc<WFDATA>*)& WthrR, 0); // record containing current hour's wea
makAncWFDATA2(WthrNxHrR, nullptr, "weatherNextHour"); // basAnc for...
WFDATA WthrNxHr((anc<WFDATA>*)& WthrNxHrR, 0); // record containing current next hour's weather data,
// extracted and adjusted, for cgWthr.cpp read-ahead

makAncWFSTATSDAY(WfStatsDay, nullptr);
// WFSTATSDAY WfStatsDay((anc<WFSTATSDAY>*)& WfStatsDay, 0);

makAncDESCOND(DcR, dcT); // design conditions

// zones, transfers, gains, meters
Expand Down
3 changes: 0 additions & 3 deletions src/cndefns.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@
#define AIRNET_EIGEN // define to use Eigen for AirNet solving
// else gaussjb

#undef WTHR_T24DLL // #define to support T24WTHR.DLL source for hourly compliance
// weather data

// implement zone exhaust fan, 8-10
#define ZONE_XFAN // define to enable zone exhaust fan implementation, 8-10
// FAN object historically in ZNISUB.xfan but previously not simulated
Expand Down
7 changes: 6 additions & 1 deletion src/cnguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,20 @@ static_assert(NDHWENDUSESXPP == C_DHWEUXCH_COUNT, "Inconsistent DHW UEX constant

// more comments and set/used info in rundata.cpp

//-- cnguts.cpp run record basAncs --
// global run record basAncs --
extern anc<TOPRAT> TopR; // basAnc for Top run record. ancrec.h template class.
extern TOPRAT Top; // the one static Top runtime record. rccn.h type.

// global weather-related
extern anc<WFILE> WfileR; // basAnc for the one weather file info record 1-94. Runtime only - no input basAnc.
extern WFILE Wfile; // the one static WFILE record with overall info and file buffer for 1 day's data
extern anc<WFDATA> WthrR; // basAnc for hour's weather data record. Runtime only - no corress input basAnc.
extern WFDATA Wthr; // the one static WFDATA record containing unpacked & adjusted data for hour 1-94
extern anc<WFDATA> WthrNxHrR; // basAnc for next hour's weather data record ("weatherNextHour")
extern WFDATA WthrNxHr; // static record for next hour's unpacked & adjusted data for cgwthr.cpp read-ahead

extern anc<WFSTATSDAY> WfStatsDay; // Weather statistics by day

extern anc<DESCOND> DcR; // design conditions

extern anc<MTR> MtrB; // meters, by name, each containing use by interval H D M Y and end use
Expand Down
10 changes: 8 additions & 2 deletions src/cuprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ w break;
#endif
case DTMASSLAYERP:
case DTMASSMODELP:
case DTYACAMP:
case DTXFILEP:
errorSub = "un-probe-able";
break;
Expand All @@ -730,7 +729,14 @@ w break;
break;

default:
errorSub = "unrecognized";
if (dt & DTBCHOICB)
{
lop = PSRATLOD2; // basAnc record load 2 bytes: fetches SI/USI.
ty = TYSI;
sz = 2;
}
else
errorSub = "unrecognized";
break;

} // switch (dt)
Expand Down
Loading
Loading