Skip to content

Commit

Permalink
feat(feat-75): new values for classe_emission_ges and classe_bilan_dp…
Browse files Browse the repository at this point in the history
…e for surface <= 40m2
  • Loading branch information
Jérôme GAVIGNET committed Aug 23, 2024
1 parent d1653a6 commit e11d840
Show file tree
Hide file tree
Showing 8 changed files with 4,591 additions and 28 deletions.
59 changes: 36 additions & 23 deletions src/conso.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import enums from './enums.js';
import calc_conso_eclairage from './16_conso_eclairage.js';
import tvs from './tv.js';

const coef_ep = {
'électricité ch': 2.3,
Expand Down Expand Up @@ -91,11 +92,17 @@ export default function calc_conso(Sh, zc_id, ca_id, vt, ch, ecs, fr) {
emission_ges: calc_conso_pond(Sh, zc_id, vt, gen_ch, gen_ecs, fr, 'emission_ges', coef_ges),
cout: calc_conso_pond(Sh, zc_id, vt, gen_ch, gen_ecs, fr, 'cout', coef_cout)
};
ret.ep_conso.classe_bilan_dpe = classe_bilan_dpe(ret.ep_conso.ep_conso_5_usages_m2, zc_id, ca_id);
ret.ep_conso.classe_bilan_dpe = classe_bilan_dpe(
ret.ep_conso.ep_conso_5_usages_m2,
zc_id,
ca_id,
Sh
);
ret.emission_ges.classe_emission_ges = classe_emission_ges(
ret.emission_ges.emission_ges_5_usages_m2,
zc_id,
ca_id
ca_id,
Sh
);

const energie_ids = [];
Expand Down Expand Up @@ -142,42 +149,48 @@ export default function calc_conso(Sh, zc_id, ca_id, vt, ch, ecs, fr) {
return ret;
}

function classe_bilan_dpe(ep_conso_5_usages_m2, zc_id, ca_id) {
function classe_bilan_dpe(ep_conso_5_usages_m2, zc_id, ca_id, Sh) {
const ca = enums.classe_altitude[ca_id];

const cut = tvs.bilanDpe[ca][Math.round(Sh)] ?? [];

if (!ep_conso_5_usages_m2) return null;
if (ep_conso_5_usages_m2 < 70) return 'A';
if (ep_conso_5_usages_m2 < 110) return 'B';
if (ep_conso_5_usages_m2 < 180) return 'C';
if (ep_conso_5_usages_m2 < 250) return 'D';
if (ep_conso_5_usages_m2 < (cut['A'] ?? 70)) return 'A';
if (ep_conso_5_usages_m2 < (cut['B'] ?? 110)) return 'B';
if (ep_conso_5_usages_m2 < (cut['C'] ?? 180)) return 'C';
if (ep_conso_5_usages_m2 < (cut['D'] ?? 250)) return 'D';

const zc = enums.zone_climatique[zc_id];
const ca = enums.classe_altitude[ca_id];

if (['h1b', 'h1c', 'h2d'].includes(zc) && ca == 'supérieur à 800m') {
if (ep_conso_5_usages_m2 < 390) return 'E';
if (ep_conso_5_usages_m2 < 500) return 'F';
if (['h1b', 'h1c', 'h2d'].includes(zc) && ca === 'supérieur à 800m') {
if (ep_conso_5_usages_m2 < (cut['E'] ?? 390)) return 'E';
if (ep_conso_5_usages_m2 < (cut['F'] ?? 500)) return 'F';
} else {
if (ep_conso_5_usages_m2 < 330) return 'E';
if (ep_conso_5_usages_m2 < 420) return 'F';
if (ep_conso_5_usages_m2 < (cut['E'] ?? 330)) return 'E';
if (ep_conso_5_usages_m2 < (cut['F'] ?? 420)) return 'F';
}
return 'G';
}

function classe_emission_ges(emission_ges_5_usages_m2, zc_id, ca_id) {
function classe_emission_ges(emission_ges_5_usages_m2, zc_id, ca_id, Sh) {
const ca = enums.classe_altitude[ca_id];

const cut = tvs.emissionGes[ca][Math.round(Sh)] ?? [];

if (!emission_ges_5_usages_m2) return null;
if (emission_ges_5_usages_m2 < 6) return 'A';
if (emission_ges_5_usages_m2 < 11) return 'B';
if (emission_ges_5_usages_m2 < 30) return 'C';
if (emission_ges_5_usages_m2 < 50) return 'D';
if (emission_ges_5_usages_m2 < (cut['A'] ?? 6)) return 'A';
if (emission_ges_5_usages_m2 < (cut['B'] ?? 11)) return 'B';
if (emission_ges_5_usages_m2 < (cut['C'] ?? 30)) return 'C';
if (emission_ges_5_usages_m2 < (cut['D'] ?? 50)) return 'D';

const zc = enums.zone_climatique[zc_id];
const ca = enums.classe_altitude[ca_id];

if (['h1b', 'h1c', 'h2d'].includes(zc) && ca == 'supérieur à 800m') {
if (emission_ges_5_usages_m2 < 80) return 'E';
if (emission_ges_5_usages_m2 < 110) return 'F';
if (emission_ges_5_usages_m2 < (cut['E'] ?? 80)) return 'E';
if (emission_ges_5_usages_m2 < (cut['F'] ?? 110)) return 'F';
} else {
if (emission_ges_5_usages_m2 < 70) return 'E';
if (emission_ges_5_usages_m2 < 100) return 'F';
if (emission_ges_5_usages_m2 < (cut['E'] ?? 70)) return 'E';
if (emission_ges_5_usages_m2 < (cut['F'] ?? 100)) return 'F';
}
return 'G';
}
Expand Down
Loading

0 comments on commit e11d840

Please sign in to comment.