getLinks: Retrieve links connected to a set of areas

Description Usage Arguments Value Examples

View source: R/getLinks.R

Description

This function find the name of the links connected to a set of areas.

Usage

1
2
getLinks(areas = NULL, exclude = NULL, opts = simOptions(),
  internalOnly = FALSE, namesOnly = TRUE, withDirection = FALSE)

Arguments

areas

Vector containing area names. It represents the set of areas we are interested in. If NULL, all areas of the study are used.

exclude

Vector containing area names. If not NULL, all links connected to one of these areas are omited.

opts

list of simulation parameters returned by the function setSimulationPath

internalOnly

If TRUE, only links that connect two areas from parameter area are returned. If not, the function may return links that connect an area from the list with an area outside the list.

namesOnly

If TRUE, the function returns a vector with link names, else it returns a table containing the name, the origin and the destination of each selected link.

withDirection

Used only if namesOnly = TRUE. If FALSE, then the function returns a table with one line per link, containing the link name the origin and the destination of the link. If FALSE, then it returns a table with columns area, link, to and direction which is equal is equal to 1 if the link connects "area" to "to" and -1 if it connects "to" to "area". The column area contains only areas that are compatible with parameters areas and exclude. Note that the same link can appear twice in the table with different directions.

Value

If namesOnly = TRUE the function returns a vector containing link names

If namesOnly = FALSE and withDirection = FALSE, it returns a data.table with exactly one line per link and with three columns:

link

link name

from

first area connected to the link

to

second area connected to the link

If namesOnly = FALSE and withDirection = FALSE, it returns a data.table with one or two lines per link and with four columns:

area

Area name

link

Link name

to

Area connected to "area" by "link"

direction

1 if the link connects "area" to "to" else -1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Get all links of a study
getLinks()

# Get all links with their origin and their destination

# Get all links connected to french areas (assuming their name contains "fr")
getLinks(getAreas("fr"))

# Same but with only links connecting two french areas
getLinks(getAreas("fr"), internalOnly = TRUE)

# Exclude links connecting real areas with pumped storage virtual areas
# (assuming their name contains "psp")
getLinks(getAreas("fr"), exclude = getAreas("psp"))


## End(Not run)

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