@ssg-coop/luic-calculator-core 1.3.0 → 1.4.1
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/README.md +12 -2
- package/dist/api/domain.d.ts +5 -0
- package/dist/api/domain.js +5 -0
- package/dist/config/i18n/en.d.ts +19 -0
- package/dist/config/i18n/en.js +19 -0
- package/dist/config/i18n/fr.d.ts +19 -0
- package/dist/config/i18n/fr.js +19 -0
- package/dist/config/types.d.ts +2 -0
- package/dist/config/types.js +5 -0
- package/dist/generator/WorkbookGenerator.d.ts +4 -0
- package/dist/generator/WorkbookGenerator.js +69 -9
- package/dist/generator/builders/ChartDataSheetBuilder.d.ts +10 -0
- package/dist/generator/builders/ChartDataSheetBuilder.js +160 -7
- package/dist/generator/builders/ChartsSheetBuilder.js +103 -2
- package/dist/generator/builders/InputDataSheetBuilder.js +4 -3
- package/dist/generator/builders/ScenarioDetailsBuilder.d.ts +2 -0
- package/dist/generator/builders/ScenarioDetailsBuilder.js +4 -4
- package/dist/generator/builders/ScenarioSheetBuilder.d.ts +2 -0
- package/dist/generator/builders/ScenarioSheetBuilder.js +205 -25
- package/dist/generator/builders/SummarySheetBuilder.d.ts +3 -2
- package/dist/generator/builders/SummarySheetBuilder.js +109 -9
- package/dist/types/config.types.d.ts +9 -0
- package/dist/types/workbook.types.d.ts +52 -1
- package/package.json +1 -1
- package/dist/package.json +0 -31
- package/dist/src/config/appConfig.d.ts +0 -11
- package/dist/src/config/appConfig.js +0 -38
- package/dist/src/config/core/calculatorUtils.d.ts +0 -17
- package/dist/src/config/core/calculatorUtils.js +0 -212
- package/dist/src/config/core/genericUtils.d.ts +0 -10
- package/dist/src/config/core/genericUtils.js +0 -79
- package/dist/src/config/domain/buildings.d.ts +0 -14
- package/dist/src/config/domain/buildings.js +0 -282
- package/dist/src/config/domain/emissionFactors.d.ts +0 -2
- package/dist/src/config/domain/emissionFactors.js +0 -42
- package/dist/src/config/domain/energySources.d.ts +0 -18
- package/dist/src/config/domain/energySources.js +0 -370
- package/dist/src/config/domain/infrastructure.d.ts +0 -8
- package/dist/src/config/domain/infrastructure.js +0 -56
- package/dist/src/config/domain/neighbourhoodTypes.d.ts +0 -10
- package/dist/src/config/domain/neighbourhoodTypes.js +0 -366
- package/dist/src/config/domain/regions.d.ts +0 -8
- package/dist/src/config/domain/regions.js +0 -423
- package/dist/src/config/domain/services.d.ts +0 -8
- package/dist/src/config/domain/services.js +0 -48
- package/dist/src/config/domain/transportation.d.ts +0 -12
- package/dist/src/config/domain/transportation.js +0 -81
- package/dist/src/config/i18n/en.d.ts +0 -445
- package/dist/src/config/i18n/en.js +0 -488
- package/dist/src/config/i18n/fr.d.ts +0 -445
- package/dist/src/config/i18n/fr.js +0 -491
- package/dist/src/config/types.d.ts +0 -80
- package/dist/src/config/types.js +0 -5
- package/dist/src/generator/FormulaBuilder.d.ts +0 -58
- package/dist/src/generator/FormulaBuilder.js +0 -101
- package/dist/src/generator/WorkbookGenerator.d.ts +0 -7
- package/dist/src/generator/WorkbookGenerator.js +0 -77
- package/dist/src/generator/builders/AssumptionsBuilder.d.ts +0 -20
- package/dist/src/generator/builders/AssumptionsBuilder.js +0 -311
- package/dist/src/generator/builders/CalculationSheetBuilder.d.ts +0 -20
- package/dist/src/generator/builders/CalculationSheetBuilder.js +0 -149
- package/dist/src/generator/builders/EmissionFactorsSheetBuilder.d.ts +0 -7
- package/dist/src/generator/builders/EmissionFactorsSheetBuilder.js +0 -86
- package/dist/src/generator/builders/InputDataSheetBuilder.d.ts +0 -13
- package/dist/src/generator/builders/InputDataSheetBuilder.js +0 -114
- package/dist/src/generator/builders/ScenarioSheetBuilder.d.ts +0 -19
- package/dist/src/generator/builders/ScenarioSheetBuilder.js +0 -1067
- package/dist/src/generator/builders/SummarySheetBuilder.d.ts +0 -8
- package/dist/src/generator/builders/SummarySheetBuilder.js +0 -304
- package/dist/src/index.d.ts +0 -57
- package/dist/src/index.js +0 -103
- package/dist/src/theme/defaultTheme.d.ts +0 -2
- package/dist/src/theme/defaultTheme.js +0 -254
- package/dist/src/theme/index.d.ts +0 -2
- package/dist/src/theme/index.js +0 -2
- package/dist/src/theme/sunsetTheme.d.ts +0 -2
- package/dist/src/theme/sunsetTheme.js +0 -310
- package/dist/src/types/config.types.d.ts +0 -69
- package/dist/src/types/config.types.js +0 -1
- package/dist/src/types/scenario.types.d.ts +0 -63
- package/dist/src/types/scenario.types.js +0 -1
- package/dist/src/types/workbook.types.d.ts +0 -181
- package/dist/src/types/workbook.types.js +0 -1
- package/dist/src/utils/ReactivityUtils.d.ts +0 -7
- package/dist/src/utils/ReactivityUtils.js +0 -26
- package/dist/src/utils/cellAddressing.d.ts +0 -16
- package/dist/src/utils/cellAddressing.js +0 -35
- package/dist/src/utils/formatting.d.ts +0 -9
- package/dist/src/utils/formatting.js +0 -32
- package/dist/src/writers/JsonExporter.d.ts +0 -11
- package/dist/src/writers/JsonExporter.js +0 -14
- package/dist/types/blinktagtypes.d.ts +0 -167
- package/dist/types/blinktagtypes.js +0 -21
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* © Copyright 2023, LUIC-CIUT's Contributors
|
|
3
|
-
* generic utilities for managing arrays and objects
|
|
4
|
-
*/
|
|
5
|
-
export default function genericUtils() {
|
|
6
|
-
/**
|
|
7
|
-
* returns an Object whose keys are regular Objects as an Array of objects, optionally filtered to a list of keys
|
|
8
|
-
* Returned Objects are sorted alphabetically if they contain a 'name' key
|
|
9
|
-
* @param {any} Obj - the object to extract values from
|
|
10
|
-
* @param {string[] | null} keys - an array of keys to filter the list to
|
|
11
|
-
* @returns an array of objects
|
|
12
|
-
*/
|
|
13
|
-
const getObjectKeysAsArray = (Obj, keys = null) => {
|
|
14
|
-
if (keys !== null && !Array.isArray(keys)) {
|
|
15
|
-
console.warn("filter keys not passed as an array to getObjectKeysArray");
|
|
16
|
-
}
|
|
17
|
-
const keysArray = keys !== null && keys !== undefined ? keys.map((_key) => Obj[_key]) : Object.values(Obj);
|
|
18
|
-
if (keysArray.length === 0)
|
|
19
|
-
return [];
|
|
20
|
-
return "name" in keysArray[0]
|
|
21
|
-
? [...keysArray].sort((a, b) => {
|
|
22
|
-
if (a.name < b.name) {
|
|
23
|
-
return -1;
|
|
24
|
-
}
|
|
25
|
-
if (a.name > b.name) {
|
|
26
|
-
return 1;
|
|
27
|
-
}
|
|
28
|
-
return 0;
|
|
29
|
-
})
|
|
30
|
-
: keysArray;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* resolves a string representation of a path in an Object and returns the value at that path.
|
|
34
|
-
* Objects can be nested and may contain arrays.
|
|
35
|
-
* @param {any} object - object being referenced
|
|
36
|
-
* @param {string} path - the string representation of the path (example: myObj.nestedObj.anotherOb[0].value)
|
|
37
|
-
* @param {any} defaultValue - default value to return
|
|
38
|
-
* @returns value at the specified path location in the object
|
|
39
|
-
*/
|
|
40
|
-
const resolveObjPath = (object, path, defaultValue) => path
|
|
41
|
-
.split(/[.[\]'"]/)
|
|
42
|
-
.filter((p) => p)
|
|
43
|
-
.reduce((o, p) => o?.[p] ?? defaultValue, object);
|
|
44
|
-
/**
|
|
45
|
-
* finds a unique name given a proposed name and a list of existing names. If the name already exists, an incremental number is automatically appended before the delimiter
|
|
46
|
-
* @param {string} newName - the proposed name
|
|
47
|
-
* @param {string[]} nameCollection - array of existing names to test against
|
|
48
|
-
* @param {string | null} delimiter - the delimiter/ending of the string to keep constant
|
|
49
|
-
* @param {number} maxLength - the max number of characters the returned name can be
|
|
50
|
-
* @returns a unique name as a string
|
|
51
|
-
*/
|
|
52
|
-
const getUniqueName = (newName, nameCollection, delimiter = null, maxLength = 0) => {
|
|
53
|
-
let uniqueName = newName;
|
|
54
|
-
let originalName = delimiter !== null ? newName.split(delimiter)[0] : newName;
|
|
55
|
-
// trim if the name is too long
|
|
56
|
-
if (maxLength > 0 && uniqueName.length > maxLength) {
|
|
57
|
-
const charsToTrim = uniqueName.length - maxLength;
|
|
58
|
-
originalName = originalName.slice(0, -charsToTrim);
|
|
59
|
-
uniqueName = delimiter !== null ? `${originalName}${delimiter}` : `${originalName}`;
|
|
60
|
-
}
|
|
61
|
-
// test if name is unique
|
|
62
|
-
let i = 1;
|
|
63
|
-
while (nameCollection.includes(uniqueName)) {
|
|
64
|
-
// if not unique, append number increment before the delimiter
|
|
65
|
-
uniqueName = delimiter !== null ? `${originalName} (${i})${delimiter}` : `${originalName} (${i})`;
|
|
66
|
-
i++;
|
|
67
|
-
}
|
|
68
|
-
return uniqueName;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* generates an image url for an image in the /assets folder
|
|
72
|
-
* @param {string} name filename for the image
|
|
73
|
-
* @returns full path to image for use in app
|
|
74
|
-
*/
|
|
75
|
-
const getImageUrl = (name) => {
|
|
76
|
-
return new URL(`../assets/${name}`, import.meta.url).href;
|
|
77
|
-
};
|
|
78
|
-
return { getObjectKeysAsArray, resolveObjPath, getUniqueName, getImageUrl };
|
|
79
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default function buildingsConfig(t: any): {
|
|
2
|
-
homeTypes: any;
|
|
3
|
-
buildingEnergyCodes: any;
|
|
4
|
-
buildingSectorReferences: {
|
|
5
|
-
description: any;
|
|
6
|
-
references: any[][];
|
|
7
|
-
};
|
|
8
|
-
getBuildingEnergyCodesAsArray: (filterIds?: string[] | null) => any[];
|
|
9
|
-
getBuildingEnergyCodeNamesIdsAsArray: (filterIds?: string[] | null) => {
|
|
10
|
-
id: any;
|
|
11
|
-
name: any;
|
|
12
|
-
}[];
|
|
13
|
-
getAllBuildingCodesForScenario: (scenario: any) => any[];
|
|
14
|
-
};
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// © Copyright 2023, LUIC-CIUT's Contributors
|
|
2
|
-
// list of building types, building codes and associated config details
|
|
3
|
-
import genericUtils from '../core/genericUtils';
|
|
4
|
-
export default function buildingsConfig(t) {
|
|
5
|
-
const homeTypes = {
|
|
6
|
-
single: {
|
|
7
|
-
id: 'single',
|
|
8
|
-
name: t('appConfig.buildings.homeTypes.single'),
|
|
9
|
-
size_m2: 186,
|
|
10
|
-
},
|
|
11
|
-
row: {
|
|
12
|
-
id: 'row',
|
|
13
|
-
name: t('appConfig.buildings.homeTypes.row'),
|
|
14
|
-
size_m2: 140,
|
|
15
|
-
},
|
|
16
|
-
apt: {
|
|
17
|
-
id: 'apt',
|
|
18
|
-
name: t('appConfig.buildings.homeTypes.apt'),
|
|
19
|
-
size_m2: 93,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
const buildingEnergyCodes = {
|
|
23
|
-
Current: {
|
|
24
|
-
id: 'Current',
|
|
25
|
-
name: t('appConfig.buildings.buildingEnergyCodes.Current'),
|
|
26
|
-
description: t('appConfig.buildings.buildingEnergyCodes.CurrentDesc'),
|
|
27
|
-
references: [
|
|
28
|
-
[
|
|
29
|
-
t('appConfig.buildings.references.ceud'),
|
|
30
|
-
'https://oee.nrcan.gc.ca/corporate/statistics/neud/dpa/menus/trends/comprehensive_tables/list.cfm',
|
|
31
|
-
],
|
|
32
|
-
[t('appConfig.buildings.references.effImprove25')],
|
|
33
|
-
],
|
|
34
|
-
eui: {
|
|
35
|
-
single: 750,
|
|
36
|
-
row: 616,
|
|
37
|
-
apt: 572,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
passiveHouse: {
|
|
41
|
-
id: 'passiveHouse',
|
|
42
|
-
name: t('appConfig.buildings.buildingEnergyCodes.passiveHouse'),
|
|
43
|
-
description: t('appConfig.buildings.buildingEnergyCodes.passiveHouseDesc'),
|
|
44
|
-
references: [
|
|
45
|
-
[
|
|
46
|
-
t('appConfig.buildings.references.passiveHouse'),
|
|
47
|
-
'https://passivehouse-international.org/index.php?page_id=150',
|
|
48
|
-
],
|
|
49
|
-
],
|
|
50
|
-
eui: {
|
|
51
|
-
single: 432,
|
|
52
|
-
row: 432,
|
|
53
|
-
apt: 432,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
NECB_1: {
|
|
57
|
-
id: 'NECB_1',
|
|
58
|
-
name: t('appConfig.buildings.buildingEnergyCodes.NECB_1'),
|
|
59
|
-
description: t('appConfig.buildings.buildingEnergyCodes.NECB_1Desc'),
|
|
60
|
-
references: [
|
|
61
|
-
[
|
|
62
|
-
t('appConfig.buildings.references.cnec'),
|
|
63
|
-
'https://natural-resources.canada.ca/energy-efficiency/buildings/new-buildings/canadas-national-energy-code/20675',
|
|
64
|
-
],
|
|
65
|
-
[t('appConfig.buildings.references.effImprove25')],
|
|
66
|
-
],
|
|
67
|
-
eui: {
|
|
68
|
-
single: 563,
|
|
69
|
-
row: 462,
|
|
70
|
-
apt: 429,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
NECB_2: {
|
|
74
|
-
id: 'NECB_2',
|
|
75
|
-
name: t('appConfig.buildings.buildingEnergyCodes.NECB_2'),
|
|
76
|
-
description: t('appConfig.buildings.buildingEnergyCodes.NECB_2Desc'),
|
|
77
|
-
references: [
|
|
78
|
-
[
|
|
79
|
-
t('appConfig.buildings.references.cnec'),
|
|
80
|
-
'https://natural-resources.canada.ca/energy-efficiency/buildings/new-buildings/canadas-national-energy-code/20675',
|
|
81
|
-
],
|
|
82
|
-
[t('appConfig.buildings.references.effImprove50')],
|
|
83
|
-
],
|
|
84
|
-
eui: {
|
|
85
|
-
single: 375,
|
|
86
|
-
row: 308,
|
|
87
|
-
apt: 286,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
NECB_3: {
|
|
91
|
-
id: 'NECB_3',
|
|
92
|
-
name: t('appConfig.buildings.buildingEnergyCodes.NECB_3'),
|
|
93
|
-
description: t('appConfig.buildings.buildingEnergyCodes.NECB_3Desc'),
|
|
94
|
-
references: [
|
|
95
|
-
[
|
|
96
|
-
t('appConfig.buildings.references.cnec'),
|
|
97
|
-
'https://natural-resources.canada.ca/energy-efficiency/buildings/new-buildings/canadas-national-energy-code/20675',
|
|
98
|
-
],
|
|
99
|
-
[t('appConfig.buildings.references.effImprove60')],
|
|
100
|
-
],
|
|
101
|
-
eui: {
|
|
102
|
-
single: 300,
|
|
103
|
-
row: 246,
|
|
104
|
-
apt: 229,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
BCStep_2: {
|
|
108
|
-
id: 'BCStep_2',
|
|
109
|
-
name: t('appConfig.buildings.buildingEnergyCodes.BCStep_2'),
|
|
110
|
-
description: t('appConfig.buildings.buildingEnergyCodes.BCStep_2Desc'),
|
|
111
|
-
references: [
|
|
112
|
-
[
|
|
113
|
-
t('appConfig.buildings.references.bcStepCode'),
|
|
114
|
-
'https://energystepcode.ca/',
|
|
115
|
-
],
|
|
116
|
-
[t('appConfig.buildings.references.bcStep2')],
|
|
117
|
-
],
|
|
118
|
-
eui: {
|
|
119
|
-
single: 750,
|
|
120
|
-
row: 616,
|
|
121
|
-
apt: 458,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
BCStep_3: {
|
|
125
|
-
id: 'BCStep_3',
|
|
126
|
-
name: t('appConfig.buildings.buildingEnergyCodes.BCStep_3'),
|
|
127
|
-
description: t('appConfig.buildings.buildingEnergyCodes.BCStep_3Desc'),
|
|
128
|
-
references: [
|
|
129
|
-
[
|
|
130
|
-
t('appConfig.buildings.references.bcStepCode'),
|
|
131
|
-
'https://energystepcode.ca/',
|
|
132
|
-
],
|
|
133
|
-
[t('appConfig.buildings.references.bcStep3')],
|
|
134
|
-
],
|
|
135
|
-
eui: {
|
|
136
|
-
single: 600,
|
|
137
|
-
row: 493,
|
|
138
|
-
apt: 343,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
BCStep_4: {
|
|
142
|
-
id: 'BCStep_4',
|
|
143
|
-
name: t('appConfig.buildings.buildingEnergyCodes.BCStep_4'),
|
|
144
|
-
description: t('appConfig.buildings.buildingEnergyCodes.BCStep_4Desc'),
|
|
145
|
-
references: [
|
|
146
|
-
[
|
|
147
|
-
t('appConfig.buildings.references.bcStepCode'),
|
|
148
|
-
'https://energystepcode.ca/',
|
|
149
|
-
],
|
|
150
|
-
[t('appConfig.buildings.references.bcStep4')],
|
|
151
|
-
],
|
|
152
|
-
eui: {
|
|
153
|
-
single: 450,
|
|
154
|
-
row: 370,
|
|
155
|
-
apt: 114,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
BCStep_5: {
|
|
159
|
-
id: 'BCStep_5',
|
|
160
|
-
name: t('appConfig.buildings.buildingEnergyCodes.BCStep_5'),
|
|
161
|
-
description: t('appConfig.buildings.buildingEnergyCodes.BCStep_5Desc'),
|
|
162
|
-
references: [
|
|
163
|
-
[
|
|
164
|
-
t('appConfig.buildings.references.bcStepCode'),
|
|
165
|
-
'https://energystepcode.ca/',
|
|
166
|
-
],
|
|
167
|
-
[t('appConfig.buildings.references.bcStep5')],
|
|
168
|
-
],
|
|
169
|
-
eui: {
|
|
170
|
-
single: 150,
|
|
171
|
-
row: 123,
|
|
172
|
-
apt: 114,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
TorontoGS_v3T1: {
|
|
176
|
-
id: 'TorontoGS_v3T1',
|
|
177
|
-
name: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T1'),
|
|
178
|
-
description: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T1Desc'),
|
|
179
|
-
references: [
|
|
180
|
-
[
|
|
181
|
-
t('appConfig.buildings.references.tgs'),
|
|
182
|
-
'https://www.toronto.ca/city-government/planning-development/official-plan-guidelines/toronto-green-standard/',
|
|
183
|
-
],
|
|
184
|
-
[t('appConfig.buildings.references.tgsv3t1')],
|
|
185
|
-
],
|
|
186
|
-
eui: {
|
|
187
|
-
single: 750,
|
|
188
|
-
row: 616,
|
|
189
|
-
apt: 515,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
TorontoGS_v3T2: {
|
|
193
|
-
id: 'TorontoGS_v3T2',
|
|
194
|
-
name: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T2'),
|
|
195
|
-
description: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T2Desc'),
|
|
196
|
-
references: [
|
|
197
|
-
[
|
|
198
|
-
t('appConfig.buildings.references.tgs'),
|
|
199
|
-
'https://www.toronto.ca/city-government/planning-development/official-plan-guidelines/toronto-green-standard/',
|
|
200
|
-
],
|
|
201
|
-
[t('appConfig.buildings.references.tgsv3t2')],
|
|
202
|
-
],
|
|
203
|
-
eui: {
|
|
204
|
-
single: 750,
|
|
205
|
-
row: 616,
|
|
206
|
-
apt: 400,
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
TorontoGS_v3T3: {
|
|
210
|
-
id: 'TorontoGS_v3T3',
|
|
211
|
-
name: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T3'),
|
|
212
|
-
description: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T3Desc'),
|
|
213
|
-
references: [
|
|
214
|
-
[
|
|
215
|
-
t('appConfig.buildings.references.tgs'),
|
|
216
|
-
'https://www.toronto.ca/city-government/planning-development/official-plan-guidelines/toronto-green-standard/',
|
|
217
|
-
],
|
|
218
|
-
[t('appConfig.buildings.references.tgsv3t3')],
|
|
219
|
-
],
|
|
220
|
-
eui: {
|
|
221
|
-
single: 750,
|
|
222
|
-
row: 616,
|
|
223
|
-
apt: 286,
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
TorontoGS_v3T4: {
|
|
227
|
-
id: 'TorontoGS_v3T4',
|
|
228
|
-
name: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T4'),
|
|
229
|
-
description: t('appConfig.buildings.buildingEnergyCodes.TorontoGS_v3T4Desc'),
|
|
230
|
-
references: [
|
|
231
|
-
[
|
|
232
|
-
t('appConfig.buildings.references.tgs'),
|
|
233
|
-
'https://www.toronto.ca/city-government/planning-development/official-plan-guidelines/toronto-green-standard/',
|
|
234
|
-
],
|
|
235
|
-
[t('appConfig.buildings.references.tgsv3t4')],
|
|
236
|
-
],
|
|
237
|
-
eui: {
|
|
238
|
-
single: 750,
|
|
239
|
-
row: 616,
|
|
240
|
-
apt: 229,
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
const buildingSectorReferences = {
|
|
245
|
-
description: t('appConfig.buildings.references.description'),
|
|
246
|
-
references: [
|
|
247
|
-
[
|
|
248
|
-
t('appConfig.buildings.references.shrinkThatFootprint'),
|
|
249
|
-
`https://shrinkthatfootprint.com/how-big-is-a-house/`,
|
|
250
|
-
],
|
|
251
|
-
],
|
|
252
|
-
};
|
|
253
|
-
const getBuildingEnergyCodesAsArray = (filterIds = null) => {
|
|
254
|
-
return genericUtils().getObjectKeysAsArray(buildingEnergyCodes, filterIds);
|
|
255
|
-
};
|
|
256
|
-
const getBuildingEnergyCodeNamesIdsAsArray = (filterIds = null) => {
|
|
257
|
-
return getBuildingEnergyCodesAsArray(filterIds).map((buildingEnergyCode) => {
|
|
258
|
-
return { id: buildingEnergyCode.id, name: buildingEnergyCode.name };
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
const getAllBuildingCodesForScenario = (scenario) => {
|
|
262
|
-
const scenarioBuildingCodes = [];
|
|
263
|
-
const codeIds = [];
|
|
264
|
-
Object.keys(scenario.buildings).forEach((_type) => {
|
|
265
|
-
if (!codeIds.includes(scenario.buildings[_type].buildingEnergyCode)) {
|
|
266
|
-
codeIds.push(scenario.buildings[_type].buildingEnergyCode);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
codeIds.forEach((codeId) => {
|
|
270
|
-
scenarioBuildingCodes.push(buildingEnergyCodes[codeId]);
|
|
271
|
-
});
|
|
272
|
-
return scenarioBuildingCodes;
|
|
273
|
-
};
|
|
274
|
-
return {
|
|
275
|
-
homeTypes,
|
|
276
|
-
buildingEnergyCodes,
|
|
277
|
-
buildingSectorReferences,
|
|
278
|
-
getBuildingEnergyCodesAsArray,
|
|
279
|
-
getBuildingEnergyCodeNamesIdsAsArray,
|
|
280
|
-
getAllBuildingCodesForScenario,
|
|
281
|
-
};
|
|
282
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import energySourcesConfig from './energySources';
|
|
2
|
-
import regionsConfig from './regions';
|
|
3
|
-
export function generateEmissionFactorsData(t = (k) => k) {
|
|
4
|
-
const result = [];
|
|
5
|
-
const gases = ['CO2', 'CH4', 'N2O'];
|
|
6
|
-
// 1. Get the list of provinces
|
|
7
|
-
const regions = regionsConfig(t);
|
|
8
|
-
const provinceIds = Object.keys(regions.provinces);
|
|
9
|
-
// 2. Initialize a base config to extract the start and end years dynamically
|
|
10
|
-
const baseConfig = energySourcesConfig(t);
|
|
11
|
-
const startYear = baseConfig.efStartYear;
|
|
12
|
-
const endYear = baseConfig.efEndYear;
|
|
13
|
-
// 3. Iterate over every province
|
|
14
|
-
for (const provId of provinceIds) {
|
|
15
|
-
// Initialize the energy config specifically for this province
|
|
16
|
-
// This triggers the override logic in your energySourcesConfig file
|
|
17
|
-
const provConfig = energySourcesConfig(t, provId);
|
|
18
|
-
// Get all available energy sources for this context
|
|
19
|
-
const energySources = provConfig.getEnergySourcesAsArray();
|
|
20
|
-
// 4. Iterate over every energy source
|
|
21
|
-
for (const source of energySources) {
|
|
22
|
-
// 5. Iterate over each gas type
|
|
23
|
-
for (const gas of gases) {
|
|
24
|
-
// Construct the base row
|
|
25
|
-
const row = {
|
|
26
|
-
provid: provId,
|
|
27
|
-
energysource_id: source.id,
|
|
28
|
-
name: source.name,
|
|
29
|
-
gas: gas
|
|
30
|
-
};
|
|
31
|
-
// 6. Iterate through the years and populate the emission factors
|
|
32
|
-
for (let year = startYear; year <= endYear; year++) {
|
|
33
|
-
// This uses your existing logic to handle the array indexing and MJ conversions
|
|
34
|
-
row[year.toString()] = provConfig.getEFForSourceByIdGasYear(source.id, gas, year);
|
|
35
|
-
}
|
|
36
|
-
result.push(row);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
export const emissionFactorsData = generateEmissionFactorsData();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* © Copyright 2023, LUIC-CIUT's Contributors
|
|
3
|
-
* global list of energy types and related emissions factors
|
|
4
|
-
*/
|
|
5
|
-
export default function energySourcesConfig(t?: any, provId?: string): {
|
|
6
|
-
energySources: any;
|
|
7
|
-
efStartYear: number;
|
|
8
|
-
efEndYear: number;
|
|
9
|
-
getEnergySourcesForSector: (sectorId: string) => any[];
|
|
10
|
-
getEnergySourcesAsArray: (filterIds?: string[] | null) => any[];
|
|
11
|
-
gwp: {
|
|
12
|
-
name: string;
|
|
13
|
-
references: any[][];
|
|
14
|
-
values: any;
|
|
15
|
-
};
|
|
16
|
-
getEFForSourceByIdGasYear: (id: string, gas: string, year: number) => number;
|
|
17
|
-
getAllEnergySourcesForScenario: (scenario: any) => any;
|
|
18
|
-
};
|