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
6 changes: 1 addition & 5 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -4537,7 +4537,7 @@ RECORD HPWHLINK "HPWHLink" *SUBSTRUCT // Ecotope's HPWH tank and heater
// calc'd at substep end only

*h *e INT hw_bWriteCSV; // write HPWH debugging CSV iff nz
*declare "FILE* hw_pFCSV;" // file for debugging CSV (opened on 1st use)
*declare "std::ofstream* hw_pFCSV;" // file for debugging CSV (opened on 1st use)

*s *e DBl hw_qBal; // current step HPWH heat balance, kWh (s/b 0)
*s *e INT hw_balErrCount; // annual count of energy balance errors
Expand Down Expand Up @@ -4731,10 +4731,6 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
// DHW+DHWLOOP+CHDHW; does not include wh_qXBU
*s *e INT wh_nzDrawCount; // current substep # of draws > 0

*h *e INT wh_bWriteCSV; // write HPWH debugging CSV iff nz
*declare "FILE* wh_pFCSV;" // file for debugging CSV (opened on 1st use)



*h *e DBL wh_totHARL; // cumulative (year to date) recovery load at heater, Btu
// = SUM( HARL) (includes losses, solar etc)
Expand Down
1 change: 1 addition & 0 deletions src/cnglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct CULT;
#include <vector>
#include <string>
#include <map>
#include <fstream>
#define WVect std::vector
typedef std::map< int, std::string> WMapIntStr;
typedef std::string WStr;
Expand Down
52 changes: 22 additions & 30 deletions src/dhwcalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2891,13 +2891,13 @@ void HPWHLINK::hw_Cleanup()
// duplicate calls OK
{
delete hw_pHPWH;
hw_pHPWH = NULL;
hw_pHPWH = nullptr;

delete[] hw_HSMap;
hw_HSMap = NULL;
if (hw_pFCSV)
{ fclose( hw_pFCSV);
hw_pFCSV = nullptr;
}
hw_HSMap = nullptr;

delete hw_pFCSV; // closes file if open
hw_pFCSV = nullptr;

hw_pNodePowerExtra_W.clear();

Expand Down Expand Up @@ -3618,9 +3618,8 @@ RC HPWHLINK::hw_DoSubhrStart( // HPWH subhour start

#define HPWH_DUMP // define to include debug CSV file
#if defined( HPWH_DUMP)
// #define HPWH_DUMPSMALL // #define to use abbreviated version
// use debug dump mechanism w/o headings to log file
// (dump goes to external CSV file)
// use debug dump mechanism w/o headings to log file
// (dump goes to external CSV file)
hw_bWriteCSV = DbDo(dbdHPWH, dbdoptNOHDGS);
#endif

Expand Down Expand Up @@ -3877,43 +3876,37 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick

CSVGen csvGen(CI);

if (!hw_pFCSV)
if (hw_pFCSV == nullptr)
{
hw_pFCSV = new std::ofstream;
}
if (!hw_pFCSV->is_open())
{
// dump file name = <cseFile>_<DHWHEATER name>_hpwh.csv
// Overwrite pre-existing file
// >>> thus file contains info from only last RUN in multi-RUN sessions
const char* nameNoWS = strDeWS(strtmp(hw_pOwner->Name()));
const char* fName =
strsave(strffix2(strtprintf("%s_%s_hpwh", InputFilePathNoExt, nameNoWS), ".csv", 1));
hw_pFCSV = fopen(fName, "wt");
if (!hw_pFCSV)
const char* fName = strffix2(strtprintf("%s_%s_hpwh", InputFilePathNoExt, nameNoWS), ".csv", 1);
hw_pFCSV->open(fName, std::ifstream::out); // implies truncation
if (!hw_pFCSV->is_open())
err(PWRN, "HPWH report failure for '%s'", fName);
else
{ // headings
fprintf(hw_pFCSV, "%s,%s,%s\n",
*hw_pFCSV << strtprintf("%s,%s,%s\n",
hw_pOwner->GetDescription(), Top.repHdrL.CStr(), Top.runDateTime.CStr());
fprintf(hw_pFCSV, "%s%s %s %s HPWH %s\n",
*hw_pFCSV << strtprintf( "%s%s %s %s HPWH %s\n",
Top.tp_RepTestPfx(), ProgName, ProgVersion, ProgVariant,
Top.tp_HPWHVersion.CStr());
#if defined( HPWH_DUMPSMALL)
fprintf(wh_pFCSV, "minYear,draw( L)\n");
#else
WStr s("mon,day,hr,");
s += csvGen.cg_Hdgs(dumpUx);
hw_pHPWH->WriteCSVHeading(hw_pFCSV, s.c_str(), nTCouples, hpwhOptions);
#endif
hw_pHPWH->WriteCSVHeading(*hw_pFCSV, s.c_str(), nTCouples, hpwhOptions);
}
}
if (hw_pFCSV)
{
#if defined( HPWH_DUMPSMALL)
fprintf(wh_pFCSV, "%0.2f,%0.3f\n", minYear, GAL_TO_L(drawForTick));
#else
WStr s = strtprintf("%d,%d,%d,",
if (hw_pFCSV->is_open())
{ WStr s = strtprintf("%d,%d,%d,",
Top.tp_date.month, Top.tp_date.mday, Top.iHr + 1);
s += csvGen.cg_Values(dumpUx);
hw_pHPWH->WriteCSVRow(hw_pFCSV, s.c_str(), nTCouples, hpwhOptions);
#endif
hw_pHPWH->WriteCSVRow(*hw_pFCSV, s.c_str(), nTCouples, hpwhOptions);
}
}
#endif // HPWH_DUMP
Expand Down Expand Up @@ -4311,7 +4304,6 @@ RC DHWHEATER::wh_Init() // init for run
RC rc = RCOK;

DHWSYS* pWS = wh_GetDHWSYS();
wh_pFCSV = NULL;

// one-time inits
wh_balErrCount = 0;
Expand Down
40 changes: 20 additions & 20 deletions test/ref/ASHPPKGROOM.REP
Original file line number Diff line number Diff line change
Expand Up @@ -1303,13 +1303,13 @@ dhwheater Parent: dhwsys
whLDEF 6 36 0 0 1 2 0 1 0 0
whEff 6 45 0 0 1 2 0 1 0 0
whSBL 6 46 0 0 1 2 0 0 0 0
whFAdjElec 6 98 0 0 1763 2 0 1 0 0
whFAdjFuel 6 99 0 0 1763 2 0 1 0 0
whFAdjElec 6 97 0 0 1763 2 0 1 0 0
whFAdjFuel 6 98 0 0 1763 2 0 1 0 0
whPilotPwr 6 47 0 0 739 2 0 0 0 0
whParElec 6 48 0 0 739 2 0 0 0 0
whElecMtr 6 110 0 0 1 8192 meter 0 0 0 0
whFuelMtr 6 111 0 0 1 8192 meter 0 0 0 0
whxBUEndUse 6 112 0 0 1 16 nz 0 0 0
whElecMtr 6 109 0 0 1 8192 meter 0 0 0 0
whFuelMtr 6 110 0 0 1 8192 meter 0 0 0 0
whxBUEndUse 6 111 0 0 1 16 nz 0 0 0
endDHWHEATER 13 0 0 0 0 0 0 0 0 0


Expand Down Expand Up @@ -1349,13 +1349,13 @@ dhwloopheater Parent: dhwsys
whLDEF 6 36 0 0 1 2 0 1 0 0
whEff 6 45 0 0 1 2 0 1 0 0
whSBL 6 46 0 0 1 2 0 0 0 0
whFAdjElec 6 98 0 0 1763 2 0 1 0 0
whFAdjFuel 6 99 0 0 1763 2 0 1 0 0
whFAdjElec 6 97 0 0 1763 2 0 1 0 0
whFAdjFuel 6 98 0 0 1763 2 0 1 0 0
whPilotPwr 6 47 0 0 739 2 0 0 0 0
whParElec 6 48 0 0 739 2 0 0 0 0
whElecMtr 6 110 0 0 1 8192 meter 0 0 0 0
whFuelMtr 6 111 0 0 1 8192 meter 0 0 0 0
whxBUEndUse 6 112 0 0 1 16 nz 0 0 0
whElecMtr 6 109 0 0 1 8192 meter 0 0 0 0
whFuelMtr 6 110 0 0 1 8192 meter 0 0 0 0
whxBUEndUse 6 111 0 0 1 16 nz 0 0 0
endDHWHEATER 13 0 0 0 0 0 0 0 0 0


Expand Down Expand Up @@ -2004,7 +2004,7 @@ inverse Parent: Top
ivX 6 6 8 0 1771 2 0 0 0 0
ivY 6 7 8 0 1771 2 0 0 0 0
endInverse 13 0 0 0 0 0 0 0 0 0
! CSE 0.920.0+cmath.37f8f6da.10 for Win32 console
! CSE 0.920.0+cross-platform-updates-hpwhsim.670ac9ad.37 for Win32 console



Expand Down Expand Up @@ -3567,18 +3567,18 @@ Input for Run 001:



! CSE 0.920.0+cmath.37f8f6da.10 for Win32 console run(s) done: Mon 18-Dec-23 5:14:51 pm
! CSE 0.920.0+cross-platform-updates-hpwhsim.670ac9ad.37 for Win32 console run(s) done: Sat 06-Jan-24 5:11:52 pm

! Executable: d:\cse\msvc\cse.exe
! 18-Dec-23 5:05 pm (VS 14.29 2796032 bytes) (HPWH 1.22.0+HEAD.df305f2.85)
! Command line: -x! -t1 ashpPkgRoom
! Input file: D:\cse\test\ashpPkgRoom.cse
! 06-Jan-24 4:57 pm (VS 14.29 2885120 bytes) (HPWH 1.22.0+HEAD.1d941d3.193)
! Command line: -x! -t1 ashppkgroom
! Input file: D:\cse\test\ashppkgroom.cse
! Report file: D:\CSE\TEST\ASHPPKGROOM.REP

! Timing info --

! Input: Time = 0.10 Calls = 2 T/C = 0.0505
! AutoSizing: Time = 0.28 Calls = 1 T/C = 0.2770
! Simulation: Time = 6.46 Calls = 1 T/C = 6.4650
! Reports: Time = 0.00 Calls = 1 T/C = 0.0020
! Total: Time = 6.85 Calls = 1 T/C = 6.8520
! Input: Time = 0.10 Calls = 2 T/C = 0.0480
! AutoSizing: Time = 0.27 Calls = 1 T/C = 0.2670
! Simulation: Time = 6.69 Calls = 1 T/C = 6.6940
! Reports: Time = 0.00 Calls = 1 T/C = 0.0030
! Total: Time = 7.07 Calls = 1 T/C = 7.0670
2 changes: 1 addition & 1 deletion vendor/HPWHsim
Submodule HPWHsim updated 346 files