Skip to content

Commit

Permalink
fix(feat-121): Fix pertes distribution ecs recup with 2 ECS
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme GAVIGNET committed Oct 15, 2024
1 parent 2b57e09 commit 8946e87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/14_generateur_ecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function tv_pertes_stockage(di, de) {
}

// 15.2.3
export function calc_Qdw_j(instal_ecs, becs_j) {
export function calc_Qdw_j(instal_ecs, becs_j, Rat_ecs) {
const de = instal_ecs.donnee_entree;
const du = instal_ecs.donnee_utilisateur || {};

Expand All @@ -35,7 +35,6 @@ export function calc_Qdw_j(instal_ecs, becs_j) {
let Qdw_j;
if (type_installation === 'installation individuelle') {
const Sh = de.surface_habitable;
const Rat_ecs = 1;
const Lvc = 0.2 * Sh * Rat_ecs;
Qdw_j = ((0.5 * Lvc) / Sh) * becs_j;
} else if (type_installation === 'installation collective') {
Expand Down
34 changes: 20 additions & 14 deletions src/9_besoin_ch.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,21 @@ export default function calc_besoin_ch(
let fraction_apport_gratuit_ch = 0;
let fraction_apport_gratuit_depensier_ch = 0;

for (const mois of mois_liste) {
/* console.warn(mois) */
// pertes stockage
const Qgw_total = instal_ecs.reduce((acc, instal_ecs) => {
const gen_ecs = instal_ecs.generateur_ecs_collection.generateur_ecs;
return (
acc +
gen_ecs.reduce((acc, gen_ecs) => {
return acc + (gen_ecs.donnee_intermediaire.Qgw || 0);
}, 0)
);
}, 0);

for (const mois of mois_liste) {
const nref19 = Nref19[ca][mois][zc];
const nref21 = Nref21[ca][mois][zc];

// pertes stockage
const Qgw_total = instal_ecs.reduce((acc, instal_ecs) => {
const gen_ecs = instal_ecs.generateur_ecs_collection.generateur_ecs;
return (
acc +
gen_ecs.reduce((acc, gen_ecs) => {
return acc + (gen_ecs.donnee_intermediaire.Qgw || 0);
}, 0)
);
}, 0);
const Qrec_stock_19 = (0.48 * nref19 * Qgw_total) / (24 * 365);
const Qrec_stock_21 = (0.48 * nref21 * Qgw_total) / (24 * 365);
pertes_stockage_ecs_recup += Qrec_stock_19 / 1000;
Expand All @@ -75,8 +74,15 @@ export default function calc_besoin_ch(

sumNref19 += nref19;
sumNref21 += nref21;
QrecDistr += instal_ecs.reduce((acc, ecs) => acc + calc_Qdw_j(ecs, becs_j), 0);
QrecDistrDepensier += instal_ecs.reduce((acc, ecs) => acc + calc_Qdw_j(ecs, becs_j_dep), 0);

// If several ECS installations, we consider a contribution of half for each (&15.2.3)
const Rat_ecs = instal_ecs.length > 1 ? 0.5 : 1;

QrecDistr += instal_ecs.reduce((acc, ecs) => acc + calc_Qdw_j(ecs, becs_j, Rat_ecs), 0);
QrecDistrDepensier += instal_ecs.reduce(
(acc, ecs) => acc + calc_Qdw_j(ecs, becs_j_dep, Rat_ecs),
0
);

// bvj
const dh19j = dh19[ca][mois][zc];
Expand Down

0 comments on commit 8946e87

Please sign in to comment.