@open3cl/engine 1.0.10 → 1.0.12
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/domain/models/installation-ecs.model.ts +15 -2
- package/features/dpe/domain/models/type-habitation.model.js +1 -0
- package/features/dpe/domain/models/type-stockage.model.js +8 -0
- package/features/dpe/infrastructure/ecs/ecsTv.store.js +65 -0
- package/features/dpe/infrastructure/ecs/ecsTv.store.spec.js +69 -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 +100 -0
- package/features/engine/domain/apport_et_besoin/apport-et-besoin.service.spec.js +106 -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/ecs/perte-ecs-recup.service.js +123 -0
- package/features/engine/domain/apport_et_besoin/ecs/perte-ecs-recup.service.spec.js +205 -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 +53 -6
- package/features/engine/domain/contexte.builder.spec.js +59 -3
- package/features/engine/domain/ecs/generateur-ecs.service.js +106 -0
- package/features/engine/domain/ecs/generateur-ecs.service.spec.js +136 -0
- package/features/engine/domain/ecs/installation-ecs.service.js +156 -0
- package/features/engine/domain/ecs/installation-ecs.service.spec.js +284 -0
- 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,284 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
2
|
+
import { GenerateurEcsService } from './generateur-ecs.service.js';
|
|
3
|
+
import { InstallationEcsService } from './installation-ecs.service.js';
|
|
4
|
+
import corpus from '../../../../../test/corpus-sano.json';
|
|
5
|
+
import { expect_or, getAdemeFileJson } from '../../../../../test/test-helpers.js';
|
|
6
|
+
import { DpeNormalizerService } from '../../../normalizer/domain/dpe-normalizer.service.js';
|
|
7
|
+
import { ContexteBuilder } from '../contexte.builder.js';
|
|
8
|
+
|
|
9
|
+
/** @type {InstallationEcsService} **/
|
|
10
|
+
let service;
|
|
11
|
+
|
|
12
|
+
/** @type {GenerateurEcsService} **/
|
|
13
|
+
let generateurEcsService;
|
|
14
|
+
|
|
15
|
+
/** @type {DpeNormalizerService} **/
|
|
16
|
+
let normalizerService;
|
|
17
|
+
|
|
18
|
+
/** @type {ContexteBuilder} **/
|
|
19
|
+
let contexteBuilder;
|
|
20
|
+
|
|
21
|
+
describe('Calcul des besoins et des pertes des installations ECS', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
generateurEcsService = new GenerateurEcsService();
|
|
24
|
+
service = new InstallationEcsService(generateurEcsService);
|
|
25
|
+
normalizerService = new DpeNormalizerService();
|
|
26
|
+
contexteBuilder = new ContexteBuilder();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test.each([
|
|
30
|
+
{
|
|
31
|
+
label: "Installation ECS sans surface habitable pour l'installation",
|
|
32
|
+
surfaceHabitableLogement: 40,
|
|
33
|
+
besoin_ecs: 850,
|
|
34
|
+
besoin_ecs_depensier: 1050,
|
|
35
|
+
expected: { besoinEcsDepensierInstallation: 1050, besoinEcsInstallation: 850 }
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Installation ECS avec surface habitable pour l'installation",
|
|
39
|
+
surfaceHabitableLogement: 40,
|
|
40
|
+
surfaceHabitableInstallation: 50,
|
|
41
|
+
besoin_ecs: 850,
|
|
42
|
+
besoin_ecs_depensier: 1050,
|
|
43
|
+
expected: { besoinEcsDepensierInstallation: 1312.5, besoinEcsInstallation: 1062.5 }
|
|
44
|
+
}
|
|
45
|
+
])(
|
|
46
|
+
'Calcul des besoins proratisés pour $label',
|
|
47
|
+
({
|
|
48
|
+
surfaceHabitableLogement,
|
|
49
|
+
surfaceHabitableInstallation = undefined,
|
|
50
|
+
besoin_ecs,
|
|
51
|
+
besoin_ecs_depensier,
|
|
52
|
+
expected
|
|
53
|
+
}) => {
|
|
54
|
+
/** @type {Contexte} */
|
|
55
|
+
const ctx = { surfaceHabitable: surfaceHabitableLogement };
|
|
56
|
+
|
|
57
|
+
/** @type {{besoin_ecs: number, besoin_ecs_depensier: number}} */
|
|
58
|
+
const besoinEcs = { besoin_ecs, besoin_ecs_depensier };
|
|
59
|
+
|
|
60
|
+
/** @type {InstallationEcs} */
|
|
61
|
+
const installationEcs = {
|
|
62
|
+
donnee_entree: { surface_habitable: surfaceHabitableInstallation }
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const besoinEcsInstallation = service.besoinEcsInstallation(ctx, installationEcs, besoinEcs);
|
|
66
|
+
|
|
67
|
+
expect(besoinEcsInstallation).toStrictEqual(expected);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
test.each([
|
|
72
|
+
{
|
|
73
|
+
label: 'Installation individuelle avec générateur hors volume chauffé',
|
|
74
|
+
enumTypeInstallationId: 1,
|
|
75
|
+
positionVolumeChauffeStockage1: 0,
|
|
76
|
+
positionVolumeChauffeStockage2: 0,
|
|
77
|
+
positionVolumeChauffeStockage3: 0,
|
|
78
|
+
expected: {
|
|
79
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
80
|
+
QdwColVc: { conventionnel: 0, depensier: 0 },
|
|
81
|
+
QdwColHVc: { conventionnel: 0, depensier: 0 },
|
|
82
|
+
QgwRecuperable: 0
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: 'Installation individuelle avec générateur hors volume chauffé',
|
|
87
|
+
enumTypeInstallationId: 1,
|
|
88
|
+
positionVolumeChauffeStockage2: 0,
|
|
89
|
+
positionVolumeChauffe2: 0,
|
|
90
|
+
positionVolumeChauffeStockage3: 0,
|
|
91
|
+
expected: {
|
|
92
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
93
|
+
QdwColVc: { conventionnel: 0, depensier: 0 },
|
|
94
|
+
QdwColHVc: { conventionnel: 0, depensier: 0 },
|
|
95
|
+
QgwRecuperable: 0
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: 'Installation individuelle avec 1 générateur en volume chauffé',
|
|
100
|
+
enumTypeInstallationId: 1,
|
|
101
|
+
positionVolumeChauffeStockage1: 0,
|
|
102
|
+
positionVolumeChauffeStockage2: 1,
|
|
103
|
+
positionVolumeChauffeStockage3: 0,
|
|
104
|
+
expected: {
|
|
105
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
106
|
+
QdwColVc: { conventionnel: 0, depensier: 0 },
|
|
107
|
+
QdwColHVc: { conventionnel: 0, depensier: 0 },
|
|
108
|
+
QgwRecuperable: 120
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: 'Installation individuelle avec 1 générateur en volume chauffé',
|
|
113
|
+
enumTypeInstallationId: 1,
|
|
114
|
+
positionVolumeChauffeStockage1: 0,
|
|
115
|
+
positionVolumeChauffe2: 1,
|
|
116
|
+
positionVolumeChauffeStockage3: 0,
|
|
117
|
+
expected: {
|
|
118
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
119
|
+
QdwColVc: { conventionnel: 0, depensier: 0 },
|
|
120
|
+
QdwColHVc: { conventionnel: 0, depensier: 0 },
|
|
121
|
+
QgwRecuperable: 120
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: 'Installation individuelle avec 2 générateurs en volume chauffé',
|
|
126
|
+
enumTypeInstallationId: 1,
|
|
127
|
+
positionVolumeChauffeStockage1: 0,
|
|
128
|
+
positionVolumeChauffeStockage2: 1,
|
|
129
|
+
positionVolumeChauffeStockage3: 1,
|
|
130
|
+
expected: {
|
|
131
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
132
|
+
QdwColVc: { conventionnel: 0, depensier: 0 },
|
|
133
|
+
QdwColHVc: { conventionnel: 0, depensier: 0 },
|
|
134
|
+
QgwRecuperable: 260
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: 'Installation collective avec générateur hors volume chauffé',
|
|
139
|
+
enumTypeInstallationId: 2,
|
|
140
|
+
positionVolumeChauffeStockage1: 0,
|
|
141
|
+
positionVolumeChauffeStockage2: 0,
|
|
142
|
+
positionVolumeChauffeStockage3: 0,
|
|
143
|
+
expected: {
|
|
144
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
145
|
+
QdwColVc: { conventionnel: 16.8, depensier: 30.24 },
|
|
146
|
+
QdwColHVc: { conventionnel: 4.2, depensier: 7.56 },
|
|
147
|
+
QgwRecuperable: 0
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: 'Installation collective avec 1 générateur en volume chauffé',
|
|
152
|
+
enumTypeInstallationId: 2,
|
|
153
|
+
positionVolumeChauffeStockage1: 0,
|
|
154
|
+
positionVolumeChauffeStockage2: 0,
|
|
155
|
+
positionVolumeChauffeStockage3: 1,
|
|
156
|
+
expected: {
|
|
157
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
158
|
+
QdwColVc: { conventionnel: 16.8, depensier: 30.24 },
|
|
159
|
+
QdwColHVc: { conventionnel: 4.2, depensier: 7.56 },
|
|
160
|
+
QgwRecuperable: 0
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'Installation collective avec 2 générateurs en volume chauffé',
|
|
165
|
+
enumTypeInstallationId: 2,
|
|
166
|
+
positionVolumeChauffeStockage1: 1,
|
|
167
|
+
positionVolumeChauffeStockage2: 1,
|
|
168
|
+
positionVolumeChauffeStockage3: 0,
|
|
169
|
+
expected: {
|
|
170
|
+
QdwIndVc: { conventionnel: 15, depensier: 27 },
|
|
171
|
+
QdwColVc: { conventionnel: 16.8, depensier: 30.24 },
|
|
172
|
+
QdwColHVc: { conventionnel: 4.2, depensier: 7.56 },
|
|
173
|
+
QgwRecuperable: 0
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
])(
|
|
177
|
+
'Calcul des pertes de distribution et de stockage $label',
|
|
178
|
+
({
|
|
179
|
+
enumTypeInstallationId,
|
|
180
|
+
positionVolumeChauffeStockage1,
|
|
181
|
+
positionVolumeChauffeStockage2,
|
|
182
|
+
positionVolumeChauffe2 = undefined,
|
|
183
|
+
positionVolumeChauffeStockage3,
|
|
184
|
+
expected
|
|
185
|
+
}) => {
|
|
186
|
+
/** @type {InstallationEcs} */
|
|
187
|
+
const installationEcs = {
|
|
188
|
+
donnee_entree: { enum_type_installation_id: enumTypeInstallationId },
|
|
189
|
+
generateur_ecs_collection: {
|
|
190
|
+
generateur_ecs: [
|
|
191
|
+
{
|
|
192
|
+
donnee_entree: { position_volume_chauffe_stockage: positionVolumeChauffeStockage1 },
|
|
193
|
+
donnee_utilisateur: { Qgw: 100 }
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
donnee_entree: {
|
|
197
|
+
position_volume_chauffe_stockage: positionVolumeChauffeStockage2,
|
|
198
|
+
position_volume_chauffe: positionVolumeChauffe2
|
|
199
|
+
},
|
|
200
|
+
donnee_utilisateur: { Qgw: 120 }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
donnee_entree: { position_volume_chauffe_stockage: positionVolumeChauffeStockage3 },
|
|
204
|
+
donnee_utilisateur: { Qgw: 140 }
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
service.pertesDistributionStockageEcsInstallation(installationEcs, 150, 270);
|
|
211
|
+
|
|
212
|
+
expect(installationEcs.donnee_utilisateur.QdwIndVc.conventionnel).toBeCloseTo(
|
|
213
|
+
expected.QdwIndVc.conventionnel,
|
|
214
|
+
5
|
|
215
|
+
);
|
|
216
|
+
expect(installationEcs.donnee_utilisateur.QdwIndVc.depensier).toBeCloseTo(
|
|
217
|
+
expected.QdwIndVc.depensier,
|
|
218
|
+
5
|
|
219
|
+
);
|
|
220
|
+
expect(installationEcs.donnee_utilisateur.QdwColVc.conventionnel).toBeCloseTo(
|
|
221
|
+
expected.QdwColVc.conventionnel,
|
|
222
|
+
5
|
|
223
|
+
);
|
|
224
|
+
expect(installationEcs.donnee_utilisateur.QdwColVc.depensier).toBeCloseTo(
|
|
225
|
+
expected.QdwColVc.depensier,
|
|
226
|
+
5
|
|
227
|
+
);
|
|
228
|
+
expect(installationEcs.donnee_utilisateur.QdwColHVc.conventionnel).toBeCloseTo(
|
|
229
|
+
expected.QdwColHVc.conventionnel,
|
|
230
|
+
5
|
|
231
|
+
);
|
|
232
|
+
expect(installationEcs.donnee_utilisateur.QdwColHVc.depensier).toBeCloseTo(
|
|
233
|
+
expected.QdwColHVc.depensier,
|
|
234
|
+
5
|
|
235
|
+
);
|
|
236
|
+
expect(installationEcs.donnee_utilisateur.QgwRecuperable).toBeCloseTo(
|
|
237
|
+
expected.QgwRecuperable,
|
|
238
|
+
5
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
test("Determination du caractère individuelle de l'installation", () => {
|
|
244
|
+
expect(service.isInstallationIndividuelle({ enum_type_installation_id: 1 })).toBeTruthy();
|
|
245
|
+
expect(service.isInstallationIndividuelle({ enum_type_installation_id: 2 })).toBeFalsy();
|
|
246
|
+
expect(service.isInstallationIndividuelle({ enum_type_installation_id: 3 })).toBeFalsy();
|
|
247
|
+
expect(service.isInstallationIndividuelle({ enum_type_installation_id: 4 })).toBeFalsy();
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
describe("Test d'intégration des installations ECS", () => {
|
|
251
|
+
test.each(corpus)('vérification des DI des installations ECS pour dpe %s', (ademeId) => {
|
|
252
|
+
let dpeRequest = getAdemeFileJson(ademeId);
|
|
253
|
+
dpeRequest = normalizerService.normalize(dpeRequest);
|
|
254
|
+
|
|
255
|
+
/** @type {Contexte} */
|
|
256
|
+
const ctx = contexteBuilder.fromDpe(dpeRequest);
|
|
257
|
+
|
|
258
|
+
const installationsECS = structuredClone(
|
|
259
|
+
dpeRequest.logement.installation_ecs_collection?.installation_ecs || []
|
|
260
|
+
);
|
|
261
|
+
service.execute(ctx, dpeRequest.logement, {
|
|
262
|
+
besoin_ecs: dpeRequest.logement.sortie.apport_et_besoin.besoin_ecs,
|
|
263
|
+
besoin_ecs_depensier: dpeRequest.logement.sortie.apport_et_besoin.besoin_ecs_depensier
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
installationsECS.forEach((installationECS, i) => {
|
|
267
|
+
expect_or(
|
|
268
|
+
() =>
|
|
269
|
+
expect(installationECS.donnee_intermediaire.besoin_ecs).toBeCloseTo(
|
|
270
|
+
dpeRequest.logement.installation_ecs_collection.installation_ecs[i]
|
|
271
|
+
.donnee_intermediaire.besoin_ecs,
|
|
272
|
+
2
|
|
273
|
+
),
|
|
274
|
+
() =>
|
|
275
|
+
expect(installationECS.donnee_intermediaire.besoin_ecs).toBeCloseTo(
|
|
276
|
+
dpeRequest.logement.installation_ecs_collection.installation_ecs[i]
|
|
277
|
+
.donnee_intermediaire.besoin_ecs * 1000,
|
|
278
|
+
2
|
|
279
|
+
)
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
@@ -2,7 +2,7 @@ import { inject } from 'dioma';
|
|
|
2
2
|
import { ContexteBuilder } from './contexte.builder.js';
|
|
3
3
|
import { DeperditionEnveloppeService } from './enveloppe/deperdition-enveloppe.service.js';
|
|
4
4
|
import { logger } from '../../../core/util/logger/log-service.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ApportEtBesoinService } from './apport_et_besoin/apport-et-besoin.service.js';
|
|
6
6
|
|
|
7
7
|
export class EngineService {
|
|
8
8
|
/**
|
|
@@ -11,9 +11,9 @@ export class EngineService {
|
|
|
11
11
|
#deperditionService;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @type {
|
|
14
|
+
* @type {ApportEtBesoinService}
|
|
15
15
|
*/
|
|
16
|
-
#
|
|
16
|
+
#apportEtBesoinService;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @type {ContexteBuilder}
|
|
@@ -22,16 +22,16 @@ export class EngineService {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @param deperditionService {DeperditionEnveloppeService}
|
|
25
|
-
* @param
|
|
25
|
+
* @param apportEtBesoinService {ApportEtBesoinService}
|
|
26
26
|
* @param contextBuilder {ContexteBuilder}
|
|
27
27
|
*/
|
|
28
28
|
constructor(
|
|
29
29
|
deperditionService = inject(DeperditionEnveloppeService),
|
|
30
|
-
|
|
30
|
+
apportEtBesoinService = inject(ApportEtBesoinService),
|
|
31
31
|
contextBuilder = inject(ContexteBuilder)
|
|
32
32
|
) {
|
|
33
33
|
this.#deperditionService = deperditionService;
|
|
34
|
-
this.#
|
|
34
|
+
this.#apportEtBesoinService = apportEtBesoinService;
|
|
35
35
|
this.#contextBuilder = contextBuilder;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -68,12 +68,10 @@ export class EngineService {
|
|
|
68
68
|
proceededDpe.logement
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
proceededDpe.logement.sortie.apport_et_besoin =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
76
|
-
};
|
|
71
|
+
proceededDpe.logement.sortie.apport_et_besoin = this.#apportEtBesoinService.execute(
|
|
72
|
+
ctx,
|
|
73
|
+
proceededDpe.logement
|
|
74
|
+
);
|
|
77
75
|
|
|
78
76
|
// Calcul des déperditions par renouvellement de l'air
|
|
79
77
|
|
|
@@ -114,7 +112,6 @@ export class EngineService {
|
|
|
114
112
|
*/
|
|
115
113
|
#removeComputedData(dpe) {
|
|
116
114
|
delete dpe.logement.sortie;
|
|
117
|
-
delete dpe.logement.enveloppe.inertie;
|
|
118
115
|
|
|
119
116
|
dpe.logement.enveloppe.mur_collection.mur?.map((m) => delete m.donnee_intermediaire);
|
|
120
117
|
dpe.logement.enveloppe.baie_vitree_collection.baie_vitree?.map((m) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeperditionService } from '../deperdition.service.js';
|
|
2
2
|
import { inject } from 'dioma';
|
|
3
|
-
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/baieVitreeTv.store.js';
|
|
3
|
+
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/enveloppe/baieVitreeTv.store.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Calcul des déperditions des baies vitrées
|
package/features/engine/domain/enveloppe/baie_vitree/deperdition-baie-vitree.service.spec.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ContexteBuilder } from '../../contexte.builder.js';
|
|
|
4
4
|
import { DpeNormalizerService } from '../../../../normalizer/domain/dpe-normalizer.service.js';
|
|
5
5
|
import { DeperditionBaieVitreeService } from './deperdition-baie-vitree.service.js';
|
|
6
6
|
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
7
|
-
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/baieVitreeTv.store.js';
|
|
7
|
+
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/enveloppe/baieVitreeTv.store.js';
|
|
8
8
|
|
|
9
9
|
/** @type {DeperditionBaieVitreeService} **/
|
|
10
10
|
let service;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeperditionService } from '../deperdition.service.js';
|
|
2
2
|
import { inject } from 'dioma';
|
|
3
|
-
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/baieVitreeTv.store.js';
|
|
3
|
+
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/enveloppe/baieVitreeTv.store.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Calcul des déperditions des baies vitrées
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContexteBuilder } from '../../contexte.builder.js';
|
|
2
2
|
import { DpeNormalizerService } from '../../../../normalizer/domain/dpe-normalizer.service.js';
|
|
3
3
|
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
4
|
-
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/baieVitreeTv.store.js';
|
|
4
|
+
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/enveloppe/baieVitreeTv.store.js';
|
|
5
5
|
import { EspaceTamponService } from './espace-tampon.service.js';
|
|
6
6
|
import { getAdemeFileJson } from '../../../../../../test/test-helpers.js';
|
|
7
7
|
|
package/features/engine/domain/enveloppe/pont_thermique/deperdition-pont-thermique.service.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DeperditionService } from '../deperdition.service.js';
|
|
|
3
3
|
import { logger } from '../../../../../core/util/logger/log-service.js';
|
|
4
4
|
import { compareReferences } from '../../../../../utils.js';
|
|
5
5
|
import { DeperditionMurService } from '../mur/deperdition-mur.service.js';
|
|
6
|
-
import { PontThermiqueTvStore } from '../../../../dpe/infrastructure/pontThermiqueTv.store.js';
|
|
6
|
+
import { PontThermiqueTvStore } from '../../../../dpe/infrastructure/enveloppe/pontThermiqueTv.store.js';
|
|
7
7
|
import enums from '../../../../../enums.js';
|
|
8
8
|
import { DeperditionPlancherHautService } from '../plancher_haut/deperdition-plancher-haut.service.js';
|
|
9
9
|
import { DeperditionPlancherBasService } from '../plancher_bas/deperdition-plancher-bas.service.js';
|
package/features/engine/domain/enveloppe/pont_thermique/deperdition-pont-thermique.service.spec.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ContexteBuilder } from '../../contexte.builder.js';
|
|
|
4
4
|
import { DpeNormalizerService } from '../../../../normalizer/domain/dpe-normalizer.service.js';
|
|
5
5
|
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
6
6
|
import { DeperditionPontThermiqueService } from './deperdition-pont-thermique.service.js';
|
|
7
|
-
import { PontThermiqueTvStore } from '../../../../dpe/infrastructure/pontThermiqueTv.store.js';
|
|
7
|
+
import { PontThermiqueTvStore } from '../../../../dpe/infrastructure/enveloppe/pontThermiqueTv.store.js';
|
|
8
8
|
import { DeperditionMurService } from '../mur/deperdition-mur.service.js';
|
|
9
9
|
import { DeperditionPlancherHautService } from '../plancher_haut/deperdition-plancher-haut.service.js';
|
|
10
10
|
import { DeperditionPlancherBasService } from '../plancher_bas/deperdition-plancher-bas.service.js';
|
|
@@ -10,18 +10,19 @@ import { TypeDpe } from '../../../dpe/domain/models/type-habitation.model.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export class NadeqService {
|
|
12
12
|
/**
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
13
|
+
* @param typeDpe {TypeDpe}
|
|
14
|
+
* @param surfaceHabitable {number}
|
|
15
|
+
* @param nombreAppartement {number}
|
|
15
16
|
* @return {number}
|
|
16
17
|
*/
|
|
17
|
-
execute(
|
|
18
|
-
if (
|
|
19
|
-
return this.#calculateIndividualNadeq(
|
|
18
|
+
execute(typeDpe, surfaceHabitable, nombreAppartement) {
|
|
19
|
+
if (typeDpe === TypeDpe.MAISON) {
|
|
20
|
+
return this.#calculateIndividualNadeq(surfaceHabitable);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
return this.#calculateCollectiveNadeq(
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
surfaceHabitable,
|
|
25
|
+
typeDpe === TypeDpe.APPARTEMENT ? 1 : nombreAppartement
|
|
25
26
|
);
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -18,11 +18,7 @@ describe('Nadeq unit tests', () => {
|
|
|
18
18
|
])(
|
|
19
19
|
`Typologie MAISON : Nombre d'adultes équivalent $expectedNadeq pour une surface de logement $surfaceHabitable`,
|
|
20
20
|
({ expectedNadeq, surfaceHabitable }) => {
|
|
21
|
-
|
|
22
|
-
surfaceHabitable: surfaceHabitable,
|
|
23
|
-
typeDpe: TypeDpe.MAISON
|
|
24
|
-
};
|
|
25
|
-
expect(service.execute(ctx)).toBe(expectedNadeq);
|
|
21
|
+
expect(service.execute(TypeDpe.MAISON, surfaceHabitable)).toBe(expectedNadeq);
|
|
26
22
|
}
|
|
27
23
|
);
|
|
28
24
|
|
|
@@ -36,11 +32,7 @@ describe('Nadeq unit tests', () => {
|
|
|
36
32
|
])(
|
|
37
33
|
`Typologie APPARTEMENT : Nombre d'adultes équivalent $expectedNadeq pour une surface de logement $surfaceHabitable`,
|
|
38
34
|
({ expectedNadeq, surfaceHabitable }) => {
|
|
39
|
-
|
|
40
|
-
surfaceHabitable: surfaceHabitable,
|
|
41
|
-
typeDpe: TypeDpe.APPARTEMENT
|
|
42
|
-
};
|
|
43
|
-
expect(service.execute(ctx)).toBeCloseTo(expectedNadeq, 2);
|
|
35
|
+
expect(service.execute(TypeDpe.APPARTEMENT, surfaceHabitable)).toBeCloseTo(expectedNadeq, 2);
|
|
44
36
|
}
|
|
45
37
|
);
|
|
46
38
|
|
|
@@ -60,12 +52,10 @@ describe('Nadeq unit tests', () => {
|
|
|
60
52
|
])(
|
|
61
53
|
`Typologie IMMEUBLE : Nombre d'adultes équivalent $expectedNadeq pour une surface de logement $surfaceHabitable et un nombre d'apartement $nombreAppartement`,
|
|
62
54
|
({ expectedNadeq, surfaceHabitable, nombreAppartement }) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
expect(service.execute(ctx)).toBeCloseTo(expectedNadeq, 2);
|
|
55
|
+
expect(service.execute(TypeDpe.IMMEUBLE, surfaceHabitable, nombreAppartement)).toBeCloseTo(
|
|
56
|
+
expectedNadeq,
|
|
57
|
+
2
|
|
58
|
+
);
|
|
69
59
|
}
|
|
70
60
|
);
|
|
71
61
|
});
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|