setSimulationPath: Set Path to an Antares simulation

Description Usage Arguments Details Value See Also Examples

View source: R/setSimulationPath.R

Description

This function has to be used before the read functions. It sets the path to the Antares simulation to work on and other useful options (list of areas, links, areas with clusters, variables, etc.).

Usage

1
setSimulationPath(path, simulation = NULL)

Arguments

path

(optional) Path to the simulation. It can either be the path to a directory containing an antares project or directly to the directory containing the output of a simulation. If missing, a window opens and lets the user choose the directory of the simulation interactively. Can also choose .h5 file, if rhdf5 is installed.

simulation

(optional) Only used if "path" represents the path of a study and not of the output of a simulation. It can be either the name of the simulation or a number indicating which simulation to use. It is possible to use negative values to select a simulation from the last one: for instance -1 will select the most recent simulation, -2 will the penultimate one, etc. There are two special values 0 and "input" that tells the function that the user is not interested by the results of any simulation, but only by the inputs. In such a case, the function readAntares is anavailable.

Details

The simulation choosen with setSimulationPath becomes the default simulation for all functions of the package. This behavior is fine when working on only one simulation, but it may become problematic when working on multiple simulations at same time.

In such case, you can store the object returned by the function in a variable and pass this variable to the functions of the package (see examples).

Value

A list containing various information about the simulation, in particular:

studyPath

path of the Antares study

simPath

path of the simulation

inputPath

path of the input folder of the study

studyName

Name of the study

simDataPath

path of the folder containing the data of the simulation

name

name of the simulation

mode

type of simulation: economy, adequacy, draft or input

synthesis

Are synthetic results available ?

yearByYear

Are the results for each Monte Carlo simulation available ?

scenarios

Are the Monte-Carlo scenarii stored in output ? This is important to reconstruct some input time series that have been used in each Monte-Carlo simulation.

mcYears

Vector containing the number of the exported Monte-Carlo scenarios

antaresVersion

Version of Antares used to run the simulation.

areaList

Vector of the available areas.

districtList

Vector of the available districts.

linkList

Vector of the available links.

areasWithClusters

Vector of areas containing clusters.

variables

Available variables for areas, districts and links.

parameters

Other parameters of the simulation.

timeIdMin

Minimum time id of the simulation. It is generally equal to one but can be higher if working on a subperiod.

timeIdMax

maximum time id of the simulation.

start

Date of the first day of the year in the simulation. This date corresponds to timeId = 1.

firstWeekday

First day of the week.

districtsDef

data.table containing the specification of the districts.

energyCosts

list containing the cost of spilled and unsupplied energy.

See Also

simOptions, readAntares, readLayout, readClusterDesc, readBindingConstraints

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
## Not run: 
# Select interactively a study. It only works on windows.

setSimulationPath()

# Specify path of the study. Note: if there are more than one simulation
# output in the study, the function will asks the user to interactively choose
# one simulation.

setSimulationPath("path_of_the_folder_of_the_study")

# Select the first simulation of a study

setSimulationPath("path_of_the_folder_of_the_study", 1)

# Select the last simulation of a study

setSimulationPath("path_of_the_folder_of_the_study", -1)

# Select a simulation by name

setSimulationPath("path_of_the_folder_of_the_study", "name of the simulation")

# Just need to read input data

setSimulationPath("path_of_the_folder_of_the_study", "input")
# or
setSimulationPath("path_of_the_folder_of_the_study", 0)



# WORKING WITH MULTIPLE SIMULATIONS
#----------------------------------
# Let us assume ten simulations have been run and we want to collect the
# variable "LOAD" for each area. We can create a list containing options
# for each simulation and iterate through this list.

opts <- lapply(1:10, function(i) {
   setSimulationPath("path_of_the_folder_of_the_study", i)
})

output <- lapply(opts, function(o) {
  res <- readAntares(areas = "all", select = "LOAD", timeStep = "monthly", opts = o)
  # Add a column "simulation" containing the name of the simulation
  res$simulation <- o$name
  res
})

# Concatenate all the tables in one super table
output <- rbindlist(output)

# Reshape output for easier comparisons: one line per timeId and one column
# per simulation
output <- dcast(output, timeId + areaId ~ simulation, value.var = "LOAD")

output

# Quick visualization
matplot(output[area == area[1], !c("area", "timeId"), with = FALSE], 
        type = "l")

## End(Not run)

antaresRead documentation built on Feb. 13, 2019, 5:04 p.m.