@@ -619,11 +619,11 @@ class HPWH : public Courier::Sender
619
619
};
620
620
void setMinutesPerStep (double newMinutesPerStep);
621
621
622
- int WriteCSVHeading (std::ofstream& outFILE,
622
+ int writeCSVHeading (std::ofstream& outFILE,
623
623
const char * preamble = " " ,
624
624
int nTCouples = 6 ,
625
625
int options = CSVOPT_NONE) const ;
626
- int WriteCSVRow (std::ofstream& outFILE,
626
+ int writeCSVRow (std::ofstream& outFILE,
627
627
const char * preamble = " " ,
628
628
int nTCouples = 6 ,
629
629
int options = CSVOPT_NONE) const ;
@@ -999,26 +999,41 @@ class HPWH : public Courier::Sender
999
999
// / first-hour rating designations to determine draw pattern for 24-hr test
1000
1000
struct FirstHourRating
1001
1001
{
1002
- enum class Desig
1002
+ enum class Designation
1003
1003
{
1004
1004
VerySmall,
1005
1005
Low,
1006
1006
Medium,
1007
1007
High
1008
- };
1008
+ } designation ;
1009
1009
1010
- static inline std::unordered_map<Desig , std::string> sDesigMap = {
1011
- {Desig ::VerySmall, " Very Small" },
1012
- {Desig ::Low, " Low" },
1013
- {Desig ::Medium, " Medium" },
1014
- {Desig ::High, " High" }};
1010
+ static inline std::unordered_map<Designation , std::string> DesignationMap = {
1011
+ {Designation ::VerySmall, " Very Small" },
1012
+ {Designation ::Low, " Low" },
1013
+ {Designation ::Medium, " Medium" },
1014
+ {Designation ::High, " High" }};
1015
1015
1016
- Desig desig;
1017
1016
double drawVolume_L;
1017
+ std::string report ();
1018
1018
};
1019
1019
1020
- // / collection of information derived from standard test
1021
- struct StandardTestSummary
1020
+ // / fields for test output to csv
1021
+ struct TestData
1022
+ {
1023
+ int time_min;
1024
+ double ambientT_C;
1025
+ double setpointT_C;
1026
+ double inletT_C;
1027
+ double drawVolume_L;
1028
+ DRMODES drMode;
1029
+ std::vector<double > h_srcIn_kWh;
1030
+ std::vector<double > h_srcOut_kWh;
1031
+ std::vector<double > thermocoupleT_C;
1032
+ double outletT_C;
1033
+ };
1034
+
1035
+ // / collection of information derived from standard 24-h test
1036
+ struct TestSummary
1022
1037
{
1023
1038
// first recovery values
1024
1039
double recoveryEfficiency = 0 .; // eta_r
@@ -1045,8 +1060,8 @@ class HPWH : public Courier::Sender
1045
1060
// 24-hr values
1046
1061
double removedVolume_L = 0 .;
1047
1062
double waterHeatingEnergy_kJ = 0 .; // Q_HW
1048
- double avgOutletT_C = 0 .; // <Tdel,i>
1049
- double avgInletT_C = 0 .; // <Tin,i>
1063
+ double averageOutletT_C = 0 .; // <Tdel,i>
1064
+ double averageInletT_C = 0 .; // <Tin,i>
1050
1065
1051
1066
double usedFossilFuelEnergy_kJ = 0 .; // Q_f
1052
1067
double usedElectricalEnergy_kJ = 0 .; // Q_e
@@ -1055,97 +1070,104 @@ class HPWH : public Courier::Sender
1055
1070
double standardWaterHeatingEnergy_kJ = 0 .; // Q_HW,T
1056
1071
double adjustedConsumedWaterHeatingEnergy_kJ = 0 .; // Q_da
1057
1072
double modifiedConsumedWaterHeatingEnergy_kJ = 0 .; // Q_dm
1058
- double UEF = 0 .;
1073
+ double EF = 0 .;
1059
1074
1060
1075
// (calculated) annual totals
1061
1076
double annualConsumedElectricalEnergy_kJ = 0 .; // E_annual,e
1062
1077
double annualConsumedEnergy_kJ = 0 .; // E_annual
1063
1078
1064
1079
bool qualifies = false ;
1080
+
1081
+ std::vector<TestData> testDataSet = {};
1082
+
1083
+ // return a verbose string summary
1084
+ std::string report ();
1065
1085
};
1066
1086
1067
- struct StandardTestOptions
1087
+ struct TestConfiguration
1068
1088
{
1069
- bool saveOutput = false ;
1070
- std::string sOutputDirectory = " " ;
1071
- std::string sOutputFilename = " " ;
1072
- std::ostream* outputStream = &std::cout;
1073
- bool changeSetpoint = false ;
1074
- std::ofstream outputFile;
1075
- int nTestTCouples = 6 ;
1076
- double setpointT_C = 51.7 ;
1089
+ double ambientT_C;
1090
+ double inletT_C;
1091
+ double externalT_C;
1077
1092
};
1078
1093
1094
+ static TestConfiguration testConfiguration_E50;
1095
+ static TestConfiguration testConfiguration_UEF;
1096
+ static TestConfiguration testConfiguration_E95;
1097
+ static double testSetpointT_C;
1098
+
1079
1099
// / perform a draw/heat cycle to prepare for test
1080
- void prepForTest (StandardTestOptions& standardTestOptions );
1100
+ void prepareForTest ( const TestConfiguration& test_configuration );
1081
1101
1082
1102
// / determine first-hour rating
1083
- void findFirstHourRating (FirstHourRating& firstHourRating,
1084
- StandardTestOptions& standardTestOptions);
1103
+ FirstHourRating findFirstHourRating ();
1085
1104
1086
- // / run 24-hr draw pattern and compute metrics
1087
- void run24hrTest (const FirstHourRating firstHourRating,
1088
- StandardTestSummary& standardTestSummary,
1089
- StandardTestOptions& standardTestOptions);
1105
+ // / run 24-hr draw pattern
1106
+ TestSummary run24hrTest (TestConfiguration testConfiguration,
1107
+ FirstHourRating::Designation designation,
1108
+ bool saveOutput = false );
1109
+ TestSummary run24hrTest (TestConfiguration testConfiguration, bool saveOutput = false )
1110
+ {
1111
+ return run24hrTest (testConfiguration, findFirstHourRating ().designation , saveOutput);
1112
+ }
1090
1113
1091
1114
// / specific information for a single draw
1092
1115
struct Draw
1093
1116
{
1094
1117
double startTime_min;
1095
1118
double volume_L;
1096
- double flowRate_Lper_min ;
1119
+ double flowRate_L_per_min ;
1097
1120
1098
1121
Draw (const double startTime_min_in,
1099
1122
const double volume_L_in,
1100
1123
const double flowRate_Lper_min_in)
1101
1124
: startTime_min(startTime_min_in)
1102
1125
, volume_L(volume_L_in)
1103
- , flowRate_Lper_min (flowRate_Lper_min_in)
1126
+ , flowRate_L_per_min (flowRate_Lper_min_in)
1104
1127
{
1105
1128
}
1106
1129
};
1107
1130
1108
1131
// / sequence of draws in pattern
1109
1132
typedef std::vector<Draw> DrawPattern;
1110
1133
1111
- static std::unordered_map<FirstHourRating::Desig , std::size_t > firstDrawClusterSizes;
1134
+ static std::unordered_map<FirstHourRating::Designation , std::size_t > firstDrawClusterSizes;
1112
1135
1113
1136
// / collection of standard draw patterns
1114
- static std::unordered_map<FirstHourRating::Desig , DrawPattern> drawPatterns;
1137
+ static std::unordered_map<FirstHourRating::Designation , DrawPattern> drawPatterns;
1115
1138
1116
- // / fields for test output to csv
1117
- struct OutputData
1118
- {
1119
- int time_min;
1120
- double ambientT_C;
1121
- double setpointT_C;
1122
- double inletT_C;
1123
- double drawVolume_L;
1124
- DRMODES drMode;
1125
- std::vector<double > h_srcIn_kWh;
1126
- std::vector<double > h_srcOut_kWh;
1127
- std::vector<double > thermocoupleT_C;
1128
- double outletT_C;
1129
- };
1139
+ struct Fitter ;
1130
1140
1131
- int writeRowAsCSV (std::ofstream& outFILE,
1132
- OutputData& outputData,
1133
- const CSVOPTIONS& options = CSVOPTIONS::CSVOPT_NONE) const ;
1141
+ // / fit using a single configuration
1142
+ TestSummary makeGenericEF (double targetEF,
1143
+ TestConfiguration testConfiguration,
1144
+ FirstHourRating::Designation designation);
1145
+ TestSummary makeGenericEF (double targetEF, TestConfiguration testConfiguration)
1146
+ {
1147
+ return makeGenericEF (targetEF, testConfiguration, findFirstHourRating ().designation );
1148
+ }
1134
1149
1135
- void measureMetrics (FirstHourRating& firstHourRating,
1136
- StandardTestOptions& standardTestOptions,
1137
- StandardTestSummary& standardTestSummary);
1150
+ // / fit using each of three configurations, independently
1151
+ void makeGenericE50_UEF_E95 (double targetE50,
1152
+ double targetUEF,
1153
+ double targetE95,
1154
+ FirstHourRating::Designation designation);
1138
1155
1139
- struct CustomTestOptions
1156
+ void makeGenericE50_UEF_E95 ( double targetE50, double targetUEF, double targetE95)
1140
1157
{
1141
- bool overrideFirstHourRating = false ;
1142
- FirstHourRating::Desig desig = FirstHourRating::Desig::VerySmall ;
1143
- } customTestOptions;
1158
+ return makeGenericE50_UEF_E95 (
1159
+ targetE50, targetUEF, targetE95, findFirstHourRating (). designation ) ;
1160
+ }
1144
1161
1145
- void makeGeneric (const double targetUEF);
1162
+ // / fit using UEF config, then adjust E50, E95 coefficients
1163
+ TestSummary makeGenericUEF (double targetUEF, FirstHourRating::Designation designation);
1164
+ TestSummary makeGenericUEF (double targetUEF)
1165
+ {
1166
+ return makeGenericUEF (targetUEF, findFirstHourRating ().designation );
1167
+ }
1146
1168
1147
1169
private:
1148
- void setAllDefaults (); /* *< sets all the defaults default */
1170
+ void setAllDefaults (); /* *< sets all the defaults */
1149
1171
1150
1172
void updateTankTemps (
1151
1173
double draw, double inletT_C, double ambientT_C, double inletVol2_L, double inletT2_L);
@@ -1444,16 +1466,18 @@ class HPWH::HeatSource : public Courier::Sender
1444
1466
void defrostDerate (double & to_derate, double airT_C);
1445
1467
/* *< Derates the COP of a system based on the air temperature */
1446
1468
1447
- struct perfPoint
1469
+ struct PerformancePoint
1448
1470
{
1449
1471
double T_F;
1450
1472
std::vector<double > inputPower_coeffs; // c0 + c1*T + c2*T*T
1451
1473
std::vector<double > COP_coeffs; // c0 + c1*T + c2*T*T
1452
1474
};
1453
1475
1454
- std::vector<perfPoint> perfMap ;
1476
+ std::vector<PerformancePoint> performanceMap ;
1455
1477
/* *< A map with input/COP quadratic curve coefficients at a given external temperature */
1456
1478
1479
+ int getAmbientT_index (double ambientT_C);
1480
+
1457
1481
private:
1458
1482
// start with a few type definitions
1459
1483
enum COIL_CONFIG
0 commit comments