Skip to content
Open
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test:corpus:ch-col": "node test/corpus/run_corpus_checks.js --corpus-file-path=test/corpus/dpe_immeuble_chauffage_collectif.csv",
"test:corpus:ch-mix": "node test/corpus/run_corpus_checks.js --corpus-file-path=test/corpus/dpe_immeuble_chauffage_mixte.csv",
"test:corpus:all": "npm run test:corpus && npm run test:corpus:ch-ind && npm run test:corpus:ch-col && npm run test:corpus:ch-mix",
"test:corpus:all+database": "npm run test:corpus:all && node test/corpus/corpus_database.js",
"qa:lint": "eslint .",
"qa:lint:fix": "npm run qa:lint -- --fix",
"qa:duplication": "jscpd",
Expand Down
15 changes: 10 additions & 5 deletions src/14_generateur_ecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,25 @@ export function calc_Qdw_j(instal_ecs, becs_j) {

const type_installation = requestInput(de, du, 'type_installation');

const Qdw_ind_vc = calc_Qdw_ind_j(becs_j);
const Qdw_ind_vc = calc_Qdw_ind_j(instal_ecs, becs_j);
const Qdw_coll_vc = calc_Qdw_col_j(instal_ecs, becs_j, type_installation);

return (Qdw_ind_vc + Qdw_coll_vc) * 0.48;
return Qdw_ind_vc + Qdw_coll_vc;
}

