From 980305e331cc7df6f613691beefc1ae1cf8e792d Mon Sep 17 00:00:00 2001 From: Michael Desigaud Date: Tue, 1 Sep 2026 14:55:50 +0200 Subject: [PATCH 1/2] feat: #issue-177 --- dist/reports/corpus/corpus_list_main.json | 2 +- src/16.2_production_enr.js | 42 +++++---- src/conso.js | 13 +++ src/engine.js | 75 +++++++++++++-- src/index.js | 10 +- test/open3cl-coeff-1-7.spec.js | 74 +++++++++++++++ .../open3cl-coeff-1-7.spec.js" | 93 +++++++++++++++++++ types.d.ts | 9 +- 8 files changed, 286 insertions(+), 32 deletions(-) create mode 100644 test/open3cl-coeff-1-7.spec.js create mode 100644 "test/\342\200\216test/open3cl-coeff-1-7.spec.js" diff --git a/dist/reports/corpus/corpus_list_main.json b/dist/reports/corpus/corpus_list_main.json index 3e15dce4..33b70994 100644 --- a/dist/reports/corpus/corpus_list_main.json +++ b/dist/reports/corpus/corpus_list_main.json @@ -10,5 +10,5 @@ "dpe_appartement_individuel_chauffage_collectif_2025.csv", "dpe_individuel_a_partir_dpe_immeuble_2026.csv" ], - "branches": ["main"] + "branches": ["main", "fix_issue_177"] } diff --git a/src/16.2_production_enr.js b/src/16.2_production_enr.js index 43253642..03823099 100644 --- a/src/16.2_production_enr.js +++ b/src/16.2_production_enr.js @@ -1,7 +1,7 @@ import enums from './enums.js'; import { mois_liste, tv } from './utils.js'; import tvs from './tv.js'; -import { COEFF_EP_1_9, COEFF_EP_2_3 } from './conso.js'; +import { DEFAULT_COEFF_EP } from './conso.js'; export class ProductionENR { #taplpi = { @@ -18,9 +18,13 @@ export class ProductionENR { * Calcul des consommations d'électricité auto-consommée par enveloppe * Mise à jour des conso ef en prenant en compte ces auto-consommations * @param productionElecEnr - * @param Sh {string} + * @param conso + * @param Sh {number} + * @param th {string} + * @param zc_id {string} + * @param coeff_ep_override {number?} */ - calculateEnr(productionElecEnr, conso, Sh, th, zc_id, use_coeff_ch_elec_2_3) { + calculateEnr(productionElecEnr, conso, Sh, th, zc_id, coeff_ep_override) { const productionElectricite = { conso_elec_ac: 0, production_pv: 0, @@ -45,7 +49,7 @@ export class ProductionENR { this.updateEfConso(productionElectricite, conso, Sh); // Mise à jour des consommations d'énergie primaire en minorant l'énergie consommée par l'énergie autoconsommée par le poste - this.updateEPConso(productionElectricite, conso, Sh, use_coeff_ch_elec_2_3); + this.updateEPConso(productionElectricite, conso, Sh, coeff_ep_override); } return { @@ -181,17 +185,17 @@ export class ProductionENR { * @param productionElectricite * @param conso {{ep_conso: Ep_conso}} * @param Sh {number} - * @param use_coeff_ch_elec_2_3 {boolean} "true" pour ne pas utiliser le dernier coeff de chauffage électrique + * @param coeff_ep_override {number?} coeff ep à surcharger si définit */ - updateEPConso(productionElectricite, conso, Sh, use_coeff_ch_elec_2_3) { - if (use_coeff_ch_elec_2_3) { - conso.ep_conso.ep_conso_ecs -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_ecs; - conso.ep_conso.ep_conso_ch -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_ch; - conso.ep_conso.ep_conso_fr -= COEFF_EP_2_3 * productionElectricite.conso_elec_ac_fr; + updateEPConso(productionElectricite, conso, Sh, coeff_ep_override) { + if (coeff_ep_override) { + conso.ep_conso.ep_conso_ecs -= coeff_ep_override * productionElectricite.conso_elec_ac_ecs; + conso.ep_conso.ep_conso_ch -= coeff_ep_override * productionElectricite.conso_elec_ac_ch; + conso.ep_conso.ep_conso_fr -= coeff_ep_override * productionElectricite.conso_elec_ac_fr; conso.ep_conso.ep_conso_eclairage -= - COEFF_EP_2_3 * productionElectricite.conso_elec_ac_eclairage; + coeff_ep_override * productionElectricite.conso_elec_ac_eclairage; conso.ep_conso.ep_conso_totale_auxiliaire -= - COEFF_EP_2_3 * productionElectricite.conso_elec_ac_auxiliaire; + coeff_ep_override * productionElectricite.conso_elec_ac_auxiliaire; const conso_elec = productionElectricite.conso_elec_ac_ecs + @@ -200,17 +204,17 @@ export class ProductionENR { productionElectricite.conso_elec_ac_eclairage + productionElectricite.conso_elec_ac_auxiliaire; - conso.ep_conso.ep_conso_5_usages -= COEFF_EP_2_3 * conso_elec; + conso.ep_conso.ep_conso_5_usages -= coeff_ep_override * conso_elec; conso.ep_conso.ep_conso_5_usages_m2 = Math.floor(conso.ep_conso.ep_conso_5_usages / Sh); } else { - conso.ep_conso.ep_conso_ecs -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_ecs; - conso.ep_conso.ep_conso_ch -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_ch; - conso.ep_conso.ep_conso_fr -= COEFF_EP_1_9 * productionElectricite.conso_elec_ac_fr; + conso.ep_conso.ep_conso_ecs -= DEFAULT_COEFF_EP * productionElectricite.conso_elec_ac_ecs; + conso.ep_conso.ep_conso_ch -= DEFAULT_COEFF_EP * productionElectricite.conso_elec_ac_ch; + conso.ep_conso.ep_conso_fr -= DEFAULT_COEFF_EP * productionElectricite.conso_elec_ac_fr; conso.ep_conso.ep_conso_eclairage -= - COEFF_EP_1_9 * productionElectricite.conso_elec_ac_eclairage; + DEFAULT_COEFF_EP * productionElectricite.conso_elec_ac_eclairage; conso.ep_conso.ep_conso_totale_auxiliaire -= - COEFF_EP_1_9 * productionElectricite.conso_elec_ac_auxiliaire; + DEFAULT_COEFF_EP * productionElectricite.conso_elec_ac_auxiliaire; const conso_elec = productionElectricite.conso_elec_ac_ecs + @@ -219,7 +223,7 @@ export class ProductionENR { productionElectricite.conso_elec_ac_eclairage + productionElectricite.conso_elec_ac_auxiliaire; - conso.ep_conso.ep_conso_5_usages -= COEFF_EP_1_9 * conso_elec; + conso.ep_conso.ep_conso_5_usages -= DEFAULT_COEFF_EP * conso_elec; conso.ep_conso.ep_conso_5_usages_m2 = Math.floor(conso.ep_conso.ep_conso_5_usages / Sh); } diff --git a/src/conso.js b/src/conso.js index e2e4b0cc..39b3856f 100644 --- a/src/conso.js +++ b/src/conso.js @@ -5,6 +5,8 @@ import { tv } from './utils.js'; export const COEFF_EP_2_3 = 2.3; export const COEFF_EP_1_9 = 1.9; +export const COEFF_EP_1_7 = 1.7; +export const DEFAULT_COEFF_EP = COEFF_EP_1_9; /** * Coeff de chauffage 1.9 au 01/01/2026 @@ -29,6 +31,17 @@ export const coef_ep_2_3 = { 'électricité auxiliaire': COEFF_EP_2_3 }; +/** + * Coeff de chauffage 1.7 au 01/01/2027 + */ +export const coef_ep_1_7 = { + 'électricité ch': COEFF_EP_1_7, + 'électricité ecs': COEFF_EP_1_7, + 'électricité fr': COEFF_EP_1_7, + 'électricité éclairage': COEFF_EP_1_7, + 'électricité auxiliaire': COEFF_EP_1_7 +}; + /** * Au 31 mars 2021 * @link {https://www.legifrance.gouv.fr/download/pdf?id=doxMrRr0wbfJVvtWjfDP4gHzzERt1iX0PtobthCE6A0=} diff --git a/src/engine.js b/src/engine.js index 65f38419..9b6ed7ad 100644 --- a/src/engine.js +++ b/src/engine.js @@ -11,7 +11,10 @@ import calc_conso, { classe_bilan_dpe, classe_emission_ges, coef_ep, - coef_ep_2_3 + coef_ep_1_7, + coef_ep_2_3, + COEFF_EP_1_7, + COEFF_EP_2_3 } from './conso.js'; import { add_references, @@ -559,8 +562,30 @@ export function calcul_3cl(inputDpe, options) { conso, Sh, th, + zc_id + ); + + const conso1_7 = calc_conso( + Sh, + zc_id, + ca_id, + vt_list, + instal_ch, + ecs, + clim, + prorataECS, + prorataChauffage, + dateDpe, + coef_ep_1_7 + ); + + productionENR.calculateEnr( + dpe.logement.production_elec_enr, + conso1_7, + Sh, + th, zc_id, - false + COEFF_EP_1_7 ); const conso2_3 = calc_conso( @@ -577,7 +602,14 @@ export function calcul_3cl(inputDpe, options) { coef_ep_2_3 ); - productionENR.calculateEnr(dpe.logement.production_elec_enr, conso2_3, Sh, th, zc_id, true); + productionENR.calculateEnr( + dpe.logement.production_elec_enr, + conso2_3, + Sh, + th, + zc_id, + COEFF_EP_2_3 + ); // get all baie_vitree orientations const ph_list = env.plancher_haut_collection.plancher_haut || []; @@ -594,12 +626,15 @@ export function calcul_3cl(inputDpe, options) { ...logement.sortie.ep_conso, coeff_2_3_classe_bilan_dpe: conso2_3.ep_conso.classe_bilan_dpe, coeff_2_3_ep_conso_5_usages: conso2_3.ep_conso.ep_conso_5_usages, - coeff_2_3_ep_conso_5_usages_m2: conso2_3.ep_conso.ep_conso_5_usages_m2 + coeff_2_3_ep_conso_5_usages_m2: conso2_3.ep_conso.ep_conso_5_usages_m2, + coeff_1_7_classe_bilan_dpe: conso1_7.ep_conso.classe_bilan_dpe, + coeff_1_7_ep_conso_5_usages: conso1_7.ep_conso.ep_conso_5_usages, + coeff_1_7_ep_conso_5_usages_m2: conso1_7.ep_conso.ep_conso_5_usages_m2 }; - logement.sortie.ep_conso.classe_bilan_dpe_2026 = logement.sortie.ep_conso.classe_bilan_dpe; - logement.sortie.ep_conso.ep_conso_5_usages_2026 = logement.sortie.ep_conso.ep_conso_5_usages; - logement.sortie.ep_conso.ep_conso_5_usages_2026_m2 = + logement.sortie.ep_conso.classe_bilan_dpe_2027 = logement.sortie.ep_conso.classe_bilan_dpe; + logement.sortie.ep_conso.ep_conso_5_usages_2027 = logement.sortie.ep_conso.ep_conso_5_usages; + logement.sortie.ep_conso.ep_conso_5_usages_2027_m2 = logement.sortie.ep_conso.ep_conso_5_usages_m2; return dpe; @@ -641,12 +676,36 @@ export function get_classe_ges_dpe(dpe) { * @returns {{ep_conso_5_usages: number; ep_conso_5_usages_m2: number; classe_bilan_dpe: string}} */ export function get_conso_coeff_1_9_2026(dpe) { + return get_conso_with_coeff(dpe, 0.9 / 1.3); +} + +/** + * Calcul de la nouvelle conso suite à la modification du coefficient pour le chauffage électrique + * Applicable uniquement à partir de janvier 2027 + * + * {@link https://www.legifrance.gouv.fr/jorf/id/JORFTEXT000054747079} + * + * @param dpe {FullDpe} + * @returns {{ep_conso_5_usages: number; ep_conso_5_usages_m2: number; classe_bilan_dpe: string}} + */ +export function get_conso_coeff_1_7_2027(dpe) { + return get_conso_with_coeff(dpe, 0.7 / 0.9); +} + +/** + * Calcul de la nouvelle conso suite à la modification du coefficient pour le chauffage électrique + * + * @param dpe {FullDpe} + * @param coeff {number} + * @returns {{ep_conso_5_usages: number; ep_conso_5_usages_m2: number; classe_bilan_dpe: string}} + */ +function get_conso_with_coeff(dpe, coeff) { const zc_id = dpe.logement.meteo.enum_zone_climatique_id; const ca_id = dpe.logement.meteo.enum_classe_altitude_id; const th = calc_th(dpe.logement.caracteristique_generale.enum_methode_application_dpe_log_id); const ep_conso_5_usages = - (0.9 / 1.3) * + coeff * (Number(dpe.logement.sortie.ep_conso.ep_conso_5_usages) - Number(dpe.logement.sortie.ef_conso.conso_5_usages)) + Number(dpe.logement.sortie.ef_conso.conso_5_usages); diff --git a/src/index.js b/src/index.js index 77cc80c1..3d296aa7 100644 --- a/src/index.js +++ b/src/index.js @@ -3,8 +3,16 @@ import { calcul_3cl_xml, get_classe_ges_dpe, get_conso_coeff_1_9_2026, + get_conso_coeff_1_7_2027, getVersion } from './engine.js'; -export { calcul_3cl, calcul_3cl_xml, get_classe_ges_dpe, get_conso_coeff_1_9_2026, getVersion }; +export { + calcul_3cl, + calcul_3cl_xml, + get_classe_ges_dpe, + get_conso_coeff_1_9_2026, + get_conso_coeff_1_7_2027, + getVersion +}; import { Umur, Uph, Upb, Uporte, Ubv, Upt } from './3_deperdition.js'; export { Umur, Uph, Upb, Uporte, Ubv, Upt }; diff --git a/test/open3cl-coeff-1-7.spec.js b/test/open3cl-coeff-1-7.spec.js new file mode 100644 index 00000000..00c330ea --- /dev/null +++ b/test/open3cl-coeff-1-7.spec.js @@ -0,0 +1,74 @@ +import { describe, expect, test } from 'vitest'; +import { getAdemeFileJsonOrDownload } from './test-helpers.js'; +import { calcul_3cl } from '../src/index.js'; + +describe('Open3cl misc unit tests', () => { + test('should calculate primary conso with coeff 1.7 (since janvier 2027) for dpe: 2369E2791083C', async () => { + const inputDpe = await getAdemeFileJsonOrDownload('2369E2791083C'); + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + expect(outputDpe.logement.sortie.ep_conso.coeff_1_7_classe_bilan_dpe).toBe('F'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('F'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2027).toBe('F'); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages_m2 + ); + }); + + test('should calculate primary conso with coeff 1.7 (since janvier 2027) for dpe: 2513E1166911W', async () => { + const inputDpe = await getAdemeFileJsonOrDownload('2513E1166911W'); + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + expect(outputDpe.logement.sortie.ep_conso.coeff_1_7_classe_bilan_dpe).toBe('B'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('B'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2027).toBe('B'); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages_m2 + ); + }); + + test('should calculate primary conso with coeff 1.7 (since janvier 2027) for dpe: 2528E1249844E', async () => { + const inputDpe = await getAdemeFileJsonOrDownload('2528E1249844E'); + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + expect(outputDpe.logement.sortie.ep_conso.coeff_1_7_classe_bilan_dpe).toBe('A'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('A'); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2027).toBe('A'); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages + ); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeGreaterThan( + outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages_m2 + ); + }); + + test('should calculate primary conso with coeff 1.7 (since janvier 2027) for dpe: 2464E1799476F', async () => { + const inputDpe = await getAdemeFileJsonOrDownload('2464E1799476F'); + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + expect(outputDpe.logement.sortie.ep_conso.coeff_1_7_ep_conso_5_usages).toBeCloseTo( + 33669.79, + 0.5 + ); + }); +}); diff --git "a/test/\342\200\216test/open3cl-coeff-1-7.spec.js" "b/test/\342\200\216test/open3cl-coeff-1-7.spec.js" new file mode 100644 index 00000000..45f83253 --- /dev/null +++ "b/test/\342\200\216test/open3cl-coeff-1-7.spec.js" @@ -0,0 +1,93 @@ +import { describe, expect, test } from 'vitest'; +import fs from 'node:fs'; +import { calcul_3cl, get_conso_coeff_1_7_2027 } from '../../src/index.js'; + +/** + * Load a DPE fixture from local JSON cache (no ADEME credentials needed). + * Falls back to null if file not found. + */ +function loadFixture(dpeCode) { + const path = `test/fixtures/${dpeCode}.json`; + if (!fs.existsSync(path)) return null; + return JSON.parse(fs.readFileSync(path, 'utf-8')); +} + +describe('Open3cl CEP 1.7 (janvier 2027) unit tests', () => { + test('calcul_3cl output should include _2027 ep_conso fields', () => { + // Use any available local JSON fixture + const fixtures = fs + .readdirSync('test/fixtures') + .filter((f) => f.endsWith('.json') && !f.endsWith('-result.json')); + expect(fixtures.length).toBeGreaterThan(0); + + const inputDpe = loadFixture(fixtures[0].replace('.json', '')); + expect(inputDpe).not.toBeNull(); + + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2027).toBeDefined(); + expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2027_m2).toBeDefined(); + expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2027).toBeDefined(); + }); + + test('_2027 ep_conso should be <= _2026 ep_conso (lower coefficient)', () => { + const fixtures = fs + .readdirSync('test/fixtures') + .filter((f) => f.endsWith('.json') && !f.endsWith('-result.json')); + + // Test across all available fixtures + let tested = 0; + for (const file of fixtures.slice(0, 10)) { + const inputDpe = loadFixture(file.replace('.json', '')); + if (!inputDpe) continue; + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + const ep2026 = outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2026; + const ep2027 = outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2027; + // 1.7 ≤ 1.9, so 2027 energy consumption must be ≤ 2026 + expect(ep2027).toBeLessThanOrEqual(ep2026 + 0.001); // +0.001 for floating point tolerance + tested++; + } + expect(tested).toBeGreaterThan(0); + }); + + test('_2027 ep_conso should be <= _2026 ep_conso for all non-result fixtures', () => { + const fixtures = fs + .readdirSync('test/fixtures') + .filter((f) => f.endsWith('.json') && !f.endsWith('-result.json')); + + let tested = 0; + for (const file of fixtures) { + const inputDpe = loadFixture(file.replace('.json', '')); + if (!inputDpe) continue; + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + const ep2026 = outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2026; + const ep2027 = outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_2027; + expect(ep2027).toBeLessThanOrEqual(ep2026 + 0.001); + tested++; + } + expect(tested).toBeGreaterThan(0); + }, 60_000); + + test('get_conso_coeff_1_7_2027 returns valid result with ep_conso_5_usages <= 1.9 result', () => { + const fixtures = fs + .readdirSync('test/fixtures') + .filter((f) => f.endsWith('.json') && !f.endsWith('-result.json')); + + const inputDpe = loadFixture(fixtures[0].replace('.json', '')); + expect(inputDpe).not.toBeNull(); + + const outputDpe = calcul_3cl(structuredClone(inputDpe)); + const result1_7 = get_conso_coeff_1_7_2027(outputDpe); + + expect(result1_7.ep_conso_5_usages).toBeDefined(); + expect(result1_7.ep_conso_5_usages_m2).toBeDefined(); + expect(result1_7.classe_bilan_dpe).toBeDefined(); + expect(typeof result1_7.ep_conso_5_usages).toBe('number'); + expect(typeof result1_7.ep_conso_5_usages_m2).toBe('number'); + + // 1.7 coefficient should give lower or equal conso than 1.9 + expect(result1_7.ep_conso_5_usages).toBeLessThanOrEqual( + outputDpe.logement.sortie.ep_conso.ep_conso_5_usages + 0.001 + ); + }); +}); diff --git a/types.d.ts b/types.d.ts index bb0e7440..c2f9cbfa 100644 --- a/types.d.ts +++ b/types.d.ts @@ -420,14 +420,17 @@ interface Ep_conso { ep_conso_fr: number; ep_conso_fr_depensier: number; ep_conso_5_usages: number; + coeff_1_7_ep_conso_5_usages?: number; coeff_2_3_ep_conso_5_usages?: number; - ep_conso_5_usages_2026?: number; + ep_conso_5_usages_2027?: number; ep_conso_5_usages_m2: number; + coeff_1_7_ep_conso_5_usages_m2?: number; coeff_2_3_ep_conso_5_usages_m2?: number; - ep_conso_5_usages_2026_m2?: number; + ep_conso_5_usages_2027_m2?: number; classe_bilan_dpe: string; + coeff_1_7_classe_bilan_dpe?: string; coeff_2_3_classe_bilan_dpe?: string; - classe_bilan_dpe_2026?: string; + classe_bilan_dpe_2027?: string; } interface Emission_ges { emission_ges_ch: number; From d62ebc4b4805eea80be61f6222b62e3d1e5f672f Mon Sep 17 00:00:00 2001 From: Michael Desigaud Date: Tue, 1 Sep 2026 15:09:49 +0200 Subject: [PATCH 2/2] feat: #issue-177 --- index.js | 4 +- src/engine.js | 13 ------ test/open3cl-coeff-1-9.spec.js | 74 ---------------------------------- 3 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 test/open3cl-coeff-1-9.spec.js diff --git a/index.js b/index.js index 31906776..c85515d1 100644 --- a/index.js +++ b/index.js @@ -2,9 +2,9 @@ import { calcul_3cl, calcul_3cl_xml, get_classe_ges_dpe, - get_conso_coeff_1_9_2026, + get_conso_coeff_1_7_2027, getVersion } from './src/index.js'; -export { calcul_3cl, calcul_3cl_xml, get_classe_ges_dpe, get_conso_coeff_1_9_2026, getVersion }; +export { calcul_3cl, calcul_3cl_xml, get_classe_ges_dpe, get_conso_coeff_1_7_2027, getVersion }; import { Umur, Uph, Upb, Uporte, Ubv, Upt, calc_deperdition } from './src/3_deperdition.js'; export { Umur, Uph, Upb, Uporte, Ubv, Upt, calc_deperdition }; diff --git a/src/engine.js b/src/engine.js index 9b6ed7ad..7404b97e 100644 --- a/src/engine.js +++ b/src/engine.js @@ -666,19 +666,6 @@ export function get_classe_ges_dpe(dpe) { }; } -/** - * Calcul de la nouvelle conso suite à la modification du coefficient pour le chauffage électrique - * Applicable uniquement à partir de janvier 2026 - * - * {@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.} - * - * @param dpe {FullDpe} - * @returns {{ep_conso_5_usages: number; ep_conso_5_usages_m2: number; classe_bilan_dpe: string}} - */ -export function get_conso_coeff_1_9_2026(dpe) { - return get_conso_with_coeff(dpe, 0.9 / 1.3); -} - /** * Calcul de la nouvelle conso suite à la modification du coefficient pour le chauffage électrique * Applicable uniquement à partir de janvier 2027 diff --git a/test/open3cl-coeff-1-9.spec.js b/test/open3cl-coeff-1-9.spec.js deleted file mode 100644 index df49ecf4..00000000 --- a/test/open3cl-coeff-1-9.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -import { describe, expect, test } from 'vitest'; -import { getAdemeFileJsonOrDownload } from './test-helpers.js'; -import { calcul_3cl } from '../src/index.js'; - -describe('Open3cl misc unit tests', () => { - test('should calculate primary conso with coeff 1.9 (since janvier 2026) for dpe: 2369E2791083C', async () => { - const inputDpe = await getAdemeFileJsonOrDownload('2369E2791083C'); - const outputDpe = calcul_3cl(structuredClone(inputDpe)); - expect(outputDpe.logement.sortie.ep_conso.coeff_2_3_classe_bilan_dpe).toBe('G'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('F'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2026).toBe('F'); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages_m2 - ); - }); - - test('should calculate primary conso with coeff 1.9 (since janvier 2026) for dpe: 2513E1166911W', async () => { - const inputDpe = await getAdemeFileJsonOrDownload('2513E1166911W'); - const outputDpe = calcul_3cl(structuredClone(inputDpe)); - expect(outputDpe.logement.sortie.ep_conso.coeff_2_3_classe_bilan_dpe).toBe('C'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('B'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2026).toBe('B'); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages_m2 - ); - }); - - test('should calculate primary conso with coeff 1.9 (since janvier 2026) for dpe: 2528E1249844E', async () => { - const inputDpe = await getAdemeFileJsonOrDownload('2528E1249844E'); - const outputDpe = calcul_3cl(structuredClone(inputDpe)); - expect(outputDpe.logement.sortie.ep_conso.coeff_2_3_classe_bilan_dpe).toBe('A'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe).toBe('A'); - expect(outputDpe.logement.sortie.ep_conso.classe_bilan_dpe_2026).toBe('A'); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages - ); - - expect(outputDpe.logement.sortie.ep_conso.ep_conso_5_usages_m2).toBeLessThan( - outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages_m2 - ); - }); - - test('should calculate primary conso with coeff 1.9 (since janvier 2026) for dpe: 2464E1799476F', async () => { - const inputDpe = await getAdemeFileJsonOrDownload('2464E1799476F'); - const outputDpe = calcul_3cl(structuredClone(inputDpe)); - expect(outputDpe.logement.sortie.ep_conso.coeff_2_3_ep_conso_5_usages).toBeCloseTo( - 44852.95, - 0.5 - ); - }); -});