-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrainingPresentation.Rpres
754 lines (534 loc) · 20.9 KB
/
trainingPresentation.Rpres
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
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
Training packages R / ANTARES
================================================
css: antaresTraining2017.css
author: Jalal-Edine Zawam
date: 29-11-2017
autosize: true
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
Agenda
========================================================
<br>
<br>
<br>
>1. appAntaresViz
>1. R and RStudio
>2. antaresRead
>3. antaresProcessing
>4. antaresViz
```{r setup, include=FALSE}
knitr::opts_chunk$set(cache=TRUE)
```
```{r, echo=FALSE}
library(knitr)
library(kableExtra)
library(data.table)
library(antaresRead)
library(antaresProcessing)
library(antaresViz)
library(xtable)
```
appAntaresViz
========================================================
title: false
type: first-title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
appAntaresViz
Lets try appAntaresViz
========================================================
type: antaresViz
title: false
Lets try appAntaresViz
Unsupplied energy scenario / Data
========================================================
type: text-slide
<!---
TODO rajouter une image de l'aplication
-->
***exercise/import data*** :
<small>
- Run antaresVizualisation
- Select the folder "dataTyndp"
- Select the simulation "20170830-1049eco-reference.h5"
- Click on "Set Simulation"
- Imports all areas and links
- Click on "Validate & import data"
- Click on "Launch Analysis"
- Click on "tsPlot"
- Click on "H5request"
- Import mcYear 4
</small>
<div class="footer"></div>
Unsupplied energy scenario / tsPlot
========================================================
type: text-slide
***exercise*** :in the tab "tsPlot" and "type : monotone/times series/heat map"
- Find the country who have the most of unsupplied energy for the mcYear 4 between "France", "Germany", "Belgium", "Netherlands", "Portugal", "Austria" and "Great Britain"
- For this country, which month have the most of unsupplied energy
- Find the date when the maximum of unsupplied energy is reached, in the following we will refers to this country by <span style="color:red;">Mystery</span> and the date by <span style="color:red;">Ttime</span>
- Why there is unsupplied energy for this year in <span style="color:red;">Mystery</span>? --> We will see this thanks to **prodStack**
Unsupplied energy scenario / prodStack
========================================================
type: text-slide
***exercise*** : in the tab "prodStack"
- Import mcYear 4 and 12
- Plot the prodStack for <span style="color:red;">Mystery</span> and for the week containing <span style="color:red;">Ttime</span> for the year 4
- Find the amount of wind production and import/export
- Change the parameter mcYear to **12** and find the amount of wind production and import/export
- Does <span style="color:red;">Mystery</span> import or export for the year **12** ?
- To whom <span style="color:red;">Mystery</span> is importing or exporting for the year 12 ? --> We will see this thanks to **exchangesStack**
Unsupplied energy scenario / exchangesStack
========================================================
type: text-slide
***exercise*** :
in the tab "exchangesStack":
- Import mcYear 4 and 12
- Change the "area" to <span style="color:red;">Mystery</span>
- For the year 12, to whom <span style="color:red;">Mystery</span> is importing or exporting ?
- For the year 4, to whom <span style="color:red;">Mystery</span> is importing or exporting ?
- For <span style="color:red;">Ttime</span> and the year 4, are there null flows between this country and others ? if yes, why ? --> We will see this thanks to **plotMap**
Unsupplied energy scenario / plotMap - Layout
========================================================
type: text-slide
***exercise/import data*** : in the tab "plotMap/Current Layout":
- import the file "dataTyndp/mapLayoutTyndp.RDS" with the button "Browse...""
Unsupplied energy scenario / Map
========================================================
type: text-slide
***exercise/import data*** : in the tab "plotMap/Map":
<small>
- Import mcYear 4 and 12 and change the parameter mcYear to 4
- Change the parameter DateRange for the day containing <span style="color:red;">Ttime</span>
- In the tab "Areas", change the parameter "color"" to "LOAD"
- Click on update
- In the tab "Areas", change the parameter "Size" to "H. ROR", "PSP", "MISC. NDG", "WIND", "SOLAR", "NUCLEAR", "LIGNITE", "GAS", "COAL", "OIL", "MIX. FUEL", "MISC. DTG", "H. STOR"
- Click on update
</small>
<div class="footer"></div>
Unsupplied energy scenario / Map with miniplots
========================================================
type: text-slide
***exercise/import data*** : in the tab "plotMap/Map":
- In the tab "Areas/miniPlot", change the parameter "areaCharType" to "pie chart", click on update
- In the tab "Areas/miniPlot", check the box "sizeMiniPlot", click on update
- In the tab "Areas", change the parameter "Popup" to "UNSP. ENRG", "SPIL. ENRG", "DTG MRG", "AVL DTG", "MAX MRG", "MRG. PRICE", "BALANCE", click on update
- Click on one pie chart
Unsupplied energy scenario / Map for links
========================================================
type: text-slide
***exercise/import data*** : in the tab "plotMap/Map":
- In the tab "Links", change the parameter "Color" to "CONG. PROP +"
- Click on update
- In the tab "Links", change the parameter "Width" to "FLOW LIN."
- Click on update
- Click on one link
- In the tab "Links", change the parameter "Popup" to "CONG. PROP -", "MARG. COST"
- Click on update
- Click on one link
Unsupplied energy scenario / Questions
========================================================
type: text-slide
***exercise*** : in the tab "plotMap/Map":
- On the map, click on play and pause when you reach <span style="color:red;">Ttime</span>
- Is <span style="color:red;">Mystery</span> imports or exports? to whom ?
- Are there null flows between <span style="color:red;">Mystery</span> and others ? if yes, why ?
- Are there links not congestionned between Netherlands and others countries ? why ?
- Change the parameter mcYear to 12
- Click on update
- Is <span style="color:red;">Mystery</span> imports or exports? to whom and why ?
- It's better to compare the two maps in one screen --> We will see this thanks to **Data/compare**
Unsupplied energy scenario / Compare
========================================================
type: text-slide
***exercise/import data*** : in the tab "Data":
- Add **mcYear** in the parameter "plotMap"
- Click on "Launch Analysis"
- Go to the tab "plotMap/Map"
Unsupplied energy scenario / Compare plotMap
========================================================
type: toBig
***exercise/import data*** : in the tab "plotMap/Map":<small>
- Import mcYear 4 and 12
- Reconfigure the maps with the previous parameters (Areas, color, size, popup etc.) in one step
- Click on the first graph and choose the mcYear 4
- Click on the second graph and choose the mcYear 12
- Click on the update button
- Change the parameter DateRange for the day containing <span style="color:red;">Ttime</span>
- Click on play on one map and pause when you reach <span style="color:red;">Ttime</span>
- At <span style="color:red;">Ttime</span> , which is the most important production in Germany for year 4 and for year 12 ?
- Same question for Great Britain<small>
- *The future is unpredictable so we try several scenarios to have an idea about the possible futures and increase the chance to make a good decision (more thermal capacities, more renewable energy etc.) --> We will see this thanks to* **Data - scenarios**</small>
</small>
<div class="footer"></div>
Unsupplied energy scenario / Data - scenarios
========================================================
type: text-slide
***exercise/import data*** : in the tab "Data":
<small>
- Click in the tab "Import Data"
- Select the simulation "20170112-1832eco-pascontraintenbmax.h5"
- Click on "Set simulation"
- Imports all areas and links
- Click on "Validate & import data"
- Come back to the tab "Import Data"
- Select a new simulation "201710118-0902eco-aveccontraintenbmax.h5"
- Click on "Set simulation"
- Imports all areas and links
- Click on "Validate & import data"
- delete "mcYear" in the parameter "plotMap"
- Click on "Launch Analysis"
</small>
<div class="footer"></div>
Unsupplied energy scenario / Data - scenarios - tsPlot
========================================================
type: text-slide
***exercise*** : In the tab "tsPlot":
- Import mcYear 4
- Change DateRange to contain the all year
- Plot the nuclear monotone for France, Germany and Great Britain
- Are there differences between scenarios ? if yes, why ?
- Plot the nuclear density for France for the all year
- Are there differences between scenarios ?
- Plot the nuclear heatmap for France
- For which month there is the most differences between scenarios ?
antaresViz is great but why I should learn R ?
========================================================
type: text-slide
. antaresViz is designed to respond to general request but not for all requests. For particular studies we need particular representations.
. You have a lot of available function in antaresPackages, it will be a lost of time (and money ?) to recode them in python, VBA, perl or any other scripting language.
. If you learn R you will be able to use scripts from ANTARES users and you will also be able to provide scripts to other. You can propose your ideas on github.
. You be able to use a lot of statical packages (10 thousand on CRAN) : kmeans, rpart, caret, FactoMineR etc.
<small>
*Today you will learn a few things form R, if you want to learn more about R and DataScience*, ***RTE can propose you others training***.
</small>
<div class="footer"></div>
What is R?
========================================================
type: text-slide
- R is a scientific development software specialized in calculation and statistical analysis
- R is an open source project
- R is a cross-platform software (linux, mac, windows ...) like ANTARES
- R is a language.
Creating objects and assigning values in R
========================================================
type: code-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
You can type an expression without assigning its value to an object
```{r, echo=TRUE}
(10 + 9) * 8
```
An object can be created with the operator assign <-
```{r, echo=TRUE}
firstObject <- 15 ;firstObject
```
After this assignment, the object "firstObject" contains the value 15. Another assignment to the same object will change the content.
```{r, echo=TRUE}
firstObject <- 3+rnorm(n=1) ;firstObject
```
Objects and memory in R
========================================================
type: code-slide
List object in memory
```{r, echo=TRUE}
ls()
A<-34;ls()
```
Remove objects from memory
```{r, echo=TRUE}
ls();rm(A)
ls()
```
<div class="footer"></div>
What is RStudio?
========================================================
type: text-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
<br>
RStudio is an integrated development environment (IDE) for R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management.
antaresRead
========================================================
title: false
type: first-title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
antaresRead
Install the package "antaresRead"
========================================================
type: code-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
Like any other package...
```{r, echo=TRUE, eval=FALSE}
install.packages("antaresRead")
```
Major functions
```{r, echo=FALSE}
majorFunctionsAntaresRead<-data.frame(
functions=c(
"Set Path to an ANTARES simulation",
"Read the data of an ANTARES simulation",
"Remove virtual areas",
"Show aliases for variables",
"Select and exclude areas, distructs and links ",
"Import clusters Description",
"Read Input Time Series"),
row.names = c(
"setSimulationPath",
"readAntares",
"removeVirtualAreas",
"showAliases",
"getAreas, getLinks, getDistricts",
"readClusterDesc",
"readInputTS"
),
check.rows = TRUE,
check.names = TRUE
)
kable_styling(
kable(majorFunctionsAntaresRead, "html"),
bootstrap_options = c("striped", "hover", "condensed", "responsive"),
full_width=TRUE,
font_size=40
)
```
get help
```{r, echo=TRUE, eval=FALSE}
## ??namePackage::function
??antaresRead::readAntares
```
<div class="footer"></div>
First step : set your simulation path and read the data
========================================================
type: code-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
```{r, echo=TRUE, fig.align = 'center', cache=TRUE}
myPath<-"E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\ST2030"
setSimulationPath(myPath, "20170830-1049eco-reference")
suppressWarnings(
myData<-readAntares(
areas = "all",
links="all",
clusters = "all",
linkCapacity = TRUE,
mustRun = TRUE,
showProgress = FALSE
)
)
```
<div class="footer"></div>
Consolidated data : Remove your virtual areas and correct the initial data
========================================================
type: first-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
What does this function ?
```{r, echo=TRUE, eval=FALSE}
??antaresRead::removeVirtualAreas
```
```{r, echo=TRUE}
myConData<-removeVirtualAreas(
x=myData,
storageFlexibility = getAreas(select = c("pum", "tur")),
production = getAreas(select = c("z_dsr", "y_mul"))
)
```
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
TODO TD1
-->
getAreas and getLinks
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
***exercise*** :
- Compute the number of areas without virtual areas
- Compute the number of links without virtual areas
***get help***:
```{r, echo=TRUE, eval=FALSE}
??antaresRead::getAreas
??antaresRead::getLinks
```
Data.table
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
- DT[<span style="color:blue"> i </span>, <span style="color:green"> j </span>, <span style="color:red"> by </span>]
- subset rows using <span style="color:blue"> i </span>
- then calculate <span style="color:green"> j </span>
- grouped <span style="color:red"> by </span>
You can learn the basics about data.table with the [vignette.](https://cran.r-project.org/web/packages/data.table/vignettes/datatable-intro.html)
You can also found the cheat sheet [here.](https://www.r-bloggers.com/the-data-table-cheat-sheet/)
antaresDataList : List of date.tables
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
- readAntares return a list of data.tables.
- Data.table is a list of vector with equal length.
***exercise*** :
- Compute the number of areas with unsupplied energy
- Compute the number of areas with spilled energy
- Compute the number of links with congestion
antaresDataList : use data.table
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
***exercise*** :
- Compute the sum of the spilled energy by area and order the result by the spilled energy
- Compute the sum of the unsupplied energy by area and order the result by the unsupplied energy
Explain the result for unsupplied energy in France: with rpart or others statical packages FactoMineR, kmeans
========================================================
type: explainTheResult
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
Explain the result for unsupplied energy in France without some variables
========================================================
type: explainTheResult2
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
Explain the result with some plots
========================================================
title:no
type:first-title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
Explain the result with some plots
antaresViz : prodStack, exchangesStack and plot
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
***exercise*** :
- Get the first year and the first date where there is more than 700MW of unsupplied energy in France and use prodStack to visualize the production stack for this week.
- Visualise the evolution of the echanges between France and other countries with exchangesStack.
- Plot the price for this week.
antaresViz : plotMap
========================================================
type: title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
***exercise*** :
- For the date mentioned before represend the mix of production in Europe and represend the echanges between areas.
antaresProcessing
========================================================
title: false
type: second-title-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
-->
antaresProcessing
antaresProcessing
========================================================
type: code-slide
***Major functions***
```{r, echo=FALSE}
majorFunctionsAntaresProcessing<-data.frame(
functions=c(
"Compute economic surplus",
"Add downward and upward margins of areas",
"Add export and import of areas or districts",
"Add net load of areas",
"Compare two antaresDataTable",
"Compute the modulation of cluster units"
),
row.names = c(
"Surplus, surplusClusters, surplusSectors",
"addDownwardMargin, addUpwardMargin",
"addExportAndImport",
"addNetLoad",
"compare",
"Modulation "
),
check.rows = TRUE,
check.names = TRUE
)
kable_styling(
kable(majorFunctionsAntaresProcessing, "html"),
bootstrap_options = c("striped", "hover", "condensed", "responsive"),
full_width=TRUE,
font_size=40
)
```
<div class="footer"></div>
Upward margin
========================================================
type: code-slide
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
***exercise*** :
- Compute the upward margin for the all simulations and represent it in a map for the dates mentioned before.
You can propose new features or report bugs on github
========================================================
type: github
title: no
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
<a href="https://github.com/rte-antares-rpackage">You can propose new features or report bugs on github</a>
Thanks
========================================================
title: no
type: thanks
<!---
This is a comment, it will not be included in this presentation.
You can write your notes here.
You can use the r function lenght.
-->
Thanks you for your attention, don't forget R is great and you can call us anytime if you need help.