plotNetPositionFB: Plot a flow-based typical domain and the Net Positions...

Description Usage Arguments Details Examples

View source: R/graph.R

Description

This function is used after running an Antares simulation to visualize how the domains have been used by the optimizer to fix the exchanges in the CWE area. The user chooses one (or several) domain (typical day + hour) and the function will then filter the given Antares output data to only keep the times when this domain has been used and calculate the Net Position, inside the CWE area, of the 2 countries chosen as axis. A plot gathers then the domain(s) and the points representing the Net Positions in the same color. The user can choose whether to plot Net Positions before and/or after applying the adequacy patch.

Usage

1
2
3
4
plotNetPositionFB(data, dayType, hour, country1, country2,
  fb_opts = antaresRead::simOptions(), filteringEmptyDomains = FALSE,
  nbMaxPt = 10000, drawPositionsBeforeAdqP = TRUE,
  drawPositionsAdqP = TRUE, palette = "rainbow")

Arguments

data

antaresDataList Antares output data, imported with readAntares. It can be a filtered (time or loss of load) antaresDataList.

dayType

numeric: typical day to plot. The value can also be 'all', for example if the data has been filtered.

hour

numeric : hour to plot(format : 0:23, in accordance with Antares output). The value can also be 'all'.

country1

character : first country, axis X

country2

character : second country, axis Y

fb_opts

list of simulation parameters returned by the function setSimulationPath or flow-based model directory obtained with setFlowbasedPath. By default, the value will be indicated by antaresRead::simOptions()

filteringEmptyDomains

boolean, if TRUE, the function will only plot the domains for which it can find values in data in accordance with dayType and hour. By default, it is FALSE.

nbMaxPt

numeric : maximum number of points plotted on the graph. It can be increased (which increases computation time). By default, the value is 10000.

drawPositionsBeforeAdqP

boolean, draw the Net Positions without adequacy patch being applied (or before). If TRUE, the data without adequacy patch must be included in data. To visualize both without and with adequacy patch output the data must result of adqPatch with parameter keepOldColumns set at TRUE. By default the value is TRUE.

drawPositionsAdqP

boolean draw the Net Positions after the adequacy patch is applied. If TRUE, the data resulting of the adequacy patch process must be included in data. It must then be the calculated result of adqPatch. By default, the value is TRUE.

palette

character color range, by default the palette is "rainbow". Are vailable : "cm.colors", "topo.colors", "terrain.colors", "heat.colors", "rainbow".

Details

The Antares output data must respect the antaresDataList format (imported with readAntares). But it can be filtered (see examples) to only keep days presenting unsupplied energy or a specific timeline. In that case, choose the value 'all' for the parameters dayType and/or hour and set the parameter filteringEmptyDomains as TRUE. The function will then filter by itself the domains which are not used.

Examples

 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
## Not run: 
# Choose an ANtares study and import its output
study <- "D:/Users/titorobe/Desktop/antaresStudy"

opts <- antaresRead::setSimulationPath(study, 2)
dta <- antaresRead::readAntares(areas = c("fr", "be", "de", "nl"),
                                links = c("be - de","be - fr","be - nl",
                                "de - fr","de - nl"), mcYears = 1:10,
                                select = c("LOLD", "UNSP. ENRG",
                                "DTG MRG", "UNSP. ENRG", "BALANCE", "FLOW LIN."),
                                 opts = opts)

# plot the typical domain 1 at 00:00 and 19:00 and the matching output 
# points of the study on the axis France-Belgium
plotNetPositionFB(fb_opts = opts,
         data = dta,
         dayType = 1, hour = c(0, 19),
         country1 = "BE", country2 = "FR")
         
# Change color palette
plotNetPositionFB(fb_opts = opts,
                 data = dta,
                 dayType = 1, hour = c(0, 19),
                 country1 = "BE", country2 = "FR", palette = "topo.colors")

# plot a single idTime : the data is filtered beforehand
# in this case all domains are plotted, also all are empty except one
dta$areas <- dta$areas[timeId == 1]
plotNetPositionFB(fb_opts = opts,
         data = dta,
         dayType = "all", hour = 0,
         country1 = "BE", country2 = "FR")

# Filtering empty domains : only the matching domain of timeid 1 will be drawn

plotNetPositionFB(fb_opts = opts,
         data = dta,
         dayType = "all", hour = 0,
         country1 = "BE", country2 = "FR", filteringEmptyDomains = TRUE)


# Plot Net Positions with adequacy patch Net Positions

# Run adequacy patch on the output
 dta_adq <- adqPatch(fb_opts = opts)

###### Filter on situations with unsupplied energy :
# If you want to keep only timeId with LOLD!=0 you can't use : 
# dta$areas <- dta$areas[LOLD!=0] otherwise some areas
# Otherwise some areas are forgotten: the data must be filtered to 
# keep all areas at specific timesteps.
 
 ## An exemple of authorized filter :
 idC <- c(antaresRead::getIdCols(dta$areas))
 idC <- idC[idC!="area"]
 LOLD <- dta$areas[,lapply(.SD, sum), by = idC, .SDcols = "LOLD"]
 LOLD <- LOLD[LOLD!=0]
 LOLD[,LOLD := NULL]
 # Merge to filter data
 dta$areas <- merge(dta$areas, LOLD, by =  idC)
 ## End filter
###### 
 
 # Plot the positions, filtering empty domains. Only adequacy positions available.
 plotNetPositionFB(fb_opts = opts,
         data = dta_adq,
         dayType = "all", hour = 19,
         country1 = "BE", country2 = "FR", filteringEmptyDomains = TRUE)
 
 # Plot the adequacy positions (only adequacy positions available), 
 # for domain typical day 6 and hour 17:00
 plotNetPositionFB(fb_opts = opts,
         data = dta_adq,
         dayType = 6, hour = 17,
         country1 = "DE", country2 = "FR")
         
 # Plot the adequacy positions for domain typical day 6 and hour 17:00  
 plotNetPositionFB(fb_opts = opts,
         data = dta_adq,
         dayType = 6, hour = 17,
         country1 = "BE", country2 = "FR", drawPositionsBeforeAdqP = FALSE)
 
 # Plot the positions before adequacy patch for domain typical day 6 
 # and hour 17:00 : impossible because no data
 plotNetPositionFB(fb_opts = opts,
         data = dta_adq,
         dayType = 6, hour = 17,
         country1 = "BE", country2 = "FR", drawPositionsAdqP = FALSE)

 # Calculate data containing both before and after adequacy patch
 dta_complete <- adqPatch(fb_opts = opts, keepOldColumns = FALSE)

 plotNetPositionFB(fb_opts = opts,
         data = dta_complete,
         dayType = 6, hour = 17,
         country1 = "BE", country2 = "FR", filteringEmptyDomains = TRUE)


## End(Not run)

rte-antares-rpackage/antaresFlowbased documentation built on Oct. 19, 2020, 11:23 a.m.