-
Notifications
You must be signed in to change notification settings - Fork 1
/
enel-analyzer.html
398 lines (346 loc) · 39 KB
/
enel-analyzer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--
v.1.1.0
Corretto bug di output excel mancante
Passato a nuova versione di charts.js, vediamo se elimina il problema dei "grafici fantasma" che comparivano ogni tanto.
Cambiato formato data, adattato a excel italiano
Spostata in alto l'interfaccia di input
v. 1.0.0
Cambiato metodo di elaborazione da ciclo for a metodo map ==> aumento smodato di velocita' di elaborazione
Riordinata GUI tramite tabella
Aggiunta opzione per scaricare dati solari da PVGIS
Aggiunta funzione per sfogliare giorni/mesi/anni uno per volta
Migliorato output numerico
v. 0.0.1: Prima versione pubblica
-->
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>Visualizzatore consumi enel</title>
</head>
<!-- <script src="Chart.bundle.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.min.js"></script>
<body>
<center><big><big><big>Visualizzatore consumi orari ENEL Energia</big></big></big><br>
<i>Versione 1.1.0 - 21/9/2022</i><br>
<i>Sorgenti: <a href="https://github.com/jumpjack/electric-sources/blob/main/enel-analyzer.html">link</a></i><br>
<i>(Vedi anche il sito nazionale ufficiale "<a href="https://www.consumienergia.it/portaleConsumi/it/letture_e_consumi.page">Portale consumi</a>"</i>)</center><br>
<br>
Codice POD: <input type="text" id="POD" name="POD" > (visibile solo nella bolletta)(<a href="file:///c:\temp\private.txt">memo</a>)<br>
Numero utente: <input type="text" id="username" name="username" > (visibile nella bolletta e su sito ENEL)(<a href="file:///c:\temp\private.txt">memo</a>)<br>
Data inizio (GGMMAAAA):<input type="text" id="inizio" name="inizio" value = "01082022"/><br>
Data fine (GGMMAAAA):<input type="text" id="fine" name="fine" value = "31082022"/><br>
<button onclick="creaLink()" >Crea link</button><br>
Link: <span id = "mylink" name="mylink"></span><br>
<br>
Incolla qui l'output del tuo link (*): <button onclick="inputData.value=''">Pulisci</button><br>
<textarea id="inputData" name="inputData" cols = 100 rows = 5>
{"data":{"esitoRichiesta":"0","aggregationResult":{"requestId":"","channel":"A","pod":"","numeroUtente":"","validityFrom":"01082022","validityTo":"31082022","total":309.014,"aggregations":[{"referenceID":"hourlyConsumption","resultType":"daily","results":[{"date":"01082022","measureType":"RN","binValues":[{"name":"H1","value":0.837},{"name":"H2","value":0.436},{"name":"H3","value":0.833},{"name":"H4","value":2.768},{"name":"H5","value":2.756},{"name":"H6","value":2.745},{"name":"H7","value":1.296},{"name":"H8","value":0.662},{"name":"H9","value":0.147},{"name":"H10","value":0.152},{"name":"H11","value":0.15},{"name":"H12","value":0.152},{"name":"H13","value":0.154},{"name":"H14","value":0.153},{"name":"H15","value":0.152},{"name":"H16","value":0.151},{"name":"H17","value":0.151},{"name":"H18","value":0.376},{"name":"H19","value":1.355},{"name":"H20","value":1.08},{"name":"H21","value":0.642},{"name":"H22","value":1.005},{"name":"H23","value":1.169},{"name":"H24","value":0.623}]},{"date":"02082022","measureType":"RN","binValues":[{"name":"H1","value":0.427},{"name":"H2","value":0.424},{"name":"H3","value":0.8},{"name":"H4","value":2.712},{"name":"H5","value":2.538},{"name":"H6","value":0.449},{"name":"H7","value":0.394},{"name":"H8","value":0.649},{"name":"H9","value":0.228},{"name":"H10","value":0.223},{"name":"H11","value":0.209},{"name":"H12","value":0.208},{"name":"H13","value":0.22},{"name":"H14","value":0.224},{"name":"H15","value":0.227},{"name":"H16","value":0.226},{"name":"H17","value":0.227},{"name":"H18","value":0.924},{"name":"H19","value":1.243},{"name":"H20","value":0.238},{"name":"H21","value":0.254},{"name":"H22","value":0.796},{"name":"H23","value":0.679},{"name":"H24","value":0.471}]},{"date":"03082022","measureType":"RN","binValues":[{"name":"H1","value":0.457},{"name":"H2","value":0.433},{"name":"H3","value":0.85},{"name":"H4","value":2.771},{"name":"H5","value":2.751},{"name":"H6","value":1.675},{"name":"H7","value":0.413},{"name":"H8","value":0.426},{"name":"H9","value":0.155},{"name":"H10","value":0.154},{"name":"H11","value":0.142},{"name":"H12","value":0.135},{"name":"H13","value":0.136},{"name":"H14","value":0.15},{"name":"H15","value":0.151},{"name":"H16","value":0.158},{"name":"H17","value":0.169},{"name":"H18","value":0.677},{"name":"H19","value":1.161},{"name":"H20","value":0.32},{"name":"H21","value":0.378},{"name":"H22","value":0.424},{"name":"H23","value":0.495},{"name":"H24","value":0.414}]},{"date":"04082022","measureType":"RN","binValues":[{"name":"H1","value":0.443},{"name":"H2","value":0.451},{"name":"H3","value":0.818},{"name":"H4","value":2.73},{"name":"H5","value":2.571},{"name":"H6","value":0.47},{"name":"H7","value":0.302},{"name":"H8","value":0.386},{"name":"H9","value":0.152},{"name":"H10","value":0.139},{"name":"H11","value":0.135},{"name":"H12","value":0.137},{"name":"H13","value":0.145},{"name":"H14","value":0.151},{"name":"H15","value":0.15},{"name":"H16","value":0.151},{"name":"H17","value":0.159},{"name":"H18","value":0.232},{"name":"H19","value":2.741},{"name":"H20","value":2.71},{"name":"H21","value":2.726},{"name":"H22","value":1.712},{"name":"H23","value":1.045},{"name":"H24","value":0.457}]},{"date":"05082022","measureType":"RN","binValues":[{"name":"H1","value":0.466},{"name":"H2","value":0.429},{"name":"H3","value":0.42},{"name":"H4","value":0.397},{"name":"H5","value":0.393},{"name":"H6","value":0.416},{"name":"H7","value":0.427},{"name":"H8","value":0.467},{"name":"H9","value":0.15},{"name":"H10","value":0.149},{"name":"H11","value":0.148},{"name":"H12","value":0.147},{"name":"H13","value":0.148},{"name":"H14","value":0.147},{"name":"H15","value":0.147},{"name":"H16","value":0.142},{"name":"H17","value":0.147},{"name":"H18","value":0.154},{"name":"H19","value":0.143},{"name":"H20","value":0.141},{"name":"H21","value":0.142},{"name":"H22","value":0.141},{"name":"H23","value":0.149},{"name":"H24","value":0.154}]},{"date":"06082022","measureType":"RN","binValues":[{"name":"H1","value":0.479},{"name":"H2","value":0.439},{"name":"H3","value":0.861},{"name":"H4","value":2.766},{"name":"H5","value":2.759},{"name":"H6","value":1.789},{"name":"H7","value":0.692},{"name":"H8","value":0.941},{"name":"H9","value":0.445},{"name":"H10","value":0.162},{"name":"H11","value":0.144},{"name":"H12","value":0.145},{"name":"H13","value":0.147},{"name":"H14","value":0.146},{"name":"H15","value":0.147},{"name":"H16","value":0.147},{"name":"H17","value":0.147},{"name":"H18","value":0.146},{"name":"H19","value":0.141},{"name":"H20","value":0.14},{"name":"H21","value":0.141},{"name":"H22","value":0.141},{"name":"H23","value":0.146},{"name":"H24","value":0.149}]},{"date":"07082022","measureType":"RN","binValues":[{"name":"H1","value":0.181},{"name":"H2","value":0.206},{"name":"H3","value":0.568},{"name":"H4","value":2.493},{"name":"H5","value":2.491},{"name":"H6","value":2.056},{"name":"H7","value":0.657},{"name":"H8","value":0.162},{"name":"H9","value":0.17},{"name":"H10","value":0.245},{"name":"H11","value":0.583},{"name":"H12","value":0.814},{"name":"H13","value":0.995},{"name":"H14","value":1.255},{"name":"H15","value":0.975},{"name":"H16","value":1.189},{"name":"H17","value":0.846},{"name":"H18","value":0.829},{"name":"H19","value":0.648},{"name":"H20","value":0.73},{"name":"H21","value":0.834},{"name":"H22","value":0.779},{"name":"H23","value":0.78},{"name":"H24","value":0.523}]},{"date":"08082022","measureType":"RN","binValues":[{"name":"H1","value":0.442},{"name":"H2","value":0.329},{"name":"H3","value":0.313},{"name":"H4","value":0.302},{"name":"H5","value":0.271},{"name":"H6","value":0.273},{"name":"H7","value":0.286},{"name":"H8","value":0.143},{"name":"H9","value":0.173},{"name":"H10","value":0.31},{"name":"H11","value":0.303},{"name":"H12","value":0.306},{"name":"H13","value":0.33},{"name":"H14","value":0.367},{"name":"H15","value":0.306},{"name":"H16","value":0.358},{"name":"H17","value":0.309},{"name":"H18","value":0.309},{"name":"H19","value":0.37},{"name":"H20","value":0.557},{"name":"H21","value":0.463},{"name":"H22","value":0.341},{"name":"H23","value":0.308},{"name":"H24","value":0.215}]},{"date":"09082022","measureType":"RN","binValues":[{"name":"H1","value":0.163},{"name":"H2","value":0.141},{"name":"H3","value":0.135},{"name":"H4","value":0.138},{"name":"H5","value":0.139},{"name":"H6","value":0.153},{"name":"H7","value":0.151},{"name":"H8","value":0.693},{"name":"H9","value":2.63},{"name":"H10","value":0.929},{"name":"H11","value":0.602},{"name":"H12","value":0.652},{"name":"H13","value":0.95},{"name":"H14","value":0.717},{"name":"H15","value":0.694},{"name":"H16","value":0.478},{"name":"H17","value":0.544},{"name":"H18","value":0.546},{"name":"H19","value":0.548},{"name":"H20","value":0.626},{"name":"H21","value":0.334},{"name":"H22","value":0.337},{"name":"H23","value":0.615},{"name":"H24","value":0.342}]},{"date":"10082022","measureType":"RN","binValues":[{"name":"H1","value":0.477},{"name":"H2","value":0.119},{"name":"H3","value":0.537},{"name":"H4","value":1.12},{"name":"H5","value":0.119},{"name":"H6","value":0.121},{"name":"H7","value":0.116},{"name":"H8","value":0.392},{"name":"H9","value":0.132},{"name":"H10","value":0.126},{"name":"H11","value":0.128},{"name":"H12","value":0.126},{"name":"H13","value":0.127},{"name":"H14","value":0.778},{"name":"H15","value":1.243},{"name":"H16","value":0.121},{"name":"H17","value":0.122},{"name":"H18","value":0.122},{"name":"H19","value":0.122},{"name":"H20","value":2.625},{"name":"H21","value":3.202},{"name":"H22","value":2.861},{"name":"H23","value":0.283},{"name":"H24","value":0.136}]},{"date":"11082022","measureType":"RN","binValues":[{"name":"H1","value":2.522},{"name":"H2","value":2.513},{"name":"H3","value":1.469},{"name":"H4","value":0.134},{"name":"H5","value":0.133},{"name":"H6","value":0.146},{"name":"H7","value":0.148},{"name":"H8","value":0.492},{"name":"H9","value":0.378},{"name":"H10","value":0.284},{"name":"H11","value":0.277},{"name":"H12","value":0.97},{"name":"H13","value":1.019},{"name":"H14","value":0.725},{"name":"H15","value":0.657},{"name":"H16","value":0.594},{"name":"H17","value":0.408},{"name":"H18","value":0.309},{"name":"H19","value":0.322},{"name":"H20","value":0.4},{"name":"H21","value":0.37},{"name":"H22","value":0.535},{"name":"H23","value":0.871},{"name":"H24","value":0.933}]},{"date":"12082022","measureType":"RN","binValues":[{"name":"H1","value":0.441},{"name":"H2","value":0.387},{"name":"H3","value":0.405},{"name":"H4","value":0.403},{"name":"H5","value":0.367},{"name":"H6","value":0.372},{"name":"H7","value":0.386},{"name":"H8","value":0.204},{"name":"H9","value":0.135},{"name":"H10","value":0.133},{"name":"H11","value":0.118},{"name":"H12","value":0.116},{"name":"H13","value":0.12},{"name":"H14","value":0.133},{"name":"H15","value":0.13},{"name":"H16","value":0.13},{"name":"H17","value":0.13},{"name":"H18","value":0.132},{"name":"H19","value":0.124},{"name":"H20","value":0.12},{"name":"H21","value":0.12},{"name":"H22","value":0.121},{"name":"H23","value":0.133},{"name":"H24","value":0.133}]},{"date":"13082022","measureType":"RN","binValues":[{"name":"H1","value":0.132},{"name":"H2","value":0.122},{"name":"H3","value":0.116},{"name":"H4","value":0.116},{"name":"H5","value":0.115},{"name":"H6","value":0.119},{"name":"H7","value":0.12},{"name":"H8","value":0.122},{"name":"H9","value":0.132},{"name":"H10","value":0.13},{"name":"H11","value":0.13},{"name":"H12","value":0.13},{"name":"H13","value":0.13},{"name":"H14","value":0.131},{"name":"H15","value":0.121},{"name":"H16","value":0.119},{"name":"H17","value":0.121},{"name":"H18","value":0.122},{"name":"H19","value":0.121},{"name":"H20","value":0.129},{"name":"H21","value":0.129},{"name":"H22","value":0.129},{"name":"H23","value":0.13},{"name":"H24","value":0.13}]},{"date":"14082022","measureType":"RN","binValues":[{"name":"H1","value":0.131},{"name":"H2","value":0.122},{"name":"H3","value":0.116},{"name":"H4","value":0.111},{"name":"H5","value":0.108},{"name":"H6","value":0.12},{"name":"H7","value":0.121},{"name":"H8","value":0.128},{"name":"H9","value":0.132},{"name":"H10","value":0.131},{"name":"H11","value":0.131},{"name":"H12","value":0.133},{"name":"H13","value":0.133},{"name":"H14","value":0.127},{"name":"H15","value":0.121},{"name":"H16","value":0.118},{"name":"H17","value":0.125},{"name":"H18","value":0.136},{"name":"H19","value":0.136},{"name":"H20","value":0.133},{"name":"H21","value":0.132},{"name":"H22","value":0.111},{"name":"H23","value":0.123},{"name":"H24","value":0.133}]},{"date":"15082022","measureType":"RN","binValues":[{"name":"H1","value":0.133},{"name":"H2","value":0.123},{"name":"H3","value":0.117},{"name":"H4","value":0.117},{"name":"H5","value":0.113},{"name":"H6","value":0.12},{"name":"H7","value":0.121},{"name":"H8","value":0.12},{"name":"H9","value":0.13},{"name":"H10","value":0.13},{"name":"H11","value":0.13},{"name":"H12","value":0.13},{"name":"H13","value":0.133},{"name":"H14","value":0.133},{"name":"H15","value":0.127},{"name":"H16","value":0.12},{"name":"H17","value":0.119},{"name":"H18","value":0.119},{"name":"H19","value":0.131},{"name":"H20","value":0.131},{"name":"H21","value":0.131},{"name":"H22","value":0.132},{"name":"H23","value":0.133},{"name":"H24","value":0.132}]},{"date":"16082022","measureType":"RN","binValues":[{"name":"H1","value":0.122},{"name":"H2","value":0.111},{"name":"H3","value":0.106},{"name":"H4","value":0.109},{"name":"H5","value":0.116},{"name":"H6","value":0.132},{"name":"H7","value":0.132},{"name":"H8","value":0.133},{"name":"H9","value":0.13},{"name":"H10","value":0.128},{"name":"H11","value":0.12},{"name":"H12","value":0.12},{"name":"H13","value":0.119},{"name":"H14","value":0.125},{"name":"H15","value":0.131},{"name":"H16","value":0.132},{"name":"H17","value":0.13},{"name":"H18","value":0.131},{"name":"H19","value":0.13},{"name":"H20","value":0.129},{"name":"H21","value":0.12},{"name":"H22","value":0.121},{"name":"H23","value":0.121},{"name":"H24","value":0.12}]},{"date":"17082022","measureType":"RN","binValues":[{"name":"H1","value":0.131},{"name":"H2","value":0.123},{"name":"H3","value":0.117},{"name":"H4","value":0.117},{"name":"H5","value":0.117},{"name":"H6","value":0.133},{"name":"H7","value":0.132},{"name":"H8","value":0.127},{"name":"H9","value":0.122},{"name":"H10","value":0.122},{"name":"H11","value":0.121},{"name":"H12","value":0.122},{"name":"H13","value":0.131},{"name":"H14","value":0.132},{"name":"H15","value":0.132},{"name":"H16","value":0.131},{"name":"H17","value":0.132},{"name":"H18","value":0.131},{"name":"H19","value":0.132},{"name":"H20","value":0.122},{"name":"H21","value":0.118},{"name":"H22","value":0.122},{"name":"H23","value":0.122},{"name":"H24","value":0.129}]},{"date":"18082022","measureType":"RN","binValues":[{"name":"H1","value":0.134},{"name":"H2","value":0.123},{"name":"H3","value":0.117},{"name":"H4","value":0.117},{"name":"H5","value":0.117},{"name":"H6","value":0.132},{"name":"H7","value":0.133},{"name":"H8","value":0.126},{"name":"H9","value":0.123},{"name":"H10","value":0.122},{"name":"H11","value":0.122},{"name":"H12","value":0.124},{"name":"H13","value":0.132},{"name":"H14","value":0.132},{"name":"H15","value":0.131},{"name":"H16","value":0.131},{"name":"H17","value":0.131},{"name":"H18","value":0.132},{"name":"H19","value":0.131},{"name":"H20","value":0.131},{"name":"H21","value":0.124},{"name":"H22","value":0.122},{"name":"H23","value":0.125},{"name":"H24","value":0.126}]},{"date":"19082022","measureType":"RN","binValues":[{"name":"H1","value":0.126},{"name":"H2","value":0.118},{"name":"H3","value":0.118},{"name":"H4","value":0.116},{"name":"H5","value":0.117},{"name":"H6","value":0.133},{"name":"H7","value":0.134},{"name":"H8","value":0.132},{"name":"H9","value":0.133},{"name":"H10","value":0.132},{"name":"H11","value":0.133},{"name":"H12","value":0.127},{"name":"H13","value":0.125},{"name":"H14","value":0.126},{"name":"H15","value":0.126},{"name":"H16","value":0.125},{"name":"H17","value":0.124},{"name":"H18","value":0.132},{"name":"H19","value":0.135},{"name":"H20","value":0.133},{"name":"H21","value":0.131},{"name":"H22","value":0.132},{"name":"H23","value":0.134},{"name":"H24","value":0.132}]},{"date":"20082022","measureType":"RN","binValues":[{"name":"H1","value":0.135},{"name":"H2","value":0.125},{"name":"H3","value":0.11},{"name":"H4","value":0.109},{"name":"H5","value":0.11},{"name":"H6","value":0.124},{"name":"H7","value":0.127},{"name":"H8","value":0.133},{"name":"H9","value":0.133},{"name":"H10","value":0.133},{"name":"H11","value":0.133},{"name":"H12","value":0.134},{"name":"H13","value":0.134},{"name":"H14","value":0.133},{"name":"H15","value":0.125},{"name":"H16","value":0.123},{"name":"H17","value":0.123},{"name":"H18","value":0.122},{"name":"H19","value":0.126},{"name":"H20","value":0.134},{"name":"H21","value":1.575},{"name":"H22","value":2.974},{"name":"H23","value":3.26},{"name":"H24","value":1.708}]},{"date":"21082022","measureType":"RN","binValues":[{"name":"H1","value":0.752},{"name":"H2","value":0.391},{"name":"H3","value":0.376},{"name":"H4","value":0.366},{"name":"H5","value":0.357},{"name":"H6","value":0.382},{"name":"H7","value":0.387},{"name":"H8","value":0.396},{"name":"H9","value":0.426},{"name":"H10","value":0.702},{"name":"H11","value":0.259},{"name":"H12","value":0.133},{"name":"H13","value":0.129},{"name":"H14","value":0.11},{"name":"H15","value":0.108},{"name":"H16","value":0.122},{"name":"H17","value":0.128},{"name":"H18","value":0.129},{"name":"H19","value":3.211},{"name":"H20","value":1.81},{"name":"H21","value":0.616},{"name":"H22","value":0.325},{"name":"H23","value":0.119},{"name":"H24","value":0.138}]},{"date":"22082022","measureType":"RN","binValues":[{"name":"H1","value":0.138},{"name":"H2","value":2.43},{"name":"H3","value":2.5},{"name":"H4","value":0.81},{"name":"H5","value":0.105},{"name":"H6","value":0.125},{"name":"H7","value":0.137},{"name":"H8","value":0.369},{"name":"H9","value":0.138},{"name":"H10","value":0.152},{"name":"H11","value":0.151},{"name":"H12","value":0.16},{"name":"H13","value":0.371},{"name":"H14","value":0.657},{"name":"H15","value":0.597},{"name":"H16","value":0.547},{"name":"H17","value":0.342},{"name":"H18","value":0.183},{"name":"H19","value":0.208},{"name":"H20","value":0.335},{"name":"H21","value":0.418},{"name":"H22","value":0.393},{"name":"H23","value":0.389},{"name":"H24","value":0.273}]},{"date":"23082022","measureType":"RN","binValues":[{"name":"H1","value":0.165},{"name":"H2","value":0.154},{"name":"H3","value":0.541},{"name":"H4","value":1.204},{"name":"H5","value":0.135},{"name":"H6","value":0.165},{"name":"H7","value":0.173},{"name":"H8","value":0.396},{"name":"H9","value":0.199},{"name":"H10","value":0.298},{"name":"H11","value":0.2},{"name":"H12","value":0.896},{"name":"H13","value":0.574},{"name":"H14","value":0.412},{"name":"H15","value":0.288},{"name":"H16","value":0.305},{"name":"H17","value":0.295},{"name":"H18","value":0.194},{"name":"H19","value":0.235},{"name":"H20","value":0.381},{"name":"H21","value":0.624},{"name":"H22","value":0.491},{"name":"H23","value":0.504},{"name":"H24","value":0.164}]},{"date":"24082022","measureType":"RN","binValues":[{"name":"H1","value":0.166},{"name":"H2","value":0.155},{"name":"H3","value":0.538},{"name":"H4","value":2.233},{"name":"H5","value":0.159},{"name":"H6","value":0.167},{"name":"H7","value":0.17},{"name":"H8","value":0.401},{"name":"H9","value":0.296},{"name":"H10","value":0.17},{"name":"H11","value":0.154},{"name":"H12","value":0.144},{"name":"H13","value":0.171},{"name":"H14","value":0.175},{"name":"H15","value":0.156},{"name":"H16","value":0.142},{"name":"H17","value":0.155},{"name":"H18","value":0.184},{"name":"H19","value":0.15},{"name":"H20","value":0.14},{"name":"H21","value":0.162},{"name":"H22","value":0.169},{"name":"H23","value":0.17},{"name":"H24","value":0.302}]},{"date":"25082022","measureType":"RN","binValues":[{"name":"H1","value":0.217},{"name":"H2","value":0.142},{"name":"H3","value":0.137},{"name":"H4","value":0.149},{"name":"H5","value":0.154},{"name":"H6","value":0.168},{"name":"H7","value":0.169},{"name":"H8","value":0.168},{"name":"H9","value":0.155},{"name":"H10","value":0.219},{"name":"H11","value":0.255},{"name":"H12","value":0.158},{"name":"H13","value":0.158},{"name":"H14","value":0.159},{"name":"H15","value":0.16},{"name":"H16","value":0.801},{"name":"H17","value":1.125},{"name":"H18","value":0.336},{"name":"H19","value":0.274},{"name":"H20","value":0.341},{"name":"H21","value":0.235},{"name":"H22","value":0.22},{"name":"H23","value":0.307},{"name":"H24","value":0.77}]},{"date":"26082022","measureType":"RN","binValues":[{"name":"H1","value":0.138},{"name":"H2","value":0.116},{"name":"H3","value":0.503},{"name":"H4","value":2.473},{"name":"H5","value":2.473},{"name":"H6","value":2.376},{"name":"H7","value":0.497},{"name":"H8","value":0.928},{"name":"H9","value":0.658},{"name":"H10","value":0.831},{"name":"H11","value":0.231},{"name":"H12","value":0.196},{"name":"H13","value":0.136},{"name":"H14","value":0.196},{"name":"H15","value":0.228},{"name":"H16","value":0.313},{"name":"H17","value":0.276},{"name":"H18","value":0.27},{"name":"H19","value":0.332},{"name":"H20","value":0.335},{"name":"H21","value":0.321},{"name":"H22","value":0.243},{"name":"H23","value":0.266},{"name":"H24","value":0.314}]},{"date":"27082022","measureType":"RN","binValues":[{"name":"H1","value":0.445},{"name":"H2","value":0.444},{"name":"H3","value":0.417},{"name":"H4","value":0.419},{"name":"H5","value":0.413},{"name":"H6","value":0.377},{"name":"H7","value":0.152},{"name":"H8","value":0.143},{"name":"H9","value":0.116},{"name":"H10","value":0.116},{"name":"H11","value":0.159},{"name":"H12","value":0.221},{"name":"H13","value":0.32},{"name":"H14","value":0.298},{"name":"H15","value":0.258},{"name":"H16","value":0.19},{"name":"H17","value":0.393},{"name":"H18","value":1.069},{"name":"H19","value":0.299},{"name":"H20","value":0.342},{"name":"H21","value":0.454},{"name":"H22","value":0.471},{"name":"H23","value":0.981},{"name":"H24","value":0.178}]},{"date":"28082022","measureType":"RN","binValues":[{"name":"H1","value":0.14},{"name":"H2","value":0.122},{"name":"H3","value":0.115},{"name":"H4","value":0.117},{"name":"H5","value":0.116},{"name":"H6","value":0.132},{"name":"H7","value":0.131},{"name":"H8","value":0.132},{"name":"H9","value":0.174},{"name":"H10","value":0.17},{"name":"H11","value":0.383},{"name":"H12","value":0.375},{"name":"H13","value":0.347},{"name":"H14","value":0.415},{"name":"H15","value":0.341},{"name":"H16","value":0.323},{"name":"H17","value":0.24},{"name":"H18","value":0.284},{"name":"H19","value":0.289},{"name":"H20","value":0.443},{"name":"H21","value":0.407},{"name":"H22","value":0.391},{"name":"H23","value":0.231},{"name":"H24","value":0.168}]},{"date":"29082022","measureType":"RN","binValues":[{"name":"H1","value":0.163},{"name":"H2","value":0.152},{"name":"H3","value":0.534},{"name":"H4","value":1.779},{"name":"H5","value":0.143},{"name":"H6","value":0.156},{"name":"H7","value":0.156},{"name":"H8","value":0.198},{"name":"H9","value":0.272},{"name":"H10","value":0.369},{"name":"H11","value":0.328},{"name":"H12","value":0.283},{"name":"H13","value":0.468},{"name":"H14","value":0.381},{"name":"H15","value":0.304},{"name":"H16","value":0.294},{"name":"H17","value":0.294},{"name":"H18","value":0.409},{"name":"H19","value":0.869},{"name":"H20","value":0.656},{"name":"H21","value":0.406},{"name":"H22","value":0.32},{"name":"H23","value":0.228},{"name":"H24","value":0.162}]},{"date":"30082022","measureType":"RN","binValues":[{"name":"H1","value":0.152},{"name":"H2","value":0.138},{"name":"H3","value":0.135},{"name":"H4","value":0.137},{"name":"H5","value":0.136},{"name":"H6","value":0.153},{"name":"H7","value":0.153},{"name":"H8","value":0.127},{"name":"H9","value":0.127},{"name":"H10","value":0.138},{"name":"H11","value":0.324},{"name":"H12","value":0.302},{"name":"H13","value":0.482},{"name":"H14","value":0.608},{"name":"H15","value":0.174},{"name":"H16","value":0.117},{"name":"H17","value":0.118},{"name":"H18","value":0.121},{"name":"H19","value":0.12},{"name":"H20","value":0.123},{"name":"H21","value":0.514},{"name":"H22","value":0.568},{"name":"H23","value":0.715},{"name":"H24","value":0.907}]},{"date":"31082022","measureType":"RN","binValues":[{"name":"H1","value":0.423},{"name":"H2","value":0.388},{"name":"H3","value":0.776},{"name":"H4","value":2.607},{"name":"H5","value":2.453},{"name":"H6","value":2.444},{"name":"H7","value":0.295},{"name":"H8","value":0.312},{"name":"H9","value":0.144},{"name":"H10","value":0.146},{"name":"H11","value":0.171},{"name":"H12","value":0.246},{"name":"H13","value":0.356},{"name":"H14","value":0.652},{"name":"H15","value":0.86},{"name":"H16","value":0.117},{"name":"H17","value":0.118},{"name":"H18","value":0.124},{"name":"H19","value":0.126},{"name":"H20","value":0.121},{"name":"H21","value":0.296},{"name":"H22","value":0.874},{"name":"H23","value":0.553},{"name":"H24","value":0.441}]}]},{"referenceID":"dailyConsumption","resultType":"daily","results":[{"date":"01082022","measureType":"RN","binValues":[{"name":"D1","value":19.945}]},{"date":"02082022","measureType":"RN","binValues":[{"name":"D1","value":14.99}]},{"date":"03082022","measureType":"RN","binValues":[{"name":"D1","value":14.995}]},{"date":"04082022","measureType":"RN","binValues":[{"name":"D1","value":21.113}]},{"date":"05082022","measureType":"RN","binValues":[{"name":"D1","value":5.764}]},{"date":"06082022","measureType":"RN","binValues":[{"name":"D1","value":13.36}]},{"date":"07082022","measureType":"RN","binValues":[{"name":"D1","value":21.009}]},{"date":"08082022","measureType":"RN","binValues":[{"name":"D1","value":7.684}]},{"date":"09082022","measureType":"RN","binValues":[{"name":"D1","value":13.257}]},{"date":"10082022","measureType":"RN","binValues":[{"name":"D1","value":15.255}]},{"date":"11082022","measureType":"RN","binValues":[{"name":"D1","value":16.609}]},{"date":"12082022","measureType":"RN","binValues":[{"name":"D1","value":4.993}]},{"date":"13082022","measureType":"RN","binValues":[{"name":"D1","value":2.996}]},{"date":"14082022","measureType":"RN","binValues":[{"name":"D1","value":3.012}]},{"date":"15082022","measureType":"RN","binValues":[{"name":"D1","value":3.025}]},{"date":"16082022","measureType":"RN","binValues":[{"name":"D1","value":2.968}]},{"date":"17082022","measureType":"RN","binValues":[{"name":"D1","value":3.018}]},{"date":"18082022","measureType":"RN","binValues":[{"name":"D1","value":3.038}]},{"date":"19082022","measureType":"RN","binValues":[{"name":"D1","value":3.074}]},{"date":"20082022","measureType":"RN","binValues":[{"name":"D1","value":12.043}]},{"date":"21082022","measureType":"RN","binValues":[{"name":"D1","value":11.872}]},{"date":"22082022","measureType":"RN","binValues":[{"name":"D1","value":11.928}]},{"date":"23082022","measureType":"RN","binValues":[{"name":"D1","value":8.993}]},{"date":"24082022","measureType":"RN","binValues":[{"name":"D1","value":6.829}]},{"date":"25082022","measureType":"RN","binValues":[{"name":"D1","value":6.977}]},{"date":"26082022","measureType":"RN","binValues":[{"name":"D1","value":14.65}]},{"date":"27082022","measureType":"RN","binValues":[{"name":"D1","value":8.675}]},{"date":"28082022","measureType":"RN","binValues":[{"name":"D1","value":5.986}]},{"date":"29082022","measureType":"RN","binValues":[{"name":"D1","value":9.324}]},{"date":"30082022","measureType":"RN","binValues":[{"name":"D1","value":6.589}]},{"date":"31082022","measureType":"RN","binValues":[{"name":"D1","value":15.043}]}]}]}},"status":{"code":"0","result":"OK","description":"SUCCESS"},"meta":{"tid":"dbc04c7b-215d-4a73-b926-2c7cbc05f929","sid":"25dca03d-19eb-4443-8992-932a8e867187","path":"/query/v1/aggregateConsumption","method":"get-aggregate-consumption","dataAggiornamento":"19-09-2022 14:36:04"}}
</textarea><br>
<button onclick="elabora()">Elabora</button><br>
<br>
Status: <span id="spnStatus" name="spnStatus"></span><br>
<table border = 1>
<tr>
<td>
Input<br>
Giorno: <input type="number" id="giorno" name="giorno" value = "1" onchange="aggiorna()"><br>
Mese: <input type="number" id="mese" name="mese" value = "8" onchange="aggiorna()"><br>
Anno: <input type="number" id="anno" name="anno" value = "2022" onchange="aggiorna()"><br>
Euro/kWh: <input type="text" id="euk" name="euk" value = "0.30"><br>
<br>
Output:<br>
Minimo: <span id="spn_minimo" name="spn_minimo"></span><br>
Medio: <input type="text" id="spn_medio" name="spn_medio"><br>
Massimo:<span id="spn_massimo" name="spn_massimo"></span><br>
Totale: <span id="spn_totale" name="spn_totale"></span> <br>
<br>
Costi stimati in base a consumo medio giornaliero:<br>
Giorno: <span id="spn_costoGmed" name="spn_costoGmed"></span><br>
Mese: <span id="spn_costoMmed" name="spn_costoMmed"></span><br>
Anno: <span id="spn_costoAmed" name="spn_costoAmed"></span><br>
<button onclick="ricalcola()">Ricalcola</button><br>
<br>
Costi reali:<br>
Giorno selezionato: <span id="spn_costoGtot" name="spn_costoGtot"></span> <br>
Periodo selezionato: <span id="spn_costoTotalePeriodo" name="spn_costoTotalePeriodo"></span> <br>
Media periodo selezionato: <span id="spn_costoMedioPeriodo" name="spn_costoMedioPeriodo"></span> Euro/giorno<br>
</td>
<td>
<button onclick="aggiorna()">Aggiorna</button><br>
<canvas id="myChart" width="400" height="400"></canvas>
</td>
</tr>
<tr>
<td>
Mostra dati solari (<a href="https://re.jrc.ec.europa.eu/pvg_tools/en/">Sito</a>):<br>
Latitudine: <input type="text" id="spnLat" name="spnLat" value = "42"><br>
Longitudine: <input type="text" id="spnLon" name="spnLon" value = "12"><br>
Potenza (kWp): <input type="text" id="spnPotenza" name="spnPotenza" value = "3"><br>
<!--
Superficie: <input type="text" id="spnArea" name="spnArea" value = "30"><br>
Efficienza (0-1): <input type="text" id="spnEff" name="spnEff" value = "0.2"><br>
-->
<button onclick="leggiDatiSolari()">Scarica</button><br>
</td>
<td>
<textarea id="solarData" name="solarData" cols = 50 rows= 15></textarea>
</td>
</tr>
</table>
<br>
<!--Anno: <span id="spn_costoAtot" name="spn_costoAtot"></span><br>-->
<br>
Output da incollare in spreadsheet:<br>
<textarea id="outputData" name="outputData" cols = 100 rows = 5></textarea><br>
<br>
<li>Pagina per dimensionamento pannelli solari a isola: <a href="https://jumpjack.altervista.org/pannelli/dimensionamento.html">Link</a></li>
<li>"Tool fotovoltaico" ufficiale dell'Unione Europea: <a href="https://re.jrc.ec.europa.eu/pvg_tools/it/">Link</a><br></li>
Cliccando su "FV autonoma" si possono inserire i dati del proprio sistema con accumulo e scoprire per quanto tempo durerebbe una determinata batteria, data una determinata potenza dell'impianto:
<img src="https://user-images.githubusercontent.com/1620953/191217769-885104a7-541b-485e-9e32-e45663f585f2.png"><br>
<br>
<hr>
(*)
Il link risulta attivo solo dopo che hai effettuato l'accesso alla tua area clienti sul sito <a href="https://www.enel.it/bin/areaclienti/">ENEL energia</a>.<br>
<br>
Link di esempio:<br>
https://www.enel.it/bin/areaclienti/auth/aggregateConsumption?pod=CODICE_POD&userNumber=NUMERO_UTENZA&validityFrom=INIZIO(GGMMAAAA)&validityTo=FINE(GGMMAAAA)&_=TTTTTTTTTTTTT<br>
<br>
<script>
PROXY = "http://win98.altervista.org/space/exploration/myp.php?pass=miapass&mode=native&url=";
const myLabels = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];
POD_LENGTH = 14;
USER_LENGTH = 9;
const params = new URLSearchParams(document.location.search);
const prmPOD = params.get("pod");
const prmUser = params.get("number");
if (prmPOD) {
if (prmPOD != "") {
if (prmPOD.length == POD_LENGTH) {
POD.value = prmPOD;
} else {
alert("ERRORE! Il POD deve essere lungo " + POD_LENGTH + " caratteri, nell'url hai scritto '" + prmPOD + "'")
}
} else {
// do nothing
}
} else {
// do nothing
}
if (prmUser) {
if (prmUser != "") {
if (prmUser.length == USER_LENGTH) {
username.value = prmUser;
} else {
alert("ERRORE! Il numero utente deve essere un numero di "+ USER_LENGTH + " cifre, nell'url hai scritto '" + prmUser + "'")
}
} else {
// do nothing
}
} else {
// do nothing
}
myConfig = {
type: 'bar',
data: {
labels: myLabels, // Etichette asse X
datasets: [{
label: 'Consumi giornalieri (kWh/h)',
data: [], // Dati (asse Y)
borderWidth: 1,
backgroundColor : 'rgb(0, 0, 255)'
}]
},
options: {
scales: {
y: {
beginAtZero: true,
stacked: false,
max : 3.5,
}
},
responsive: false,
animation: false
}
}
const ctx = document.getElementById('myChart').getContext('2d');
function elabora() {
periodTotalkWh = 0;
periodTotalsamples = 0;
spnStatus.innerHTML = "";
data = inputData.value;
JSONdata = JSON.parse(data);
hourData = JSONdata.data.aggregationResult.aggregations[0].results;
appoggio = {data: hourData};
periodTotalkWh=0;
periodTotalsamples=0;
var mapped = appoggio.data.map(function(obj) {
data = {value : obj.binValues, date: obj.date};
var mapped2 = data.value.map(function(obj2) {
periodTotalkWh += obj2.value;
periodTotalsamples++;
dateSplit = obj.date.substr(4,4) + "/" + obj.date.substr(2,2) + "/" + obj.date.substr(0,2);
outputData.value += dateSplit + " " + ((obj2.name.substr(1,2)*1)-1) + ":00\t" + (obj2.value+"").replace(".",",") + "\n"; // Per Excel
});
});
daysData = JSONdata.data.aggregationResult.aggregations[0].results;
try {
myChart = new Chart(ctx, myConfig)
} catch {
if (myChart) myChart.destroy();
myChart = new Chart(ctx, myConfig);
}
}
function creaLink() {
console.log(POD.value, username.value);
user = username.value.split(" ").join(""); // Rimuove spazi
if (user=="") {
alert("Manca numero utente!")
return;
}
if (user.length != USER_LENGTH) {
alert("ERRORE! Il numero utente deve essere un numero di 9 cifre, tu hai inserito '" + username.value + "'")
return;
}
if (POD.value=="") {
alert("Manca POD!")
return;
}
if (POD.value.length != POD_LENGTH) {
alert("ERRORE! Il POD deve essere lungo 14 caratteri, tu hai inserito '" + POD.value + "'")
return;
}
d = new Date()
timestamp = d.getTime();
base = "https://www.enel.it/bin/areaclienti/auth/aggregateConsumption?pod=";
parte2 = "&userNumber=";
parte3 = "&validityFrom=";
parte4 = "&validityTo="
finale = "&_=" + timestamp;
url = base + POD.value.toUpperCase() + parte2 + user + parte3 + inizio.value + parte4 + fine.value + finale;
console.log(url);
mylink.innerHTML = '<a href="' + url + '">click</a>';
}
function convertiDataRichiesta(d) {
for(var i = 0; i < daysData.length; i++) {
if (daysData[i].date == d) return i;
}
return -1;
}
async function aggiorna() {
dataUtente = zeri(giorno.value) + zeri(mese.value) + zeri(anno.value);
numeroPerData = convertiDataRichiesta(dataUtente);
if (numeroPerData < 0) {
alert("Giorno non disponibile: ", dataUtente);
return -2;
}
dayDataRaw = daysData[numeroPerData];
firstDay = daysData[0].date;
lastDay = daysData[daysData.length-1].date;
thisDay = dayDataRaw.date;
dayDate = dayDataRaw.date;
dayValues = [];
minimo = 10000;
massimo = -1;
medio = 0;
totale = 0;
conteggio = 0;
dayDataRaw.binValues.forEach((objVal) => {
dayValues.push(objVal.value); // per grafico
conteggio++;
totale += objVal.value;
if (objVal.value > massimo) massimo = objVal.value;
if (objVal.value < minimo) minimo = objVal.value;
});
medio = totale/conteggio;
calcolaCosti(medio, totale);
myConfig.data.datasets[0].data = dayValues;
myChart.update();
spn_minimo.innerHTML = minimo.toFixed(1) + " kWh";
spn_medio.value = medio.toFixed(1);
spn_massimo.innerHTML = massimo.toFixed(1) + " kWh";
spn_totale.innerHTML = totale.toFixed(0) + " kWh";
spn_costoGmed.innerHTML = costoG_daMedio.toFixed(0) + " Euro";
spn_costoMmed.innerHTML = costoM_daMedio.toFixed(0) + " Euro";
spn_costoAmed.innerHTML = costoA_daMedio.toFixed(0) + " Euro";
spn_costoGtot.innerHTML = costoG_daTotale.toFixed(0) + " Euro (" + readableDate(thisDay) + ")";
// spn_costoMtot.innerHTML = costoM_daTotale.toFixed(0) + " Euro";
// spn_costoAtot.innerHTML = costoA_daTotale.toFixed(0) + " Euro";
spn_costoTotalePeriodo.innerHTML = costoTotalePeriodo.toFixed(0) + " Euro (" + readableDate(firstDay) + " - " + readableDate(lastDay) + ")";
spn_costoMedioPeriodo.innerHTML = mediaPeriodo.toFixed(0);
//leggiDatiSolari();
}
async function leggiDatiSolari() {
latit = spnLat.value*1;
longi = spnLon.value*1;
/*area = spnArea.value*1;
efficiency = spnEff.value*1;*/
power = spnPotenza.value*1;
url = "http://re.jrc.ec.europa.eu/api/PVcalc?lat=" + latit + "&lon=" + longi + "&peakpower=" + power + "&loss=14&outputformat=csv";
results = await retrieve(url);
console.log(results);
solarData.value = results
}
function readableDate(s) {
return s.substr(0,2) + "/" + s.substr(2,2) + "/" + s.substr(4,4);
}
function calcolaCosti(medio, totale) {
costoG_daMedio = medio * 24 * euk.value;
costoG_daTotale = totale * euk.value;
costoM_daMedio = costoG_daMedio*30;
costoM_daTotale = costoG_daTotale*30;
costoA_daMedio = costoG_daMedio*365;
costoA_daTotale = costoG_daTotale*365;
costoTotalePeriodo = periodTotalkWh * euk.value;
mediaPeriodo = costoTotalePeriodo / (periodTotalsamples/24);
}
function ricalcola() {
calcolaCosti(spn_medio.value, totale);
spn_costoGmed.innerHTML = costoG_daMedio.toFixed(0) + " Euro";
spn_costoMmed.innerHTML = costoM_daMedio.toFixed(0) + " Euro";
spn_costoAmed.innerHTML = costoA_daMedio.toFixed(0) + " Euro";
// spn_costoGtot.innerHTML = costoG_daTotale.toFixed(0);
// spn_costoMtot.innerHTML = costoM_daTotale.toFixed(0);
// spn_costoAtot.innerHTML = costoA_daTotale.toFixed(0);
}
function zeri(v) {
if (v<10) {return "0"+v} else return v;
}
function retrieve(url, log, output, status) {
console.log(url, log, output, status);
return new Promise(resolve => {
finalURL = PROXY + encodeURIComponent(url);
var myClient = new XMLHttpRequest();
myClient.open('GET',finalURL);
myClient.onprogress = function(event) {
//showDownloadProgress(myClient.response.length, status);
};
myClient.responseType = 'text';
myClient.onload = function(response) {
//console.log("### Raw response for RETRIEVE: ",response);
//console.log("### Sub-response for RETRIEVE: ",response.currentTarget.response);
if (log) {log.value += "Legacy response received.\n"} else {console.log("Legacy response received.\n")};
if (output) {output.value = response} else {console.log(response)};
rawResponse = response.currentTarget.response;
validResponse = rawResponse.substr(rawResponse.indexOf("Latitude"), rawResponse.length - rawResponse.indexOf("Latitude") + 1);
try {
resolve(validResponse);
} catch (e) {
console.log("Errore nei dati solari da url ", url, e );
console.log(rawResponse);
resolve ("ERRORE - " + rawResponse);
}
}
myClient.onerror = function(event) {
if (log) log.value += "*****NETWORK ERROR**\n";
if (status) status.innerHTML = "** NETWORK ERROR";
};
if (log) log.value += "Sending request...\n";
myClient.send(); // Async connection to data server.
if (log) log.value += "Request sent.\n";
});
}
</script>
</body>
</html>