@open3cl/engine 1.8.37 → 1.8.39

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/15_conso_aux.js CHANGED
@@ -345,6 +345,8 @@ export function getDeltaDim(em_ch) {
345
345
  * @param zcId {number} id de la zone climatique
346
346
  * @param nadeq {number} nombre d'unités d'équivalence
347
347
  * @param nombre_niveau_immeuble {number} nombre de niveaux de l'immeuble
348
+ * @param isImmeubleMultiEcs {boolean} immeuble à plusieurs installations ECS dont une collective :
349
+ * di.besoin_ecs est déjà proratisé (Becs_immeuble × Sh_ecs / SH / rdim, cf. 11_ecs.js)
348
350
  */
349
351
  export function conso_aux_distribution_ecs(
350
352
  ecs,
@@ -355,7 +357,8 @@ export function conso_aux_distribution_ecs(
355
357
  caId,
356
358
  zcId,
357
359
  nadeq,
358
- nombre_niveau_immeuble
360
+ nombre_niveau_immeuble,
361
+ isImmeubleMultiEcs = false
359
362
  ) {
360
363
  const typeInstallation = parseInt(de.enum_type_installation_id);
361
364
 
@@ -375,6 +378,15 @@ export function conso_aux_distribution_ecs(
375
378
  // CAS 3 - enum_bouclage_reseau_ecs_id = 3 (traçage)
376
379
  if (enumBouclage === 3) {
377
380
  const BECS_annuel = di.besoin_ecs;
381
+ if (isImmeubleMultiEcs) {
382
+ /**
383
+ * Besoin déjà ramené à l'installation : pas de second prorata de surface.
384
+ * Tribu : Qtrac = 0,14 × Becs_immeuble × Sh_ecs / SH
385
+ * (Moteur_DPE.dll, Calcul_installation_ECS.C_circulateur et Calcul_batiment.Calcul_Cecs)
386
+ */
387
+ di.conso_auxiliaire_distribution_ecs = 0.14 * BECS_annuel * (Number(de.rdim) || 1);
388
+ return;
389
+ }
378
390
  const Sh_install = de.surface_habitable || Sh_logement;
379
391
  di.conso_auxiliaire_distribution_ecs = (0.14 * BECS_annuel * Sh_install) / Sh_logement;
380
392
  return;
@@ -654,6 +654,47 @@ describe("conso_aux_distribution_ecs - auxiliaires de distribution d'ECS", () =>
654
654
  expect(di.conso_auxiliaire_distribution_ecs).toBeCloseTo(168, 10);
655
655
  });
656
656
 
657
+ test('traçage, immeuble à plusieurs installations ECS : besoin déjà proratisé, × rdim', () => {
658
+ const di = { besoin_ecs: 1000 };
659
+ conso_aux_distribution_ecs(
660
+ {},
661
+ {
662
+ enum_type_installation_id: '2',
663
+ enum_bouclage_reseau_ecs_id: '3',
664
+ surface_habitable: 60,
665
+ rdim: 2
666
+ },
667
+ di,
668
+ 175,
669
+ 175,
670
+ 1,
671
+ 1,
672
+ 30,
673
+ 1,
674
+ true
675
+ );
676
+ // 0,14 × 1000 × 2 : pas de second prorata Sh_installation / Sh_logement
677
+ expect(di.conso_auxiliaire_distribution_ecs).toBeCloseTo(280, 10);
678
+ });
679
+
680
+ test('traçage, immeuble à plusieurs installations ECS, rdim absent : rdim = 1', () => {
681
+ const di = { besoin_ecs: 1000 };
682
+ conso_aux_distribution_ecs(
683
+ {},
684
+ { enum_type_installation_id: '2', enum_bouclage_reseau_ecs_id: '3', surface_habitable: 60 },
685
+ di,
686
+ 175,
687
+ 175,
688
+ 1,
689
+ 1,
690
+ 30,
691
+ 1,
692
+ true
693
+ );
694
+ // 0,14 × 1000 × 1
695
+ expect(di.conso_auxiliaire_distribution_ecs).toBeCloseTo(140, 10);
696
+ });
697
+
657
698
  test("traçage sans surface d'installation : repli sur la surface du logement", () => {
658
699
  const di = { besoin_ecs: 1000 };
659
700
  conso_aux_distribution_ecs(
package/9_besoin_ch.js CHANGED
@@ -89,7 +89,8 @@ export default function calc_besoin_ch(
89
89
  ca,
90
90
  zc,
91
91
  th,
92
- nbLogements
92
+ nbLogements,
93
+ Sh
93
94
  );
94
95
 
95
96
  /**
@@ -220,7 +221,59 @@ export default function calc_besoin_ch(
220
221
  };
221
222
  }
222
223
 
223
- function calc_qrec(instal_ecs, nadeq, prorataEcs, ilpa, ca, zc, th, nbLogements) {
224
+ /**
225
+ * Immeuble avec plusieurs installations ECS dont au moins une collective (installations
226
+ * collectives ou mixtes individuelles/collectives), toutes avec une surface habitable desservie.
227
+ * Le besoin ECS de chaque installation est alors Becs_immeuble × Sh_ecs / SH (cf. engine.js,
228
+ * isImmeubleMultiEcs).
229
+ */
230
+ export function isImmeubleMultiEcs(instal_ecs, th, Sh) {
231
+ return (
232
+ th === 'immeuble' &&
233
+ instal_ecs.length > 1 &&
234
+ Number(Sh) > 0 &&
235
+ instal_ecs.some((e) => e.donnee_entree.enum_type_installation_id !== '1') &&
236
+ instal_ecs.every((e) => Number(e.donnee_entree.surface_habitable) > 0)
237
+ );
238
+ }
239
+
240
+ /**
241
+ * Prorata du besoin ECS de l'immeuble servant aux pertes de distribution récupérées d'une
242
+ * installation, cas isImmeubleMultiEcs. Tribu (Moteur_DPE.dll) :
243
+ * - Becs_inst = Becs_immeuble × Sh_ecs / SH (Calcul_batiment.Calcul_Cecs) ;
244
+ * - Qrec = 0,48 × Σ (Qdw_ind_vc × Rdim + Qdw_coll_vc) pour une installation individuelle,
245
+ * 0,48 × Σ (Qdw_ind_vc + Qdw_coll_vc) pour une collective (Calcul_batiment.cs, l. 374),
246
+ * avec Qdw_ind_vc = 0,1 × Becs_inst et Qdw_coll_vc = 0,112 × Becs_inst
247
+ * (Calcul_installation_ECS.cs, l. 347-350).
248
+ * @see Methode_de_calcul_3CL_DPE_2021-338.pdf - §9.1.1 et §11.4
249
+ */
250
+ export function prorataEcsImmeubleMulti(de, Sh, surfaceParLogement = true) {
251
+ const rdim =
252
+ surfaceParLogement && de.enum_type_installation_id === '1' ? Number(de.rdim) || 1 : 1;
253
+ return (Number(de.surface_habitable) / Number(Sh)) * rdim;
254
+ }
255
+
256
+ /**
257
+ * Convention d'export de Sh_ecs des installations individuelles (cf. 11_ecs.js,
258
+ * ratio_besoin_ecs_individuel) :
259
+ * - surface d'un logement (Σ Sh × rdim ≈ SH) → Sh_ecs à multiplier par rdim ;
260
+ * - surface totale desservie par l'installation (Σ Sh ≈ SH, ex. LICIEL) → pas de × rdim.
261
+ * Retourne true pour la convention « surface d'un logement ».
262
+ */
263
+ export function isSurfaceEcsParLogement(instal_ecs, Sh) {
264
+ const des = instal_ecs.map((e) => e.donnee_entree);
265
+ const sommeSh = des.reduce((acc, d) => acc + (Number(d.surface_habitable) || 0), 0);
266
+ const sommeShRdim = des.reduce(
267
+ (acc, d) =>
268
+ acc +
269
+ (Number(d.surface_habitable) || 0) *
270
+ (d.enum_type_installation_id === '1' ? Number(d.rdim) || 1 : 1),
271
+ 0
272
+ );
273
+ return Math.abs(sommeShRdim - Number(Sh)) < Math.abs(sommeSh - Number(Sh));
274
+ }
275
+
276
+ function calc_qrec(instal_ecs, nadeq, prorataEcs, ilpa, ca, zc, th, nbLogements, Sh) {
224
277
  const Nref21 = tvs.nref21[ilpa];
225
278
  const Nref19 = tvs.nref19[ilpa];
226
279
 
@@ -238,12 +291,16 @@ function calc_qrec(instal_ecs, nadeq, prorataEcs, ilpa, ca, zc, th, nbLogements)
238
291
  let Qrec_dep = 0;
239
292
  let total_becs_rdim = 0;
240
293
  let total_becs_dep_rdim = 0;
294
+ const multiEcs = isImmeubleMultiEcs(instal_ecs, th, Sh);
295
+ const surfaceParLogement = multiEcs && isSurfaceEcsParLogement(instal_ecs, Sh);
241
296
  instal_ecs.forEach((ecs) => {
242
297
  let becs_int = 0;
243
298
  let becs_dep_int = 0;
244
299
  const isInstallationSimple = ecs.donnee_entree.enum_type_installation_id === '1';
245
300
  const Tau = isInstallationSimple ? 0.1 : 0.212;
246
- if (th === 'immeuble' && ecs.donnee_entree.rdim > 1) {
301
+ if (multiEcs) {
302
+ prorataEcs = prorataEcsImmeubleMulti(ecs.donnee_entree, Sh, surfaceParLogement);
303
+ } else if (th === 'immeuble' && ecs.donnee_entree.rdim > 1) {
247
304
  prorataEcs = ecs.donnee_entree.rdim / nbLogements;
248
305
  }
249
306
  for (const mois of mois_liste) {
@@ -56,7 +56,14 @@ vi.mock('./utils.js', () => ({
56
56
  }
57
57
  }));
58
58
 
59
- const { default: calc_besoin_ch, calc_Fj, calc_bvj } = await import('./9_besoin_ch.js');
59
+ const {
60
+ default: calc_besoin_ch,
61
+ calc_Fj,
62
+ calc_bvj,
63
+ isImmeubleMultiEcs,
64
+ isSurfaceEcsParLogement,
65
+ prorataEcsImmeubleMulti
66
+ } = await import('./9_besoin_ch.js');
60
67
  const { default: tvsBch } = await import('./tv.js');
61
68
  const { calc_ai_j, calc_as_j } = await import('./6.1_apport_gratuit.js');
62
69
  const { calc_sse_j } = await import('./6.2_surface_sud_equivalente.js');
@@ -550,3 +557,106 @@ describe('calc_besoin_ch - récupération des pertes des générateurs ECS seuls
550
557
  expect(ret.pertes_generateur_ch_recup).toBe(0);
551
558
  });
552
559
  });
560
+
561
+ /**
562
+ * Immeuble à plusieurs installations ECS dont une collective (ex. installation mixte
563
+ * individuelle/collective) : besoin de chaque installation = Becs_immeuble × Sh_ecs / SH, × rdim
564
+ * pour une installation individuelle (Tribu, Calcul_batiment.Calcul_Cecs et l. 374).
565
+ * @see : Methode_de_calcul_3CL_DPE_2021-338.pdf - §9.1.1 et §11.4
566
+ */
567
+ describe('calc_besoin_ch - immeuble à installations ECS individuelles et collectives', () => {
568
+ const ecsIndividuelle = (surface_habitable, rdim) => ({
569
+ donnee_entree: { enum_type_installation_id: '1', surface_habitable, rdim },
570
+ generateur_ecs_collection: { generateur_ecs: [] }
571
+ });
572
+ const ecsCollective = (surface_habitable) => ({
573
+ donnee_entree: { enum_type_installation_id: '2', surface_habitable, rdim: 1 },
574
+ generateur_ecs_collection: { generateur_ecs: [] }
575
+ });
576
+
577
+ beforeEach(() => {
578
+ utilState.bug = false;
579
+ vi.mocked(calc_ai_j).mockReset().mockReturnValue(5000);
580
+ vi.mocked(calc_as_j).mockReset().mockReturnValue(2000);
581
+ vi.mocked(calc_sse_j).mockReset().mockReturnValue(10);
582
+ vi.mocked(calc_besoin_ecs_j).mockReset().mockReturnValue(10);
583
+ vi.mocked(calc_Qrec_gen_j).mockReset().mockReturnValue(0);
584
+ });
585
+
586
+ test('isImmeubleMultiEcs : immeuble, plusieurs installations dont une collective, surfaces renseignées', () => {
587
+ const mixte = [ecsIndividuelle(20, 1), ecsCollective(155)];
588
+ expect(isImmeubleMultiEcs(mixte, 'immeuble', 175)).toBe(true);
589
+ expect(isImmeubleMultiEcs(mixte, 'appartement', 175)).toBe(false);
590
+ expect(isImmeubleMultiEcs([ecsCollective(155)], 'immeuble', 175)).toBe(false);
591
+ expect(
592
+ isImmeubleMultiEcs([ecsIndividuelle(20, 1), ecsIndividuelle(155, 1)], 'immeuble', 175)
593
+ ).toBe(false);
594
+ expect(isImmeubleMultiEcs([ecsIndividuelle(0, 1), ecsCollective(155)], 'immeuble', 175)).toBe(
595
+ false
596
+ );
597
+ expect(isImmeubleMultiEcs(mixte, 'immeuble', 0)).toBe(false);
598
+ });
599
+
600
+ test('prorataEcsImmeubleMulti : Sh_ecs / SH, × rdim pour une installation individuelle seulement', () => {
601
+ expect(
602
+ prorataEcsImmeubleMulti(
603
+ { enum_type_installation_id: '1', surface_habitable: 20, rdim: 3 },
604
+ 200
605
+ )
606
+ ).toBeCloseTo(0.3, 12);
607
+ expect(
608
+ prorataEcsImmeubleMulti({ enum_type_installation_id: '1', surface_habitable: 20 }, 200)
609
+ ).toBeCloseTo(0.1, 12);
610
+ expect(
611
+ prorataEcsImmeubleMulti(
612
+ { enum_type_installation_id: '2', surface_habitable: 150, rdim: 3 },
613
+ 200
614
+ )
615
+ ).toBeCloseTo(0.75, 12);
616
+ });
617
+
618
+ test("prorataEcsImmeubleMulti : pas de × rdim si Sh_ecs est la surface totale de l'installation", () => {
619
+ expect(
620
+ prorataEcsImmeubleMulti(
621
+ { enum_type_installation_id: '1', surface_habitable: 3713, rdim: 64 },
622
+ 3918,
623
+ false
624
+ )
625
+ ).toBeCloseTo(3713 / 3918, 12);
626
+ });
627
+
628
+ test("isSurfaceEcsParLogement : détecte la convention d'export de Sh_ecs", () => {
629
+ // Σ Sh × rdim = 20 × 3 + 115 = 175 = SH → surface d'un logement
630
+ expect(isSurfaceEcsParLogement([ecsIndividuelle(20, 3), ecsCollective(115)], 175)).toBe(true);
631
+ // Σ Sh = 3713 + 205 = 3918 = SH (ex. LICIEL) → surface totale de l'installation
632
+ expect(isSurfaceEcsParLogement([ecsIndividuelle(3713, 64), ecsCollective(205)], 3918)).toBe(
633
+ false
634
+ );
635
+ });
636
+
637
+ test('isSurfaceEcsParLogement : surface ou rdim absents comptés 0 et 1', () => {
638
+ const sansRdim = { donnee_entree: { enum_type_installation_id: '1', surface_habitable: 50 } };
639
+ const sansSurface = { donnee_entree: { enum_type_installation_id: '2' } };
640
+ // Σ Sh = Σ Sh × rdim = 50 : égalité → convention « surface de l'installation »
641
+ expect(isSurfaceEcsParLogement([sansRdim, sansSurface], 50)).toBe(false);
642
+ // Σ Sh × rdim = 20 × 3 = 60 = SH, Σ Sh = 20
643
+ expect(isSurfaceEcsParLogement([ecsIndividuelle(20, 3), sansSurface], 60)).toBe(true);
644
+ });
645
+
646
+ test('pertes récupérées sans × rdim quand Σ Sh_ecs = SH (DPE 2369E3867365O, LICIEL)', () => {
647
+ const instal_ecs = [ecsIndividuelle(160, 8), ecsCollective(40)];
648
+ const ret = calc_besoin_ch(0, 0, 0, 0, 200, 100, 3, instal_ecs, [], [], null, 'immeuble', 9);
649
+ const total = (0.1 * 10 * (160 / 200) + 0.212 * 10 * (40 / 200)) * 1000;
650
+ expect(ret.pertes_distribution_ecs_recup).toBeCloseTo((0.48 * 100 * total) / 8760, 9);
651
+ });
652
+
653
+ test('pertes de distribution ECS récupérées pondérées par Sh_ecs / SH (et rdim en individuel)', () => {
654
+ // Σ Sh × rdim = 20 × 3 + 115 = 175 = SH : Sh_ecs exportée par logement
655
+ const instal_ecs = [ecsIndividuelle(20, 3), ecsCollective(115)];
656
+ const ret = calc_besoin_ch(0, 0, 0, 0, 175, 100, 3, instal_ecs, [], [], null, 'immeuble', 4);
657
+ // Σ Tau × Becs × prorata (Wh) : 0,1 × 10 × (20 / 175 × 3) + 0,212 × 10 × 115 / 175
658
+ const total = (0.1 * 10 * ((20 / 175) * 3) + 0.212 * 10 * (115 / 175)) * 1000;
659
+ // un seul mois : Qrec_j = Qrec = 0,48 × ΣNref19 / 8760 × total
660
+ expect(ret.pertes_distribution_ecs_recup).toBeCloseTo((0.48 * 100 * total) / 8760, 9);
661
+ });
662
+ });
package/README.md CHANGED
@@ -370,14 +370,14 @@ 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.36`** · branche `main` · généré le 2026-10-09
373
+ > **Version `1.8.38`** · branche `main` · généré le 2026-10-10
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 984</strong><br/><sub>DPE analysés</sub></td>
380
- <td align="center"><strong>61 950</strong><br/><sub>DPE conformes</sub></td>
380
+ <td align="center"><strong>61 951</strong><br/><sub>DPE conformes</sub></td>
381
381
  <td align="center"><strong>68,85 %</strong><br/><sub>réussite globale</sub></td>
382
382
  </tr>
383
383
  </table>
@@ -388,7 +388,7 @@ 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,61 %** | `██████████████████░░` | 8 860 / 9 999 |
391
- | 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **84,21 %** | `█████████████████░░░` | 8 419 / 9 998 |
391
+ | 🟡 | **Immeuble · chauffage individuel**<br/><sub>`dpe_immeuble_chauffage_individuel.csv`</sub> | **84,22 %** | `█████████████████░░░` | 8 420 / 9 998 |
392
392
  | 🟡 | **Appartement · chauffage collectif (2025)**<br/><sub>`dpe_appartement_individuel_chauffage_collectif_2025.csv`</sub> | **71,60 %** | `██████████████░░░░░░` | 7 160 / 10 000 |
393
393
  | 🟡 | **Immeuble · chauffage collectif**<br/><sub>`dpe_immeuble_chauffage_collectif.csv`</sub> | **66,19 %** | `█████████████░░░░░░░` | 6 618 / 9 999 |
394
394
  | 🔴 | **Immeuble · chauffage mixte**<br/><sub>`dpe_immeuble_chauffage_mixte.csv`</sub> | **53,71 %** | `███████████░░░░░░░░░` | 5 369 / 9 997 |
@@ -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,13 ms</strong><br/><sub>moyenne</sub></td>
407
- <td align="center"><strong>4,48 ms</strong><br/><sub>médiane</sub></td>
406
+ <td align="center"><strong>4,77 ms</strong><br/><sub>moyenne</sub></td>
407
+ <td align="center"><strong>4,18 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>468,0 ms</strong><br/><sub>max</sub></td>
409
+ <td align="center"><strong>803,0 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** | 4,50 ms | 4,02 ms | 0,22 ms | 33,8 ms | 8,30 ms | 12,2 ms |
416
- | **Appartement · chauffage individuel (2025)** | 3,59 ms | 3,26 ms | 1,42 ms | 25,6 ms | 6,19 ms | 7,93 ms |
417
- | **Logement individuel (2025)** | 5,29 ms | 4,77 ms | 1,61 ms | 35,7 ms | 9,74 ms | 13,2 ms |
418
- | **Maison individuelle (2025)** | 6,09 ms | 5,50 ms | 1,84 ms | 37,9 ms | 10,9 ms | 14,2 ms |
419
- | **Immeuble · chauffage individuel** | 6,28 ms | 5,40 ms | 0,12 ms | 85,1 ms | 12,7 ms | 19,8 ms |
420
- | **Appartement · chauffage collectif (2025)** | 3,96 ms | 3,55 ms | 1,40 ms | 33,4 ms | 6,53 ms | 8,28 ms |
421
- | **Immeuble · chauffage collectif** | 5,22 ms | 4,41 ms | 0,11 ms | 93,8 ms | 9,69 ms | 16,8 ms |
422
- | **Immeuble · chauffage mixte** | 5,18 ms | 4,23 ms | 0,22 ms | 468,0 ms | 10,7 ms | 17,7 ms |
423
- | **Individuel généré depuis l'immeuble (2026)** | 6,07 ms | 5,20 ms | 1,63 ms | 47,3 ms | 11,7 ms | 18,6 ms |
415
+ | **Généraliste** | 4,10 ms | 3,68 ms | 0,22 ms | 30,3 ms | 7,50 ms | 10,6 ms |
416
+ | **Appartement · chauffage individuel (2025)** | 3,65 ms | 3,31 ms | 1,44 ms | 25,0 ms | 6,29 ms | 8,11 ms |
417
+ | **Logement individuel (2025)** | 4,48 ms | 3,99 ms | 1,56 ms | 42,6 ms | 8,07 ms | 11,5 ms |
418
+ | **Maison individuelle (2025)** | 5,21 ms | 4,74 ms | 1,90 ms | 43,1 ms | 8,99 ms | 12,2 ms |
419
+ | **Immeuble · chauffage individuel** | 6,01 ms | 5,14 ms | 0,11 ms | 82,9 ms | 12,1 ms | 19,4 ms |
420
+ | **Appartement · chauffage collectif (2025)** | 4,14 ms | 3,77 ms | 1,38 ms | 34,4 ms | 6,76 ms | 8,60 ms |
421
+ | **Immeuble · chauffage collectif** | 5,32 ms | 4,53 ms | 0,13 ms | 104,0 ms | 9,82 ms | 17,4 ms |
422
+ | **Immeuble · chauffage mixte** | 4,73 ms | 3,88 ms | 0,19 ms | 803,0 ms | 9,38 ms | 15,8 ms |
423
+ | **Individuel généré depuis l'immeuble (2026)** | 5,31 ms | 4,59 ms | 1,72 ms | 40,3 ms | 9,84 ms | 15,7 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/conso.js CHANGED
@@ -626,6 +626,28 @@ function getEcsConso(gen_ecs, field, coef, prorataECS, prefix) {
626
626
  }, 0);
627
627
  }
628
628
 
629
+ /**
630
+ * Consommation des auxiliaires de génération ECS (circulateurs des générateurs).
631
+ * Le besoin d'une installation dimensionnée (rdim > 1) est exprimé par unité : comme la
632
+ * consommation ECS (cle_repartition_ecs × rdim), les auxiliaires de génération sont multipliés
633
+ * par le rdim de l'installation lorsque la conso est calculée à l'échelle du DPE (prorataECS = 1).
634
+ * @see Moteur_DPE.dll Calcul_batiment.cs l.660 (Qcirc_ecs1 += Qcirc × Rdim)
635
+ * @param ecs {InstallationEcs[]}
636
+ * @param field {string} conso_auxiliaire_generation_ecs[_depensier]
637
+ * @param coef {object}
638
+ * @param prorataECS {number}
639
+ * @returns {number}
640
+ */
641
+ export function getAuxGenerationEcs(ecs, field, coef, prorataECS) {
642
+ return ecs.reduce((acc, inst) => {
643
+ const rdim = prorataECS === 1 ? Number(inst.donnee_entree.rdim) || 1 : 1;
644
+ return inst.generateur_ecs_collection.generateur_ecs.reduce((acc2, gen) => {
645
+ const conso = (gen.donnee_intermediaire[field] || 0) * rdim;
646
+ return acc2 + getConso(coef, 'électricité auxiliaire', conso);
647
+ }, acc);
648
+ }, 0);
649
+ }
650
+
629
651
  /**
630
652
  * Calcul de la consommation globale de chauffage
631
653
  * @param gen_ch {Generateur_chauffage_collection}
@@ -721,15 +743,19 @@ function calc_conso_pond(
721
743
  prefix
722
744
  );
723
745
 
724
- ret.auxiliaire_generation_ecs = gen_ecs.reduce((acc, gen_ecs) => {
725
- const conso = gen_ecs.donnee_intermediaire.conso_auxiliaire_generation_ecs || 0;
726
- return acc + getConso(coef, 'électricité auxiliaire', conso);
727
- }, 0);
746
+ ret.auxiliaire_generation_ecs = getAuxGenerationEcs(
747
+ ecs_installations,
748
+ 'conso_auxiliaire_generation_ecs',
749
+ coef,
750
+ prorataECS
751
+ );
728
752
 
729
- ret.auxiliaire_generation_ecs_depensier = gen_ecs.reduce((acc, gen_ecs) => {
730
- const conso = gen_ecs.donnee_intermediaire.conso_auxiliaire_generation_ecs_depensier || 0;
731
- return acc + getConso(coef, 'électricité auxiliaire', conso);
732
- }, 0);
753
+ ret.auxiliaire_generation_ecs_depensier = getAuxGenerationEcs(
754
+ ecs_installations,
755
+ 'conso_auxiliaire_generation_ecs_depensier',
756
+ coef,
757
+ prorataECS
758
+ );
733
759
 
734
760
  ret.auxiliaire_distribution_ecs = ecs_installations.reduce((acc, inst) => {
735
761
  const conso = inst.donnee_intermediaire.conso_auxiliaire_distribution_ecs || 0;
package/conso.spec.js CHANGED
@@ -55,6 +55,7 @@ const {
55
55
  getCoefCout,
56
56
  coefCoutProrata,
57
57
  masqueEnergie,
58
+ getAuxGenerationEcs,
58
59
  DATE_BAREME_COUT_2024
59
60
  } = await import('./conso.js');
60
61
 
@@ -734,3 +735,65 @@ describe('coefCoutProrata - ratio de surface des installations collectives', ()
734
735
  });
735
736
  });
736
737
  });
738
+
739
+ /**
740
+ * Auxiliaires de génération ECS : multipliés par le rdim de l'installation (comme la conso ECS).
741
+ * @see Moteur_DPE.dll Calcul_batiment.cs l.660 (Qcirc_ecs1 += Qcirc × Rdim) ; autotests IC-echantillon-gaz.
742
+ */
743
+ describe('getAuxGenerationEcs - auxiliaires de génération ECS et rdim', () => {
744
+ const coefUnitaire = { 'électricité auxiliaire': 1 };
745
+ const inst = (rdim, ...consos) =>
746
+ installEcs(
747
+ rdim === undefined ? {} : { rdim },
748
+ consos.map((c) =>
749
+ genEcs('1', {
750
+ conso_auxiliaire_generation_ecs: c,
751
+ conso_auxiliaire_generation_ecs_depensier: 2 * c
752
+ })
753
+ )
754
+ );
755
+
756
+ test('installation dimensionnée (rdim 3,25) : auxiliaires × rdim à l’échelle du DPE', () => {
757
+ const ecs = [inst(3.25, 2.74, 2.97), inst(undefined, 10)];
758
+ // (2,74 + 2,97) × 3,25 + 10 × 1
759
+ expect(
760
+ getAuxGenerationEcs(ecs, 'conso_auxiliaire_generation_ecs', coefUnitaire, 1)
761
+ ).toBeCloseTo((2.74 + 2.97) * 3.25 + 10, 9);
762
+ expect(
763
+ getAuxGenerationEcs(ecs, 'conso_auxiliaire_generation_ecs_depensier', coefUnitaire, 1)
764
+ ).toBeCloseTo(2 * ((2.74 + 2.97) * 3.25 + 10), 9);
765
+ });
766
+
767
+ test('appartement proratisé (prorataECS ≠ 1) : rdim non appliqué', () => {
768
+ const ecs = [inst(3.25, 4)];
769
+ expect(getAuxGenerationEcs(ecs, 'conso_auxiliaire_generation_ecs', coefUnitaire, 0.4)).toBe(4);
770
+ });
771
+
772
+ test('rdim non numérique ou générateur sans conso : neutre', () => {
773
+ const ecs = [inst('abc', 4), installEcs({ rdim: 2 }, [genEcs('1', {})])];
774
+ expect(getAuxGenerationEcs(ecs, 'conso_auxiliaire_generation_ecs', coefUnitaire, 1)).toBe(4);
775
+ });
776
+
777
+ test('calc_conso : auxiliaire_generation_ecs intègre le rdim', () => {
778
+ const ecs = [inst(2, 5)];
779
+ const res = calc_conso(100, 1, 1, [], [], ecs, [], 1, 1, DATE_DPE, coef_ep);
780
+ const sansRdim = calc_conso(
781
+ 100,
782
+ 1,
783
+ 1,
784
+ [],
785
+ [],
786
+ [inst(undefined, 5)],
787
+ [],
788
+ 1,
789
+ 1,
790
+ DATE_DPE,
791
+ coef_ep
792
+ );
793
+ expect(res.ef_conso.conso_auxiliaire_generation_ecs).toBeCloseTo(
794
+ 2 * sansRdim.ef_conso.conso_auxiliaire_generation_ecs,
795
+ 9
796
+ );
797
+ expect(res.ef_conso.conso_auxiliaire_generation_ecs).toBeGreaterThan(0);
798
+ });
799
+ });
package/engine.js CHANGED
@@ -33,7 +33,7 @@ import getFicheTechnique from './ficheTechnique.js';
33
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.37';
36
+ const LIB_VERSION = '1.8.39';
37
37
 
38
38
  const dpeSanitizerService = new DpeSanitizerService();
39
39
 
@@ -472,7 +472,8 @@ export function calcul_3cl(inputDpe, options) {
472
472
  ca_id,
473
473
  zc_id,
474
474
  apport_et_besoin.nadeq,
475
- dpe.logement.caracteristique_generale.nombre_niveau_immeuble
475
+ dpe.logement.caracteristique_generale.nombre_niveau_immeuble,
476
+ isImmeubleMultiEcs
476
477
  );
477
478
  }
478
479
  });
package/engine.spec.js CHANGED
@@ -486,7 +486,8 @@ describe('calcul_3cl - run intégral (maison)', () => {
486
486
  'ca1',
487
487
  'zc1',
488
488
  2, // nadeq
489
- 3 // nombre_niveau_immeuble
489
+ 3, // nombre_niveau_immeuble
490
+ false // isImmeubleMultiEcs (maison)
490
491
  );
491
492
 
492
493
  // Climatisation présente : calc_clim appelé.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open3cl/engine",
3
- "version": "1.8.37",
3
+ "version": "1.8.39",
4
4
  "description": "Open Source 3CL-DPE engine",
5
5
  "main": "index.js",
6
6
  "directories": {