Learn R Programming

antaresEditObject (version 0.6.4)

scenario-builder: Read, create, update & deduplicate scenario builder

Description

Antares API OK

Read, create, update & deduplicate scenario builder.

Usage

scenarioBuilder(
  n_scenario,
  n_mc = NULL,
  areas = NULL,
  areas_rand = NULL,
  coef_hydro_levels = NULL,
  opts = antaresRead::simOptions()
)

readScenarioBuilder( ruleset = "Default Ruleset", as_matrix = TRUE, opts = antaresRead::simOptions() )

updateScenarioBuilder( ldata, ruleset = "Default Ruleset", series = NULL, clusters_areas = NULL, links = NULL, opts = antaresRead::simOptions() )

clearScenarioBuilder( ruleset = "Default Ruleset", opts = antaresRead::simOptions() )

deduplicateScenarioBuilder( ruleset = "Default Ruleset", opts = antaresRead::simOptions() )

Value

scenarioBuilder : a matrix

readScenarioBuilder : a list of matrix or list according to as_matrix parameters.

Arguments

n_scenario

Number of scenario.

n_mc

Number of Monte-Carlo years.

areas

Areas to use in scenario builder, if NULL (default) all areas in Antares study are used.

areas_rand

Areas for which to use "rand".

coef_hydro_levels

Hydro levels coefficients.

opts

List of simulation parameters returned by the function antaresRead::setSimulationPath()

ruleset

Ruleset to read.

as_matrix

If TRUE (default) return a matrix, else a list.

ldata

A matrix obtained with scenarioBuilder, or a named list of matrices obtained with scenarioBuilder, names must be 'l', 'h', 'w', 's', 't', 'r', 'ntc' or 'hl', depending on the series to update.

series

Name(s) of the serie(s) to update if ldata is a single matrix.

clusters_areas

A data.table with two columns area and cluster to identify area/cluster couple to update for thermal or renewable series. Default is to read clusters description and update all couples area/cluster.

links

Links to use if series is "ntc". Either a simple vector with links described as "area01%area02 or a data.table with two columns from and to. Default is to read existing links and update them all.

See Also

Examples

Run this code
if (FALSE) {

library(antaresRead)
library(antaresEditObject)

# simulation path
setSimulationPath(
  path = "pat/to/simulation",
  simulation = "input"
)

# Create a scenario builder matrix
sbuilder <- scenarioBuilder(
  n_scenario = 51,
  n_mc = 2040,
  areas_rand = c("fr", "be")
)
sbuilder[, 1:6]
dim(sbuilder)

# Create a scenario builder matrix for hydro levels (use case 1)
sbuilder <- scenarioBuilder(
  n_mc = opts$parameters$general$nbyears,
  areas = c("fr", "be"),
  coef_hydro_levels = c(0.1, 0.9)
)

# Create a scenario builder matrix for hydro levels (use case 2)
sbuilder <- scenarioBuilder(
  n_mc = opts$parameters$general$nbyears,
  areas = c("fr", "be"),
  coef_hydro_levels = c(runif(opts$parameters$general$nbyears)
  , runif(opts$parameters$general$nbyears)
  )
)

# Read previous scenario builder
# in a matrix format
prev_sb <- readScenarioBuilder()


# Update scenario builder

# Single matrix for load serie
updateScenarioBuilder(ldata = sbuilder, series = "load") # can be l instead of load

# equivalent as
updateScenarioBuilder(ldata = list(l = sbuilder))


# update several series

# same input
sbuilder
updateScenarioBuilder(
  ldata = sbuilder, 
  series = c("load", "hydro", "solar")
)

# List of matrix
updateScenarioBuilder(ldata = list(
  l = load_sb,
  h = hydro_sb,
  s = solar_sb
))

# Deduplicate scenario builder

deduplicateScenarioBuilder()
}

Run the code above in your browser using DataLab