Skip to content

Commit

Permalink
Merge pull request jzck#305 from RedFroggy/fix304RepartConsoAux
Browse files Browse the repository at this point in the history
fix(fix-304): Use cle_repartition_ventilation and cle_repartition_ch for conso_auxiliaire
  • Loading branch information
jgavignet authored Jan 17, 2025
2 parents 9c823e0 + 87cfac4 commit 3fe7c0e
Show file tree
Hide file tree
Showing 5 changed files with 4,373 additions and 11 deletions.
20 changes: 18 additions & 2 deletions src/16_conso_eclairage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import enums from './enums.js';

/**
* Nombre moyen d'heures d'éclairage annuel pour chacune des zones
* @type {{h1a: number, h1b: number, h1c: number, h2a: number, h2b: number, h2c: number, h2d: number, h3: number}}
*/
const Nh = {
h1a: 1500,
h1b: 1445,
Expand All @@ -11,11 +15,23 @@ const Nh = {
h3: 1506
};

/**
* 16.1 Consommation d’éclairage (Cecl)
* @param zc_id
* @returns {number}
*/
export default function calc_conso_eclairage(zc_id) {
const zc = enums.zone_climatique[zc_id];

// Coefficient correspondant au taux d'utilisation de l'éclairage en l'absence d'éclairage naturel. Il prend la
// valeur de 0,9 pour une commande de l’éclairage par interrupteur (considéré dans les logements).
const C = 0.9;

// Puissance d’éclairage conventionnelle, égale à 1,4 W/m2
const Pecl = 1.4;
const Cecl = (C * Pecl * Nh[zc]) / 1000;
return Cecl;

// Nombre d’heures de fonctionnement de l’éclairage sur l'année
const nh = Nh[zc];

return (C * Pecl * nh) / 1000;
}
2 changes: 1 addition & 1 deletion src/6.2_surface_sud_equivalente.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function getSsd(bv, zc, mois, coeff) {
const di = bv.donnee_intermediaire || {};

const orientation = enums.orientation[de.enum_orientation_id];
const inclinaison = enums.inclinaison_vitrage[de.enum_inclinaison_vitrage_id];
const inclinaison = enums.inclinaison_vitrage[de.enum_inclinaison_vitrage_id ?? 3];
let oi = `${orientation} ${inclinaison}`;
if (inclinaison === 'horizontal') oi = 'horizontal';
const c1j = c1[zc][mois][oi];
Expand Down
12 changes: 8 additions & 4 deletions src/9_conso_ch.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ function coef_ch(Fch) {
export function conso_ch(di, de, du, _pos, cfg_ch, em_list, GV, Sh, hsp, bch, bch_dep) {
const gen_lge_id = requestInputID(de, du, 'lien_generateur_emetteur');
const coef = coef_ch(de.fch || 0.5)[cfg_ch][_pos] || 1;
let em_filt;

const em_filt = em_list.filter(
(em) => em.donnee_entree.enum_lien_generateur_emetteur_id === gen_lge_id
);

if (em_list.length === 1) {
em_filt = em_list;
} else {
em_filt = em_list.filter(
(em) => em.donnee_entree.enum_lien_generateur_emetteur_id === gen_lge_id
);
}
const emetteur_eq = em_filt.reduce((acc, em) => {
const int = calc_intermittence(GV, Sh, hsp, em.donnee_intermediaire.i0);
const r_em = rendement_emission(em);
Expand Down
38 changes: 34 additions & 4 deletions src/conso.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ export default function calc_conso(
value.donnee_entree.cle_repartition_ch =
ch.donnee_entree.cle_repartition_ch || prorataChauffage;
}
value.donnee_entree.enum_methode_calcul_conso_id =
ch.donnee_entree.enum_methode_calcul_conso_id;
value.donnee_entree.enum_type_installation_id = ch.donnee_entree.enum_type_installation_id;
(value.donnee_utilisateur = value.donnee_utilisateur || {}).coeffEmissionGes =
getGesCoeffForGenerateur(value, 'ch');
Expand Down Expand Up @@ -267,7 +269,18 @@ export default function calc_conso(
const gen_ecs_en = gen_ecs.filter(
(gen_ecs) => gen_ecs.donnee_entree.enum_type_energie_id === energie_id
);
let conso_en = calc_conso_pond(Sh, zc_id, vt_en, gen_ch_en, gen_ecs_en, fr_en, '', null);
let conso_en = calc_conso_pond(
Sh,
zc_id,
vt_en,
gen_ch_en,
gen_ecs_en,
fr_en,
'',
null,
prorataECS,
prorataChauffage
);
conso_en = {
conso_ch: conso_en._ch,
conso_ecs: conso_en._ecs,
Expand Down Expand Up @@ -400,7 +413,12 @@ function calc_conso_pond(
) {
const ret = {};
ret.auxiliaire_ventilation = vt_list.reduce((acc, vt) => {
const conso = vt.donnee_intermediaire.conso_auxiliaire_ventilation || 0;
let conso = vt.donnee_intermediaire.conso_auxiliaire_ventilation || 0;

if (vt.donnee_entree.cle_repartition_ventilation) {
conso *= vt.donnee_entree.cle_repartition_ventilation;
}

return acc + getConso(coef, 'électricité auxiliaire', conso);
}, 0);

Expand All @@ -419,7 +437,19 @@ function calc_conso_pond(
}, 0);

ret.auxiliaire_distribution_ch = gen_ch.reduce((acc, gen_ch) => {
const conso = gen_ch.donnee_intermediaire.conso_auxiliaire_distribution_ch || 0;
let conso = gen_ch.donnee_intermediaire.conso_auxiliaire_distribution_ch || 0;

/**
* enum_methode_calcul_conso_id
* 2 : 'installation collective rapportée à un logement : cas générateur à combustion virtuel ou ecs collective virtuelle'
*/
if (
['2', '4'].includes(gen_ch.donnee_entree.enum_methode_calcul_conso_id) &&
gen_ch.donnee_entree.cle_repartition_ch
) {
conso *= gen_ch.donnee_entree.cle_repartition_ch;
}

return acc + getConso(coef, 'électricité auxiliaire', conso);
}, 0);

Expand Down Expand Up @@ -484,7 +514,7 @@ function calc_conso_pond(
}

/**
* Retourne le type d'énergie utlisé.
* Retourne le type d'énergie utilisé.
* 1 - Electricité par défaut si la donnée n'est pas définie
* @param donneeEntree {Donnee_entree}
* @param suffix {string} Suffix à ajouter au type électricité
Expand Down
Loading

0 comments on commit 3fe7c0e

Please sign in to comment.