@powercalc/power-router 1.2.3 → 1.2.5
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/dist/config/types.json +22 -30
- package/dist/controllers/LoadAndParse.js +6 -0
- package/dist/controllers/LoadAndParse.js.map +1 -1
- package/dist/controllers/Router.js +3 -0
- package/dist/controllers/Router.js.map +1 -1
- package/dist/services/CommonTimestamps.js +3 -0
- package/dist/services/CommonTimestamps.js.map +1 -1
- package/dist/services/LoadService.d.ts +9 -0
- package/dist/services/LoadService.js +32 -0
- package/dist/services/LoadService.js.map +1 -1
- package/dist/services/Loader.js +29 -20
- package/dist/services/Loader.js.map +1 -1
- package/dist/services/ParseEdifact.js +3 -2
- package/dist/services/ParseEdifact.js.map +1 -1
- package/dist/services/Temperature.d.ts +15 -0
- package/dist/services/Temperature.js +89 -0
- package/dist/services/Temperature.js.map +1 -0
- package/package.json +5 -2
- package/src/router/config/types.json +22 -30
- package/src/router/controllers/LoadAndParse.ts +6 -0
- package/src/router/controllers/Router.ts +3 -0
- package/src/router/services/CommonTimestamps.ts +3 -0
- package/src/router/services/LoadService.ts +60 -11
- package/src/router/services/Loader.ts +81 -55
- package/src/router/services/ParseEdifact.ts +2 -2
- package/src/router/services/Temperature.ts +98 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Temperature = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const queryoptions_1 = require("../interfaces/queryoptions");
|
|
7
|
+
class Temperature {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.countries = [];
|
|
10
|
+
// Capital city coordinates for all European countries
|
|
11
|
+
this.coordinates = {
|
|
12
|
+
AT: { lat: 48.2082, lon: 16.3738 },
|
|
13
|
+
BE: { lat: 50.8503, lon: 4.3517 },
|
|
14
|
+
BA: { lat: 43.8564, lon: 18.4131 },
|
|
15
|
+
HR: { lat: 45.8150, lon: 15.9819 },
|
|
16
|
+
BG: { lat: 42.6977, lon: 23.3219 },
|
|
17
|
+
CY: { lat: 35.1856, lon: 33.3823 },
|
|
18
|
+
CZ: { lat: 50.0755, lon: 14.4378 },
|
|
19
|
+
DK: { lat: 55.6761, lon: 12.5683 },
|
|
20
|
+
EE: { lat: 59.4370, lon: 24.7536 },
|
|
21
|
+
FI: { lat: 60.1699, lon: 24.9384 },
|
|
22
|
+
FR: { lat: 48.8566, lon: 2.3522 },
|
|
23
|
+
DE: { lat: 52.5200, lon: 13.4050 },
|
|
24
|
+
GR: { lat: 37.9838, lon: 23.7275 },
|
|
25
|
+
HU: { lat: 47.4979, lon: 19.0402 },
|
|
26
|
+
IE: { lat: 53.3498, lon: -6.2603 },
|
|
27
|
+
IT: { lat: 41.9028, lon: 12.4964 },
|
|
28
|
+
LV: { lat: 56.9496, lon: 24.1052 },
|
|
29
|
+
LT: { lat: 54.6872, lon: 25.2797 },
|
|
30
|
+
LU: { lat: 49.6116, lon: 6.1319 },
|
|
31
|
+
ME: { lat: 42.4304, lon: 19.2594 },
|
|
32
|
+
GB: { lat: 51.5074, lon: -0.1278 },
|
|
33
|
+
NL: { lat: 52.3676, lon: 4.9041 },
|
|
34
|
+
MK: { lat: 41.9973, lon: 21.4280 },
|
|
35
|
+
NO: { lat: 59.9139, lon: 10.7522 },
|
|
36
|
+
PL: { lat: 52.2297, lon: 21.0122 },
|
|
37
|
+
PT: { lat: 38.7223, lon: -9.1393 },
|
|
38
|
+
RO: { lat: 44.4268, lon: 26.1025 },
|
|
39
|
+
RS: { lat: 44.7866, lon: 20.4489 },
|
|
40
|
+
SK: { lat: 48.1486, lon: 17.1077 },
|
|
41
|
+
SI: { lat: 46.0569, lon: 14.5058 },
|
|
42
|
+
ES: { lat: 40.4168, lon: -3.7038 },
|
|
43
|
+
SE: { lat: 59.3293, lon: 18.0686 },
|
|
44
|
+
CH: { lat: 46.9480, lon: 7.4474 }, // Bern, Switzerland
|
|
45
|
+
};
|
|
46
|
+
const countryPath = (0, path_1.join)(__dirname, '..', 'config/countries.json');
|
|
47
|
+
const countriesString = (0, fs_1.readFileSync)(countryPath, 'utf-8');
|
|
48
|
+
this.countries = JSON.parse(countriesString);
|
|
49
|
+
}
|
|
50
|
+
async load(countryCode, queryOptions) {
|
|
51
|
+
var _a;
|
|
52
|
+
const countryShort = (_a = this.countries.find((item) => item.code === countryCode)) === null || _a === void 0 ? void 0 : _a.short;
|
|
53
|
+
if (!countryShort || !this.coordinates[countryShort]) {
|
|
54
|
+
throw new Error(`Country ${countryCode} not supported for temperature data`);
|
|
55
|
+
}
|
|
56
|
+
const { lat, lon } = this.coordinates[countryShort];
|
|
57
|
+
// Calculate date range for the month
|
|
58
|
+
//const startDate = new Date(year, month - 1, 1)
|
|
59
|
+
//const endDate = new Date(year, month, 0)
|
|
60
|
+
const startDate = new Date('2015-01-01');
|
|
61
|
+
const endDate = new Date();
|
|
62
|
+
const startDateStr = startDate.toISOString().split('T')[0];
|
|
63
|
+
const endDateStr = endDate.toISOString().split('T')[0];
|
|
64
|
+
// Open-Meteo API - free historical weather data
|
|
65
|
+
const url = `https://archive-api.open-meteo.com/v1/archive?latitude=${lat}&longitude=${lon}&start_date=${startDateStr}&end_date=${endDateStr}&hourly=temperature_2m&timezone=auto`;
|
|
66
|
+
console.log(url);
|
|
67
|
+
if (queryOptions.format === queryoptions_1.Format.SOURCES) {
|
|
68
|
+
return [url];
|
|
69
|
+
}
|
|
70
|
+
const response = await fetch(url);
|
|
71
|
+
const json = await response.json();
|
|
72
|
+
const r = this.convert(json);
|
|
73
|
+
return r;
|
|
74
|
+
}
|
|
75
|
+
convert(x) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const timeStrings = ((_a = x === null || x === void 0 ? void 0 : x.hourly) === null || _a === void 0 ? void 0 : _a.time) || [];
|
|
78
|
+
const temperatures = ((_b = x === null || x === void 0 ? void 0 : x.hourly) === null || _b === void 0 ? void 0 : _b.temperature_2m) || [];
|
|
79
|
+
const time = timeStrings.map((item) => {
|
|
80
|
+
return new Date(item).getTime();
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
time: time,
|
|
84
|
+
temperature: temperatures
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Temperature = Temperature;
|
|
89
|
+
//# sourceMappingURL=Temperature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Temperature.js","sourceRoot":"","sources":["../../src/router/services/Temperature.ts"],"names":[],"mappings":";;;AAAA,2BAAiC;AACjC,+BAA2B;AAE3B,6DAAiE;AAEjE,MAAa,WAAW;IAwCtB;QAvCA,cAAS,GAAc,EAAE,CAAA;QAEzB,sDAAsD;QACrC,gBAAW,GAAoD;YAC9E,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE;YACjC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;YAClC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,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AAW,EAAE,YAAY;SAC1B,CAAA;IACH,CAAC;CACF;AA5FD,kCA4FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powercalc/power-router",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "a",
|
|
5
8
|
"main": "dist/index.js",
|
|
6
9
|
"types": "dist/index.d.ts",
|
|
@@ -50,4 +53,4 @@
|
|
|
50
53
|
"src/**/*",
|
|
51
54
|
"!**/*.test.js"
|
|
52
55
|
]
|
|
53
|
-
}
|
|
56
|
+
}
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"stack": "kerosenePrice",
|
|
39
39
|
"abbr": "KP"
|
|
40
40
|
},
|
|
41
|
-
|
|
42
41
|
"gasolinePrice": {
|
|
43
42
|
"name": "Gasoline Price",
|
|
44
43
|
"psrType": "X91",
|
|
@@ -49,9 +48,6 @@
|
|
|
49
48
|
"stack": "gasolinePrice",
|
|
50
49
|
"abbr": "GP"
|
|
51
50
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
51
|
"consumption": {
|
|
56
52
|
"name": "Consumption",
|
|
57
53
|
"psrType": "A05",
|
|
@@ -70,7 +66,7 @@
|
|
|
70
66
|
"stack": "stack2",
|
|
71
67
|
"type": "consumption"
|
|
72
68
|
},
|
|
73
|
-
|
|
69
|
+
"batteryStorageCost": {
|
|
74
70
|
"name": "Battery Storage Cost",
|
|
75
71
|
"psrType": "C99",
|
|
76
72
|
"co2Footprint": null,
|
|
@@ -79,7 +75,7 @@
|
|
|
79
75
|
"yAxis": "y",
|
|
80
76
|
"type": "cost"
|
|
81
77
|
},
|
|
82
|
-
|
|
78
|
+
"P2GCost": {
|
|
83
79
|
"name": "H2 Electrolyzer Cost",
|
|
84
80
|
"psrType": "C97",
|
|
85
81
|
"co2Footprint": null,
|
|
@@ -88,7 +84,7 @@
|
|
|
88
84
|
"yAxis": "y",
|
|
89
85
|
"type": "cost"
|
|
90
86
|
},
|
|
91
|
-
|
|
87
|
+
"H2PeakerCost": {
|
|
92
88
|
"name": "H2 Peaker Cost",
|
|
93
89
|
"psrType": "C97",
|
|
94
90
|
"co2Footprint": null,
|
|
@@ -97,8 +93,7 @@
|
|
|
97
93
|
"yAxis": "y",
|
|
98
94
|
"type": "cost"
|
|
99
95
|
},
|
|
100
|
-
|
|
101
|
-
"H2StorageCost": {
|
|
96
|
+
"H2StorageCost": {
|
|
102
97
|
"name": "H2 Storage Cost",
|
|
103
98
|
"psrType": "C97",
|
|
104
99
|
"co2Footprint": null,
|
|
@@ -107,8 +102,6 @@
|
|
|
107
102
|
"yAxis": "y",
|
|
108
103
|
"type": "cost"
|
|
109
104
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
105
|
"diesel": {
|
|
113
106
|
"name": "Diesel",
|
|
114
107
|
"psrType": "F2",
|
|
@@ -157,7 +150,6 @@
|
|
|
157
150
|
"abbr": "GE",
|
|
158
151
|
"type": "sum"
|
|
159
152
|
},
|
|
160
|
-
|
|
161
153
|
"waste": {
|
|
162
154
|
"name": "Waste",
|
|
163
155
|
"psrType": "B17",
|
|
@@ -182,7 +174,6 @@
|
|
|
182
174
|
"abbr": "BM",
|
|
183
175
|
"type": "dispatchablegreen"
|
|
184
176
|
},
|
|
185
|
-
|
|
186
177
|
"hydroRunOfRiverAndPoundage": {
|
|
187
178
|
"name": "Hydro Run-of-river and poundage",
|
|
188
179
|
"psrType": "B11",
|
|
@@ -223,7 +214,6 @@
|
|
|
223
214
|
"abbr": "BC",
|
|
224
215
|
"type": "fossil"
|
|
225
216
|
},
|
|
226
|
-
|
|
227
217
|
"fossilOil": {
|
|
228
218
|
"name": "Fossil Oil",
|
|
229
219
|
"psrType": "B06",
|
|
@@ -312,7 +302,7 @@
|
|
|
312
302
|
"abbr": "PC",
|
|
313
303
|
"type": "charge"
|
|
314
304
|
},
|
|
315
|
-
|
|
305
|
+
"hydroPumpedStorageDischarge": {
|
|
316
306
|
"name": "Hydro Pumped Storage Discharge",
|
|
317
307
|
"psrType": "C10",
|
|
318
308
|
"co2Footprint": 0,
|
|
@@ -320,7 +310,6 @@
|
|
|
320
310
|
"abbr": "PD",
|
|
321
311
|
"type": "discharge"
|
|
322
312
|
},
|
|
323
|
-
|
|
324
313
|
"battery": {
|
|
325
314
|
"name": "Battery",
|
|
326
315
|
"psrType": "B98",
|
|
@@ -329,7 +318,6 @@
|
|
|
329
318
|
"abbr": "BA",
|
|
330
319
|
"type": "dispatchablegreen"
|
|
331
320
|
},
|
|
332
|
-
|
|
333
321
|
"batteryCharge": {
|
|
334
322
|
"name": "Battery charge",
|
|
335
323
|
"psrType": "B98",
|
|
@@ -338,7 +326,6 @@
|
|
|
338
326
|
"abbr": "BG",
|
|
339
327
|
"type": "charge"
|
|
340
328
|
},
|
|
341
|
-
|
|
342
329
|
"batteryDischarge": {
|
|
343
330
|
"name": "Battery discharge",
|
|
344
331
|
"psrType": "B98",
|
|
@@ -347,8 +334,6 @@
|
|
|
347
334
|
"abbr": "BD",
|
|
348
335
|
"type": "discharge"
|
|
349
336
|
},
|
|
350
|
-
|
|
351
|
-
|
|
352
337
|
"power2gas": {
|
|
353
338
|
"name": "Power2gas",
|
|
354
339
|
"psrType": "H2",
|
|
@@ -357,7 +342,6 @@
|
|
|
357
342
|
"abbr": "H2",
|
|
358
343
|
"type": "dispatchablegreen"
|
|
359
344
|
},
|
|
360
|
-
|
|
361
345
|
"power2gasCharge": {
|
|
362
346
|
"name": "Power2gas charge",
|
|
363
347
|
"psrType": "H2",
|
|
@@ -366,8 +350,6 @@
|
|
|
366
350
|
"abbr": "HG",
|
|
367
351
|
"type": "charge"
|
|
368
352
|
},
|
|
369
|
-
|
|
370
|
-
|
|
371
353
|
"power2gasDischarge": {
|
|
372
354
|
"name": "Power2gas discharge",
|
|
373
355
|
"psrType": "H2",
|
|
@@ -376,8 +358,6 @@
|
|
|
376
358
|
"abbr": "HD",
|
|
377
359
|
"type": "discharge"
|
|
378
360
|
},
|
|
379
|
-
|
|
380
|
-
|
|
381
361
|
"power2liquid": {
|
|
382
362
|
"name": "Power2liquid",
|
|
383
363
|
"psrType": "L2",
|
|
@@ -386,7 +366,6 @@
|
|
|
386
366
|
"abbr": "L2",
|
|
387
367
|
"type": "dispatchablegreen"
|
|
388
368
|
},
|
|
389
|
-
|
|
390
369
|
"otherRenewable": {
|
|
391
370
|
"name": "Other renewable",
|
|
392
371
|
"psrType": "B15",
|
|
@@ -403,6 +382,14 @@
|
|
|
403
382
|
"abbr": "SO",
|
|
404
383
|
"type": "intermittentgreen"
|
|
405
384
|
},
|
|
385
|
+
"heatPump": {
|
|
386
|
+
"name": "Heat pump",
|
|
387
|
+
"psrType": "H1",
|
|
388
|
+
"co2Footprint": 733,
|
|
389
|
+
"color": "#ff00ff",
|
|
390
|
+
"abbr": "HE",
|
|
391
|
+
"type": "electric"
|
|
392
|
+
},
|
|
406
393
|
"ev": {
|
|
407
394
|
"name": "EV",
|
|
408
395
|
"psrType": "F16",
|
|
@@ -420,7 +407,6 @@
|
|
|
420
407
|
"type": "storage",
|
|
421
408
|
"yAxis": "hydroFill"
|
|
422
409
|
},
|
|
423
|
-
|
|
424
410
|
"hydroWaterReservoirIncrease": {
|
|
425
411
|
"name": "Hydro Fill added Reservoir",
|
|
426
412
|
"psrType": "H99",
|
|
@@ -475,8 +461,6 @@
|
|
|
475
461
|
"yAxis": "hydroFill",
|
|
476
462
|
"type": "storage"
|
|
477
463
|
},
|
|
478
|
-
|
|
479
|
-
|
|
480
464
|
"crossBorder": {
|
|
481
465
|
"name": "Cross Border",
|
|
482
466
|
"psrType": "H49",
|
|
@@ -492,5 +476,13 @@
|
|
|
492
476
|
"co2Footprint": 0,
|
|
493
477
|
"color": "#cfcfcf",
|
|
494
478
|
"abbr": "CU"
|
|
479
|
+
},
|
|
480
|
+
"temperature": {
|
|
481
|
+
"name": "Temperature",
|
|
482
|
+
"psrType": "T1",
|
|
483
|
+
"co2Footprint": 0,
|
|
484
|
+
"color": "red",
|
|
485
|
+
"abbr": "CB",
|
|
486
|
+
"type": "temperature"
|
|
495
487
|
}
|
|
496
|
-
}
|
|
488
|
+
}
|
|
@@ -75,6 +75,9 @@ export class LoadAndParse {
|
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
+
if (chartType === 'congestion') {
|
|
79
|
+
return await this.loadService.getCongestionCost(countryCode,year, month, queryOptions);
|
|
80
|
+
}
|
|
78
81
|
if (chartType === 'hydrofill') {
|
|
79
82
|
return await this.loadService.getHydrofill(countryCode, queryOptions);
|
|
80
83
|
}
|
|
@@ -84,5 +87,8 @@ export class LoadAndParse {
|
|
|
84
87
|
if (chartType === 'countrydata') {
|
|
85
88
|
return await this.loadService.getCountrydata(countryCode, queryOptions);
|
|
86
89
|
}
|
|
90
|
+
if(chartType === 'temperature' ){
|
|
91
|
+
return await this.loadService.getTemperature(countryCode, queryOptions);
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
}
|
|
@@ -16,6 +16,9 @@ export class PowerRouter {
|
|
|
16
16
|
router.get(`/:country/:year/:month`, async (req, res) => {
|
|
17
17
|
await this.load(config, req, res, 'power');
|
|
18
18
|
});
|
|
19
|
+
router.get(`/:country/congestion/:year/:month`, async (req, res) => {
|
|
20
|
+
await this.load(config, req, res, 'congestion');
|
|
21
|
+
});
|
|
19
22
|
router.get(`/:country/fossil`, async (req, res) => {
|
|
20
23
|
await this.load(config, req, res, 'fossil');
|
|
21
24
|
});
|
|
@@ -8,6 +8,7 @@ import { EurostatAPI } from './Eurostat';
|
|
|
8
8
|
import { Types } from '../interfaces/types';
|
|
9
9
|
import { Format, QueryOptions } from '../interfaces/queryoptions';
|
|
10
10
|
import { NaturalGasPrices } from './NaturalGasPrice';
|
|
11
|
+
import { Temperature } from './Temperature';
|
|
11
12
|
import { Entsoe } from '../interfaces/entsoe';
|
|
12
13
|
import { EnergyCharts } from './EnergyCharts';
|
|
13
14
|
import { FuelPrices } from './FuelPrices';
|
|
@@ -44,19 +45,56 @@ export class LoadService {
|
|
|
44
45
|
const startMonth = new Date(Date.UTC(year, month - 1)).toISOString();
|
|
45
46
|
const endMonth = new Date(Date.UTC(year, month)).toISOString();
|
|
46
47
|
const energyCharts = new EnergyCharts();
|
|
47
|
-
try{
|
|
48
|
-
|
|
48
|
+
try {
|
|
49
|
+
const power = await energyCharts.load(
|
|
50
|
+
countryCode,
|
|
51
|
+
startMonth,
|
|
52
|
+
endMonth,
|
|
53
|
+
queryOptions
|
|
54
|
+
);
|
|
55
|
+
return power;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.error(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async getPower(
|
|
61
|
+
countryCode: string,
|
|
62
|
+
year: number,
|
|
63
|
+
month: number,
|
|
64
|
+
queryOptions?: QueryOptions
|
|
65
|
+
): Promise<any> {
|
|
66
|
+
const startMonth = new Date(Date.UTC(year, month - 1)).toISOString();
|
|
67
|
+
const endMonth = new Date(Date.UTC(year, month)).toISOString();
|
|
68
|
+
const wanted = ['generation', 'price', 'consumption'];
|
|
69
|
+
if (queryOptions?.format === Format.SOURCES) {
|
|
70
|
+
return this.loader.makeUrls(wanted, countryCode, year, month);
|
|
71
|
+
}
|
|
72
|
+
const edifactAsJson = await this.loader.load(
|
|
73
|
+
wanted,
|
|
49
74
|
countryCode,
|
|
50
|
-
|
|
51
|
-
|
|
75
|
+
year,
|
|
76
|
+
month,
|
|
52
77
|
queryOptions
|
|
53
78
|
);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
if (queryOptions?.format === Format.EDIJSON) {
|
|
80
|
+
return edifactAsJson;
|
|
81
|
+
}
|
|
82
|
+
const parsed = await this.parser.parseAll(edifactAsJson);
|
|
83
|
+
delete parsed.generation; //workaround for entsoe data
|
|
84
|
+
if (queryOptions?.format === Format.KEYVALUE) {
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
|
87
|
+
const ready: any = CommonTimestamps.transform(parsed, startMonth, endMonth);
|
|
88
|
+
//console.log('e.price',e.price)
|
|
89
|
+
/*
|
|
90
|
+
if (!e.price) {
|
|
91
|
+
e.price = ready.price
|
|
92
|
+
}
|
|
93
|
+
*/
|
|
94
|
+
return ready;
|
|
58
95
|
}
|
|
59
|
-
|
|
96
|
+
|
|
97
|
+
async getCongestionCost(
|
|
60
98
|
countryCode: string,
|
|
61
99
|
year: number,
|
|
62
100
|
month: number,
|
|
@@ -64,7 +102,7 @@ export class LoadService {
|
|
|
64
102
|
): Promise<any> {
|
|
65
103
|
const startMonth = new Date(Date.UTC(year, month - 1)).toISOString();
|
|
66
104
|
const endMonth = new Date(Date.UTC(year, month)).toISOString();
|
|
67
|
-
const wanted = ['
|
|
105
|
+
const wanted = ['congestion'];
|
|
68
106
|
if (queryOptions?.format === Format.SOURCES) {
|
|
69
107
|
return this.loader.makeUrls(wanted, countryCode, year, month);
|
|
70
108
|
}
|
|
@@ -152,7 +190,7 @@ export class LoadService {
|
|
|
152
190
|
const eurostat = new NaturalGasPrices();
|
|
153
191
|
return await eurostat.load(country, queryOptions);
|
|
154
192
|
}
|
|
155
|
-
async getFuelPrices(){
|
|
193
|
+
async getFuelPrices() {
|
|
156
194
|
return await FuelPrices.getPrices();
|
|
157
195
|
}
|
|
158
196
|
|
|
@@ -169,6 +207,17 @@ export class LoadService {
|
|
|
169
207
|
fuelPrice: await this.getFuelPrices(),
|
|
170
208
|
installed: installed,
|
|
171
209
|
hydrofill: await this.getHydrofill(country, queryOptions),
|
|
210
|
+
temperature: await this.getTemperature(
|
|
211
|
+
country, queryOptions)
|
|
172
212
|
};
|
|
173
213
|
}
|
|
214
|
+
|
|
215
|
+
async getTemperature(
|
|
216
|
+
countryCode: string,
|
|
217
|
+
queryOptions: QueryOptions
|
|
218
|
+
) {
|
|
219
|
+
console.log('get temperature for', countryCode);
|
|
220
|
+
const temperature = new Temperature();
|
|
221
|
+
return await temperature.load(countryCode, queryOptions);
|
|
222
|
+
}
|
|
174
223
|
}
|