@open3cl/engine 1.8.1 → 1.8.3
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/11_ecs.js +5 -1
- package/11_ecs.spec.js +1 -1
- package/9_besoin_ch.js +7 -0
- package/9_besoin_ch.spec.js +21 -0
- package/README.md +26 -26
- package/engine.js +1 -1
- package/package.json +1 -1
- package/utils.spec.js +28 -1
package/11_ecs.js
CHANGED
|
@@ -13,7 +13,11 @@ function tv_rendement_distribution_ecs(di, de, du, pvc) {
|
|
|
13
13
|
let configuration_logement;
|
|
14
14
|
if (type_installation.includes('individuelle')) {
|
|
15
15
|
if (pvc === 1) {
|
|
16
|
-
|
|
16
|
+
// Motif ancré « ^…+…$ » : compatible avec les deux matchers de tv().
|
|
17
|
+
// - tvMatchLegacy échappe le « + » d'un motif ancré avant le .match() regex ;
|
|
18
|
+
// - tvMatchOptimized retire les ancres puis compare la chaîne littérale.
|
|
19
|
+
// L'ancien « [+] » (échappement regex) ne matchait jamais en version optimisée (#206).
|
|
20
|
+
configuration_logement = '^production volume habitable + pièces alimentées contiguës$';
|
|
17
21
|
} else configuration_logement = 'production hors volume habitable';
|
|
18
22
|
} else if (type_installation.includes('collective')) {
|
|
19
23
|
let type_reseau_collectif;
|
package/11_ecs.spec.js
CHANGED
|
@@ -169,7 +169,7 @@ describe('calc_ecs - rendement de distribution', () => {
|
|
|
169
169
|
calc_ecs({}, ecs, 100, 200, 1, 'ca1', 'h1a', 'maison', false, null, null, false);
|
|
170
170
|
|
|
171
171
|
expect(tv).toHaveBeenCalledWith('rendement_distribution_ecs', {
|
|
172
|
-
configuration_logement: 'production volume habitable
|
|
172
|
+
configuration_logement: '^production volume habitable + pièces alimentées contiguës$'
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
175
|
|
package/9_besoin_ch.js
CHANGED
|
@@ -171,6 +171,13 @@ export default function calc_besoin_ch(
|
|
|
171
171
|
besoin_ch_depensier += besoin_ch_mois_dep[mois] / 1000;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Fraction des besoins de chauffage couverts par les apports gratuits sur l'année :
|
|
176
|
+
* moyenne des Fj mensuels pondérée par les déperditions mensuelles (GV × DHj).
|
|
177
|
+
* C'est une fraction sans unité comprise entre 0 et 1, elle n'est PAS arrondie à 1.
|
|
178
|
+
* Certains logiciels publient 1 dans le XML ADEME : ce n'est pas une valeur calculée
|
|
179
|
+
* et elle ne doit pas servir de référence (cf. issue #51).
|
|
180
|
+
*/
|
|
174
181
|
fraction_apport_gratuit_ch /= sumDh19;
|
|
175
182
|
fraction_apport_gratuit_depensier_ch /= sumDh21;
|
|
176
183
|
|
package/9_besoin_ch.spec.js
CHANGED
|
@@ -130,6 +130,27 @@ describe('calc_besoin_ch - agrégation mensuelle du besoin de chauffage', () =>
|
|
|
130
130
|
expect(ret.fraction_apport_gratuit_depensier_ch).toBeCloseTo(0.05808492254600494, 9);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* La fraction des apports gratuits est une moyenne pondérée des Fj :
|
|
135
|
+
* elle reste dans [0, 1] et n'est jamais arrondie à 1 (cf. issue #51).
|
|
136
|
+
*/
|
|
137
|
+
test("la fraction des apports gratuits n'est pas arrondie à 1 et reste dans [0, 1]", () => {
|
|
138
|
+
const ret = appelSansRecup();
|
|
139
|
+
const Fj = calc_Fj(100, 2000, 5000, 1000, 'moyenne');
|
|
140
|
+
const FjDep = calc_Fj(100, 2000, 5000, 1200, 'moyenne');
|
|
141
|
+
|
|
142
|
+
// sur un seul mois, la moyenne pondérée vaut exactement Fj
|
|
143
|
+
expect(ret.fraction_apport_gratuit_ch).toBeCloseTo(Fj, 12);
|
|
144
|
+
expect(ret.fraction_apport_gratuit_depensier_ch).toBeCloseTo(FjDep, 12);
|
|
145
|
+
for (const fraction of [
|
|
146
|
+
ret.fraction_apport_gratuit_ch,
|
|
147
|
+
ret.fraction_apport_gratuit_depensier_ch
|
|
148
|
+
]) {
|
|
149
|
+
expect(fraction).toBeGreaterThan(0);
|
|
150
|
+
expect(fraction).toBeLessThan(1);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
133
154
|
test('sans récupération, toutes les pertes récupérées retournées sont nulles', () => {
|
|
134
155
|
const ret = appelSansRecup();
|
|
135
156
|
expect(ret.pertes_distribution_ecs_recup).toBe(0);
|
package/README.md
CHANGED
|
@@ -370,57 +370,57 @@ 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.1`** · à publier · branche `main` · généré le 2026-10-01
|
|
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
|
-
<td align="center"><strong>89
|
|
380
|
-
<td align="center"><strong>59
|
|
381
|
-
<td align="center"><strong>66,
|
|
379
|
+
<td align="center"><strong>89 990</strong><br/><sub>DPE analysés</sub></td>
|
|
380
|
+
<td align="center"><strong>59 630</strong><br/><sub>DPE conformes</sub></td>
|
|
381
|
+
<td align="center"><strong>66,26 %</strong><br/><sub>réussite globale</sub></td>
|
|
382
382
|
</tr>
|
|
383
383
|
</table>
|
|
384
384
|
|
|
385
385
|
| | Corpus | Réussite | | DPE conformes |
|
|
386
386
|
| :-: | :---------------------------------------------------------------------------------------------------------------------- | ----------: | :--------------------- | -------------: |
|
|
387
|
-
| 🔴 | **Généraliste**<br/><sub>`corpus_dpe.csv`</sub> | **
|
|
388
|
-
| 🟢 | **Appartement · chauffage individuel (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_individuel_2025.csv`</sub> | **91,
|
|
389
|
-
| 🟢 | **Logement individuel (2025)**<br/><sub>`dpe_logement_individuel_2025.csv`</sub> | **88,
|
|
390
|
-
| 🟢 | **Maison individuelle (2025)**<br/><sub>`dpe_maison_individuelle_2025.csv`</sub> | **
|
|
391
|
-
| 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **
|
|
392
|
-
| 🟡 | **Appartement · chauffage collectif (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_collectif_2025.csv`</sub> | **69,
|
|
393
|
-
| 🟡 | **Immeuble · chauffage collectif**<br/><sub>`dpe_immeuble_chauffage_collectif.csv`</sub> | **62,
|
|
394
|
-
| 🔴 | **Immeuble · chauffage mixte**<br/><sub>`dpe_immeuble_chauffage_mixte.csv`</sub> | **48,
|
|
395
|
-
| 🔴 | **Individuel généré depuis l'immeuble (2026)**<br/><sub>`dpe_individuel_a_partir_dpe_immeuble_2026.csv`</sub> | **27,
|
|
387
|
+
| 🔴 | **Généraliste**<br/><sub>`corpus_dpe.csv`</sub> | **46,11 %** | `█████████░░░░░░░░░░░` | 4 611 / 10 000 |
|
|
388
|
+
| 🟢 | **Appartement · chauffage individuel (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_individuel_2025.csv`</sub> | **91,69 %** | `██████████████████░░` | 9 169 / 10 000 |
|
|
389
|
+
| 🟢 | **Logement individuel (2025)**<br/><sub>`dpe_logement_individuel_2025.csv`</sub> | **88,19 %** | `██████████████████░░` | 8 812 / 9 992 |
|
|
390
|
+
| 🟢 | **Maison individuelle (2025)**<br/><sub>`dpe_maison_individuelle_2025.csv`</sub> | **88,02 %** | `██████████████████░░` | 8 802 / 10 000 |
|
|
391
|
+
| 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **74,08 %** | `███████████████░░░░░` | 7 407 / 9 999 |
|
|
392
|
+
| 🟡 | **Appartement · chauffage collectif (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_collectif_2025.csv`</sub> | **69,67 %** | `██████████████░░░░░░` | 6 967 / 10 000 |
|
|
393
|
+
| 🟡 | **Immeuble · chauffage collectif**<br/><sub>`dpe_immeuble_chauffage_collectif.csv`</sub> | **62,42 %** | `████████████░░░░░░░░` | 6 241 / 9 999 |
|
|
394
|
+
| 🔴 | **Immeuble · chauffage mixte**<br/><sub>`dpe_immeuble_chauffage_mixte.csv`</sub> | **48,82 %** | `██████████░░░░░░░░░░` | 4 882 / 10 000 |
|
|
395
|
+
| 🔴 | **Individuel généré depuis l'immeuble (2026)**<br/><sub>`dpe_individuel_a_partir_dpe_immeuble_2026.csv`</sub> | **27,39 %** | `█████░░░░░░░░░░░░░░░` | 2 739 / 10 000 |
|
|
396
396
|
|
|
397
397
|
<sub>🟢 ≥ 85 % · 🟡 ≥ 60 % · 🔴 < 60 %</sub>
|
|
398
398
|
|
|
399
399
|
#### Temps d’exécution
|
|
400
400
|
|
|
401
|
-
> Durée de l’appel à `calcul_3cl` par DPE, sur 89
|
|
401
|
+
> Durée de l’appel à `calcul_3cl` par DPE, sur 89 950 calculs.
|
|
402
402
|
> La copie défensive de l’entrée et la lecture du fichier sont exclues de la mesure.
|
|
403
403
|
|
|
404
404
|
<table>
|
|
405
405
|
<tr>
|
|
406
|
-
<td align="center"><strong>
|
|
407
|
-
<td align="center"><strong>4,
|
|
406
|
+
<td align="center"><strong>4,88 ms</strong><br/><sub>moyenne</sub></td>
|
|
407
|
+
<td align="center"><strong>4,26 ms</strong><br/><sub>médiane</sub></td>
|
|
408
408
|
<td align="center"><strong>0,11 ms</strong><br/><sub>min</sub></td>
|
|
409
|
-
<td align="center"><strong>
|
|
409
|
+
<td align="center"><strong>891,4 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)** | 3,
|
|
417
|
-
| **Logement individuel (2025)** |
|
|
418
|
-
| **Maison individuelle (2025)** |
|
|
419
|
-
| **Immeuble · chauffage individuel** |
|
|
420
|
-
| **Appartement · chauffage collectif (2025)** | 3,
|
|
421
|
-
| **Immeuble · chauffage collectif** | 5,
|
|
422
|
-
| **Immeuble · chauffage mixte** |
|
|
423
|
-
| **Individuel généré depuis l'immeuble (2026)** | 6,
|
|
415
|
+
| **Généraliste** | 3,65 ms | 3,28 ms | 0,21 ms | 29,7 ms | 6,67 ms | 8,87 ms |
|
|
416
|
+
| **Appartement · chauffage individuel (2025)** | 3,54 ms | 3,23 ms | 1,09 ms | 24,6 ms | 6,11 ms | 8,02 ms |
|
|
417
|
+
| **Logement individuel (2025)** | 4,89 ms | 4,37 ms | 1,41 ms | 39,4 ms | 9,35 ms | 12,7 ms |
|
|
418
|
+
| **Maison individuelle (2025)** | 5,30 ms | 4,73 ms | 1,69 ms | 39,6 ms | 9,54 ms | 13,0 ms |
|
|
419
|
+
| **Immeuble · chauffage individuel** | 5,64 ms | 4,78 ms | 0,11 ms | 76,2 ms | 11,4 ms | 17,8 ms |
|
|
420
|
+
| **Appartement · chauffage collectif (2025)** | 3,92 ms | 3,56 ms | 1,18 ms | 32,4 ms | 6,59 ms | 9,44 ms |
|
|
421
|
+
| **Immeuble · chauffage collectif** | 5,56 ms | 4,75 ms | 0,13 ms | 140,4 ms | 10,7 ms | 18,7 ms |
|
|
422
|
+
| **Immeuble · chauffage mixte** | 5,41 ms | 4,41 ms | 0,19 ms | 891,4 ms | 11,0 ms | 18,0 ms |
|
|
423
|
+
| **Individuel généré depuis l'immeuble (2026)** | 6,04 ms | 5,26 ms | 1,65 ms | 64,0 ms | 11,5 ms | 17,8 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
|
@@ -33,7 +33,7 @@ import getFicheTechnique from './ficheTechnique.js';
|
|
|
33
33
|
import { ProductionENR } 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.3';
|
|
37
37
|
|
|
38
38
|
const dpeSanitizerService = new DpeSanitizerService();
|
|
39
39
|
|
package/package.json
CHANGED
package/utils.spec.js
CHANGED
|
@@ -23,7 +23,12 @@ vi.mock('./tv.js', () => ({
|
|
|
23
23
|
{ code: 'abc', val: 'r4' }
|
|
24
24
|
],
|
|
25
25
|
// Table dédiée à tvMatchOptimized (version optimisée).
|
|
26
|
-
table_opt: [{ a: 'brique', b: '1|2', c: '≥50', d: 'isolation par exterieur', e: 'zone 3' }]
|
|
26
|
+
table_opt: [{ a: 'brique', b: '1|2', c: '≥50', d: 'isolation par exterieur', e: 'zone 3' }],
|
|
27
|
+
// Table dédiée à la compatibilité des deux matchers sur un libellé contenant « + » (#206).
|
|
28
|
+
table_plus: [
|
|
29
|
+
{ conf: 'production volume habitable + pièces alimentées non contiguës', val: 'p0' },
|
|
30
|
+
{ conf: 'production volume habitable + pièces alimentées contiguës', val: 'p1' }
|
|
31
|
+
]
|
|
27
32
|
}
|
|
28
33
|
}));
|
|
29
34
|
|
|
@@ -431,6 +436,28 @@ describe('Utils unit tests', () => {
|
|
|
431
436
|
});
|
|
432
437
|
});
|
|
433
438
|
|
|
439
|
+
// -------------------------------------------------------------------------------------------
|
|
440
|
+
// Libellé contenant un « + » littéral (ex. rendement_distribution_ecs, cf. issue #206) : le
|
|
441
|
+
// motif ancré « ^…+…$ » doit sélectionner la même ligne dans les deux versions du matcher.
|
|
442
|
+
describe('tv / libellé avec « + » : compatibilité des deux matchers', () => {
|
|
443
|
+
const motifAncre = '^production volume habitable + pièces alimentées contiguës$';
|
|
444
|
+
|
|
445
|
+
test.each([
|
|
446
|
+
['historique', unset_tv_match_optimized_version],
|
|
447
|
+
['optimisée', set_tv_match_optimized_version]
|
|
448
|
+
])('version %s : le motif ancré sélectionne la bonne ligne', (_, setVersion) => {
|
|
449
|
+
setVersion();
|
|
450
|
+
expect(tv('table_plus', { conf: motifAncre }).val).toBe('p1');
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
test('version optimisée : l’échappement regex « [+] » ne matche aucune ligne', () => {
|
|
454
|
+
set_tv_match_optimized_version();
|
|
455
|
+
expect(
|
|
456
|
+
tv('table_plus', { conf: 'production volume habitable [+] pièces alimentées contiguës' })
|
|
457
|
+
).toBeNull();
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
|
|
434
461
|
// -------------------------------------------------------------------------------------------
|
|
435
462
|
describe('tv / cache', () => {
|
|
436
463
|
// Règle : `tv()` mémoïse chaque couple (table, matcher), borné par une éviction FIFO.
|