@open3cl/engine 1.8.34 → 1.8.35
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 +74 -7
- package/16.2_production_enr.spec.js +98 -3
- package/README.md +19 -19
- package/engine.js +17 -5
- package/engine.spec.js +16 -3
- package/package.json +1 -1
package/16.2_production_enr.js
CHANGED
|
@@ -3,6 +3,38 @@ import { mois_liste, tv } from './utils.js';
|
|
|
3
3
|
import tvs from './tv.js';
|
|
4
4
|
import { DEFAULT_COEFF_EP } from './conso.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Méthodes d'application « appartement chauffage individuel ECS individuel » : l'installation PV
|
|
8
|
+
* déclarée est celle du logement, aucune proratisation (exports ADEME non proratisés, cf. 2528E1249844E).
|
|
9
|
+
*/
|
|
10
|
+
const MAP_APPARTEMENT_INDIVIDUEL = ['2', '22', '25'];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Coefficient de proratisation au logement de la production d'une installation PV d'immeuble.
|
|
14
|
+
*
|
|
15
|
+
* Le moteur de référence (Tribu, `Calcul_batiment.cs` l.1142-1156) calcule le taux de couverture
|
|
16
|
+
* Tcv = Ppv / Celec_tot avec la surface du logement : pour un appartement desservi par une
|
|
17
|
+
* installation d'immeuble, la surface de capteurs doit être ramenée au logement
|
|
18
|
+
* (S_capteur × Sh_logement / Sh_immeuble), comme pour les générateurs collectifs (l.253, l.303).
|
|
19
|
+
*
|
|
20
|
+
* @param th {string} type de bâtiment ('maison', 'appartement', 'immeuble')
|
|
21
|
+
* @param map_id {string} enum_methode_application_dpe_log_id
|
|
22
|
+
* @param surfaceLogement {number|string} surface_habitable_logement
|
|
23
|
+
* @param surfaceImmeuble {number|string} surface_habitable_immeuble
|
|
24
|
+
* @returns {number} 1 si aucune proratisation, sinon Sh_logement / Sh_immeuble
|
|
25
|
+
*/
|
|
26
|
+
export function ratioProrataPvLogement(th, map_id, surfaceLogement, surfaceImmeuble) {
|
|
27
|
+
const shl = Number(surfaceLogement);
|
|
28
|
+
const shi = Number(surfaceImmeuble);
|
|
29
|
+
if (th !== 'appartement' || MAP_APPARTEMENT_INDIVIDUEL.includes(String(map_id))) {
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
if (!(shl > 0) || !(shi > shl)) {
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
return shl / shi;
|
|
36
|
+
}
|
|
37
|
+
|
|
6
38
|
export class ProductionENR {
|
|
7
39
|
/**
|
|
8
40
|
* Taux d'autoproduction limite par poste Taplpi (§16.2).
|
|
@@ -29,8 +61,9 @@ export class ProductionENR {
|
|
|
29
61
|
* @param th {string}
|
|
30
62
|
* @param zc_id {string}
|
|
31
63
|
* @param coeff_ep_override {number?}
|
|
64
|
+
* @param ratioPv {number?} proratisation au logement d'une installation d'immeuble (cf. ratioProrataPvLogement)
|
|
32
65
|
*/
|
|
33
|
-
calculateEnr(productionElecEnr, conso, Sh, th, zc_id, coeff_ep_override) {
|
|
66
|
+
calculateEnr(productionElecEnr, conso, Sh, th, zc_id, coeff_ep_override, ratioPv = 1) {
|
|
34
67
|
const productionElectricite = {
|
|
35
68
|
conso_elec_ac: 0,
|
|
36
69
|
production_pv: 0,
|
|
@@ -49,7 +82,15 @@ export class ProductionENR {
|
|
|
49
82
|
|
|
50
83
|
if (productionElecEnr && productionElecEnr.donnee_entree?.presence_production_pv === 1) {
|
|
51
84
|
// Calcul de l'électricité auto-consommée pour chaque enveloppe
|
|
52
|
-
this.calculateConsoElecAc(
|
|
85
|
+
this.calculateConsoElecAc(
|
|
86
|
+
productionElectricite,
|
|
87
|
+
productionElecEnr,
|
|
88
|
+
conso,
|
|
89
|
+
zc_id,
|
|
90
|
+
th,
|
|
91
|
+
Sh,
|
|
92
|
+
ratioPv
|
|
93
|
+
);
|
|
53
94
|
|
|
54
95
|
// Mise à jour des consommations d'énergie finale en minorant l'énergie consommée par l'énergie autoconsommée par le poste
|
|
55
96
|
this.updateEfConso(productionElectricite, conso, Sh);
|
|
@@ -78,10 +119,19 @@ export class ProductionENR {
|
|
|
78
119
|
* @param zc_id
|
|
79
120
|
* @param th
|
|
80
121
|
* @param Sh
|
|
122
|
+
* @param ratioPv {number?}
|
|
81
123
|
*/
|
|
82
|
-
calculateConsoElecAc(
|
|
124
|
+
calculateConsoElecAc(
|
|
125
|
+
productionElectricite,
|
|
126
|
+
productionElecEnr,
|
|
127
|
+
conso,
|
|
128
|
+
zc_id,
|
|
129
|
+
th,
|
|
130
|
+
Sh,
|
|
131
|
+
ratioPv = 1
|
|
132
|
+
) {
|
|
83
133
|
// Production d’électricité par des capteurs photovoltaïques Ppv (en kWh/m²)
|
|
84
|
-
const Ppv = this.getPpv(productionElecEnr, zc_id);
|
|
134
|
+
const Ppv = this.getPpv(productionElecEnr, zc_id, ratioPv);
|
|
85
135
|
|
|
86
136
|
// Consommation annuelle d’électricité pour les autres usages (kWhef/an)
|
|
87
137
|
const CelecTotAu = this.getCelecAu(th, Sh);
|
|
@@ -342,9 +392,11 @@ export class ProductionENR {
|
|
|
342
392
|
*
|
|
343
393
|
* @param productionElecEnr
|
|
344
394
|
* @param zc_id
|
|
395
|
+
* @param ratioPv {number?} proratisation au logement (1 = aucune). Non appliquée aux installations
|
|
396
|
+
* qui exportent un ratio_virtualisation (déjà virtualisées par le logiciel).
|
|
345
397
|
* @returns {number}
|
|
346
398
|
*/
|
|
347
|
-
getPpv(productionElecEnr, zc_id) {
|
|
399
|
+
getPpv(productionElecEnr, zc_id, ratioPv = 1) {
|
|
348
400
|
const ePvValues = tvs.e_pv;
|
|
349
401
|
const zc = enums.zone_climatique[zc_id];
|
|
350
402
|
|
|
@@ -370,8 +422,23 @@ export class ProductionENR {
|
|
|
370
422
|
*/
|
|
371
423
|
const k = row.coef_orientation_pv;
|
|
372
424
|
|
|
373
|
-
|
|
374
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Surface des panneaux photovoltaïques orientés et inclinés de la même manière (m²).
|
|
427
|
+
* Le moteur de référence n'a que S_capteur en entrée (Tribu `photovoltaique.cs` l.8) : la
|
|
428
|
+
* surface saisie est prioritaire, le forfait 1,6 m²/module ne sert qu'à défaut de surface.
|
|
429
|
+
*/
|
|
430
|
+
let Scapteur = panneaux_pv.surface_totale_capteurs || 1.6 * panneaux_pv.nombre_module;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Installation d'immeuble : surface ramenée au logement (Sh_logement / Sh_immeuble).
|
|
434
|
+
* Si l'installation exporte un ratio_virtualisation, le logiciel de saisie a déjà virtualisé
|
|
435
|
+
* l'installation au logement et la production ADEME n'est pas proratisée (corpus : 36 exports
|
|
436
|
+
* LICIEL, autoconsommation ADEME reproduite sans proratisation, jamais avec ; ex. 2501E3381654V,
|
|
437
|
+
* 2369E0282894H, 2469E2989760O) : pas de proratisation supplémentaire.
|
|
438
|
+
*/
|
|
439
|
+
if (ratioPv !== 1 && panneaux_pv.ratio_virtualisation == null) {
|
|
440
|
+
Scapteur *= ratioPv;
|
|
441
|
+
}
|
|
375
442
|
|
|
376
443
|
// Rendement moyen des modules
|
|
377
444
|
const r = 0.17;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductionENR } from './16.2_production_enr.js';
|
|
1
|
+
import { ProductionENR, ratioProrataPvLogement } from './16.2_production_enr.js';
|
|
2
2
|
import { describe, expect, test, it } from 'vitest';
|
|
3
3
|
|
|
4
4
|
describe('production ENR unit tests', () => {
|
|
@@ -47,8 +47,12 @@ describe('production ENR unit tests', () => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
it.each([
|
|
50
|
-
|
|
51
|
-
[2120.1011712,
|
|
50
|
+
// surface saisie prioritaire sur le forfait 1,6 m²/module (Tribu : seule S_capteur en entrée)
|
|
51
|
+
[2120.1011712, 8, 9.6],
|
|
52
|
+
[2120.1011712, undefined, 9.6],
|
|
53
|
+
// à défaut de surface : 1,6 m² × nombre de modules
|
|
54
|
+
[2826.8015616000007, 8, undefined],
|
|
55
|
+
[2826.8015616000007, 8, 0]
|
|
52
56
|
])(
|
|
53
57
|
'should get ppv %s with nombre module %s and surface totale capteur %s',
|
|
54
58
|
(ppv, nombre_module, surface_totale_capteurs) => {
|
|
@@ -68,6 +72,97 @@ describe('production ENR unit tests', () => {
|
|
|
68
72
|
}
|
|
69
73
|
);
|
|
70
74
|
|
|
75
|
+
describe('proratisation au logement des installations PV d’immeuble', () => {
|
|
76
|
+
const panneau = (extra = {}) => ({
|
|
77
|
+
panneaux_pv_collection: {
|
|
78
|
+
panneaux_pv: [
|
|
79
|
+
{
|
|
80
|
+
surface_totale_capteurs: 9.6,
|
|
81
|
+
nombre_module: 8,
|
|
82
|
+
enum_orientation_pv_id: 1,
|
|
83
|
+
enum_inclinaison_pv_id: 2,
|
|
84
|
+
...extra
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('ratio 1 par défaut : production de l’installation complète', () => {
|
|
91
|
+
expect(productionENR.getPpv(panneau(), 1)).toBe(2120.1011712);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('la production est proratisée par Sh_logement / Sh_immeuble', () => {
|
|
95
|
+
expect(productionENR.getPpv(panneau(), 1, 0.25)).toBeCloseTo(2120.1011712 * 0.25, 9);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test.each([0.1, 0.01, 0])(
|
|
99
|
+
'installation déjà virtualisée par le logiciel (ratio_virtualisation %s) : pas de proratisation',
|
|
100
|
+
(ratio_virtualisation) => {
|
|
101
|
+
expect(productionENR.getPpv(panneau({ ratio_virtualisation }), 1, 0.25)).toBe(2120.1011712);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
test('le ratio_virtualisation est ignoré sans proratisation (maison, appartement individuel)', () => {
|
|
106
|
+
expect(productionENR.getPpv(panneau({ ratio_virtualisation: 0.1 }), 1, 1)).toBe(2120.1011712);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('2469E1760405R : 2 m² saisis, 18 modules, Sh 67,42 / 1 921,43 m²', () => {
|
|
110
|
+
// Ppv = S × Sh_log / Sh_imm × Σ k·0,17·Epv·0,86 : la production dépend de la surface
|
|
111
|
+
// retenue (2 m², pas 1,6 × 18 = 28,8 m²) et est ramenée au logement.
|
|
112
|
+
const ratio = ratioProrataPvLogement('appartement', '5', 67.42, 1921.43);
|
|
113
|
+
const pvImmeuble = productionENR.getPpv(
|
|
114
|
+
panneau({ surface_totale_capteurs: 2, nombre_module: 18 }),
|
|
115
|
+
1
|
|
116
|
+
);
|
|
117
|
+
const pvLogement = productionENR.getPpv(
|
|
118
|
+
panneau({ surface_totale_capteurs: 2, nombre_module: 18 }),
|
|
119
|
+
1,
|
|
120
|
+
ratio
|
|
121
|
+
);
|
|
122
|
+
expect(pvImmeuble).toBeCloseTo((2120.1011712 / 9.6) * 2, 9);
|
|
123
|
+
expect(pvLogement).toBeCloseTo(pvImmeuble * (67.42 / 1921.43), 9);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('calculateEnr transmet le ratio à la production PV', () => {
|
|
127
|
+
const conso = {
|
|
128
|
+
ef_conso: { conso_ecs: 1000, conso_5_usages: 1500 },
|
|
129
|
+
ep_conso: { ep_conso_5_usages: 10000 },
|
|
130
|
+
sortie_par_energie_collection: {
|
|
131
|
+
sortie_par_energie: [{ enum_type_energie_id: '1', conso_5_usages: 1500 }]
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const ret = productionENR.calculateEnr(
|
|
135
|
+
{ donnee_entree: { presence_production_pv: 1 }, ...panneau() },
|
|
136
|
+
conso,
|
|
137
|
+
10,
|
|
138
|
+
'appartement',
|
|
139
|
+
1,
|
|
140
|
+
undefined,
|
|
141
|
+
0.5
|
|
142
|
+
);
|
|
143
|
+
expect(ret.production_pv).toBeCloseTo(2120.1011712 * 0.5, 9);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('ratioProrataPvLogement', () => {
|
|
148
|
+
test.each([
|
|
149
|
+
['appartement, installation d’immeuble (map 5)', 'appartement', '5', 50, 200, 0.25],
|
|
150
|
+
['appartement issu d’un DPE immeuble (map 33)', 'appartement', '33', 50, 200, 0.25],
|
|
151
|
+
['surfaces sous forme de chaînes', 'appartement', '32', '48.3', '1113.35', 48.3 / 1113.35],
|
|
152
|
+
['maison', 'maison', '1', 50, 200, 1],
|
|
153
|
+
['immeuble', 'immeuble', '6', 200, 200, 1],
|
|
154
|
+
['appartement chauffage + ECS individuels (map 2)', 'appartement', '2', 50, 200, 1],
|
|
155
|
+
['appartement RT2012 individuel (map 22)', 'appartement', '22', 50, 200, 1],
|
|
156
|
+
['appartement RE2020 individuel (map 25)', 'appartement', '25', 50, 200, 1],
|
|
157
|
+
['surface immeuble absente', 'appartement', '5', 50, undefined, 1],
|
|
158
|
+
['surface logement absente', 'appartement', '5', undefined, 200, 1],
|
|
159
|
+
['surface immeuble égale à celle du logement', 'appartement', '5', 50, 50, 1],
|
|
160
|
+
['surface immeuble inférieure à celle du logement', 'appartement', '5', 50, 40, 1]
|
|
161
|
+
])('%s', (_label, th, mapId, shl, shi, attendu) => {
|
|
162
|
+
expect(ratioProrataPvLogement(th, mapId, shl, shi)).toBeCloseTo(attendu, 12);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
71
166
|
test('should update ef conso', () => {
|
|
72
167
|
const productionElectricite = {
|
|
73
168
|
conso_elec_ac_fr: 100,
|
package/README.md
CHANGED
|
@@ -370,15 +370,15 @@ Ces résultats sont **générés automatiquement** à la fin de `npm run test:co
|
|
|
370
370
|
|
|
371
371
|
<!-- CORPUS:START -->
|
|
372
372
|
|
|
373
|
-
> **Version `1.8.
|
|
373
|
+
> **Version `1.8.34`** · branche `main` · généré le 2026-10-09
|
|
374
374
|
> Seuil de tolérance **5%**
|
|
375
375
|
|
|
376
376
|
<table>
|
|
377
377
|
<tr>
|
|
378
378
|
<td align="center"><strong>9</strong><br/><sub>corpus</sub></td>
|
|
379
379
|
<td align="center"><strong>89 986</strong><br/><sub>DPE analysés</sub></td>
|
|
380
|
-
<td align="center"><strong>
|
|
381
|
-
<td align="center"><strong>
|
|
380
|
+
<td align="center"><strong>61 945</strong><br/><sub>DPE conformes</sub></td>
|
|
381
|
+
<td align="center"><strong>68,84 %</strong><br/><sub>réussite globale</sub></td>
|
|
382
382
|
</tr>
|
|
383
383
|
</table>
|
|
384
384
|
|
|
@@ -388,10 +388,10 @@ Ces résultats sont **générés automatiquement** à la fin de `npm run test:co
|
|
|
388
388
|
| 🟢 | **Appartement · chauffage individuel (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_individuel_2025.csv`</sub> | **92,53 %** | `███████████████████░` | 9 253 / 10 000 |
|
|
389
389
|
| 🟢 | **Logement individuel (2025)**<br/><sub>`dpe_logement_individuel_2025.csv`</sub> | **89,54 %** | `██████████████████░░` | 8 947 / 9 992 |
|
|
390
390
|
| 🟢 | **Maison individuelle (2025)**<br/><sub>`dpe_maison_individuelle_2025.csv`</sub> | **88,60 %** | `██████████████████░░` | 8 859 / 9 999 |
|
|
391
|
-
| 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **
|
|
391
|
+
| 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **84,21 %** | `█████████████████░░░` | 8 419 / 9 998 |
|
|
392
392
|
| 🟡 | **Appartement · chauffage collectif (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_collectif_2025.csv`</sub> | **71,59 %** | `██████████████░░░░░░` | 7 159 / 10 000 |
|
|
393
|
-
| 🟡 | **Immeuble · chauffage collectif**<br/><sub>`dpe_immeuble_chauffage_collectif.csv`</sub> | **
|
|
394
|
-
| 🔴 | **Immeuble · chauffage mixte**<br/><sub>`dpe_immeuble_chauffage_mixte.csv`</sub> | **
|
|
393
|
+
| 🟡 | **Immeuble · chauffage collectif**<br/><sub>`dpe_immeuble_chauffage_collectif.csv`</sub> | **66,19 %** | `█████████████░░░░░░░` | 6 618 / 9 999 |
|
|
394
|
+
| 🔴 | **Immeuble · chauffage mixte**<br/><sub>`dpe_immeuble_chauffage_mixte.csv`</sub> | **53,72 %** | `███████████░░░░░░░░░` | 5 371 / 9 999 |
|
|
395
395
|
| 🔴 | **Individuel généré depuis l'immeuble (2026)**<br/><sub>`dpe_individuel_a_partir_dpe_immeuble_2026.csv`</sub> | **27,06 %** | `█████░░░░░░░░░░░░░░░` | 2 706 / 10 000 |
|
|
396
396
|
|
|
397
397
|
<sub>🟢 ≥ 85 % · 🟡 ≥ 60 % · 🔴 < 60 %</sub>
|
|
@@ -403,24 +403,24 @@ Ces résultats sont **générés automatiquement** à la fin de `npm run test:co
|
|
|
403
403
|
|
|
404
404
|
<table>
|
|
405
405
|
<tr>
|
|
406
|
-
<td align="center"><strong>5,
|
|
407
|
-
<td align="center"><strong>5,
|
|
408
|
-
<td align="center"><strong>0,
|
|
409
|
-
<td align="center"><strong>
|
|
406
|
+
<td align="center"><strong>5,76 ms</strong><br/><sub>moyenne</sub></td>
|
|
407
|
+
<td align="center"><strong>5,07 ms</strong><br/><sub>médiane</sub></td>
|
|
408
|
+
<td align="center"><strong>0,17 ms</strong><br/><sub>min</sub></td>
|
|
409
|
+
<td align="center"><strong>856,2 ms</strong><br/><sub>max</sub></td>
|
|
410
410
|
</tr>
|
|
411
411
|
</table>
|
|
412
412
|
|
|
413
413
|
| Corpus | Moyenne | Médiane | Min | Max | p95 | p99 |
|
|
414
414
|
| :--------------------------------------------- | ------: | ------: | ------: | -------: | ------: | ------: |
|
|
415
|
-
| **Généraliste** |
|
|
416
|
-
| **Appartement · chauffage individuel (2025)** |
|
|
417
|
-
| **Logement individuel (2025)** | 5,
|
|
418
|
-
| **Maison individuelle (2025)** |
|
|
419
|
-
| **Immeuble · chauffage individuel** |
|
|
420
|
-
| **Appartement · chauffage collectif (2025)** | 4,
|
|
421
|
-
| **Immeuble · chauffage collectif** |
|
|
422
|
-
| **Immeuble · chauffage mixte** |
|
|
423
|
-
| **Individuel généré depuis l'immeuble (2026)** |
|
|
415
|
+
| **Généraliste** | 4,95 ms | 4,55 ms | 0,23 ms | 34,8 ms | 8,96 ms | 12,0 ms |
|
|
416
|
+
| **Appartement · chauffage individuel (2025)** | 3,85 ms | 3,49 ms | 1,48 ms | 37,6 ms | 6,63 ms | 8,69 ms |
|
|
417
|
+
| **Logement individuel (2025)** | 5,66 ms | 5,09 ms | 1,71 ms | 45,2 ms | 10,5 ms | 14,0 ms |
|
|
418
|
+
| **Maison individuelle (2025)** | 6,33 ms | 5,75 ms | 2,00 ms | 43,8 ms | 11,1 ms | 14,6 ms |
|
|
419
|
+
| **Immeuble · chauffage individuel** | 6,54 ms | 5,58 ms | 0,17 ms | 81,9 ms | 13,2 ms | 21,7 ms |
|
|
420
|
+
| **Appartement · chauffage collectif (2025)** | 4,44 ms | 4,09 ms | 1,55 ms | 36,6 ms | 7,30 ms | 10,3 ms |
|
|
421
|
+
| **Immeuble · chauffage collectif** | 5,41 ms | 4,58 ms | 0,20 ms | 97,7 ms | 9,90 ms | 18,1 ms |
|
|
422
|
+
| **Immeuble · chauffage mixte** | 6,86 ms | 5,57 ms | 0,27 ms | 856,2 ms | 14,8 ms | 25,4 ms |
|
|
423
|
+
| **Individuel généré depuis l'immeuble (2026)** | 7,86 ms | 6,93 ms | 1,81 ms | 67,1 ms | 16,5 ms | 26,4 ms |
|
|
424
424
|
|
|
425
425
|
<sub>La moyenne est tirée vers le haut par les DPE collectifs, dont le coût atteint plusieurs
|
|
426
426
|
dizaines de fois la médiane : c’est la médiane qui décrit le cas courant, et p95/p99 le cas
|
package/engine.js
CHANGED
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
} from './utils.js';
|
|
31
31
|
import { Inertie } from './7_inertie.js';
|
|
32
32
|
import getFicheTechnique from './ficheTechnique.js';
|
|
33
|
-
import { ProductionENR } from './16.2_production_enr.js';
|
|
33
|
+
import { ProductionENR, ratioProrataPvLogement } from './16.2_production_enr.js';
|
|
34
34
|
import DpeSanitizerService from './dpe-sanitizer.service.js';
|
|
35
35
|
|
|
36
|
-
const LIB_VERSION = '1.8.
|
|
36
|
+
const LIB_VERSION = '1.8.35';
|
|
37
37
|
|
|
38
38
|
const dpeSanitizerService = new DpeSanitizerService();
|
|
39
39
|
|
|
@@ -598,12 +598,22 @@ export function calcul_3cl(inputDpe, options) {
|
|
|
598
598
|
th === 'immeuble' ? Nb_lgt : 1
|
|
599
599
|
);
|
|
600
600
|
|
|
601
|
+
// Proratisation au logement d'une installation PV d'immeuble (appartement)
|
|
602
|
+
const ratioPv = ratioProrataPvLogement(
|
|
603
|
+
th,
|
|
604
|
+
map_id,
|
|
605
|
+
cg.surface_habitable_logement,
|
|
606
|
+
cg.surface_habitable_immeuble
|
|
607
|
+
);
|
|
608
|
+
|
|
601
609
|
const production_electricite = productionENR.calculateEnr(
|
|
602
610
|
dpe.logement.production_elec_enr,
|
|
603
611
|
conso,
|
|
604
612
|
Sh,
|
|
605
613
|
th,
|
|
606
|
-
zc_id
|
|
614
|
+
zc_id,
|
|
615
|
+
undefined,
|
|
616
|
+
ratioPv
|
|
607
617
|
);
|
|
608
618
|
|
|
609
619
|
const conso1_7 = calc_conso(
|
|
@@ -627,7 +637,8 @@ export function calcul_3cl(inputDpe, options) {
|
|
|
627
637
|
Sh,
|
|
628
638
|
th,
|
|
629
639
|
zc_id,
|
|
630
|
-
COEFF_EP_1_7
|
|
640
|
+
COEFF_EP_1_7,
|
|
641
|
+
ratioPv
|
|
631
642
|
);
|
|
632
643
|
|
|
633
644
|
const conso2_3 = calc_conso(
|
|
@@ -651,7 +662,8 @@ export function calcul_3cl(inputDpe, options) {
|
|
|
651
662
|
Sh,
|
|
652
663
|
th,
|
|
653
664
|
zc_id,
|
|
654
|
-
COEFF_EP_2_3
|
|
665
|
+
COEFF_EP_2_3,
|
|
666
|
+
ratioPv
|
|
655
667
|
);
|
|
656
668
|
|
|
657
669
|
// get all baie_vitree orientations
|
package/engine.spec.js
CHANGED
|
@@ -75,8 +75,12 @@ vi.mock('./ficheTechnique.js', () => ({ default: vi.fn() }));
|
|
|
75
75
|
// On expose des méthodes mockées récupérables dans les tests.
|
|
76
76
|
const calculateInertie = vi.fn();
|
|
77
77
|
const calculateEnr = vi.fn();
|
|
78
|
+
const ratioProrataPvLogement = vi.fn();
|
|
78
79
|
vi.mock('./7_inertie.js', () => ({ Inertie: vi.fn(() => ({ calculateInertie })) }));
|
|
79
|
-
vi.mock('./16.2_production_enr.js', () => ({
|
|
80
|
+
vi.mock('./16.2_production_enr.js', () => ({
|
|
81
|
+
ProductionENR: vi.fn(() => ({ calculateEnr })),
|
|
82
|
+
ratioProrataPvLogement: (...args) => ratioProrataPvLogement(...args)
|
|
83
|
+
}));
|
|
80
84
|
|
|
81
85
|
// Le service de sanitisation est instancié au chargement puis appelé : `execute`
|
|
82
86
|
// renvoie l'entrée telle quelle.
|
|
@@ -153,6 +157,8 @@ beforeEach(() => {
|
|
|
153
157
|
};
|
|
154
158
|
vi.mocked(calc_conso).mockReturnValue(consoResult);
|
|
155
159
|
vi.mocked(calculateEnr).mockReturnValue({ pv: 1 });
|
|
160
|
+
ratioProrataPvLogement.mockReset();
|
|
161
|
+
ratioProrataPvLogement.mockReturnValue(0.25);
|
|
156
162
|
vi.mocked(calc_confort_ete).mockReturnValue('confort');
|
|
157
163
|
vi.mocked(calc_qualite_isolation).mockReturnValue('qualite');
|
|
158
164
|
});
|
|
@@ -426,17 +432,24 @@ describe('calcul_3cl - run intégral (maison)', () => {
|
|
|
426
432
|
expect(calc_conso.mock.calls[0][7]).toBe(1);
|
|
427
433
|
expect(calc_conso.mock.calls[0][8]).toBe(1);
|
|
428
434
|
|
|
429
|
-
//
|
|
435
|
+
// Coefficient de proratisation PV calculé à partir du type de bâtiment, de la méthode et des surfaces.
|
|
436
|
+
expect(ratioProrataPvLogement).toHaveBeenCalledWith('maison', '1', 80, 200);
|
|
437
|
+
|
|
438
|
+
// 3 calculs de production ENR ; le 1ᵉʳ sans coefficient ; le ratio PV est transmis aux 3 passes.
|
|
430
439
|
expect(calculateEnr).toHaveBeenCalledTimes(3);
|
|
431
440
|
expect(calculateEnr.mock.calls[0]).toEqual([
|
|
432
441
|
dpe.logement.production_elec_enr,
|
|
433
442
|
consoResult,
|
|
434
443
|
80,
|
|
435
444
|
'maison',
|
|
436
|
-
'zc1'
|
|
445
|
+
'zc1',
|
|
446
|
+
undefined,
|
|
447
|
+
0.25
|
|
437
448
|
]);
|
|
438
449
|
expect(calculateEnr.mock.calls[1][5]).toBe(1.7);
|
|
439
450
|
expect(calculateEnr.mock.calls[2][5]).toBe(2.3);
|
|
451
|
+
expect(calculateEnr.mock.calls[1][6]).toBe(0.25);
|
|
452
|
+
expect(calculateEnr.mock.calls[2][6]).toBe(0.25);
|
|
440
453
|
|
|
441
454
|
// Sorties agrégées.
|
|
442
455
|
expect(dpe.logement.sortie.deperdition).toEqual({ deperdition_enveloppe: 300 });
|