@open3cl/engine 1.0.10 → 1.0.11
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/features/dpe/infrastructure/ecs/ecsTv.store.js +22 -0
- package/features/dpe/infrastructure/ecs/ecsTv.store.spec.js +33 -0
- package/features/dpe/infrastructure/{baieVitreeTv.store.js → enveloppe/baieVitreeTv.store.js} +5 -5
- package/features/dpe/infrastructure/{pontThermiqueTv.store.js → enveloppe/pontThermiqueTv.store.js} +3 -3
- package/features/dpe/infrastructure/froid/frTv.store.js +36 -0
- package/features/dpe/infrastructure/froid/frTv.store.spec.js +52 -0
- package/features/engine/domain/apport_et_besoin/apport-et-besoin.service.js +74 -0
- package/features/engine/domain/apport_et_besoin/apport-et-besoin.service.spec.js +85 -0
- package/features/engine/domain/apport_et_besoin/apport_gratuit/apport-gratuit.service.js +134 -0
- package/features/engine/domain/apport_et_besoin/apport_gratuit/apport-gratuit.service.spec.js +167 -0
- package/features/engine/domain/apport_et_besoin/ecs/besoin-ecs.service.js +58 -0
- package/features/engine/domain/apport_et_besoin/ecs/besoin-ecs.service.spec.js +67 -0
- package/features/engine/domain/apport_et_besoin/froid/besoin-froid.service.js +131 -0
- package/features/engine/domain/apport_et_besoin/froid/besoin-froid.service.spec.js +229 -0
- package/features/engine/domain/{logement → apport_et_besoin}/surface-sud-equivalente.service.js +9 -10
- package/features/engine/domain/{logement → apport_et_besoin}/surface-sud-equivalente.service.spec.js +63 -43
- package/features/engine/domain/contexte.builder.js +48 -5
- package/features/engine/domain/contexte.builder.spec.js +59 -3
- package/features/engine/domain/engine.service.js +10 -13
- package/features/engine/domain/enveloppe/baie_vitree/deperdition-baie-vitree.service.js +1 -1
- package/features/engine/domain/enveloppe/baie_vitree/deperdition-baie-vitree.service.spec.js +1 -1
- package/features/engine/domain/enveloppe/espace_tampon/espace-tampon.service.js +1 -1
- package/features/engine/domain/enveloppe/espace_tampon/espace-tampon.service.spec.js +1 -1
- package/features/engine/domain/enveloppe/pont_thermique/deperdition-pont-thermique.service.js +1 -1
- package/features/engine/domain/enveloppe/pont_thermique/deperdition-pont-thermique.service.spec.js +1 -1
- package/features/engine/domain/logement/nadeq.service.js +8 -7
- package/features/engine/domain/logement/nadeq.service.spec.js +6 -16
- package/features/engine/domain/models/contexte.model.ts +9 -0
- package/package.json +1 -1
- /package/features/dpe/infrastructure/{baieVitreeTv.store.spec.js → enveloppe/baieVitreeTv.store.spec.js} +0 -0
- /package/features/dpe/infrastructure/{pontThermiqueTv.store.spec.js → enveloppe/pontThermiqueTv.store.spec.js} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tvs as tv } from '../../../../tv-v2.js';
|
|
2
|
+
import { TvStore } from './../tv.store.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accès aux données des tables de valeurs pour le besoin en eau chaude sanitaire
|
|
6
|
+
*/
|
|
7
|
+
export class EcsTvStore extends TvStore {
|
|
8
|
+
/**
|
|
9
|
+
* Température moyenne d’eau froide sanitaire sur le mois j (°C).
|
|
10
|
+
* La température d’eau froide est une donnée climatique mensuelle pour chacune des 8 zones climatiques
|
|
11
|
+
* @see 11.1 Calcul du besoin d’ECS : Tefs
|
|
12
|
+
*
|
|
13
|
+
* @param classeAltitude {string}
|
|
14
|
+
* @param zoneClimatique {string}
|
|
15
|
+
* @param mois {string}
|
|
16
|
+
*
|
|
17
|
+
* @return {number|undefined}
|
|
18
|
+
*/
|
|
19
|
+
getTefs(classeAltitude, zoneClimatique, mois) {
|
|
20
|
+
return tv['tefs'][classeAltitude][mois][zoneClimatique];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
2
|
+
import { EcsTvStore } from './ecsTv.store.js';
|
|
3
|
+
|
|
4
|
+
/** @type {EcsTvStore} **/
|
|
5
|
+
let ecsTvStore;
|
|
6
|
+
|
|
7
|
+
describe('Lecture des tables de valeurs', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
ecsTvStore = new EcsTvStore();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('Lecture des valeurs de tefs', () => {
|
|
13
|
+
test.each([
|
|
14
|
+
{
|
|
15
|
+
label: 'température moyenne eau froide sanitaire en janvier sur zone h1a inférieure à 400m',
|
|
16
|
+
classeAltitude: 'inférieur à 400m',
|
|
17
|
+
zoneClimatique: 'h1a',
|
|
18
|
+
mois: 'Janvier',
|
|
19
|
+
expected: 7.8
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label:
|
|
23
|
+
'température moyenne eau froide sanitaire en Décembre sur zone h3 inférieure entre 400-800m',
|
|
24
|
+
classeAltitude: '400-800m',
|
|
25
|
+
zoneClimatique: 'h3',
|
|
26
|
+
mois: 'Décembre',
|
|
27
|
+
expected: 10.1
|
|
28
|
+
}
|
|
29
|
+
])(`$label`, ({ classeAltitude, zoneClimatique, mois, expected }) => {
|
|
30
|
+
expect(ecsTvStore.getTefs(classeAltitude, zoneClimatique, mois)).toBe(expected);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
package/features/dpe/infrastructure/{baieVitreeTv.store.js → enveloppe/baieVitreeTv.store.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { tvs as tv } from '
|
|
2
|
-
import { getRange } from '
|
|
3
|
-
import { logger } from '
|
|
4
|
-
import { TvStore } from '
|
|
5
|
-
import enums from '
|
|
1
|
+
import { tvs as tv } from '../../../../tv-v2.js';
|
|
2
|
+
import { getRange } from '../../../../utils.js';
|
|
3
|
+
import { logger } from '../../../../core/util/logger/log-service.js';
|
|
4
|
+
import { TvStore } from './../tv.store.js';
|
|
5
|
+
import enums from '../../../../enums.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Accès aux données des tables de valeurs pour les baies vitrées
|
package/features/dpe/infrastructure/{pontThermiqueTv.store.js → enveloppe/pontThermiqueTv.store.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { tvs as tv } from '
|
|
2
|
-
import { logger } from '
|
|
3
|
-
import { TvStore } from '
|
|
1
|
+
import { tvs as tv } from '../../../../tv-v2.js';
|
|
2
|
+
import { logger } from '../../../../core/util/logger/log-service.js';
|
|
3
|
+
import { TvStore } from './../tv.store.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Accès aux données des tables de valeurs pour les baies vitrées
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tvs as tv } from '../../../../tv-v2.js';
|
|
2
|
+
import { TvStore } from './../tv.store.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accès aux données des tables de valeurs pour le besoin en froid
|
|
6
|
+
*/
|
|
7
|
+
export class FrTvStore extends TvStore {
|
|
8
|
+
/**
|
|
9
|
+
* Recherche des valeurs nécessaires au calcul du besoin en froid
|
|
10
|
+
* @see 10.2 Calcul du besoin mensuel de froid
|
|
11
|
+
* — e : nombre d’heures de chauffage pour un mois donné et une consigne de refroidissement à 26°C (comportement dépensier).
|
|
12
|
+
* — nref26 : nombre d’heures de chauffage pour un mois donné et une consigne de refroidissement à 26°C (comportement dépensier).
|
|
13
|
+
* — nref28 : nombre d’heures de chauffage pour un mois donné et une consigne de refroidissement à 28°C (comportement conventionnel).
|
|
14
|
+
* — e_fr_26 : ensoleillement reçu en période de refroidissement pour un mois donné et une consigne de refroidissement à 26°C (comportement conventionnel).
|
|
15
|
+
* — e_fr_28 : ensoleillement reçu en période de refroidissement pour un mois donné et une consigne de refroidissement à 28°C (comportement conventionnel).
|
|
16
|
+
* — textmoy_clim_26 : Température extérieure moyenne pour un mois donné et une consigne de refroidissement à 26°C (comportement conventionnel).
|
|
17
|
+
* — textmoy_clim_28 : nombre d’heures de chauffage pour un mois donné et une consigne de refroidissement à 28°C (comportement conventionnel).
|
|
18
|
+
*
|
|
19
|
+
* @param type {'e', nref26' | 'nref28' | 'e_fr_26' | 'e_fr_28' | 'textmoy_clim_26' | 'textmoy_clim_28'}
|
|
20
|
+
* @param classeAltitude {string}
|
|
21
|
+
* @param zoneClimatique {string}
|
|
22
|
+
* @param mois {string}
|
|
23
|
+
* @param ilpa {number|undefined} 1 si bien à inertie lourde, 0 sinon
|
|
24
|
+
*
|
|
25
|
+
* @return {number|undefined}
|
|
26
|
+
*/
|
|
27
|
+
getData(type, classeAltitude, zoneClimatique, mois, ilpa = undefined) {
|
|
28
|
+
let values = tv[type];
|
|
29
|
+
|
|
30
|
+
if (ilpa !== undefined) {
|
|
31
|
+
values = values[ilpa];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return values[classeAltitude][mois][zoneClimatique];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
2
|
+
import { FrTvStore } from './frTv.store.js';
|
|
3
|
+
|
|
4
|
+
/** @type {FrTvStore} **/
|
|
5
|
+
let tvStore;
|
|
6
|
+
|
|
7
|
+
describe('Lecture des tables de valeurs', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
tvStore = new FrTvStore();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('lecture des valeurs par zone climatique et altitude', () => {
|
|
13
|
+
test.each([
|
|
14
|
+
{
|
|
15
|
+
type: 'e',
|
|
16
|
+
ilpa: 1,
|
|
17
|
+
expected: 60.45
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'e',
|
|
21
|
+
ilpa: 0,
|
|
22
|
+
expected: 84.66
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'nref26',
|
|
26
|
+
expected: 5.98
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'nref28',
|
|
30
|
+
expected: 1.14
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'e_fr_26',
|
|
34
|
+
expected: 5.98
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'e_fr_28',
|
|
38
|
+
expected: 1.14
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'textmoy_clim_26',
|
|
42
|
+
expected: 28.4
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'textmoy_clim_28',
|
|
46
|
+
expected: 28.4
|
|
47
|
+
}
|
|
48
|
+
])(`type: $type, ilpa: $ilpa`, ({ type, ilpa = undefined, expected }) => {
|
|
49
|
+
expect(tvStore.getData(type, '400-800m', 'h1a', 'Juin', ilpa)).toBe(expected);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { inject } from 'dioma';
|
|
2
|
+
import { BesoinEcsService } from './ecs/besoin-ecs.service.js';
|
|
3
|
+
import { SurfaceSudEquivalenteService } from './surface-sud-equivalente.service.js';
|
|
4
|
+
import { BesoinFroidService } from './froid/besoin-froid.service.js';
|
|
5
|
+
import { ApportGratuitService } from './apport_gratuit/apport-gratuit.service.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Calcul des déperditions de l’enveloppe GV
|
|
9
|
+
* @see Méthode de calcul 3CL-DPE 2021 (cotobre 2021) chapitre 3
|
|
10
|
+
*/
|
|
11
|
+
export class ApportEtBesoinService {
|
|
12
|
+
/**
|
|
13
|
+
* @type {SurfaceSudEquivalenteService}
|
|
14
|
+
*/
|
|
15
|
+
#surfaceSudEquivalenteService;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {BesoinEcsService}
|
|
19
|
+
*/
|
|
20
|
+
#besoinEcsService;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @type {BesoinFroidService}
|
|
24
|
+
*/
|
|
25
|
+
#besoinFroidService;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @type {ApportGratuitService}
|
|
29
|
+
*/
|
|
30
|
+
#apportGratuitService;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param besoinEcsService {BesoinEcsService}
|
|
34
|
+
* @param besoinFroidService {BesoinFroidService}
|
|
35
|
+
* @param surfaceSudEquivalenteService {SurfaceSudEquivalenteService}
|
|
36
|
+
* @param apportGratuitService {ApportGratuitService}
|
|
37
|
+
*/
|
|
38
|
+
constructor(
|
|
39
|
+
besoinEcsService = inject(BesoinEcsService),
|
|
40
|
+
besoinFroidService = inject(BesoinFroidService),
|
|
41
|
+
surfaceSudEquivalenteService = inject(SurfaceSudEquivalenteService),
|
|
42
|
+
apportGratuitService = inject(ApportGratuitService)
|
|
43
|
+
) {
|
|
44
|
+
this.#besoinEcsService = besoinEcsService;
|
|
45
|
+
this.#besoinFroidService = besoinFroidService;
|
|
46
|
+
this.#surfaceSudEquivalenteService = surfaceSudEquivalenteService;
|
|
47
|
+
this.#apportGratuitService = apportGratuitService;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Détermination des apports et besoins pour le bien concerné
|
|
52
|
+
*
|
|
53
|
+
* @param ctx {Contexte}
|
|
54
|
+
* @param logement {Logement}
|
|
55
|
+
* @return {ApportEtBesoin}
|
|
56
|
+
*/
|
|
57
|
+
execute(ctx, logement) {
|
|
58
|
+
return {
|
|
59
|
+
...this.#besoinEcsService.execute(ctx),
|
|
60
|
+
...{
|
|
61
|
+
surface_sud_equivalente: this.#surfaceSudEquivalenteService.execute(
|
|
62
|
+
ctx,
|
|
63
|
+
logement.enveloppe
|
|
64
|
+
),
|
|
65
|
+
nadeq: ctx.nadeq,
|
|
66
|
+
v40_ecs_journalier: ctx.nadeq * 56,
|
|
67
|
+
v40_ecs_journalier_depensier: ctx.nadeq * 79
|
|
68
|
+
},
|
|
69
|
+
...this.#besoinFroidService.execute(ctx, logement),
|
|
70
|
+
...this.#apportGratuitService.apportInterne(ctx, logement),
|
|
71
|
+
...this.#apportGratuitService.apportSolaire(ctx, logement)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
2
|
+
import { SurfaceSudEquivalenteService } from './surface-sud-equivalente.service.js';
|
|
3
|
+
import { BaieVitreeTvStore } from '../../../dpe/infrastructure/enveloppe/baieVitreeTv.store.js';
|
|
4
|
+
import { ApportEtBesoinService } from './apport-et-besoin.service.js';
|
|
5
|
+
import { BesoinEcsService } from './ecs/besoin-ecs.service.js';
|
|
6
|
+
import { BesoinFroidService } from './froid/besoin-froid.service.js';
|
|
7
|
+
import { ApportGratuitService } from './apport_gratuit/apport-gratuit.service.js';
|
|
8
|
+
|
|
9
|
+
/** @type {SurfaceSudEquivalenteService} **/
|
|
10
|
+
let surfaceSudEquivalenteService;
|
|
11
|
+
|
|
12
|
+
/** @type {BesoinEcsService} **/
|
|
13
|
+
let besoinEcsService;
|
|
14
|
+
|
|
15
|
+
/** @type {BesoinFroidService} **/
|
|
16
|
+
let besoinFroidService;
|
|
17
|
+
|
|
18
|
+
/** @type {ApportGratuitService} **/
|
|
19
|
+
let apportGratuitService;
|
|
20
|
+
|
|
21
|
+
/** @type {ApportEtBesoinService} **/
|
|
22
|
+
let service;
|
|
23
|
+
|
|
24
|
+
/** @type {BaieVitreeTvStore} **/
|
|
25
|
+
let tvStore;
|
|
26
|
+
|
|
27
|
+
describe('Calcul des apports et besoin du logement', () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
tvStore = new BaieVitreeTvStore();
|
|
30
|
+
surfaceSudEquivalenteService = new SurfaceSudEquivalenteService(tvStore);
|
|
31
|
+
besoinEcsService = new BesoinEcsService();
|
|
32
|
+
besoinFroidService = new BesoinFroidService();
|
|
33
|
+
apportGratuitService = new ApportGratuitService();
|
|
34
|
+
service = new ApportEtBesoinService(
|
|
35
|
+
besoinEcsService,
|
|
36
|
+
besoinFroidService,
|
|
37
|
+
surfaceSudEquivalenteService,
|
|
38
|
+
apportGratuitService
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('Determination des apports et besoin du logement', () => {
|
|
43
|
+
vi.spyOn(surfaceSudEquivalenteService, 'execute').mockReturnValue(18.5);
|
|
44
|
+
vi.spyOn(besoinEcsService, 'execute').mockReturnValue({
|
|
45
|
+
besoin_ecs: 1526,
|
|
46
|
+
besoin_ecs_depensier: 2685.3
|
|
47
|
+
});
|
|
48
|
+
vi.spyOn(besoinFroidService, 'execute').mockReturnValue({
|
|
49
|
+
besoin_fr: 896,
|
|
50
|
+
besoin_fr_depensier: 1025.3
|
|
51
|
+
});
|
|
52
|
+
vi.spyOn(apportGratuitService, 'apportSolaire').mockReturnValue({
|
|
53
|
+
apport_solaire_ch: 5236.9,
|
|
54
|
+
apport_solaire_fr: 145.2
|
|
55
|
+
});
|
|
56
|
+
vi.spyOn(apportGratuitService, 'apportInterne').mockReturnValue({
|
|
57
|
+
apport_interne_ch: 1236.9,
|
|
58
|
+
apport_interne_fr: 3345.2
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/** @type {Contexte} */
|
|
62
|
+
const ctx = { zoneClimatique: { id: 1 }, nadeq: 2.5 };
|
|
63
|
+
/** @type { Logement } **/
|
|
64
|
+
const logement = { enveloppe: {} };
|
|
65
|
+
expect(service.execute(ctx, logement)).toStrictEqual({
|
|
66
|
+
surface_sud_equivalente: 18.5,
|
|
67
|
+
besoin_ecs: 1526,
|
|
68
|
+
besoin_ecs_depensier: 2685.3,
|
|
69
|
+
besoin_fr: 896,
|
|
70
|
+
besoin_fr_depensier: 1025.3,
|
|
71
|
+
apport_solaire_ch: 5236.9,
|
|
72
|
+
apport_solaire_fr: 145.2,
|
|
73
|
+
apport_interne_ch: 1236.9,
|
|
74
|
+
apport_interne_fr: 3345.2,
|
|
75
|
+
nadeq: 2.5,
|
|
76
|
+
v40_ecs_journalier: 140,
|
|
77
|
+
v40_ecs_journalier_depensier: 197.5
|
|
78
|
+
});
|
|
79
|
+
expect(surfaceSudEquivalenteService.execute).toHaveBeenCalledWith(ctx, logement.enveloppe);
|
|
80
|
+
expect(besoinEcsService.execute).toHaveBeenCalledWith(ctx);
|
|
81
|
+
expect(besoinFroidService.execute).toHaveBeenCalledWith(ctx, logement);
|
|
82
|
+
expect(apportGratuitService.apportSolaire).toHaveBeenCalledWith(ctx, logement);
|
|
83
|
+
expect(apportGratuitService.apportInterne).toHaveBeenCalledWith(ctx, logement);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { inject } from 'dioma';
|
|
2
|
+
import { SurfaceSudEquivalenteService } from '../surface-sud-equivalente.service.js';
|
|
3
|
+
import { mois_liste } from '../../../../../utils.js';
|
|
4
|
+
import { FrTvStore } from '../../../../dpe/infrastructure/froid/frTv.store.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Calcul des apports gratuits
|
|
8
|
+
* Chapitre 6 Détermination des apports gratuits
|
|
9
|
+
*
|
|
10
|
+
* Methode_de_calcul_3CL_DPE_2021 - Page 42
|
|
11
|
+
* Octobre 2021
|
|
12
|
+
* @see consolide_anne…arrete_du_31_03_2021_relatif_aux_methodes_et_procedures_applicables.pdf
|
|
13
|
+
*/
|
|
14
|
+
export class ApportGratuitService {
|
|
15
|
+
/**
|
|
16
|
+
* @type {FrTvStore}
|
|
17
|
+
*/
|
|
18
|
+
#frTvStore;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {SurfaceSudEquivalenteService}
|
|
22
|
+
*/
|
|
23
|
+
#surfaceSudEquivalenteService;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param frTvStore {FrTvStore}
|
|
27
|
+
* @param surfaceSudEquivalenteService {SurfaceSudEquivalenteService}
|
|
28
|
+
*/
|
|
29
|
+
constructor(
|
|
30
|
+
frTvStore = inject(FrTvStore),
|
|
31
|
+
surfaceSudEquivalenteService = inject(SurfaceSudEquivalenteService)
|
|
32
|
+
) {
|
|
33
|
+
this.#frTvStore = frTvStore;
|
|
34
|
+
this.#surfaceSudEquivalenteService = surfaceSudEquivalenteService;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Apports solaires gratuits du logement
|
|
39
|
+
*
|
|
40
|
+
* @param ctx {Contexte}
|
|
41
|
+
* @param logement {Logement}
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
apportSolaire(ctx, logement) {
|
|
45
|
+
const clim = logement.climatisation_collection?.climatisation || [];
|
|
46
|
+
|
|
47
|
+
return mois_liste.reduce(
|
|
48
|
+
(acc, mois) => {
|
|
49
|
+
acc.apport_solaire_ch += this.apportSolaireMois(
|
|
50
|
+
ctx,
|
|
51
|
+
logement.enveloppe,
|
|
52
|
+
mois,
|
|
53
|
+
this.#frTvStore.getData(
|
|
54
|
+
'e',
|
|
55
|
+
ctx.altitude.value,
|
|
56
|
+
ctx.zoneClimatique.value,
|
|
57
|
+
mois,
|
|
58
|
+
ctx.inertie.ilpa
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
if (clim.length > 0) {
|
|
62
|
+
acc.apport_solaire_fr += this.apportSolaireMois(
|
|
63
|
+
ctx,
|
|
64
|
+
logement.enveloppe,
|
|
65
|
+
mois,
|
|
66
|
+
this.#frTvStore.getData('e_fr_28', ctx.altitude.value, ctx.zoneClimatique.value, mois)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return acc;
|
|
70
|
+
},
|
|
71
|
+
{ apport_solaire_ch: 0, apport_solaire_fr: 0 }
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Apports internes gratuits du logement
|
|
77
|
+
*
|
|
78
|
+
* @param ctx {Contexte}
|
|
79
|
+
* @param logement {Logement}
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
apportInterne(ctx, logement) {
|
|
83
|
+
const clim = logement.climatisation_collection?.climatisation || [];
|
|
84
|
+
|
|
85
|
+
return mois_liste.reduce(
|
|
86
|
+
(acc, mois) => {
|
|
87
|
+
acc.apport_interne_ch += this.apportInterneMois(
|
|
88
|
+
ctx,
|
|
89
|
+
this.#frTvStore.getData(
|
|
90
|
+
'nref19',
|
|
91
|
+
ctx.altitude.value,
|
|
92
|
+
ctx.zoneClimatique.value,
|
|
93
|
+
mois,
|
|
94
|
+
ctx.inertie.ilpa
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
if (clim.length > 0) {
|
|
98
|
+
acc.apport_interne_fr += this.apportInterneMois(
|
|
99
|
+
ctx,
|
|
100
|
+
this.#frTvStore.getData('nref28', ctx.altitude.value, ctx.zoneClimatique.value, mois)
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return acc;
|
|
104
|
+
},
|
|
105
|
+
{ apport_interne_ch: 0, apport_interne_fr: 0 }
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Apports solaires pour un mois donné
|
|
111
|
+
*
|
|
112
|
+
* @param ctx {Contexte}
|
|
113
|
+
* @param enveloppe {Enveloppe}
|
|
114
|
+
* @param mois {string}
|
|
115
|
+
* @param e {number} ensoleillement reçu, pour le mois, par une paroi verticale orientée au sud en absence d'ombrage (kWh/m²)
|
|
116
|
+
* @returns {number}
|
|
117
|
+
*/
|
|
118
|
+
apportSolaireMois(ctx, enveloppe, mois, e) {
|
|
119
|
+
return 1000 * this.#surfaceSudEquivalenteService.ssdMois(ctx, enveloppe, mois) * e;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Apports internes dans le logement pour un mois donné
|
|
124
|
+
* Les apports internes de chaleur dus aux équipements prennent en compte l’ensemble des équipements
|
|
125
|
+
* « mobiliers » (cuisson, audiovisuel, informatique, lavage, froid, appareils ménagers)
|
|
126
|
+
*
|
|
127
|
+
* @param ctx {Contexte}
|
|
128
|
+
* @param nref {number} nombre d’heures de chauffage pour le mois
|
|
129
|
+
* @returns {number}
|
|
130
|
+
*/
|
|
131
|
+
apportInterneMois(ctx, nref) {
|
|
132
|
+
return ((3.18 + 0.34) * ctx.surfaceHabitable + 90 * (132 / 168) * ctx.nadeq) * nref;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
2
|
+
import { SurfaceSudEquivalenteService } from './../surface-sud-equivalente.service.js';
|
|
3
|
+
import { ApportGratuitService } from './apport-gratuit.service.js';
|
|
4
|
+
import { FrTvStore } from '../../../../dpe/infrastructure/froid/frTv.store.js';
|
|
5
|
+
import { mois_liste } from '../../../../../utils.js';
|
|
6
|
+
|
|
7
|
+
/** @type {FrTvStore} **/
|
|
8
|
+
let frTvStore;
|
|
9
|
+
|
|
10
|
+
/** @type {SurfaceSudEquivalenteService} **/
|
|
11
|
+
let surfaceSudEquivalenteService;
|
|
12
|
+
|
|
13
|
+
/** @type {ApportGratuitService} **/
|
|
14
|
+
let service;
|
|
15
|
+
|
|
16
|
+
describe('Calcul des apports gratuits au logement', () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
frTvStore = new FrTvStore();
|
|
19
|
+
surfaceSudEquivalenteService = new SurfaceSudEquivalenteService();
|
|
20
|
+
service = new ApportGratuitService(frTvStore, surfaceSudEquivalenteService);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test.each([
|
|
24
|
+
{
|
|
25
|
+
label: 'avec climatisation',
|
|
26
|
+
withClimatisation: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'sans climatisation',
|
|
30
|
+
withClimatisation: false
|
|
31
|
+
}
|
|
32
|
+
])('Determination des apports gratuits pour un logement $label', ({ withClimatisation }) => {
|
|
33
|
+
vi.spyOn(surfaceSudEquivalenteService, 'ssdMois').mockReturnValue(18.5);
|
|
34
|
+
vi.spyOn(frTvStore, 'getData').mockReturnValue(10);
|
|
35
|
+
|
|
36
|
+
/** @type {Contexte} */
|
|
37
|
+
const ctx = {
|
|
38
|
+
zoneClimatique: { value: 'h1a' },
|
|
39
|
+
altitude: { value: '400-800m' },
|
|
40
|
+
inertie: { ilpa: 1 }
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @type { Logement } **/
|
|
44
|
+
const logement = { enveloppe: { porte_collection: {} } };
|
|
45
|
+
|
|
46
|
+
if (withClimatisation) {
|
|
47
|
+
logement.climatisation_collection = { climatisation: [{}] };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
expect(service.apportSolaire(ctx, logement)).toStrictEqual({
|
|
51
|
+
apport_solaire_ch: 2220000,
|
|
52
|
+
apport_solaire_fr: withClimatisation ? 2220000 : 0
|
|
53
|
+
});
|
|
54
|
+
expect(surfaceSudEquivalenteService.ssdMois).toHaveBeenCalledWith(
|
|
55
|
+
ctx,
|
|
56
|
+
logement.enveloppe,
|
|
57
|
+
'Janvier'
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
for (const mois of mois_liste) {
|
|
61
|
+
expect(frTvStore.getData).toHaveBeenCalledWith(
|
|
62
|
+
'e',
|
|
63
|
+
ctx.altitude.value,
|
|
64
|
+
ctx.zoneClimatique.value,
|
|
65
|
+
mois,
|
|
66
|
+
ctx.inertie.ilpa
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
if (withClimatisation) {
|
|
70
|
+
expect(frTvStore.getData).toHaveBeenCalledWith(
|
|
71
|
+
'e_fr_28',
|
|
72
|
+
ctx.altitude.value,
|
|
73
|
+
ctx.zoneClimatique.value,
|
|
74
|
+
mois
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
expect(frTvStore.getData).not.toHaveBeenCalledWith(
|
|
78
|
+
'e_fr_28',
|
|
79
|
+
ctx.altitude.value,
|
|
80
|
+
ctx.zoneClimatique.value,
|
|
81
|
+
mois
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test.each([
|
|
88
|
+
{
|
|
89
|
+
label: 'avec climatisation',
|
|
90
|
+
withClimatisation: true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: 'sans climatisation',
|
|
94
|
+
withClimatisation: false
|
|
95
|
+
}
|
|
96
|
+
])('Determination des apports internes pour un logement $label', ({ withClimatisation }) => {
|
|
97
|
+
vi.spyOn(frTvStore, 'getData').mockReturnValue(10);
|
|
98
|
+
|
|
99
|
+
/** @type {Contexte} */
|
|
100
|
+
const ctx = {
|
|
101
|
+
zoneClimatique: { value: 'h1a' },
|
|
102
|
+
altitude: { value: '400-800m' },
|
|
103
|
+
inertie: { ilpa: 1 },
|
|
104
|
+
surfaceHabitable: 12,
|
|
105
|
+
nadeq: 1.25
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** @type { Logement } **/
|
|
109
|
+
const logement = { enveloppe: { porte_collection: {} } };
|
|
110
|
+
|
|
111
|
+
if (withClimatisation) {
|
|
112
|
+
logement.climatisation_collection = { climatisation: [{}] };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
expect(service.apportInterne(ctx, logement)).toStrictEqual({
|
|
116
|
+
apport_interne_ch: 15675.94285714286,
|
|
117
|
+
apport_interne_fr: withClimatisation ? 15675.94285714286 : 0
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
for (const mois of mois_liste) {
|
|
121
|
+
expect(frTvStore.getData).toHaveBeenCalledWith(
|
|
122
|
+
'nref19',
|
|
123
|
+
ctx.altitude.value,
|
|
124
|
+
ctx.zoneClimatique.value,
|
|
125
|
+
mois,
|
|
126
|
+
ctx.inertie.ilpa
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
if (withClimatisation) {
|
|
130
|
+
expect(frTvStore.getData).toHaveBeenCalledWith(
|
|
131
|
+
'nref28',
|
|
132
|
+
ctx.altitude.value,
|
|
133
|
+
ctx.zoneClimatique.value,
|
|
134
|
+
mois
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
expect(frTvStore.getData).not.toHaveBeenCalledWith(
|
|
138
|
+
'nref28',
|
|
139
|
+
ctx.altitude.value,
|
|
140
|
+
ctx.zoneClimatique.value,
|
|
141
|
+
mois
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('Determination des apports solaires pour un mois donné', () => {
|
|
148
|
+
vi.spyOn(surfaceSudEquivalenteService, 'ssdMois').mockReturnValue(18.5);
|
|
149
|
+
|
|
150
|
+
/** @type {Contexte} */
|
|
151
|
+
const ctx = { zoneClimatique: { id: 1 } };
|
|
152
|
+
|
|
153
|
+
/** @type { Enveloppe } **/
|
|
154
|
+
const enveloppe = {
|
|
155
|
+
porte_collection: {}
|
|
156
|
+
};
|
|
157
|
+
expect(service.apportSolaireMois(ctx, enveloppe, 'Janvier', 18)).toBe(333000);
|
|
158
|
+
expect(surfaceSudEquivalenteService.ssdMois).toHaveBeenCalledWith(ctx, enveloppe, 'Janvier');
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('Determination des apports internes dans le logement pour un mois donné', () => {
|
|
162
|
+
/** @type {Contexte} */
|
|
163
|
+
const ctx = { surfaceHabitable: 88, nadeq: 2 };
|
|
164
|
+
|
|
165
|
+
expect(service.apportInterneMois(ctx, 18)).toBeCloseTo(8121.39, 2);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { mois_liste, Njj } from '../../../../../utils.js';
|
|
2
|
+
import { EcsTvStore } from '../../../../dpe/infrastructure/ecs/ecsTv.store.js';
|
|
3
|
+
import { inject } from 'dioma';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Calcul du besoin en eau chaude sanitaire
|
|
7
|
+
* Chapitre 11.1 Calcul du besoin d’ECS
|
|
8
|
+
*
|
|
9
|
+
* Methode_de_calcul_3CL_DPE_2021 - Page 70
|
|
10
|
+
* Octobre 2021
|
|
11
|
+
* @see consolide_anne…arrete_du_31_03_2021_relatif_aux_methodes_et_procedures_applicables.pdf
|
|
12
|
+
*/
|
|
13
|
+
export class BesoinEcsService {
|
|
14
|
+
/**
|
|
15
|
+
* @type {EcsTvStore}
|
|
16
|
+
*/
|
|
17
|
+
#tvStore;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param tvStore {EcsTvStore}
|
|
21
|
+
*/
|
|
22
|
+
constructor(tvStore = inject(EcsTvStore)) {
|
|
23
|
+
this.#tvStore = tvStore;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param ctx {Contexte}
|
|
28
|
+
* @return {{besoin_ecs: number, besoin_ecs_depensier: number}}
|
|
29
|
+
*/
|
|
30
|
+
execute(ctx) {
|
|
31
|
+
return mois_liste.reduce(
|
|
32
|
+
(acc, mois) => {
|
|
33
|
+
acc.besoin_ecs += this.besoinEcsMois(ctx, mois, false);
|
|
34
|
+
acc.besoin_ecs_depensier += this.besoinEcsMois(ctx, mois, true);
|
|
35
|
+
return acc;
|
|
36
|
+
},
|
|
37
|
+
{ besoin_ecs: 0, besoin_ecs_depensier: 0 }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Calcul du besoin ecs pour un mois donné
|
|
43
|
+
*
|
|
44
|
+
* @param ctx {Contexte}
|
|
45
|
+
* @param mois {string}
|
|
46
|
+
* @param depensier {boolean}
|
|
47
|
+
* @returns {number}
|
|
48
|
+
*/
|
|
49
|
+
besoinEcsMois(ctx, mois, depensier) {
|
|
50
|
+
const tefs = this.#tvStore.getTefs(ctx.altitude.value, ctx.zoneClimatique.value, mois);
|
|
51
|
+
|
|
52
|
+
if (depensier) {
|
|
53
|
+
return (1.163 * ctx.nadeq * 79 * (40 - tefs) * Njj[mois]) / 1000;
|
|
54
|
+
} else {
|
|
55
|
+
return (1.163 * ctx.nadeq * 56 * (40 - tefs) * Njj[mois]) / 1000;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|