Read, create, update & deduplicate scenario builder.
scenarioBuilder(
n_scenario = 1,
n_mc = NULL,
areas = NULL,
areas_rand = NULL,
group_bc = NULL,
group_bc_rand = NULL,
coef_hydro_levels = NULL,
mode = 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()
)
Number of scenario.
Number of Monte-Carlo years.
Areas to use in scenario builder, if NULL
(default) all areas in Antares study are used.
Areas for which to use "rand"
.
character
Bindgind constraints's groups names to use.
character
Bindgind constraints which to use "rand"
.
Hydro levels coefficients.
character
"bc" to edit binding constraints.
List of simulation parameters returned by the function
antaresRead::setSimulationPath()
Ruleset to read.
If TRUE
(default) return a matrix
, else a list
.
A matrix
obtained with scenarioBuilder
,
or a named list of matrices obtained with scenarioBuilder
, names must be
'l', 'h', 'w', 's', 't', 'r', 'ntc', 'hl' or 'bc', depending on the series to update.
Name(s) of the serie(s) to update if ldata
is a single matrix
.
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 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.
scenarioBuilder
: a matrix
readScenarioBuilder
: a list
of matrix
or list
according to as_matrix
parameters.
series = "ntc"
is only available with Antares >= 8.2.0.
For series = "hl"
, each value must be between 0 and 1.
User must enable/disable custom-scenario
property in settings/generaldata.ini
by himself.
series = "bc"
is only available with Antares >= 8.7.0.
For a single matrix, value of series can be :
h or hydro
hl or hydrolevels
l or load
ntc
r or renewables
s or solar
t or thermal
w or wind
if (FALSE) { # \dontrun{
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)
)
)
# Create a scenario builder matrix with
# bindings constraints groups (study version >= 8.7.0)
# Use parameter "mode" with "bc"
sbuilder <- scenarioBuilder(
n_scenario = 51,
n_mc = 2040,
group_bc = c("my_bc_1", "my_bc_2"),
group_bc_rand = "my_bc_2",
mode = "bc"
)
# 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))
# for binding constraints (study version >= 8.7.0)
updateScenarioBuilder(ldata = sbuilder, series = "bc")
# 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()
} # }