-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindSites.mc2
524 lines (438 loc) · 25.7 KB
/
WindSites.mc2
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
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
// @endpoint https://resverianaliz.aydemyenilenebilir.com.tr:8889/api/v0/exec
// @theme dark-blue
{
//'type' 'flex'
'title' 'Wind Site'
'cellHeight' 85
'options' {
'scheme' 'WARP10'
'timeZone' 'Europe/Istanbul'
//'autoRefresh' 600
'showErrors' true
'showLoader' true
}
//variables
'vars' {
'plant' 'Yalova'
'TurbineId' '1'
'myreadtoken' '4vM.a2aMxhl2qCB88Gutar8jXe4R4cqp.QaYYHtumjJg9DCHgXXY1_qIoBhzeh6PIdfX9KLtgeK1O0YHXcr0qA2ZPQrLAurl_PbQAkNjvy3WNq4fNEv434rOXWMsGq55X4qYtTOCtx53bqFwUXsRr6.B3sKF1YE1At8iEE2RyxC9RYOnS7UT4F'
'startDate' [ NOW 7 d - ISO8601 'T' SPLIT 0 GET '21:00:00Z' ] 'T' JOIN TOTIMESTAMP //NOW 7 d - //NOW
'endDate' NOW // 604800000000
'values' []
}
//Start of dashboard tiles
'tiles' [
//Site selection
{
'title' 'Plant'
'x' 0 'y' 0 'w' 1 'h' 1
'type' 'input:list'
'macro'
<%
[ $myreadtoken '~.*' { 'type' 'Wind' } ] FINDSETS STACKTOLIST 1 GET 'plant' GET LSORT 'listOfPlants' STORE
{
'data' $listOfPlants
'globalParams' { 'input' { 'value' $plant } } // the initial selected value coming from global vars
'events' [ { 'type' 'variable' 'tags' [ 'plant' ] 'selector' 'plant' } ] // Event definition to send selected variable to tiles
}
%>
}
//Date Selections
{
'title' 'Start Date'
'x' 1 'y' 0 'w' 2 'h' 1
'type' 'input:date'
'macro' <%
{
'data' [ NOW 8 d - ISO8601 'T' SPLIT 0 GET '21:00:00Z' ] 'T' JOIN TOTIMESTAMP
'events' [
{ 'type' 'variable' 'tags' [ 'startDate' ] 'selector' 'startDate' }
]
}
%>
}
{
'title' 'End Date'
'x' 3 'y' 0 'w' 2 'h' 1
'type' 'input:date'
'macro' <%
{
'data' [ NOW ISO8601 'T' SPLIT 0 GET '20:59:59Z' ] 'T' JOIN TOTIMESTAMP
'events' [
{ 'type' 'variable' 'tags' [ 'endDate' ] 'selector' 'endDate' }
]
}
%>
}
{
'title' 'Active Power'
'options' { 'autoRefresh' 60
'eventHandler' 'type=variable,tag=(plant|startDate|endDate)'
'maxValue' 100
'unit' 'MW'
}
'x' 5 'y' 0 'w' 2 'h' 1
'type' 'display'
'macro' <%
<% $plant 'Usak' == %> <%
[ $myreadtoken '~(ACTIVE_POWER).*' { 'plant' $plant }
// $startDate TOSTRING
// $endDate TOSTRING
NOW 1 d
] FETCH 'y' STORE
%>
<% $plant 'Yalova' == %> <%
[ $myreadtoken '~(ACTIVE_POWER).*' { 'plant' $plant } //general signal is not sent
// $startDate TOSTRING
// $endDate TOSTRING
NOW 1 d
] FETCH 'y' STORE
%>
<% $plant 'Soke' == %> <%
[ $myreadtoken '~(ACTIVE_POWER).*' { 'plant' $plant } //general signal is not sent
// $startDate TOSTRING
// $endDate TOSTRING
NOW 1 d
] FETCH 'y' STORE
%> <% %> 3 SWITCH
[ $y bucketizer.last 0 10 m 0 ] BUCKETIZE [ SWAP [] reducer.sum ] REDUCE [ SWAP bucketizer.last 0 0 1 ] BUCKETIZE 'plant_data' STORE
// reduce all turbine totals to totalsum, zero if no energy
<% $plant_data [] == %>
<% 0.00 'plant_pwr' STORE %>
<% $plant_data VALUES 0 GET 0 GET 'plant_pwr' STORE %>
1 SWITCH
$plant_data VALUES 0 GET 0 GET TODOUBLE 1000 / 'plant_pwr' STORE
<'
%.2f
'>
[ $plant_pwr ] STRINGFORMAT 'plant_pwr' STORE
$plant_pwr
%>
}
{
'title' 'Average Wind'
'options' { 'autoRefresh' 60
'eventHandler' 'type=variable,tag=(plant|startDate|endDate)'
'maxValue' 100
'unit' 'm/s'
}
'x' 7 'y' 0 'w' 2 'h' 1
'type' 'display'
'macro' <%
<% $plant 'Usak' == %> <%
// calculate wind average
[ $myreadtoken '~(WIND_SPEED).*' { 'plant' $plant }
// $startDate TOSTRING
// $endDate TOSTRING
NOW 1 d
] FETCH 'wind_data' STORE
%>
<% $plant 'Yalova' == %> <%
// calculate wind average
[ $myreadtoken '~(WIND_SPEED).*' { 'plant' $plant }
// $startDate TOSTRING
// $endDate TOSTRING
NOW 1 d
] FETCH 'wind_data' STORE
%>
<% $plant 'Soke' == %> <%
[ $myreadtoken '~(WIND_SPEED).*' { 'plant' $plant } //general signal is not sent
$startDate TOSTRING
$endDate TOSTRING
//NOW 1 d
] FETCH 'wind_data' STORE
%> <% %> 3 SWITCH
// [ $wind_data bucketizer.mean NOW MAXLONG d 0 ] BUCKETIZE [ SWAP [] reducer.mean ] REDUCE VALUES 0 GET 0 GET 'wind_avg' STORE //average wind
[ $wind_data bucketizer.last 0 10 m 0 ] BUCKETIZE [ SWAP [] reducer.mean ] REDUCE [ SWAP bucketizer.last 0 0 1 ] BUCKETIZE VALUES 0 GET 0 GET 'wind_avg' STORE
$wind_avg 'tostring' STORE
<'
%.2f
'>
[ $tostring ] STRINGFORMAT 'data' STORE
$data
%>
}
{
'title' 'Turbines In Production / Total'
'x' 9 'y' 0 'w' 4 'h' 1
'options' { 'autoRefresh' 60
'eventHandler' 'type=variable,tag=(plant|startDate|endDate)'
}
'type' 'display'
'macro' <%
[ $myreadtoken '~.*' { 'plant' $plant } ] FINDSETS STACKTOLIST 1 GET 'TurbineId' GET SIZE 'total_turbines' STORE
<% $plant 'Usak' == %> <%
[ $myreadtoken 'PLC_STATUS' { 'plant' 'Usak' 'manufacturer' 'Goldwind' }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'avail_usak_gw' STORE
[ $avail_usak_gw [] 4 filter.any.eq ] FILTER SIZE 'in_production_Usak_gw_1' STORE
[ $avail_usak_gw [] 5 filter.any.eq ] FILTER SIZE 'in_production_Usak_gw_2' STORE
[ $myreadtoken 'PLC_STATUS' { 'plant' 'Usak' 'manufacturer' 'Sinovel' }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'avail_usak_sn' STORE
[ $avail_usak_sn [] 2 filter.any.eq ] FILTER SIZE 'in_production_Usak_sn' STORE
$in_production_Usak_sn $in_production_Usak_gw_1 + $in_production_Usak_gw_2 + 'avail_turbine' STORE
%>
<% $plant 'Yalova' == %> <%
[ $myreadtoken 'PLC_STATUS' { 'plant' 'Yalova' }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'avail' STORE
[ $avail [] 2 filter.any.eq ] FILTER SIZE 'avail_turbine' STORE
%>
<% $plant 'Soke' == %> <%
[ $myreadtoken 'PLC_STATUS' { 'plant' $plant 'manufacturer' 'Vestas' }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'avail_soke_vs' STORE
[ $avail_soke_vs [] 3 filter.any.eq ] FILTER SIZE 'avail_turbine_vs' STORE
[ $myreadtoken 'PLC_STATUS' { 'plant' $plant 'manufacturer' 'Goldwind' }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'avail_soke_gw' STORE
[ $avail_soke_gw [] 4 filter.any.eq ] FILTER SIZE 'in_production_soke_gw_1' STORE
[ $avail_soke_gw [] 5 filter.any.eq ] FILTER SIZE 'in_production_soke_gw_2' STORE
$avail_turbine_vs $in_production_soke_gw_1 + $in_production_soke_gw_2 + 'avail_turbine' STORE
%> <% %> 3 SWITCH
{
'data' [ $avail_turbine TOINTEXACT TOSTRING ' / ' $total_turbines TOINTEXACT TOSTRING + + ]
'params' [ { 'maxValue' $total_turbines } ]
}
%>
}
{
'title' 'Asset Map'
'options' { 'autoRefresh' 60
'showControls' true
'eventHandler' 'type=variable,tag=(plant|startDate|endDate)' }
'x' 0 'y' 1 'w' 6 'h' 7
'type' 'map'
'macro' <%
[ $myreadtoken 'PLC_STATUS' { 'plant' $plant }
// $startDate TOSTRING
// $endDate TOSTRING
NOW -1
] FETCH 'data' STORE
$data { '.app' '' '.uuid' '' 'type' '' 'plant' '' } RELABEL 'data' STORE
$data 0 GET LABELS 'manufacturer' GET 'manu' STORE
// <% $manu 'Goldwind' == %> <%
[ $data [] { 'manufacturer' 'Goldwind' } filter.bylabels ] FILTER 'gwdata' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 0 filter.any.eq ] FILTER 'init' RENAME { 'Status' 'Initialization' } RELABEL 'gwinit' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 1 filter.any.eq ] FILTER 'stop' RENAME { 'Status' 'Stop' } RELABEL 'gwstop' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 2 filter.any.eq ] FILTER 'nowind' RENAME { 'Status' 'Standstill/NoWind' } RELABEL 'gwnowind' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 3 filter.any.eq ] FILTER 'start' RENAME { 'Status' 'Starting' } RELABEL 'gwstart' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 4 filter.any.eq ] FILTER 'runup' RENAME { 'Status' 'Run Up' } RELABEL 'gwrunup' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 5 filter.any.eq ] FILTER 'powprod' RENAME { 'Status' 'Production' } RELABEL 'gwpowprod' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 6 filter.any.eq ] FILTER 'service' RENAME { 'Status' 'Service' } RELABEL 'gwservice' STORE
[ $gwdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 7 filter.any.eq ] FILTER 'fault' RENAME { 'Status' 'Fault' } RELABEL 'gwfault' STORE
// %> IFT
// <% $manu 'Sinovel' == %> <%
[ $data [] { 'manufacturer' 'Sinovel' } filter.bylabels ] FILTER 'sndata' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] -1 filter.any.eq ] FILTER 'offline' RENAME { 'Status' 'Offline' } RELABEL 'snoffline' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 0 filter.any.eq ] FILTER 'start' RENAME { 'Status' 'Start' } RELABEL 'snstart' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 1 filter.any.eq ] FILTER 'nowind' RENAME { 'Status' 'Standby/NoWind' } RELABEL 'snnowind' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 2 filter.any.eq ] FILTER 'prod' RENAME { 'Status' 'Production' } RELABEL 'snprod' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 3 filter.any.eq ] FILTER 'error' RENAME { 'Status' 'Error' } RELABEL 'snerror' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 4 filter.any.eq ] FILTER 'service' RENAME { 'Status' 'Service' } RELABEL 'snservice' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 5 filter.any.eq ] FILTER 'lowtemp' RENAME { 'Status' 'LowTemp' } RELABEL 'snlowtemp' STORE
[ $sndata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 6 filter.any.eq ] FILTER 'highwind' RENAME { 'Status' 'HighWind' } RELABEL 'snhighwind' STORE
//%> IFT
// <% $manu 'Vestas' == %> <%
[ $data [] { 'manufacturer' 'Vestas' } filter.bylabels ] FILTER 'vsdata' STORE
[ $vsdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 3 filter.any.eq ] FILTER 'run' RENAME { 'Status' 'Production' } RELABEL 'vsrun' STORE
[ $vsdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 2 filter.any.eq ] FILTER 'pause' RENAME { 'Status' 'Standby/NoWind' } RELABEL 'vspause' STORE
[ $vsdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 1 filter.any.eq ] FILTER 'stop' RENAME { 'Status' 'Stop' } RELABEL 'vsstop' STORE
[ $vsdata bucketizer.last 0 0 1 ] BUCKETIZE [ SWAP [] 4 filter.any.eq ] FILTER 'emergency' RENAME { 'Status' 'Emergency' } RELABEL 'vsemrgncy' STORE
//%> IFT
// get average wind for creating heatmap
[ $myreadtoken '~WIND_SPEED.*' { 'plant' $plant }
$startDate TOSTRING
$endDate TOSTRING
//NOW 610 d
] FETCH 'g' STORE
$g { '.app' '' '.uuid' '' } RELABEL 'g' STORE //relabel the atributes
[ $g bucketizer.mean 0 0 1 ] BUCKETIZE 'g' STORE
$g MERGE 'speeds' STORE
{
'data' [ $speeds $gwinit $gwstop $gwnowind $gwstart $gwrunup $gwpowprod $gwservice $snoffline $snstart $snnowind $snprod $snerror $snservice $snlowtemp $snhighwind $vsrun $vspause $vsstop $vsemrgncy ]
'params' [
{ 'map' { 'heatmap' true } } // for visualising speeds
<% $gwinit SIZE 0 > %> <% 0 $gwinit SIZE 1 - <% 'i' STORE { "key" 'T-' $gwinit $i GET LABELS 'TurbineId' GET + ' - ' + $gwinit $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // green for productions
<% $gwstop SIZE 0 > %> <% 0 $gwstop SIZE 1 - <% 'i' STORE { "key" 'T-' $gwstop $i GET LABELS 'TurbineId' GET + ' - ' + $gwstop $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $gwnowind SIZE 0 > %> <% 0 $gwnowind SIZE 1 - <% 'i' STORE { "key" 'T-' $gwnowind $i GET LABELS 'TurbineId' GET + ' - ' + $gwnowind $i GET LABELS 'Status' GET + 'color' '#0000FF' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // blue for standby
<% $gwstart SIZE 0 > %> <% 0 $gwstart SIZE 1 - <% 'i' STORE { "key" 'T-' $gwstart $i GET LABELS 'TurbineId' GET + ' - ' + $gwstart $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // green for productions
<% $gwrunup SIZE 0 > %> <% 0 $gwrunup SIZE 1 - <% 'i' STORE { "key" 'T-' $gwrunup $i GET LABELS 'TurbineId' GET + ' - ' + $gwrunup $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // green for productions
<% $gwpowprod SIZE 0 > %> <% 0 $gwpowprod SIZE 1 - <% 'i' STORE { "key" 'T-' $gwpowprod $i GET LABELS 'TurbineId' GET + ' - ' + $gwpowprod $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // green for productions
<% $gwservice SIZE 0 > %> <% 0 $gwservice SIZE 1 - <% 'i' STORE { "key" 'T-' $gwservice $i GET LABELS 'TurbineId' GET + ' - ' + $gwservice $i GET LABELS 'Status' GET + 'color' '#FFFF00' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // yellow for service
<% $snoffline SIZE 0 > %> <% 0 $snoffline SIZE 1 - <% 'i' STORE { "key" 'T-' $snoffline $i GET LABELS 'TurbineId' GET + ' - ' + $snoffline $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $snstart SIZE 0 > %> <% 0 $snstart SIZE 1 - <% 'i' STORE { "key" 'T-' $snstart $i GET LABELS 'TurbineId' GET + ' - ' + $snstart $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // green for productions
<% $snnowind SIZE 0 > %> <% 0 $snnowind SIZE 1 - <% 'i' STORE { "key" 'T-' $snnowind $i GET LABELS 'TurbineId' GET + ' - ' + $snnowind $i GET LABELS 'Status' GET + 'map' { 'iconSize' [ 28 28 ] } 'color' '#0000FF' 'render' 'marker' } %> FOR %> IFT // blue for standby
<% $snprod SIZE 0 > %> <% 0 $snprod SIZE 1 - <% 'i' STORE { "key" 'T-' $snprod $i GET LABELS 'TurbineId' GET + ' - ' + $snprod $i GET LABELS 'Status' GET + 'map' { 'iconSize' [ 28 28 ] } 'color' '#008000' 'render' 'marker' } %> FOR %> IFT // green for productions
<% $snerror SIZE 0 > %> <% 0 $snerror SIZE 1 - <% 'i' STORE { "key" 'T-' $snerror $i GET LABELS 'TurbineId' GET + ' - ' + $snerror $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $snservice SIZE 0 > %> <% 0 $snservice SIZE 1 - <% 'i' STORE { "key" 'T-' $snservice $i GET LABELS 'TurbineId' GET + ' - ' + $snservice $i GET LABELS 'Status' GET + 'color' '#FFFF00' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // yellow for service
<% $snlowtemp SIZE 0 > %> <% 0 $snlowtemp SIZE 1 - <% 'i' STORE { "key" 'T-' $snlowtemp $i GET LABELS 'TurbineId' GET + ' - ' + $snlowtemp $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $snhighwind SIZE 0 > %> <% 0 $snhighwind SIZE 1 - <% 'i' STORE { "key" 'T-' $snhighwind $i GET LABELS 'TurbineId' GET + ' - ' + $snhighwind $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $vsrun SIZE 0 > %> <% 0 $vsrun SIZE 1 - <% 'i' STORE { "key" 'T-' $vsrun $i GET LABELS 'TurbineId' GET + ' - ' + $vsrun $i GET LABELS 'Status' GET + 'color' '#008000' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $vspause SIZE 0 > %> <% 0 $vspause SIZE 1 - <% 'i' STORE { "key" 'T-' $vspause $i GET LABELS 'TurbineId' GET + ' - ' + $vspause $i GET LABELS 'Status' GET + 'color' '#0000FF' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // yellow for service
<% $vsstop SIZE 0 > %> <% 0 $vsstop SIZE 1 - <% 'i' STORE { "key" 'T-' $vsstop $i GET LABELS 'TurbineId' GET + ' - ' + $vsstop $i GET LABELS 'Status' GET + 'color' '#FFFF00' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
<% $vsemrgncy SIZE 0 > %> <% 0 $vsemrgncy SIZE 1 - <% 'i' STORE { "key" 'T-' $vsemrgncy $i GET LABELS 'TurbineId' GET + ' - ' + $vsemrgncy $i GET LABELS 'Status' GET + 'color' '#ff1030' 'render' 'marker' 'map' { 'iconSize' [ 28 28 ] } } %> FOR %> IFT // red for gw stop
]
'globalParams' { 'map' { 'mapType' 'SATELLITE' 'heatRadius' 25 'heatOpacity' 0.1 'track' true } }
}
%>
}
// Turbine Table
{
'type' 'tabular' 'x' 6 'y' 1 'w' 6 'h' 7
'title' 'Wind Turbines CFs'
'options' { 'autoRefresh' 600
//'eventHandler' 'type=variable,tag=(plant|startDate|endDate)' // suscribe to events
'showControls' true
}
'macro' <%
[ $myreadtoken '~.*' { 'plant' $plant } ] FINDSETS STACKTOLIST 1 GET 'TurbineId' GET 'listOfTurbines' STORE
$listOfTurbines SIZE 'numTurbines' STORE
[] 'turbinelist' STORE
[] 'pwrlist' STORE
[] 'windlist' STORE
[] 'timelist' STORE
[] 'nowcflist' STORE
[] 'lastnowcflist' STORE
[] 'lastyearcflist' STORE
//FOR plant turbines
1 $numTurbines <%
'turbineid' STORE
// calculate turbine cf according from year start, last year until this time, last year total
NOW ->TSELEMENTS 'now_stamp' STORE
$now_stamp 0 GET 'year' STORE // year now
$now_stamp 1 GET 'month' STORE // value of this month
$now_stamp 2 GET 'day' STORE // value of today
$now_stamp 3 GET 3 + 'hour' STORE //value of this hour and adjust for UTC time Turkey
[ $year $month $day 00 00 00 ] TSELEMENTS-> 3 h - ISO8601 'today' STORE //adjust 3 hrs for UTC time Turkey
[ $year 01 01 00 00 00 ] TSELEMENTS-> 3 h - ISO8601 'thisyear' STORE //adjust 3 hrs for UTC time Turkey
$year 1 - 'last_year' STORE
[ $last_year 01 01 00 00 00 ] TSELEMENTS-> 3 h - ISO8601 'lastyear' STORE //adjust 3 hrs for UTC time Turkey
[ $last_year $month $day 00 00 00 ] TSELEMENTS-> 3 h - ISO8601 'lastyeartoday' STORE //adjust 3 hrs for UTC time Turkey
[ $last_year 12 31 23 59 59 ] TSELEMENTS-> 3 h - ISO8601 'lastyearend' STORE //adjust 3 hrs for UTC time Turkey
// turbine this year
// [ $myreadtoken '~ACTIVE_POWER.*' { 'plant' $plant 'TurbineId' $turbineid TOSTRING }
// $start $end
//NOW ISO8601 $thisyear
// ]
{ 'token' $myreadtoken
'class' 'ACTIVE_POWER'
'labels' { 'plant' $plant 'TurbineId' $turbineid TOSTRING }
'start' $thisyear
'end' $today // NOW ISO8601
//'sample' 0.5
'timestep' 10 m
} FETCH 'data' STORE
$data { '.app' '' '.uuid' '' 'type' '' } RELABEL 'MWh' RENAME 'data' STORE //relabel the atributes
[ $data bucketizer.last 0 10 m 0 ] BUCKETIZE 'etrenddata' STORE // sum of each turbine seperately and aligned
[ $etrenddata [] { 'manufacturer' 'Sinovel' } filter.bylabels ] FILTER SIZE 'sksn' STORE // find number of turbines of that month
[ $etrenddata [] { 'manufacturer' 'Vestas' } filter.bylabels ] FILTER SIZE 'skvs' STORE
[ $etrenddata [] { 'manufacturer' 'Goldwind' } filter.bylabels ] FILTER SIZE 'skgw' STORE
[ $etrenddata [] reducer.sum ] REDUCE [ SWAP bucketizer.sum 0 0 1 ] BUCKETIZE 'etrenddata' STORE
$etrenddata VALUES 0 GET 0 GET TODOUBLE 1000 / 6 / 'total' STORE //change to Mwh
// calculate capacity of the turbine
1500 TODOUBLE $sksn * 1000 /
3450 TODOUBLE $skvs * 1000 / +
6000 TODOUBLE $skgw * 1000 / + 'capacity_max_sk_new' STORE
// $totActPow $capacity_max / TODOUBLE 100 * 'cf' STORE //old calculation for last 10 mins
$month 1 - 30 * 24 *
$day 1 - 24 * +
// $hour +
'total_hours' STORE
<% $etrenddata [] == %> <% 0 'turbine_this_year' STORE %>
<%
$total $capacity_max_sk_new $total_hours * / TODOUBLE 100 * 100 * RINT 100 / 'turbine_this_year' STORE
%> IFTE // if there is no data this year
// turbine last year this time
[ $myreadtoken '~ACTIVE_POWER.*' { 'plant' $plant 'TurbineId' $turbineid TOSTRING }
// $start $end
$lastyear $lastyeartoday
] FETCH 'ldata' STORE
$ldata { '.app' '' '.uuid' '' 'type' '' } RELABEL 'MWh' RENAME 'ldata' STORE //relabel the atributes
[ $ldata bucketizer.last 0 10 m 0 ] BUCKETIZE 'letrenddata' STORE // sum of each turbine seperately and aligned
[ $letrenddata [] { 'manufacturer' 'Sinovel' } filter.bylabels ] FILTER SIZE 'lsksn' STORE // find number of turbines of that month
[ $letrenddata [] { 'manufacturer' 'Vestas' } filter.bylabels ] FILTER SIZE 'lskvs' STORE
[ $letrenddata [] { 'manufacturer' 'Goldwind' } filter.bylabels ] FILTER SIZE 'lskgw' STORE
<% $letrenddata [] == %> <% 0 'ltotal' STORE %>
<% [ $letrenddata [] reducer.sum ] REDUCE [ SWAP bucketizer.sum 0 0 1 ] BUCKETIZE 'letrenddata' STORE
$letrenddata VALUES 0 GET 0 GET TODOUBLE 1000 / 6 / 'ltotal' STORE //change to Mwh
%> IFTE
// calculate capacity of the plant
1500 TODOUBLE $lsksn * 1000 /
3450 TODOUBLE $lskvs * 1000 / +
6000 TODOUBLE $lskgw * 1000 / + 'capacity_max_sk_old' STORE
// $totActPow $capacity_max / TODOUBLE 100 * 'cf' STORE //old calculation for last 10 mins
// 30 24 * 'month_hours' STORE
<% $letrenddata [] == %> <% 0 'turbine_last_year_today' STORE %>
<%
$ltotal $capacity_max_sk_old $total_hours * / TODOUBLE 100 * 100 * RINT 100 / 'turbine_last_year_today' STORE
%> IFTE // if there is no data last year
// turbine last year total
[ $myreadtoken '~ACTIVE_POWER.*' { 'plant' $plant 'TurbineId' $turbineid TOSTRING }
// $start $end
$lastyear $lastyearend
] FETCH 'lydata' STORE
$lydata { '.app' '' '.uuid' '' 'type' '' } RELABEL 'MWh' RENAME 'lydata' STORE //relabel the atributes
[ $lydata bucketizer.mean 0 10 m 0 ] BUCKETIZE 'lyetrenddata' STORE // sum of each turbine seperately and aligned
[ $lyetrenddata [] { 'manufacturer' 'Sinovel' } filter.bylabels ] FILTER SIZE 'lysksn' STORE // find number of turbines of that month
[ $lyetrenddata [] { 'manufacturer' 'Vestas' } filter.bylabels ] FILTER SIZE 'lyskvs' STORE
[ $lyetrenddata [] { 'manufacturer' 'Goldwind' } filter.bylabels ] FILTER SIZE 'lyskgw' STORE
<% $lyetrenddata [] == %> <% 0 'lytotal' STORE %>
<% [ $lyetrenddata [] reducer.sum ] REDUCE [ SWAP bucketizer.sum 0 0 1 ] BUCKETIZE 'lyetrenddata' STORE
$lyetrenddata VALUES 0 GET 0 GET TODOUBLE 1000 / 6 / 'lytotal' STORE //change to Mwh
%> IFTE
// calculate capacity of the plant
1500 TODOUBLE $lysksn * 1000 /
3450 TODOUBLE $lyskvs * 1000 / +
6000 TODOUBLE $lyskgw * 1000 / + 'capacity_max_year' STORE
// $totActPow $capacity_max / TODOUBLE 100 * 'cf' STORE //old calculation for last 10 mins
// 30 24 * 'month_hours' STORE
365 24 * 'year_hours' STORE
<% $letrenddata [] == %> <% 0 'turbine_last_year' STORE %>
<%
$lytotal $capacity_max_year $year_hours * / TODOUBLE 100 * 100 * RINT 100 / 'turbine_last_year' STORE
%> IFTE // if there is no data last year
$nowcflist [ $turbine_this_year ] APPEND 'nowcflist' STORE
$lastnowcflist [ $turbine_last_year_today ] APPEND 'lastnowcflist' STORE
$lastyearcflist [ $turbine_last_year ] APPEND 'lastyearcflist' STORE
%> FOR
{
'columns' [ 'Turbine' 'CF YTD' 'CF Last Yr. YTD' 'CF Last Yr.' ] //'Energy Availability' ]
'rows' [
//FOR yalova turbines
1 $numTurbines <% 'i' STORE
$i 1 - 'index' STORE
// $turbinelist $index GET 'perf' STORE
$nowcflist $index GET 'nowcf' STORE
$lastnowcflist $index GET 'lastnowcf' STORE
$lastyearcflist $index GET 'lastyearcf' STORE
[ $i $nowcf $lastnowcf $lastyearcf ] // $perf ]
%> FOR
]
}
'values' STORE
{ 'data' $values
'events' [ { 'type' 'variable' 'tags' [ 'result' ] 'value' $values } ] // send time avail and energy avail to other widgets
'globalParams' {
'tabular' {
'fixedWidth' true
'sortable' true
'filterable' true
}
}
} // data can also be a gts or a list thereof
%>
}
]
}