20#ifndef TOOLS_SUITE_PROCESSCOOLING_H
21#define TOOLS_SUITE_PROCESSCOOLING_H
34const int LOAD_NUM = 11;
35const int HOURS_IN_YEAR = 8760;
39 enum RefrigerantType { R_11, R_123, R_12, R_134a, R_22, R_717 };
41 enum ACSourceLocation { Inside, Outside };
43 enum CoolingSystemType { Water, Air };
45 enum CellFanType { AxialFan, CentrifugalFan };
47 enum TowerSizedBy { Tonnage, Fan_HP };
49 enum ChillerCompressorType { Centrifugal, Screw, Reciprocating };
51 enum FanMotorSpeedType { One, Two, Variable };
63 ChillerOutput(vector<vector<double>> efficiency, vector<vector<double>> hours, vector<vector<double>> power,
64 vector<vector<double>> energy)
65 : efficiency(std::move(efficiency)), hours(std::move(hours)), power(std::move(power)),
66 energy(std::move(energy)) {}
68 vector<vector<double>> efficiency;
69 vector<vector<double>> hours;
70 vector<vector<double>> power;
71 vector<vector<double>> energy;
82 : chillerPumpingEnergy(std::move(pumpingEnergy)) {}
84 vector<double> chillerPumpingEnergy;
102 TowerOutput(vector<double> hours, vector<double> energy) : hours(std::move(hours)), energy(std::move(energy)) {}
104 vector<double> tempBins = {35, 45, 55, 65, 75, 75};
105 vector<double> hours;
106 vector<double> energy;
128 bool CWVariableFlow,
double CWFlowRate,
double CWTFollow)
129 : CHWT(CHWT), useFreeCooling(useFreeCooling), HEXApproachTemp(HEXApproachTemp), constantCWT(constantCWT),
130 CWT(CWT), CWVariableFlow(CWVariableFlow), CWFlowRate(CWFlowRate), CWTFollow(CWTFollow) {
131 isWaterCooled =
true;
135 bool useFreeCooling =
false;
136 double HEXApproachTemp = 0;
137 bool constantCWT =
true;
139 bool CWVariableFlow =
true;
140 double CWFlowRate = 3;
141 double CWTFollow = 0;
142 bool isWaterCooled =
false;
161 : CHWT(CHWT), OADT(OADT), ACSource(ACSource), indoorTemp(indoorTemp), CWTFollow(CWTFollow) {
167 ACSourceLocation ACSource = ACSourceLocation::Outside;
168 double indoorTemp = 75;
169 double CWTFollow = 0;
170 bool isAirCooled =
false;
182 PumpInput(
bool variableFlow,
double flowRate,
double efficiency,
double motorSize,
double motorEfficiency)
183 : variableFlow(variableFlow), flowRate(flowRate), efficiency(efficiency * 100), motorSize(motorSize),
184 motorEfficiency(motorEfficiency * 100) {}
190 double motorEfficiency;
210 TowerInput(
int numTower,
int numFanPerTower_Cells, FanMotorSpeedType fanSpeedType, TowerSizedBy towerSizing,
211 CellFanType towerCellFanType,
double cellFanHP,
double tonnage)
212 : numTower(numTower), numFanPerTower_Cells(numFanPerTower_Cells), fanSpeedType(fanSpeedType),
213 fanHP(cellFanHP), tonnage(tonnage) {
214 fanHP = getFanHP(tonnage, towerSizing, numFanPerTower_Cells, towerCellFanType, fanHP);
218 int numFanPerTower_Cells;
219 FanMotorSpeedType fanSpeedType;
240 ChillerInput(ChillerCompressorType chillerType,
double capacity,
bool isFullLoadEffKnown,
double fullLoadEff,
241 double age,
bool installVSD,
bool useARIMonthlyLoadSchedule, vector<vector<double>> monthlyLoads)
242 : chillerType(chillerType), capacity(capacity), isFullLoadEffKnown(isFullLoadEffKnown),
243 fullLoadEff(fullLoadEff), age(age), installVSD(installVSD),
244 useARIMonthlyLoadSchedule(useARIMonthlyLoadSchedule), monthlyLoads(std::move(monthlyLoads)),
245 isCustomChiller(false), loadAtPercent({}), kwPerTonLoads({}), changeRefrig(
false),
246 currentRefrig(RefrigerantType::R_11), proposedRefrig(RefrigerantType::R_11) {
247 InitNonVaryingMonthlyLoad();
268 ChillerInput(ChillerCompressorType chillerType,
double capacity,
bool isFullLoadEffKnown,
double fullLoadEff,
269 double age,
bool installVSD,
bool useARIMonthlyLoadSchedule, vector<vector<double>> monthlyLoads,
270 bool changeRefrig, RefrigerantType currentRefrig, RefrigerantType proposedRefrig)
271 : chillerType(chillerType), capacity(capacity), isFullLoadEffKnown(isFullLoadEffKnown),
272 fullLoadEff(fullLoadEff), age(age), installVSD(installVSD),
273 useARIMonthlyLoadSchedule(useARIMonthlyLoadSchedule), monthlyLoads(std::move(monthlyLoads)),
274 isCustomChiller(false), loadAtPercent({}), kwPerTonLoads({}), changeRefrig(changeRefrig),
275 currentRefrig(currentRefrig), proposedRefrig(proposedRefrig) {
276 InitNonVaryingMonthlyLoad();
297 ChillerInput(ChillerCompressorType chillerType,
double capacity,
bool isFullLoadEffKnown,
double fullLoadEff,
298 double age,
bool installVSD,
bool useARIMonthlyLoadSchedule, vector<vector<double>> monthlyLoads,
299 RefrigerantType currentRefrig, RefrigerantType proposedRefrig)
300 : chillerType(chillerType), capacity(capacity), isFullLoadEffKnown(isFullLoadEffKnown),
301 fullLoadEff(fullLoadEff), age(age), installVSD(installVSD),
302 useARIMonthlyLoadSchedule(useARIMonthlyLoadSchedule), monthlyLoads(std::move(monthlyLoads)),
303 isCustomChiller(false), loadAtPercent({}), kwPerTonLoads({}), changeRefrig(
true),
304 currentRefrig(currentRefrig), proposedRefrig(proposedRefrig) {
305 InitNonVaryingMonthlyLoad();
326 ChillerInput(ChillerCompressorType chillerType,
double capacity,
bool isFullLoadEffKnown,
double fullLoadEff,
327 double age,
bool installVSD,
bool useARIMonthlyLoadSchedule, vector<vector<double>> monthlyLoads,
328 vector<double> loadAtPercent, vector<double> kwPerTonLoads)
329 : chillerType(chillerType), capacity(capacity), isFullLoadEffKnown(isFullLoadEffKnown),
330 fullLoadEff(fullLoadEff), age(age), installVSD(installVSD),
331 useARIMonthlyLoadSchedule(useARIMonthlyLoadSchedule), monthlyLoads(std::move(monthlyLoads)),
332 isCustomChiller(true), loadAtPercent(std::move(loadAtPercent)), kwPerTonLoads(std::move(kwPerTonLoads)),
333 changeRefrig(false), currentRefrig(RefrigerantType::R_11), proposedRefrig(RefrigerantType::R_11) {
334 InitNonVaryingMonthlyLoad();
335 SetCustomCoefficient();
359 ChillerInput(ChillerCompressorType chillerType,
double capacity,
bool isFullLoadEffKnown,
double fullLoadEff,
360 double age,
bool installVSD,
bool useARIMonthlyLoadSchedule, vector<vector<double>> monthlyLoads,
361 vector<double> loadAtPercent, vector<double> kwPerTonLoads, RefrigerantType currentRefrig,
362 RefrigerantType proposedRefrig)
363 : chillerType(chillerType), capacity(capacity), isFullLoadEffKnown(isFullLoadEffKnown),
364 fullLoadEff(fullLoadEff), age(age), installVSD(installVSD),
365 useARIMonthlyLoadSchedule(useARIMonthlyLoadSchedule), monthlyLoads(std::move(monthlyLoads)),
366 isCustomChiller(true), loadAtPercent(std::move(loadAtPercent)), kwPerTonLoads(std::move(kwPerTonLoads)),
367 changeRefrig(true), currentRefrig(currentRefrig), proposedRefrig(proposedRefrig) {
368 InitNonVaryingMonthlyLoad();
369 SetCustomCoefficient();
372 ChillerCompressorType chillerType;
374 bool isFullLoadEffKnown;
378 bool useARIMonthlyLoadSchedule;
379 vector<vector<double>> monthlyLoads;
381 bool isCustomChiller;
382 vector<double> loadAtPercent;
383 vector<double> kwPerTonLoads;
385 bool changeRefrig =
false;
386 RefrigerantType currentRefrig;
387 RefrigerantType proposedRefrig;
389 vector<double> customCoeffs;
392 void InitNonVaryingMonthlyLoad() {
393 if (monthlyLoads.size() == 1) {
394 auto monthlyLoad = monthlyLoads[0];
396 for (
int i = 0; i < 11; i++) {
397 monthlyLoads.push_back(monthlyLoad);
402 void SetCustomCoefficient() {
403 auto size =
static_cast<int>(loadAtPercent.size());
404 vector<double> x(size, 0);
405 vector<double> y(size, 0);
406 for (
int i = 0; i < size; i++) {
407 x[i] = loadAtPercent[i];
408 y[i] = kwPerTonLoads[i] * loadAtPercent[i] / kwPerTonLoads[0];
410 vector<double> coeff = solveForCoefficients(x, y);
412 size =
static_cast<int>(coeff.size());
413 customCoeffs.resize(size, 0);
414 for (
int i = 0; i < size; i++) {
415 customCoeffs[i] = coeff[i];
419 static vector<double> solveForCoefficients(vector<double> x, vector<double> y) {
420 if (x.empty() || x.size() != y.size())
423 const int n = (int)x.size();
425 vector<vector<double>> a(n, vector<double>(n, 0));
426 for (
int i = 0; i < n; ++i) {
427 for (
int j = 0; j < n; ++j) {
428 a[i][j] = pow(x[i], n - 1 - j);
433 for (
int k = 0; k < n - 1; ++k) {
434 for (
int i = k + 1; i < n; ++i) {
435 double factor = a[i][k] / a[k][k];
436 for (
int j = k + 1; j < n; ++j) {
437 a[i][j] -= factor * a[k][j];
439 y[i] -= factor * y[k];
444 vector<double> coeff(n, 0);
445 coeff[n - 1] = y[n - 1] / a[n - 1][n - 1];
446 for (
int i = n - 2; i >= 0; --i) {
448 for (
int j = i + 1; j < n; ++j) {
449 sum -= a[i][j] * coeff[j];
451 coeff[i] = sum / a[i][i];
474 ProcessCooling(
const vector<int>& systemOperationAnnualHours,
const vector<double>& weatherDryBulbHourlyTemp,
475 const vector<double>& weatherWetBulbHourlyTemp,
const vector<ChillerInput>& chillerInputList,
477 :
ProcessCooling(systemOperationAnnualHours, weatherDryBulbHourlyTemp, weatherWetBulbHourlyTemp,
478 chillerInputList, {}, towerInput, waterCooledSystemInput) {}
491 ProcessCooling(
const vector<int>& systemOperationAnnualHours,
const vector<double>& weatherDryBulbHourlyTemp,
492 const vector<double>& weatherWetBulbHourlyTemp,
const vector<ChillerInput>& chillerInputList,
494 :
ProcessCooling(systemOperationAnnualHours, weatherDryBulbHourlyTemp, weatherWetBulbHourlyTemp,
495 chillerInputList, airCooledSystemInput, {}, {}) {}
517 ProcessCooling(
const vector<int>& systemOperationAnnualHours,
const vector<double>& weatherDryBulbHourlyTemp,
518 const vector<double>& weatherWetBulbHourlyTemp,
const vector<ChillerInput>& chillerInputList,
522 vector<int> systemOperationAnnual;
523 vector<double> dryBulbHourlyTemp;
524 vector<double> wetBulbHourlyTemp;
527 WaterCooledSystemInput waterCooledSystem;
528 AirCooledSystemInput airCooledSystem;
529 CoolingSystemType coolingType;
532 vector<double> CWTHourly;
535 vector<ChillerInput> chillers;
536 vector<vector<double>> chillerHourlyLoad;
537 vector<vector<double>> chillerHourlyLoadOperational;
538 vector<vector<double>> chillerHourlyEfficiencyARI;
539 vector<vector<double>> chillerHourlyEfficiency;
540 vector<vector<double>> chillerHourlyPower;
542 void annualChillerLoadProfile();
544 void annualChillerEfficiencyProfileARI();
546 void annualChillerEfficiencyProfile();
548 void annualChillerPowerProfile();
550 static double getFanHP(
double tonnage, TowerSizedBy towerSizing,
int fanNum, CellFanType fanType,
double fanHP);
552 double getPercentFanPower(
double wetBulbTemp,
double percentWaterFlow,
double range,
double desiredApproach,
555 double getPercentWaterFlow(
int yearHourIndex);
557 double getRange(
int yearHourIndex);
559 double getApproach(
double wetBulbTemp,
double minToChillersTemp)
const;
561 double modifyPercentFanPower(
double percentFanPower)
const;
563 double getWeightedAverageChillerLoad(
int yearHourIndex);
565 double getChillerTonnageTotal();
567 static double getCubeRoot(
double number);
569 static double getPumpHP(
double power);
TowerOutput calculateTowerEnergy()
ChillerOutput calculateChillerEnergy()
ProcessCooling(const vector< int > &systemOperationAnnualHours, const vector< double > &weatherDryBulbHourlyTemp, const vector< double > &weatherWetBulbHourlyTemp, const vector< ChillerInput > &chillerInputList, AirCooledSystemInput airCooledSystemInput)
ChillerPumpingEnergyOutput calculatePumpEnergy(PumpInput pump)
ProcessCooling(const vector< int > &systemOperationAnnualHours, const vector< double > &weatherDryBulbHourlyTemp, const vector< double > &weatherWetBulbHourlyTemp, const vector< ChillerInput > &chillerInputList, TowerInput towerInput, WaterCooledSystemInput waterCooledSystemInput)
ChillerOutput(vector< vector< double > > efficiency, vector< vector< double > > hours, vector< vector< double > > power, vector< vector< double > > energy)
ChillerPumpingEnergyOutput(vector< double > pumpingEnergy)
TowerOutput(vector< double > hours, vector< double > energy)