// 15.2.3
export function calc_Qdw_ind_j(becs_j) {
return (0.1 * becs_j) / 8760.0;
/**
* @param instal_ecs {InstallationEcsItem}
* @param becs_j {number}
*/
export function calc_Qdw_ind_j(instal_ecs, becs_j) {
const Rat_ecs = instal_ecs.generateur_ecs_collection.generateur_ecs.length > 1 ? 0.5 : 1;
return 0.1 * Rat_ecs * becs_j;
}

export function calc_Qdw_col_j(instal_ecs, becs_j, type_installation) {
if (type_installation.includes('installation collective')) {
return (0.112 * becs_j) / 8760.0;
return 0.112 * becs_j;
}
return 0;
}
Expand Down
87 changes: 70 additions & 17 deletions src/9_besoin_ch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import enums from './enums.js';
import tvs from './tv.js';
import { calc_Qdw_j } from './14_generateur_ecs.js';
import { calc_besoin_ecs_j } from './11_besoin_ecs.js';
import { calc_Qrec_gen_j } from './9_generateur_ch.js';
import { calc_ai_j, calc_as_j } from './6.1_apport_gratuit.js';
Expand All @@ -18,7 +17,9 @@ export default function calc_besoin_ch(
instal_ecs,
instal_ch,
bv,
ets
ets,
th,
nbLogements
) {
const ca = enums.classe_altitude[ca_id];
const zc = enums.zone_climatique[zc_id];
Expand Down Expand Up @@ -48,10 +49,8 @@ export default function calc_besoin_ch(
* 11.4 Plusieurs systèmes d’ECS (limité à 2 systèmes différents par logement)
* Les besoins en ECS pour chaque générateur sont / 2
*/
const prorataEcs = instal_ecs.length > 1 ? 0.5 : 1;
const prorataEcs = instal_ecs.length > 1 ? 1 / instal_ecs.length : 1;

let Qdw_total_ecs = 0;
let Qdw_total_ecs_dep = 0;
let Qgw_total_ecs = 0;
instal_ecs.forEach((instal_ecs) => {
let Qgw;
Expand All @@ -78,15 +77,16 @@ export default function calc_besoin_ch(
Qgw_total_ecs += (0.48 * Qgw * (instal_ecs.donnee_entree.rdim || 1)) / 8760;
});

for (const mois of mois_liste) {
// en kw/h
const becsj = calc_besoin_ecs_j(ca, mois, zc, nadeq, false) * prorataEcs;
// en kw/h
const becs_j_dep = calc_besoin_ecs_j(ca, mois, zc, nadeq, true) * prorataEcs;

Qdw_total_ecs += instal_ecs.reduce((acc, ecs) => acc + calc_Qdw_j(ecs, becsj), 0);
Qdw_total_ecs_dep += instal_ecs.reduce((acc, ecs) => acc + calc_Qdw_j(ecs, becs_j_dep), 0);
}
const { Qrec, Qrec_dep, sumNref19, sumNref21 } = calc_qrec(
instal_ecs,
nadeq,
prorataEcs,
ilpa,
ca,
zc,
th,
nbLogements
);

/**
* Création de la liste des générateurs de chauffage pour lesquels il y a une récupération d'énergie
Expand Down Expand Up @@ -144,24 +144,26 @@ export default function calc_besoin_ch(
pertes_generateur_ch_recup += gen_recup;
pertes_generateur_ch_recup_depensier += gen_recup_dep;

const pertes_distribution_ecs_recup_j = nref19 * Qdw_total_ecs * 1000;
const pertes_distribution_ecs_recup_j_dep = nref21 * Qdw_total_ecs_dep * 1000;
const pertes_distribution_ecs_recup_j = (Qrec * nref19) / sumNref19;
const pertes_distribution_ecs_recup_j_dep = (Qrec_dep * nref21) / sumNref21;
pertes_distribution_ecs_recup += pertes_distribution_ecs_recup_j;
pertes_distribution_ecs_recup_depensier += pertes_distribution_ecs_recup_j_dep;

const pertes_stockage_ecs_recup_j = nref19 * Qgw_total_ecs;
pertes_stockage_ecs_recup += pertes_stockage_ecs_recup_j;
const pertes_stockage_ecs_recup_j_dep = nref21 * Qgw_total_ecs;

// Normalement en wh
besoin_ch_mois[mois] = bvj * dh19j;
besoin_ch_mois_dep[mois] = bvj_dep * dh21j;
besoin_ch_mois[mois] -=
pertes_distribution_ecs_recup_j + pertes_stockage_ecs_recup_j + gen_recup;
besoin_ch_mois_dep[mois] -=
pertes_distribution_ecs_recup_j_dep + pertes_stockage_ecs_recup_j_dep + gen_recup_dep;
besoin_ch_mois[mois] = Math.max(besoin_ch_mois[mois], 0);
besoin_ch += besoin_ch_mois[mois] / 1000;

// Besoin de chauffage final en kwh
besoin_ch += besoin_ch_mois[mois] / 1000;
besoin_ch_depensier += besoin_ch_mois_dep[mois] / 1000;
}

Expand All @@ -182,6 +184,57 @@ export default function calc_besoin_ch(
};
}

function calc_qrec(instal_ecs, nadeq, prorataEcs, ilpa, ca, zc, th, nbLogements) {
const Nref21 = tvs.nref21[ilpa];
const Nref19 = tvs.nref19[ilpa];

let sumNref19 = 0;
let sumNref21 = 0;

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

let Qrec = 0;
let Qrec_dep = 0;
let total_becs_rdim = 0;
let total_becs_dep_rdim = 0;
instal_ecs.forEach((ecs) => {
let becs_int = 0;
let becs_dep_int = 0;
const isInstallationSimple = ecs.donnee_entree.enum_type_installation_id === '1';
const Tau = isInstallationSimple ? 0.1 : 0.212;
if (th === 'immeuble' && ecs.donnee_entree.rdim > 1) {
prorataEcs = ecs.donnee_entree.rdim / nbLogements;
}
for (const mois of mois_liste) {
// en kwh
becs_int += calc_besoin_ecs_j(ca, mois, zc, nadeq, false) * prorataEcs;

// en kwh
becs_dep_int += calc_besoin_ecs_j(ca, mois, zc, nadeq, true) * prorataEcs;
}

if (th !== 'immeuble') {
Qrec += ((0.48 * sumNref19 * Tau * becs_int) / 8760) * 1000;
Qrec_dep += ((0.48 * sumNref21 * Tau * becs_dep_int) / 8760) * 1000;
} else {
total_becs_rdim += Tau * becs_int * 1000;
total_becs_dep_rdim += Tau * becs_dep_int * 1000;
}
});

if (th === 'immeuble') {
Qrec = ((0.48 * sumNref19) / 8760) * total_becs_rdim;
Qrec_dep = ((0.48 * sumNref21) / 8760) * total_becs_dep_rdim;
}

return { Qrec, Qrec_dep, sumNref19, sumNref21 };
}

function calc_Fj(GV, asj, aij, dhj, inertie) {
if (dhj === 0) return 0;

Expand Down
4 changes: 3 additions & 1 deletion src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ export function calcul_3cl(dpe) {
ecs,
instal_ch,
bv_list,
ets
ets,
th,
dpe.logement.caracteristique_generale.nombre_appartement
);
apport_et_besoin = { ...apport_et_besoin, ...besoin_ch };

Expand Down
Loading
Loading