| 1482 | */ |
| 1483 | } |
| 1484 | void SimModel::heatingAndCooling(const Vector& v_E_sol, const Vector& v_Th_avg, const Vector& v_Hve_ht, const Vector& v_Tc_avg, |
| 1485 | const Vector& v_Hve_cl, double tau, double H_tr, double phi_I_tot, double frac_hrs_wk_day, Vector& v_Qfan_tot, |
| 1486 | Vector& v_Qneed_ht, Vector& v_Qneed_cl, double& Qneed_ht_yr, double& Qneed_cl_yr) const { |
| 1487 | Vector temp = mult(megasecondsInMonth, phi_I_tot, 12); |
| 1488 | Vector v_tot_mo_ht_gain = sum(temp, v_E_sol); |
| 1489 | |
| 1490 | double a_H0 = 1; |
| 1491 | double tau_H0 = 15; |
| 1492 | double a_H = a_H0 + tau / tau_H0; |
| 1493 | |
| 1494 | Vector v_QT_ht = mult(mult(dif(v_Th_avg, location->weather()->mdbt()), megasecondsInMonth), H_tr); |
| 1495 | Vector v_QV_ht = mult(mult(mult(v_Hve_ht, structure->floorArea()), dif(v_Th_avg, location->weather()->mdbt())), megasecondsInMonth); |
| 1496 | Vector v_Qtot_ht = sum(v_QT_ht, v_QV_ht); |
| 1497 | /* |
| 1498 | %% Heating and Cooling Needs |
| 1499 | |
| 1500 | %total monthly heat gains (MJ) |
| 1501 | |
| 1502 | v_tot_mo_ht_gain = phi_I_tot*v_Msec_ina_mo + v_E_sol; % total_heat_gain = total internal + total solar in MJ/m2. |
| 1503 | |
| 1504 | % compute the heating need including thermal mass effects |
| 1505 | % NOTE: the building heat thermal time constant, tau, was calculated in the section |
| 1506 | % on interior temperature |
| 1507 | a_H0=1; % a_H_0 = reference dimensionless parameter |
| 1508 | tau_H0=15; % tau_H_0 = reference time constant |
| 1509 | a_H = a_H0+tau/tau_H0; %a_H_building heating dimensionless constant |
| 1510 | |
| 1511 | v_QT_ht = H_tr.*(v_Th_avg-v_mdbt).*v_Msec_ina_mo; %QT = transmission loss (MJ) |
| 1512 | v_QV_ht = v_Hve_ht*In.cond_flr_area.*(v_Th_avg-v_mdbt).*v_Msec_ina_mo; % QV in MJ |
| 1513 | v_Qtot_ht = v_QT_ht+v_QV_ht ; %QL_total total heat loss in MJ |
| 1514 | */ |
| 1515 | Vector v_gamma_H_ht = div(v_tot_mo_ht_gain, sum(v_Qtot_ht, std::numeric_limits<double>::min())); |
| 1516 | Vector v_eta_g_H(12); |
| 1517 | for (size_t i = 0; i < v_eta_g_H.size(); i++) { |
| 1518 | v_eta_g_H[i] = v_gamma_H_ht(i) > 0 ? (1 - std::pow(v_gamma_H_ht[i], a_H)) / (1 - std::pow(v_gamma_H_ht[i], (a_H + 1))) |
| 1519 | : 1 / (v_gamma_H_ht(i) + std::numeric_limits<double>::min()); |
| 1520 | } |
| 1521 | v_Qneed_ht = dif(v_Qtot_ht, mult(v_eta_g_H, v_tot_mo_ht_gain)); |
| 1522 | Qneed_ht_yr = sum(v_Qneed_ht); |
| 1523 | |
| 1524 | /* |
| 1525 | % compute the ratio of heat gain to heating loss, gamma_H |
| 1526 | v_gamma_H_ht = v_tot_mo_ht_gain./(v_Qtot_ht+eps); %gamma_H = QG/QL - eps added to avoid divide by zero problem |
| 1527 | |
| 1528 | % for each month, check the heat gain ratio and set the heating gain |
| 1529 | % utilization factor, eta_g_H accordingly |
| 1530 | v_eta_g_H=zeros(12,1); |
| 1531 | for I=1:12 |
| 1532 | if v_gamma_H_ht(I)>0 |
| 1533 | v_eta_g_H(I) = (1-v_gamma_H_ht(I).^a_H)./(1-v_gamma_H_ht(I).^(a_H+1)); % eta_g_H heating gain utilization factor |
| 1534 | else |
| 1535 | v_eta_g_H(I) = 1./(v_gamma_H_ht(I)+eps); |
| 1536 | end |
| 1537 | end |
| 1538 | v_Qneed_ht = v_Qtot_ht - v_eta_g_H.*v_tot_mo_ht_gain; %QNH = QL,H - eta_G_H.*Q_G_H |
| 1539 | |
| 1540 | Qneed_ht_yr = sum(v_Qneed_ht); |
| 1541 | */ |
nothing calls this directly
no test coverage detected