@open3cl/engine 1.3.25 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/16.2_production_enr.js +45 -21
- package/README.md +107 -72
- package/conso.js +36 -13
- package/dpe-sanitizer.service.js +90 -0
- package/engine.js +68 -14
- package/index.js +8 -2
- package/package.json +1 -1
- package/utils.js +33 -33
package/16.2_production_enr.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import enums from './enums.js';
|
|
2
2
|
import { mois_liste, tv } from './utils.js';
|
|
3
3
|
import tvs from './tv.js';
|
|
4
|
+
import { COEFF_EP_1_9, COEFF_EP_2_3 } from './conso.js';
|
|
4
5
|
|
|
5
6
|
export class ProductionENR {
|
|
6
7
|
#taplpi = {
|
|
@@ -19,7 +20,7 @@ export class ProductionENR {
|
|
|
19
20
|
* @param productionElecEnr
|
|
20
21
|
* @param Sh {string}
|
|
21
22
|
*/
|
|
22
|
-
calculateEnr(productionElecEnr, conso, Sh, th, zc_id) {
|
|
23
|
+
calculateEnr(productionElecEnr, conso, Sh, th, zc_id, use_coeff_ch_elec_2_3) {
|
|
23
24
|
const productionElectricite = {
|
|
24
25
|
conso_elec_ac: 0,
|
|
25
26
|
production_pv: 0,
|
|
@@ -44,7 +45,7 @@ export class ProductionENR {
|
|
|
44
45
|
this.updateEfConso(productionElectricite, conso, Sh);
|
|
45
46
|
|
|
46
47
|
// Mise à jour des consommations d'énergie primaire en minorant l'énergie consommée par l'énergie autoconsommée par le poste
|
|
47
|
-
this.updateEPConso(productionElectricite, conso, Sh);
|
|
48
|
+
this.updateEPConso(productionElectricite, conso, Sh, use_coeff_ch_elec_2_3);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
return {
|
|
@@ -179,26 +180,49 @@ export class ProductionENR {
|
|
|
179
180
|
* Mise à jour des consommations ef en minorant l'énergie primaire consommée par l'énergie autoconsommée par chaque enveloppe
|
|
180
181
|
* @param productionElectricite
|
|
181
182
|
* @param conso {{ep_conso: Ep_conso}}
|
|
182
|
-
* @param Sh
|
|
183
|
+
* @param Sh {number}
|
|
184
|
+
* @param use_coeff_ch_elec_2_3 {boolean} "true" pour ne pas utiliser le dernier coeff de chauffage électrique
|
|
183
185
|
*/
|
|
184
|
-
updateEPConso(productionElectricite, conso, Sh) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
186
|
+
updateEPConso(productionElectricite, conso, Sh, use_coeff_ch_elec_2_3) {
|
|
187
|
+
if (use_coeff_ch_elec_2_3) {
|
|
188
|
+
conso.ep_conso.ep_conso_ecs -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_ecs;
|
|
189
|
+
conso.ep_conso.ep_conso_ch -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_ch;
|
|
190
|
+
conso.ep_conso.ep_conso_fr -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_fr;
|
|
191
|
+
conso.ep_conso.ep_conso_eclairage -=
|
|
192
|
+
COEFF_EP_2_3 * productionElectricite.conso_elec_ac_eclairage;
|
|
193
|
+
conso.ep_conso.ep_conso_totale_auxiliaire -=
|
|
194
|
+
COEFF_EP_2_3 * productionElectricite.conso_elec_ac_auxiliaire;
|
|
195
|
+
|
|
196
|
+
const conso_elec =
|
|
197
|
+
productionElectricite.conso_elec_ac_ecs +
|
|
198
|
+
productionElectricite.conso_elec_ac_ch +
|
|
199
|
+
productionElectricite.conso_elec_ac_fr +
|
|
200
|
+
productionElectricite.conso_elec_ac_eclairage +
|
|
201
|
+
productionElectricite.conso_elec_ac_auxiliaire;
|
|
202
|
+
|
|
203
|
+
conso.ep_conso.ep_conso_5_usages -= COEFF_EP_2_3 * conso_elec;
|
|
204
|
+
|
|
205
|
+
conso.ep_conso.ep_conso_5_usages_m2 = Math.floor(conso.ep_conso.ep_conso_5_usages / Sh);
|
|
206
|
+
} else {
|
|
207
|
+
conso.ep_conso.ep_conso_ecs -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_ecs;
|
|
208
|
+
conso.ep_conso.ep_conso_ch -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_ch;
|
|
209
|
+
conso.ep_conso.ep_conso_fr -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_fr;
|
|
210
|
+
conso.ep_conso.ep_conso_eclairage -=
|
|
211
|
+
COEFF_EP_1_9 * productionElectricite.conso_elec_ac_eclairage;
|
|
212
|
+
conso.ep_conso.ep_conso_totale_auxiliaire -=
|
|
213
|
+
COEFF_EP_1_9 * productionElectricite.conso_elec_ac_auxiliaire;
|
|
214
|
+
|
|
215
|
+
const conso_elec =
|
|
216
|
+
productionElectricite.conso_elec_ac_ecs +
|
|
217
|
+
productionElectricite.conso_elec_ac_ch +
|
|
218
|
+
productionElectricite.conso_elec_ac_fr +
|
|
219
|
+
productionElectricite.conso_elec_ac_eclairage +
|
|
220
|
+
productionElectricite.conso_elec_ac_auxiliaire;
|
|
221
|
+
|
|
222
|
+
conso.ep_conso.ep_conso_5_usages -= COEFF_EP_1_9 * conso_elec;
|
|
223
|
+
|
|
224
|
+
conso.ep_conso.ep_conso_5_usages_m2 = Math.floor(conso.ep_conso.ep_conso_5_usages / Sh);
|
|
225
|
+
}
|
|
202
226
|
}
|
|
203
227
|
|
|
204
228
|
/**
|
package/README.md
CHANGED
|
@@ -73,7 +73,8 @@ Vous devez d'abord installer [NodeJS](https://nodejs.org/en) en version 20 ou su
|
|
|
73
73
|
|
|
74
74
|
## Démonstration
|
|
75
75
|
|
|
76
|
-
Il est possible d'analyser un dpe pour tester la lib
|
|
76
|
+
Il est possible d'analyser un dpe pour tester la lib
|
|
77
|
+
Open3CL: [https://open3cl.github.io/engine](https://open3cl.github.io/engine/build/).
|
|
77
78
|
Un dpe au format XML peut être chargé, il sera envoyé à la lib Open3CL. Un visuel permet de voir les informations
|
|
78
79
|
du dpe d'origine ainsi que du dpe en sortie de la lib ainsi qu'un différentiel.
|
|
79
80
|
|
|
@@ -84,7 +85,7 @@ C'est un bon moyen de détecter un éventuel problème dans le dpe ou la librair
|
|
|
84
85
|
```javascript
|
|
85
86
|
import { calcul_3cl } from 'open3cl';
|
|
86
87
|
|
|
87
|
-
// Exemple d'objet JSON issu d'un fichier XML DPE
|
|
88
|
+
// Exemple d'objet JSON (partiel) issu d'un fichier XML DPE
|
|
88
89
|
const dpeData = {
|
|
89
90
|
numero_dpe: '2113E1018248X',
|
|
90
91
|
statut: 'ACTIF',
|
|
@@ -107,7 +108,23 @@ const dpeData = {
|
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
|
|
111
|
+
// Execution d'un dpe avec la librairie Open3CL avec pré-transformation / nettoyage du dpe (comportement par défaut)
|
|
110
112
|
const result = calcul_3cl(dpeData);
|
|
113
|
+
const result = calcul_3cl(dpeData, { sanitize: true });
|
|
114
|
+
|
|
115
|
+
// Execution d'un dpe avec la librairie Open3CL sans pré-transformation / nettoyage du dpe
|
|
116
|
+
const result = calcul_3cl(dpeData, { sanitize: false });
|
|
117
|
+
|
|
118
|
+
// Execution d'un dpe au format xml avec la librairie Open3CL avec pré-transformation / nettoyage du dpe (comportement par défaut)
|
|
119
|
+
const result = calcul_3cl_xml('<xml><dpe><numero_dpe>2113E1018248X</numero_dpe></dpe</xml>');
|
|
120
|
+
const result = calcul_3cl_xml('<xml><dpe><numero_dpe>2113E1018248X</numero_dpe></dpe</xml>', {
|
|
121
|
+
sanitize: true
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Execution d'un dpe au format xml avec la librairie Open3CL sans pré-transformation / nettoyage du dpe (comportement par défaut)
|
|
125
|
+
const result = calcul_3cl_xml('<xml><dpe><numero_dpe>2113E1018248X</numero_dpe></dpe</xml>', {
|
|
126
|
+
sanitize: false
|
|
127
|
+
});
|
|
111
128
|
```
|
|
112
129
|
|
|
113
130
|
## Variables d'environnements
|
|
@@ -182,6 +199,8 @@ Il existe actuellement 8 corpus (avec 10000 dpe analysés dans chaque corpus) :
|
|
|
182
199
|
Par défaut, le corpus utilisé est présent ici : [test/corpus/corpus_dpe.csv](test/corpus/files/corpus_dpe.csv)
|
|
183
200
|
- `npm run test:corpus -- dpes-folder-path=/home/user/dpes`. Chemin vers le dossier ou les DPE seront téléchargés. Si un
|
|
184
201
|
fichier DPE est déjà présent dans ce dossier, il ne sera pas retéléchargé.
|
|
202
|
+
- `npm run test:corpus -- dpes-code=2592E1233185X`. Execution du corpus sur le dpe spécifié.
|
|
203
|
+
- Si le dpe n'est pas présent en local, il sera téléchargé sur le site de l'ADEME.
|
|
185
204
|
|
|
186
205
|
### Résultats corpus
|
|
187
206
|
|
|
@@ -190,78 +209,94 @@ Résultats des tests de corpus avec le mode de compatibilité activé.
|
|
|
190
209
|
<details>
|
|
191
210
|
<summary>Voir les versions précédents</summary>
|
|
192
211
|
|
|
193
|
-
| Version librairie | corpus
|
|
194
|
-
| :------------------- |
|
|
195
|
-
| <ins>**1.2.3**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
196
|
-
| 1.2.3 | dpe_immeuble_chauffage_individuel.csv
|
|
197
|
-
| 1.2.3 | dpe_immeuble_chauffage_collectif.csv
|
|
198
|
-
| 1.2.3 | dpe_immeuble_chauffage_mixte.csv
|
|
199
|
-
| <ins>**1.2.8**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
200
|
-
| 1.2.8 | dpe_immeuble_chauffage_individuel.csv
|
|
201
|
-
| 1.2.8 | dpe_immeuble_chauffage_collectif.csv
|
|
202
|
-
| 1.2.8 | dpe_immeuble_chauffage_mixte.csv
|
|
203
|
-
| <ins>**1.3.1**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
204
|
-
| 1.3.1 | dpe_immeuble_chauffage_individuel.csv
|
|
205
|
-
| 1.3.1 | dpe_immeuble_chauffage_collectif.csv
|
|
206
|
-
| 1.3.1 | dpe_immeuble_chauffage_mixte.csv
|
|
207
|
-
| <ins>**1.3.2**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
208
|
-
| 1.3.2 | dpe_immeuble_chauffage_individuel.csv
|
|
209
|
-
| 1.3.2 | dpe_immeuble_chauffage_collectif.csv
|
|
210
|
-
| 1.3.2 | dpe_immeuble_chauffage_mixte.csv
|
|
211
|
-
| <ins>**1.3.5**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
212
|
-
| 1.3.5 | dpe_immeuble_chauffage_individuel.csv
|
|
213
|
-
| 1.3.5 | dpe_immeuble_chauffage_collectif.csv
|
|
214
|
-
| 1.3.5 | dpe_immeuble_chauffage_mixte.csv
|
|
215
|
-
| <ins>**1.3.6**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
216
|
-
| 1.3.6 | dpe_immeuble_chauffage_individuel.csv
|
|
217
|
-
| 1.3.6 | dpe_immeuble_chauffage_collectif.csv
|
|
218
|
-
| 1.3.6 | dpe_immeuble_chauffage_mixte.csv
|
|
219
|
-
| <ins>**1.3.7**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
220
|
-
| 1.3.7 | dpe_immeuble_chauffage_individuel.csv
|
|
221
|
-
| 1.3.7 | dpe_immeuble_chauffage_collectif.csv
|
|
222
|
-
| 1.3.7 | dpe_immeuble_chauffage_mixte.csv
|
|
223
|
-
| <ins>**1.3.8**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
224
|
-
| 1.3.8 | dpe_immeuble_chauffage_individuel.csv
|
|
225
|
-
| 1.3.8 | dpe_immeuble_chauffage_collectif.csv
|
|
226
|
-
| 1.3.8 | dpe_immeuble_chauffage_mixte.csv
|
|
227
|
-
| <ins>**1.3.9**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
228
|
-
| 1.3.9 | dpe_immeuble_chauffage_individuel.csv
|
|
229
|
-
| 1.3.9 | dpe_immeuble_chauffage_collectif.csv
|
|
230
|
-
| 1.3.9 | dpe_immeuble_chauffage_mixte.csv
|
|
231
|
-
| <ins>**1.3.11**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
232
|
-
| 1.3.11 | dpe_immeuble_chauffage_individuel.csv
|
|
233
|
-
| 1.3.11 | dpe_immeuble_chauffage_collectif.csv
|
|
234
|
-
| 1.3.11 | dpe_immeuble_chauffage_mixte.csv
|
|
235
|
-
| <ins>**1.3.12**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
236
|
-
| 1.3.12 | dpe_logement_individuel_2025.csv
|
|
237
|
-
| 1.3.12 | dpe_immeuble_chauffage_individuel.csv
|
|
238
|
-
| 1.3.12 | dpe_immeuble_chauffage_collectif.csv
|
|
239
|
-
| 1.3.12 | dpe_immeuble_chauffage_mixte.csv
|
|
240
|
-
| <ins>**1.3.15**<ins> | <ins>**corpus_dpe.csv**<ins>
|
|
241
|
-
| 1.3.15 | dpe_logement_individuel_2025.csv
|
|
242
|
-
| 1.3.15 | dpe_immeuble_chauffage_individuel.csv
|
|
243
|
-
| 1.3.15 | dpe_immeuble_chauffage_collectif.csv
|
|
244
|
-
| 1.3.15 | dpe_immeuble_chauffage_mixte.csv
|
|
212
|
+
| Version librairie | corpus | Nb en dessous du taux d'erreur | Taux de réussite | Description |
|
|
213
|
+
| :------------------- | -------------------------------------------------------- | ------------------------------ | ----------------------- | ------------------------------------------------- |
|
|
214
|
+
| <ins>**1.2.3**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4489**<ins> | <ins>**45%**<ins> | |
|
|
215
|
+
| 1.2.3 | dpe_immeuble_chauffage_individuel.csv | 3257 | 32% | |
|
|
216
|
+
| 1.2.3 | dpe_immeuble_chauffage_collectif.csv | 5279 | 53% | |
|
|
217
|
+
| 1.2.3 | dpe_immeuble_chauffage_mixte.csv | 2728 | 27% | |
|
|
218
|
+
| <ins>**1.2.8**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**489**<ins> | <ins>**45%**<ins> | |
|
|
219
|
+
| 1.2.8 | dpe_immeuble_chauffage_individuel.csv | 5275 (+2018) | 53% (+21%) | |
|
|
220
|
+
| 1.2.8 | dpe_immeuble_chauffage_collectif.csv | 5747 (+468) | 57% (+4%) | |
|
|
221
|
+
| 1.2.8 | dpe_immeuble_chauffage_mixte.csv | 3142 (+414) | 31% (+4%) | |
|
|
222
|
+
| <ins>**1.3.1**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4508 (+19)**<ins> | <ins>**45%**<ins> | |
|
|
223
|
+
| 1.3.1 | dpe_immeuble_chauffage_individuel.csv | 5459 (+184) | 55% (+2%) | |
|
|
224
|
+
| 1.3.1 | dpe_immeuble_chauffage_collectif.csv | 5848 (+101) | 58% (+1%) | |
|
|
225
|
+
| 1.3.1 | dpe_immeuble_chauffage_mixte.csv | 4018 (+876) | 40% (+9%) | |
|
|
226
|
+
| <ins>**1.3.2**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4519 (+11)**<ins> | <ins>**45%**<ins> | |
|
|
227
|
+
| 1.3.2 | dpe_immeuble_chauffage_individuel.csv | 5476 (+17) | 55% | |
|
|
228
|
+
| 1.3.2 | dpe_immeuble_chauffage_collectif.csv | 5869 (+21) | 58% | |
|
|
229
|
+
| 1.3.2 | dpe_immeuble_chauffage_mixte.csv | 4040 (+22) | 40% | |
|
|
230
|
+
| <ins>**1.3.5**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4522 (+3)**<ins> | <ins>**45%**<ins> | |
|
|
231
|
+
| 1.3.5 | dpe_immeuble_chauffage_individuel.csv | 5488 (+12) | 55% | |
|
|
232
|
+
| 1.3.5 | dpe_immeuble_chauffage_collectif.csv | 5869 | 58% | |
|
|
233
|
+
| 1.3.5 | dpe_immeuble_chauffage_mixte.csv | 4082 (+42) | 40% | |
|
|
234
|
+
| <ins>**1.3.6**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4522**<ins> | <ins>**45%**<ins> | |
|
|
235
|
+
| 1.3.6 | dpe_immeuble_chauffage_individuel.csv | 5650 (+162) | 56% | |
|
|
236
|
+
| 1.3.6 | dpe_immeuble_chauffage_collectif.csv | 5894 (+25) | 59% (+1%) | |
|
|
237
|
+
| 1.3.6 | dpe_immeuble_chauffage_mixte.csv | 4141 (+59) | 41% (+1%) | |
|
|
238
|
+
| <ins>**1.3.7**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4522**<ins> | <ins>**45%**<ins> | |
|
|
239
|
+
| 1.3.7 | dpe_immeuble_chauffage_individuel.csv | 6960 (+1310) | 69% (+13%) | |
|
|
240
|
+
| 1.3.7 | dpe_immeuble_chauffage_collectif.csv | 6106 (+212) | 61% (+2%) | |
|
|
241
|
+
| 1.3.7 | dpe_immeuble_chauffage_mixte.csv | 4730 (+589) | 47% (+6%) | |
|
|
242
|
+
| <ins>**1.3.8**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4522**<ins> | <ins>**45%**<ins> | |
|
|
243
|
+
| 1.3.8 | dpe_immeuble_chauffage_individuel.csv | 6965 (+5) | 69% | |
|
|
244
|
+
| 1.3.8 | dpe_immeuble_chauffage_collectif.csv | 6110 (+4) | 61% | |
|
|
245
|
+
| 1.3.8 | dpe_immeuble_chauffage_mixte.csv | 4735 (+5) | 47% | |
|
|
246
|
+
| <ins>**1.3.9**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4460**<ins> (-62) | <ins>**44% (-1%)**<ins> | Pertes liés au fix bug tribu zone 2hd valeur dh19 |
|
|
247
|
+
| 1.3.9 | dpe_immeuble_chauffage_individuel.csv | 6901 (-64) | 69% | Pertes liés au fix bug tribu zone 2hd valeur dh19 |
|
|
248
|
+
| 1.3.9 | dpe_immeuble_chauffage_collectif.csv | 6058 (-58) | 60% (-1%) | Pertes liés au fix bug tribu zone 2hd valeur dh19 |
|
|
249
|
+
| 1.3.9 | dpe_immeuble_chauffage_mixte.csv | 4728 (-7) | 47% | Pertes liés au fix bug tribu zone 2hd valeur dh19 |
|
|
250
|
+
| <ins>**1.3.11**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4468**<ins> (+8) | <ins>**44%**<ins> | |
|
|
251
|
+
| 1.3.11 | dpe_immeuble_chauffage_individuel.csv | 6901 | 69% | |
|
|
252
|
+
| 1.3.11 | dpe_immeuble_chauffage_collectif.csv | 6058 | 60% | |
|
|
253
|
+
| 1.3.11 | dpe_immeuble_chauffage_mixte.csv | 4727 (-1) | 47% | Dpes erronés sur le calcul volume ballon ecs |
|
|
254
|
+
| <ins>**1.3.12**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4467**<ins> (-1) | <ins>**44%**<ins> | Dpe erroné avec surface chauffée invalide |
|
|
255
|
+
| 1.3.12 | dpe_logement_individuel_2025.csv | 8429 | 84% | |
|
|
256
|
+
| 1.3.12 | dpe_immeuble_chauffage_individuel.csv | 6900 (-1) | 69% | Dpe erroné avec surface chauffée invalide |
|
|
257
|
+
| 1.3.12 | dpe_immeuble_chauffage_collectif.csv | 6058 | 60% | |
|
|
258
|
+
| 1.3.12 | dpe_immeuble_chauffage_mixte.csv | 4725 (-2) | 47% | Dpe erroné avec surface chauffée invalide |
|
|
259
|
+
| <ins>**1.3.15**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4481**<ins> (+14) | <ins>**45 (+1%)**<ins> | |
|
|
260
|
+
| 1.3.15 | dpe_logement_individuel_2025.csv | 8453 | 84% | |
|
|
261
|
+
| 1.3.15 | dpe_immeuble_chauffage_individuel.csv | 7106 (+205) | 71% (+2%) | |
|
|
262
|
+
| 1.3.15 | dpe_immeuble_chauffage_collectif.csv | 6083 (+25) | 61% (+1%) | |
|
|
263
|
+
| 1.3.15 | dpe_immeuble_chauffage_mixte.csv | 4751 (+24) | 47% | |
|
|
264
|
+
| <ins>**1.3.20**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4500**<ins> (+19) | <ins>**45%**<ins> | |
|
|
265
|
+
| 1.3.20 | dpe_logement_individuel_2025.csv | 8459 (+6) | 84% | |
|
|
266
|
+
| 1.3.20 | dpe_maison_individuelle_2025.csv | 8638 | 86% | |
|
|
267
|
+
| 1.3.20 | dpe_appartement_individuel_chauffage_individuel_2025.csv | 8561 | 86% | |
|
|
268
|
+
| 1.3.20 | dpe_immeuble_chauffage_individuel.csv | 7106 | 71% | |
|
|
269
|
+
| 1.3.20 | dpe_immeuble_chauffage_collectif.csv | 6083 | 61% | |
|
|
270
|
+
| 1.3.20 | dpe_immeuble_chauffage_mixte.csv | 4751 | 47% | |
|
|
271
|
+
| <ins>**1.3.21**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4502**<ins> (+2) | <ins>**45%**<ins> | |
|
|
272
|
+
| 1.3.21 | dpe_logement_individuel_2025.csv | 8504 (+45) | 85% (+1%) | |
|
|
273
|
+
| 1.3.21 | dpe_maison_individuelle_2025.csv | 8652 (+14) | 86% | |
|
|
274
|
+
| 1.3.21 | dpe_appartement_individuel_chauffage_individuel_2025.csv | 8578 (+17) | 86% | |
|
|
275
|
+
| 1.3.21 | dpe_appartement_individuel_chauffage_collectif_2025.csv | 6681 | 67% | |
|
|
276
|
+
| 1.3.21 | dpe_immeuble_chauffage_individuel.csv | 7144 (+38) | 71% | |
|
|
277
|
+
| 1.3.21 | dpe_immeuble_chauffage_collectif.csv | 6144 (+61) | 61% | |
|
|
278
|
+
| 1.3.21 | dpe_immeuble_chauffage_mixte.csv | 4760 (+9) | 47% | |
|
|
245
279
|
|
|
246
280
|
</details>
|
|
247
281
|
|
|
248
|
-
| Version librairie | corpus | Nb en dessous du taux d'erreur | Taux de réussite | Description
|
|
249
|
-
| :------------------- | -------------------------------------------------------- | ------------------------------ | ----------------- |
|
|
250
|
-
| <ins>**1.3.
|
|
251
|
-
| 1.3.
|
|
252
|
-
| 1.3.
|
|
253
|
-
| 1.3.
|
|
254
|
-
| 1.3.
|
|
255
|
-
| 1.3.
|
|
256
|
-
| 1.3.
|
|
257
|
-
|
|
|
258
|
-
| 1.
|
|
259
|
-
| 1.
|
|
260
|
-
| 1.
|
|
261
|
-
| 1.
|
|
262
|
-
| 1.
|
|
263
|
-
| 1.
|
|
264
|
-
| 1.
|
|
282
|
+
| Version librairie | corpus | Nb en dessous du taux d'erreur | Taux de réussite | Description |
|
|
283
|
+
| :------------------- | -------------------------------------------------------- | ------------------------------ | ----------------- | ------------------------------------ |
|
|
284
|
+
| <ins>**1.3.25**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4515**<ins> (+2) | <ins>**45%**<ins> | |
|
|
285
|
+
| 1.3.25 | dpe_logement_individuel_2025.csv | 8512 (+8) | 85% | |
|
|
286
|
+
| 1.3.25 | dpe_maison_individuelle_2025.csv | 8674 (+22) | 87% (+1%) | |
|
|
287
|
+
| 1.3.25 | dpe_appartement_individuel_chauffage_individuel_2025.csv | 8581 (+3) | 86% | |
|
|
288
|
+
| 1.3.25 | dpe_appartement_individuel_chauffage_collectif_2025.csv | 6680 (-1) | 67% | Dpe erronés enlevés du corpus |
|
|
289
|
+
| 1.3.25 | dpe_immeuble_chauffage_individuel.csv | 7142 (-2) | 71% | Dpe erronés enlevés du corpus |
|
|
290
|
+
| 1.3.25 | dpe_immeuble_chauffage_collectif.csv | 6144 | 61% | |
|
|
291
|
+
| 1.3.25 | dpe_immeuble_chauffage_mixte.csv | 4758 (-2) | 47% | Dpe erronés enlevés du corpus |
|
|
292
|
+
| <ins>**1.4.0**<ins> | <ins>**corpus_dpe.csv**<ins> | <ins>**4515**<ins> | <ins>**45%**<ins> | Maj coeff electricité (janvier 2026) |
|
|
293
|
+
| 1.4.0 | dpe_logement_individuel_2025.csv | 8512 | 85% | Maj coeff electricité (janvier 2026) |
|
|
294
|
+
| 1.4.0 | dpe_maison_individuelle_2025.csv | 8674 | 87% | Maj coeff electricité (janvier 2026) |
|
|
295
|
+
| 1.4.0 | dpe_appartement_individuel_chauffage_individuel_2025.csv | 8581 | 86% | Maj coeff electricité (janvier 2026) |
|
|
296
|
+
| 1.4.0 | dpe_appartement_individuel_chauffage_collectif_2025.csv | 6680 | 67% | Maj coeff electricité (janvier 2026) |
|
|
297
|
+
| 1.4.0 | dpe_immeuble_chauffage_individuel.csv | 7142 | 71% | Maj coeff electricité (janvier 2026) |
|
|
298
|
+
| 1.4.0 | dpe_immeuble_chauffage_collectif.csv | 6144 | 61% | Maj coeff electricité (janvier 2026) |
|
|
299
|
+
| 1.4.0 | dpe_immeuble_chauffage_mixte.csv | 4758 | 47% | Maj coeff electricité (janvier 2026) |
|
|
265
300
|
|
|
266
301
|
## Roadmap
|
|
267
302
|
|
|
@@ -297,7 +332,7 @@ Nous accueillons les contributions avec plaisir ! Si vous souhaitez améliorer O
|
|
|
297
332
|
|
|
298
333
|
## Licence
|
|
299
334
|
|
|
300
|
-
Distribué sous la license `
|
|
335
|
+
Distribué sous la license `MIT`. Lire le fichier `LICENSE` pour plus d'informations.
|
|
301
336
|
|
|
302
337
|
<p align="right">(<a href="#readme-top">Retour sommaire</a>)</p>
|
|
303
338
|
|
package/conso.js
CHANGED
|
@@ -3,16 +3,36 @@ import calc_conso_eclairage from './16_conso_eclairage.js';
|
|
|
3
3
|
import tvs from './tv.js';
|
|
4
4
|
import { tv } from './utils.js';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export const COEFF_EP_2_3 = 2.3;
|
|
7
|
+
export const COEFF_EP_1_9 = 1.9;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Coeff de chauffage 1.9 au 01/01/2026
|
|
11
|
+
* @link {https://www.legifrance.gouv.fr/jorf/id/JORFTEXT000052134589}
|
|
12
|
+
*/
|
|
13
|
+
export const coef_ep = {
|
|
14
|
+
'électricité ch': COEFF_EP_1_9,
|
|
15
|
+
'électricité ecs': COEFF_EP_1_9,
|
|
16
|
+
'électricité fr': COEFF_EP_1_9,
|
|
17
|
+
'électricité éclairage': COEFF_EP_1_9,
|
|
18
|
+
'électricité auxiliaire': COEFF_EP_1_9
|
|
12
19
|
};
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Coeff de chauffage 2.3 avant le 01/01/2026
|
|
23
|
+
*/
|
|
24
|
+
export const coef_ep_2_3 = {
|
|
25
|
+
'électricité ch': COEFF_EP_2_3,
|
|
26
|
+
'électricité ecs': COEFF_EP_2_3,
|
|
27
|
+
'électricité fr': COEFF_EP_2_3,
|
|
28
|
+
'électricité éclairage': COEFF_EP_2_3,
|
|
29
|
+
'électricité auxiliaire': COEFF_EP_2_3
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Au 31 mars 2021
|
|
34
|
+
* @link {https://www.legifrance.gouv.fr/download/pdf?id=doxMrRr0wbfJVvtWjfDP4gHzzERt1iX0PtobthCE6A0=}
|
|
35
|
+
*/
|
|
16
36
|
const coef_ges = {
|
|
17
37
|
'bois – bûches': 0.03,
|
|
18
38
|
'bois – granulés (pellets) ou briquettes': 0.03,
|
|
@@ -32,8 +52,11 @@ const coef_ges = {
|
|
|
32
52
|
'électricité auxiliaire': 0.064
|
|
33
53
|
};
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Annexe 7
|
|
57
|
+
* @link {https://www.legifrance.gouv.fr/download/file/doxMrRr0wbfJVvtWjfDP4qE7zNsiFZL-4wqNyqoY-CA=/JOE_TEXTE}
|
|
58
|
+
* @link {https://www.legifrance.gouv.fr/download/pdf?id=7hpbVyq228foxHzNM7WleDImAyXlPNb9zULelSY01V8=}
|
|
59
|
+
*/
|
|
37
60
|
const coef_cout = {
|
|
38
61
|
'fioul domestique': 0.09142,
|
|
39
62
|
'réseau de chauffage urbain': 0.0787,
|
|
@@ -44,7 +67,6 @@ const coef_cout = {
|
|
|
44
67
|
'bois – bûches': 0.03201,
|
|
45
68
|
'bois – plaquettes forestières': 0.03201,
|
|
46
69
|
'bois – plaquettes d’industrie': 0.03201,
|
|
47
|
-
// https://www.legifrance.gouv.fr/download/pdf?id=7hpbVyq228foxHzNM7WleDImAyXlPNb9zULelSY01V8=
|
|
48
70
|
'gaz naturel': cout_gaz_naturel,
|
|
49
71
|
"électricité d'origine renouvelable utilisée dans le bâtiment": cout_electricite,
|
|
50
72
|
'électricité ch': cout_electricite,
|
|
@@ -161,7 +183,8 @@ export default function calc_conso(
|
|
|
161
183
|
fr,
|
|
162
184
|
prorataECS,
|
|
163
185
|
prorataChauffage,
|
|
164
|
-
dateDpe
|
|
186
|
+
dateDpe,
|
|
187
|
+
coeffEp
|
|
165
188
|
) {
|
|
166
189
|
const gen_ch = ch.reduce((acc, ch) => {
|
|
167
190
|
const generateur_chauffage = ch.generateur_chauffage_collection.generateur_chauffage;
|
|
@@ -217,7 +240,7 @@ export default function calc_conso(
|
|
|
217
240
|
gen_ecs,
|
|
218
241
|
fr,
|
|
219
242
|
'ep_conso',
|
|
220
|
-
|
|
243
|
+
coeffEp,
|
|
221
244
|
prorataECS,
|
|
222
245
|
prorataChauffage
|
|
223
246
|
),
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ObjectUtil } from './core/util/infrastructure/object-util.js';
|
|
2
|
+
|
|
3
|
+
const nodesToMap = [
|
|
4
|
+
'mur',
|
|
5
|
+
'plancher_bas',
|
|
6
|
+
'plancher_haut',
|
|
7
|
+
'baie_vitree',
|
|
8
|
+
'porte',
|
|
9
|
+
'pont_thermique',
|
|
10
|
+
'ventilation',
|
|
11
|
+
'installation_ecs',
|
|
12
|
+
'generateur_ecs',
|
|
13
|
+
'climatisation',
|
|
14
|
+
'installation_chauffage',
|
|
15
|
+
'generateur_chauffage',
|
|
16
|
+
'emetteur_chauffage',
|
|
17
|
+
'sortie_par_energie'
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Transform single nodes in {@link nodesToMap} into array of nodes.
|
|
22
|
+
* Transform string number into digits
|
|
23
|
+
* These transformations should be done inside the open3cl library
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Will transform
|
|
27
|
+
* "plancher_haut_collection": {
|
|
28
|
+
* "plancher_haut": {"id": 1}
|
|
29
|
+
* }
|
|
30
|
+
* // Into
|
|
31
|
+
* "plancher_haut_collection": {
|
|
32
|
+
* "plancher_haut": [{"id": 1}]
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Will transform
|
|
37
|
+
* "surface_paroi_opaque": "40.94"
|
|
38
|
+
* // Into
|
|
39
|
+
* "surface_paroi_opaque": 40.94
|
|
40
|
+
*/
|
|
41
|
+
export default class DpeSanitizerService {
|
|
42
|
+
/**
|
|
43
|
+
* @param dpe {FullDpe}
|
|
44
|
+
* @return {FullDpe}
|
|
45
|
+
*/
|
|
46
|
+
execute(dpe) {
|
|
47
|
+
return ObjectUtil.deepObjectTransform(
|
|
48
|
+
dpe,
|
|
49
|
+
(key) => key,
|
|
50
|
+
(val, key) => {
|
|
51
|
+
if (this.#needTransform(key, val)) {
|
|
52
|
+
return [val];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this.#isEnum(key)) {
|
|
56
|
+
return val;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (this.#isUndefinedVal(val)) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.#isEmptyArray(val)) {
|
|
64
|
+
return val;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (Number.isNaN(Number(val))) {
|
|
68
|
+
return val;
|
|
69
|
+
}
|
|
70
|
+
return Number(val);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#isEnum(key) {
|
|
76
|
+
return key.startsWith('enum_') || key.startsWith('original_enum');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#needTransform(key, val) {
|
|
80
|
+
return typeof val === 'object' && !Array.isArray(val) && nodesToMap.includes(key);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#isUndefinedVal(val) {
|
|
84
|
+
return val === '' || val === null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#isEmptyArray(val) {
|
|
88
|
+
return Array.isArray(val) && val.length === 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
package/engine.js
CHANGED
|
@@ -7,20 +7,28 @@ import calc_besoin_ch from './9_besoin_ch.js';
|
|
|
7
7
|
import calc_chauffage, { tauxChargeForGenerator } from './9_chauffage.js';
|
|
8
8
|
import calc_confort_ete from './2021_04_13_confort_ete.js';
|
|
9
9
|
import calc_qualite_isolation from './2021_04_13_qualite_isolation.js';
|
|
10
|
-
import calc_conso, {
|
|
10
|
+
import calc_conso, {
|
|
11
|
+
classe_bilan_dpe,
|
|
12
|
+
classe_emission_ges,
|
|
13
|
+
coef_ep,
|
|
14
|
+
coef_ep_2_3
|
|
15
|
+
} from './conso.js';
|
|
11
16
|
import {
|
|
12
17
|
add_references,
|
|
13
18
|
bug_for_bug_compat,
|
|
14
19
|
collectionCanBeEmpty,
|
|
15
20
|
containsAnySubstring,
|
|
16
21
|
isEffetJoule,
|
|
17
|
-
|
|
22
|
+
xmlParser
|
|
18
23
|
} from './utils.js';
|
|
19
24
|
import { Inertie } from './7_inertie.js';
|
|
20
25
|
import getFicheTechnique from './ficheTechnique.js';
|
|
21
26
|
import { ProductionENR } from './16.2_production_enr.js';
|
|
27
|
+
import DpeSanitizerService from './dpe-sanitizer.service.js';
|
|
22
28
|
|
|
23
|
-
const LIB_VERSION = '1.
|
|
29
|
+
const LIB_VERSION = '1.4.1';
|
|
30
|
+
|
|
31
|
+
const dpeSanitizerService = new DpeSanitizerService();
|
|
24
32
|
|
|
25
33
|
function calc_th(map_id) {
|
|
26
34
|
const map = enums.methode_application_dpe_log[map_id];
|
|
@@ -38,8 +46,27 @@ export function getVersion() {
|
|
|
38
46
|
return LIB_VERSION;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Run the engine with a full dpe xml content
|
|
51
|
+
* @param dpeXmlContent {string} A full dpe xml content
|
|
52
|
+
* @param options {{sanitize: boolean}?}
|
|
53
|
+
* @return {FullDpe}
|
|
54
|
+
*/
|
|
55
|
+
export function calcul_3cl_xml(dpeXmlContent, options) {
|
|
56
|
+
/** @type {{dpe: FullDpe}} **/
|
|
57
|
+
const xmlDpe = xmlParser.parse(dpeXmlContent);
|
|
58
|
+
return calcul_3cl(xmlDpe.dpe, options);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Run the engine with a javascript plain object dpe
|
|
63
|
+
* @param inputDpe {FullDpe} A full plain object dpe
|
|
64
|
+
* @param options {{sanitize: boolean}?}
|
|
65
|
+
* @return {FullDpe}
|
|
66
|
+
*/
|
|
67
|
+
export function calcul_3cl(inputDpe, options) {
|
|
68
|
+
if (!options) options = { sanitize: true };
|
|
69
|
+
const dpe = options.sanitize ? dpeSanitizerService.execute(inputDpe) : inputDpe;
|
|
43
70
|
const modele = enums.modele_dpe[dpe.administratif.enum_modele_dpe_id];
|
|
44
71
|
const dateDpe = dpe.administratif.date_etablissement_dpe;
|
|
45
72
|
if (modele !== 'dpe 3cl 2021 méthode logement') {
|
|
@@ -507,7 +534,8 @@ export function calcul_3cl(dpe) {
|
|
|
507
534
|
clim,
|
|
508
535
|
prorataECS,
|
|
509
536
|
prorataChauffage,
|
|
510
|
-
dateDpe
|
|
537
|
+
dateDpe,
|
|
538
|
+
coef_ep
|
|
511
539
|
);
|
|
512
540
|
|
|
513
541
|
const production_electricite = productionENR.calculateEnr(
|
|
@@ -515,9 +543,26 @@ export function calcul_3cl(dpe) {
|
|
|
515
543
|
conso,
|
|
516
544
|
Sh,
|
|
517
545
|
th,
|
|
518
|
-
zc_id
|
|
546
|
+
zc_id,
|
|
547
|
+
false
|
|
519
548
|
);
|
|
520
549
|
|
|
550
|
+
const conso2_3 = calc_conso(
|
|
551
|
+
Sh,
|
|
552
|
+
zc_id,
|
|
553
|
+
ca_id,
|
|
554
|
+
vt_list,
|
|
555
|
+
instal_ch,
|
|
556
|
+
ecs,
|
|
557
|
+
clim,
|
|
558
|
+
prorataECS,
|
|
559
|
+
prorataChauffage,
|
|
560
|
+
dateDpe,
|
|
561
|
+
coef_ep_2_3
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
productionENR.calculateEnr(dpe.logement.production_elec_enr, conso2_3, Sh, th, zc_id, true);
|
|
565
|
+
|
|
521
566
|
// get all baie_vitree orientations
|
|
522
567
|
const ph_list = env.plancher_haut_collection.plancher_haut || [];
|
|
523
568
|
logement.sortie = {
|
|
@@ -529,8 +574,17 @@ export function calcul_3cl(dpe) {
|
|
|
529
574
|
...conso
|
|
530
575
|
};
|
|
531
576
|
|
|
532
|
-
|
|
533
|
-
|
|
577
|
+
logement.sortie.ep_conso = {
|
|
578
|
+
...logement.sortie.ep_conso,
|
|
579
|
+
coeff_2_3_classe_bilan_dpe: conso2_3.ep_conso.classe_bilan_dpe,
|
|
580
|
+
coeff_2_3_ep_conso_5_usages: conso2_3.ep_conso.ep_conso_5_usages,
|
|
581
|
+
coeff_2_3_ep_conso_5_usages_m2: conso2_3.ep_conso.ep_conso_5_usages_m2
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
logement.sortie.ep_conso.classe_bilan_dpe_2026 = logement.sortie.ep_conso.classe_bilan_dpe;
|
|
585
|
+
logement.sortie.ep_conso.ep_conso_5_usages_2026 = logement.sortie.ep_conso.ep_conso_5_usages;
|
|
586
|
+
logement.sortie.ep_conso.ep_conso_5_usages_2026_m2 =
|
|
587
|
+
logement.sortie.ep_conso.ep_conso_5_usages_m2;
|
|
534
588
|
|
|
535
589
|
return dpe;
|
|
536
590
|
}
|
|
@@ -568,14 +622,14 @@ export function get_classe_ges_dpe(dpe) {
|
|
|
568
622
|
* {@link https://www.ecologie.gouv.fr/actualites/evolutions-du-calcul-du-dpe-reponses-vos-questions#:~:text=Les%20DPE%20r%C3%A9alis%C3%A9s%20avant%20le,%2DAudit%20de%20l'Ademe.}
|
|
569
623
|
*
|
|
570
624
|
* @param dpe {FullDpe}
|
|
571
|
-
* @returns {{
|
|
625
|
+
* @returns {{ep_conso_5_usages: number; ep_conso_5_usages_m2: number; classe_bilan_dpe: string}}
|
|
572
626
|
*/
|
|
573
627
|
export function get_conso_coeff_1_9_2026(dpe) {
|
|
574
628
|
const zc_id = dpe.logement.meteo.enum_zone_climatique_id;
|
|
575
629
|
const ca_id = dpe.logement.meteo.enum_classe_altitude_id;
|
|
576
630
|
const th = calc_th(dpe.logement.caracteristique_generale.enum_methode_application_dpe_log_id);
|
|
577
631
|
|
|
578
|
-
const
|
|
632
|
+
const ep_conso_5_usages =
|
|
579
633
|
(0.9 / 1.3) *
|
|
580
634
|
(Number(dpe.logement.sortie.ep_conso.ep_conso_5_usages) -
|
|
581
635
|
Number(dpe.logement.sortie.ef_conso.conso_5_usages)) +
|
|
@@ -587,8 +641,8 @@ export function get_conso_coeff_1_9_2026(dpe) {
|
|
|
587
641
|
else if (th === 'immeuble')
|
|
588
642
|
Sh = Number(dpe.logement.caracteristique_generale.surface_habitable_immeuble);
|
|
589
643
|
|
|
590
|
-
const
|
|
591
|
-
const
|
|
644
|
+
const ep_conso_5_usages_m2 = Math.floor(ep_conso_5_usages / Sh);
|
|
645
|
+
const classe_dpe = classe_bilan_dpe(ep_conso_5_usages_m2, zc_id, ca_id, Sh);
|
|
592
646
|
|
|
593
|
-
return {
|
|
647
|
+
return { classe_bilan_dpe: classe_dpe, ep_conso_5_usages_m2, ep_conso_5_usages };
|
|
594
648
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
calcul_3cl,
|
|
3
|
+
calcul_3cl_xml,
|
|
4
|
+
get_classe_ges_dpe,
|
|
5
|
+
get_conso_coeff_1_9_2026,
|
|
6
|
+
getVersion
|
|
7
|
+
} from './engine.js';
|
|
8
|
+
export { calcul_3cl, calcul_3cl_xml, get_classe_ges_dpe, get_conso_coeff_1_9_2026, getVersion };
|
|
3
9
|
import { Umur, Uph, Upb, Uporte, Ubv, Upt } from './3_deperdition.js';
|
|
4
10
|
export { Umur, Uph, Upb, Uporte, Ubv, Upt };
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import enums from './enums.js';
|
|
2
2
|
import tvs from './tv.js';
|
|
3
|
-
import { set
|
|
3
|
+
import { set } from 'lodash-es';
|
|
4
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
5
|
+
|
|
6
|
+
export const xmlParser = new XMLParser({
|
|
7
|
+
// We want to make sure collections of length 1 are still parsed as arrays
|
|
8
|
+
isArray: (name) => {
|
|
9
|
+
const collectionNames = [
|
|
10
|
+
'mur',
|
|
11
|
+
'plancher_bas',
|
|
12
|
+
'plancher_haut',
|
|
13
|
+
'baie_vitree',
|
|
14
|
+
'porte',
|
|
15
|
+
'pont_thermique',
|
|
16
|
+
'ventilation',
|
|
17
|
+
'installation_ecs',
|
|
18
|
+
'generateur_ecs',
|
|
19
|
+
'climatisation',
|
|
20
|
+
'installation_chauffage',
|
|
21
|
+
'generateur_chauffage',
|
|
22
|
+
'emetteur_chauffage',
|
|
23
|
+
'sortie_par_energie'
|
|
24
|
+
];
|
|
25
|
+
if (collectionNames.includes(name)) return true;
|
|
26
|
+
},
|
|
27
|
+
tagValueProcessor: (tagName, val) => {
|
|
28
|
+
if (tagName.startsWith('enum_')) {
|
|
29
|
+
// Preserve value as string for tags starting with "enum_"
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (Number.isNaN(Number(val))) return val;
|
|
33
|
+
return Number(val);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
4
36
|
|
|
5
37
|
export let bug_for_bug_compat = false;
|
|
6
38
|
export function set_bug_for_bug_compat() {
|
|
@@ -285,44 +317,12 @@ export function removeKeyFromJSON(jsonObj, keyToRemove, skipKeys) {
|
|
|
285
317
|
}
|
|
286
318
|
}
|
|
287
319
|
|
|
288
|
-
export function useEnumAsString(jsonObj) {
|
|
289
|
-
for (const key in jsonObj) {
|
|
290
|
-
if (jsonObj.hasOwnProperty(key)) {
|
|
291
|
-
if (key.startsWith('enum_')) {
|
|
292
|
-
if (jsonObj[key] !== null) jsonObj[key] = jsonObj[key].toString();
|
|
293
|
-
} else if (typeof jsonObj[key] === 'object') {
|
|
294
|
-
useEnumAsString(jsonObj[key]);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
320
|
export function clean_dpe(dpe_in) {
|
|
301
321
|
// skip generateur_[ecs|chauffage] because some input data is contained in donnee_intermediaire (e.g. pn, qp0, ...)
|
|
302
322
|
removeKeyFromJSON(dpe_in, 'donnee_intermediaire', ['generateur_ecs', 'generateur_chauffage']);
|
|
303
323
|
set(dpe_in, 'logement.sortie', null);
|
|
304
324
|
}
|
|
305
325
|
|
|
306
|
-
export function sanitize_dpe(dpe_in) {
|
|
307
|
-
const collection_paths = [
|
|
308
|
-
'logement.enveloppe.plancher_bas_collection.plancher_bas',
|
|
309
|
-
'logement.enveloppe.plancher_haut_collection.plancher_haut',
|
|
310
|
-
'logement.ventilation_collection.ventilation',
|
|
311
|
-
'logement.climatisation_collection.climatisation',
|
|
312
|
-
'logement.enveloppe.baie_vitree_collection.baie_vitree',
|
|
313
|
-
'logement.enveloppe.porte_collection.porte',
|
|
314
|
-
'logement.enveloppe.pont_thermique_collection.pont_thermique'
|
|
315
|
-
];
|
|
316
|
-
for (const path of collection_paths) {
|
|
317
|
-
if (!has(dpe_in, path)) {
|
|
318
|
-
set(dpe_in, path, []);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (use_enum_as_string) {
|
|
322
|
-
useEnumAsString(dpe_in);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
326
|
/**
|
|
327
327
|
* Retrieve a number describing a thickness from the description
|
|
328
328
|
* @param description string in which to get the number
|