knitr::opts_chunk$set(echo = TRUE)

antaresFlowbased allows to model flow-based domains into adequacy studies using the software Antares, with the following main functionalities:

1. Preparation of the input of an Antares study to include a modelling a flow-based in the CWE area

2. Post-processing and visualisation of Antares’ results

This vignette describe the first set of functionnalities : the preparation of the inputs for the Antares study.

1 - Summary

#Convert domains from PTDF file, save the output in the directory "model1"
computeFB(PTDF = system.file("/input/ptdf/PTDF.csv", package = "antaresFlowbased"),
          outputName = "D:/model1", verbose = 0, nbFaces = 36)


#Set antares study path
antaresRead::setSimulationPath("D:/exemple_test", 0)

#Create flow-based time series considering their correlations with other inputs of an Antares Study, save the output in the directory "model1"
createFBTS(probabilityMatrix = probabilityMatrix, multiplier = multiplier,
           interSeasonBegin = interSeasonBegin,
           interSeasonEnd = interSeasonEnd, firstDay = firstDay, outputPath = "D:/model1")


#Set setFlowbased directory path
setFlowbasedPath(path = "D:/model1")

#Run shiny application to visualize the results of the convertion
runAppError()

#Initialize the Antares study
initFlowBased(scenario = rep(1:200, times = 5))

2 - Projection of domains

The function computeFB() converts flow-based domains (e.g. historical flow-based domains of some "typical representative days") into an Antares model with fixed PTDF. It uses the main following parameters :

PTDF is a csv file with ; field separator, , for decimal points and the following columns :

A PTDF file at this format can be automatically generated by using the function writePtdfOfTypicalDays of the package flowBasedClustering. One can also set the following optionnal arguments of the function :

The function creates a directory with the following files :

3 - Creation of flow-based time series

The previous function - computeFB() - converts the typical flow-based days in a format suited for Antares.

The next step consists in defining, for each day of each Monte-Carlo year, which typical flow-based day will be used to bound the exchanges within the CWE area. The function createFBTS() performs this task. Possible correlations between the flow-based shapes and external variables (e.g. load, wind power generation, solar generation) can be taken into account. Therefore, the function createFBTS() considers other inputs of the Antares study and the way they influence the occurences of the typical days.

The main inputs of this function are :

An example of the use of createFBTS() is given below.

# build probabilityMatrix with the function getProbability() from the package flowBasedClustering
# select an antaresStudy with the function setSimulationPath() from the package antaresRead

# rename columns of the probability matrix

matProb <- setNamesProbabilityMatrix(probabilityMatrix, c("FR_load", "DE_wind", "DE_solar"),
                                   c("fr@load", "de@wind", "de@solar"))

# set multipliers

multiplier <- data.frame(variable = c("fr@load", "de@wind", "de@solar"),
                         coef = c(1, 35000, 40000))

# set Calendar
firstDay <- identifyFirstDay(opts = antaresStudy)
interSeasonBegin <- as.Date(c("2017-09-03", "2018-02-02"))
interSeasonEnd <- as.Date(c("2020-10-04", "2018-05-02"))

# create ts.txt in D:/model1
ts <- createFBTS(opts = antaresStudy, probabilityMatrix = probabilityMatrix, multiplier = multiplier,
                 interSeasonBegin = interSeasonBegin,
                 interSeasonEnd = interSeasonEnd, firstDay = firstDay, outputPath = "D:/model1")

4 - Set the flow-based model

Once the modeled flow-based domains have been created with computeFB() and createFBTS(), they can be loaded using the following function :

# Specify a repository
setFlowbasedPath(path = "C:/PATH/TO/INPUT")

The directory must contain :

5 - Visualization & reports

One can visualize the modeled flow-based domains, download the associated data or create a summary of the model accuracy in a html document using a shiny application with the function runAppError().

runAppError()
Drawing

plotFB() can also be used to plot one or more domains directly in R :

library(antaresFlowbased)
setFlowbasedPath(model = "model2017")
# multiple countries and hour
plotFB(hour = 5:6, dayType = 1, country1 = c("FR", "DE"), country2 = c("DE", "NL"))

Reports in html format can also be generated within the shiny application. This solution can be use to facilitate the transmission and communication of the results.

Drawing

6 - Study initialization

This last step allows to prepare the inputs of an Antares study so as to include flow-based domains to bound CWE exchanges.

It is first necessary to select an antares study using setSimulationPath() function of the package antaresRead, and the flow-based model which will be set on this study must be specified with setFlowbasedPath().

The initialization of the study is then done with the function initFlowBased(). This function creates the inputs of the Antares study related to the flow-based modelling, with the appropriate binding constraints and virtual thermal plants.

The time-series of flow-based domains used for each Monte-Carlo years are desribed with the parameter scenarios. For instance, with scenario = rep(1:200, times = 5) (default value), up to 1000 Monte-Carlo years can be simulated with 5 blocks of, successively, time series 1 to 200. This "scenario building mode" is written in the file user/flowbased/scenario.txt of the Antares Study.

antaresRead::setSimulationPath("D:/exemple_test", 0)

# initialisation of flow-based study
initFlowBased(scenario = rep(1:200, times = 5))

7 - Run simulations

Once all these steps have been performed, the Antares study can be run as usual, for instance using the run simulation button of the software interface.



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