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

View source: R/graphs.R

plotNetPositionFBR Documentation

Plot a flow-based typical domain and the Net Positions reached within in an Antares simulation

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

plotNetPositionFB(
  data,
  dayType,
  hour,
  country1,
  country2,
  areaName = "cwe_at",
  fb_opts = antaresRead::simOptions(),
  filteringEmptyDomains = FALSE,
  nbMaxPt = 10000,
  palette = "rainbow",
  xlim = c(-12000, 12000),
  ylim = c(-12000, 12000)
)

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

areaName

character The name of the area of your study, possible values are cwe_at (default), cwe and other. If you choose other, you have to give a csv file which explains how your area work.

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.

palette

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

xlim

numeric, limits of x-axis

ylim

numeric, limits of y-axis

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

## Not run: 
# Choose an Antares study and import its output
# Change the study path for the path of a study you have on your computer
study <- "../../Pour Julien/blop/MT_base_nucM2_2023"

opts <- antaresRead::setSimulationPath(study, 17)
dta <- antaresRead::readAntares(areas = c("fr", "be", "de", "nl", "at"),
                                links = c("be - de","be - fr","be - nl",
                                "de - fr","de - nl", "at - de"), mcYears = 1:2,
                                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 = 3, hour = c(0, 19),
         country1 = "BE", country2 = "FR", areaName = "cwe_at",
         xlim = c(-10000, 10000), ylim = c(-10000, 10000))
         
dta2 <- antaresRead::readAntares(areas = c("fr", "be", "de", "nl"),
                                links = c("be - de","be - fr","be - nl",
                                "de - fr","de - nl"), mcYears = 1:2,
                                select = c("LOLD", "UNSP. ENRG",
                                "DTG MRG", "UNSP. ENRG", "BALANCE", "FLOW LIN."),
                                opts = opts)
                                
         
# Change color palette and areaName
plotNetPositionFB(fb_opts = opts,
                 data = dta2,
                 dayType = 3, hour = c(0, 19),
                 country1 = "BE", country2 = "FR", palette = "topo.colors",
                 areaName = "cwe")

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

# 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 with DE AT and changing of axes limits

plotNetPositionFB(fb_opts = opts,
         data = dta,
         dayType = "all", hour = 0,
         country1 = "AT", country2 = "DE", areaName = "cwe_at",
         filteringEmptyDomains = TRUE,
         xlim = c(-12000, 12000), ylim = c(-12000, 12000))
         
         
 
#### Example with the virtual area zz_flowbased
## If you gave virtualFBarea = TRUE in the function \link{computeFB},
## the areas and links are built with a virtual area on the center.

# Change the study path for the path of a study you have on your computer
study <- "../Etude Antares/BP19_costs18_FB18_2023Virtual/"

opts <- antaresRead::setSimulationPath(study, 5)

dta <- antaresRead::readAntares(areas = c("fr", "be", "de", "nl", "at", "zz_flowbased"),
                                links = c("be - zz_flowbased", 
                                "fr - zz_flowbased", "nl - zz_flowbased",
                                "de - zz_flowbased", "at - zz_flowbased"), mcYears = 1:2,
                                select = c("LOLD", "UNSP. ENRG",
                                "DTG MRG", "UNSP. ENRG", "BALANCE", "FLOW LIN."),
                                opts = opts)                
         
plotNetPositionFB(fb_opts = opts,
         data = dta,
         dayType = 6, hour = c(0, 19),
         country1 = "BE", country2 = "FR", areaName = "cwe_at",
         xlim = c(-10000, 10000), ylim = c(-10000, 10000))
         

## End(Not run)


rte-antares-rpackage/fbAntares documentation built on June 1, 2022, 6:20 p.m.