# CRAN limite CPU usage
::setDTthreads(2)
data.tablelibrary(antaresEditObject)
#> Le chargement a nécessité le package : antaresRead
#>
#> Attachement du package : 'antaresEditObject'
#> Les objets suivants sont masqués depuis 'package:antaresRead':
#>
#> readIni, readIniFile
This thumbnail will present the new features in line with Antares v8.6.0 (the link is here)
There are 3 new features :
- Add new storage type “short-term storage”.
- Update parameters of thermal clusters with “pollutant emission factors”
- “Hydro Pmin” : new file “mingen.txt”
<- tempdir()
dir_path createStudy(path = dir_path,
study_name = "test860",
antares_version = "8.6.0")
#> Warning: Parameter 'horizon' is missing or inconsistent with 'january.1st' and 'leapyear'. Assume correct year is 2018.
#> To avoid this warning message in future simulations, open the study with Antares and go to the simulation tab, put a valid year number in the cell 'horizon' and use consistent values for parameters 'Leap year' and '1st january'.
createArea(name = "fr")
createArea(name = "it")
We can create new st-storage cluster with new function createClusterST()
. You can see function documentation with ?createClusterST
.
By default you can call function only with two parameters (area
, cluster_name
).
<- matrix(3, 8760)
inflows_data <- matrix(0.7, 8760)
ratio_values
createClusterST(area = "fr",
cluster_name = "test_storage",
storage_parameters = storage_values_default(),
PMAX_injection = ratio_values,
PMAX_withdrawal = ratio_values,
inflows = inflows_data,
lower_rule_curve = ratio_values,
upper_rule_curve = ratio_values,
overwrite = TRUE)
#> Warning: No cluster description available.
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
createClusterST(area = "it",
cluster_name = "test_storage",
storage_parameters = storage_values_default(),
PMAX_injection = ratio_values,
PMAX_withdrawal = ratio_values,
inflows = inflows_data,
lower_rule_curve = ratio_values,
upper_rule_curve = ratio_values,
overwrite = TRUE)
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
#> x being coerced from class: matrix to data.table
Now you can see informations in simulation options.
<- simOptions()
opts $areasWithSTClusters
opts#> [1] "fr" "it"
After creating “st-storage” clusters, you can read all information with specific function readClusterSTDesc()
.
<- readClusterSTDesc()
tab ::paged_table(tab) rmarkdown
St-storages data are time series you can read for all areas or a specific area. 5 files contening one time series are generated (one per each function parameter):
<- readInputTS(st_storage = "all")
data_st_storage #> Importing st-storage
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
::paged_table(head(data_st_storage)) rmarkdown
As you can see, the last two columns (st-storage
, name_file
) give you value for each name file.
FYI : As default, reading option for hourly timestep is 8736 (see opts$timeIdMax
).
It is possible to edit parameters values and data values like you want.
# edit parameters values
<- storage_values_default()
list_params_st $efficiency <- 0.5
list_params_st$reservoircapacity <- 50
list_params_st
# edit data values
<- matrix(4, 8760)
inflows_data
editClusterST(area = "fr",
cluster_name = "test_storage",
storage_parameters = list_params_st,
inflows = inflows_data,
add_prefix = TRUE)
#> x being coerced from class: matrix to data.table
# read parameters
<- readClusterSTDesc()
tab ::paged_table(tab) rmarkdown
# read data
<- readInputTS(st_storage = "all")
data_st_storage #> Importing st-storage
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
::paged_table(head(data_st_storage)) rmarkdown
Creating or editing st-storage are done, you can also remove clusters from study.
# remove cluster
removeClusterST(area = "fr",
cluster_name = "test_storage",
add_prefix = TRUE)
# delete control
<- simOptions()
opts $areasWithSTClusters
opts#> [1] "it"
The area fr
is deleted cause we created only one cluster test_storage
.
# control removed parameters
<- readClusterSTDesc()
tab ::paged_table(head(tab)) rmarkdown
# control removed data
<- readInputTS(st_storage = "all")
data_st_storage #> Importing st-storage
#>
|
| | 0%
|
|======================================================================| 100%
::paged_table(head(data_st_storage)) rmarkdown
unique(data_st_storage$area)
#> [1] "it"
Parameters and data concerning this cluster in this area are removed.
Antares version 8.6.0 now provide pollutants parameters for thermal clusters. You can see the documentation on thermal clusters here.
You have global list
of pollutants given by function list_pollutants_values()
. By default, parameters are set to NULL, you can initialize all parameters with value or customize parameters.
# create cluster with pollutants
# pollutants
<- list_pollutants_values(multi_values = 0.25)
all_param_pollutants
createCluster(area = "fr",
cluster_name = "test_pollutant",
unitcount = 1L,
marginal_cost = 50,
list_pollutants = all_param_pollutants,
time_series = matrix(rep(c(0, 8000), each = 24*364), ncol = 2),
prepro_modulation = matrix(rep(c(1, 1, 1, 0), each = 24*365), ncol = 4)
)
# read parameters
<- readClusterDesc()
param_th_cluster ::paged_table(param_th_cluster) rmarkdown
Let’s see how to edit 3 parameters nh3, nox, pm2_5.
# editing
<- list_pollutants_values(multi_values = 0.3)[1:3]
edit_param_pollutants
editCluster(area = "fr",
cluster_name = "test_pollutant",
unitcount = 2L,
list_pollutants = edit_param_pollutants)
# read parameters
<- readClusterDesc()
param_th_cluster ::paged_table(param_th_cluster) rmarkdown
Antares version 8.6.0 provides new file mingen.txt
, this file must respect some conditions.
The first condition to respect is the dimension with file mod.txt
.
The second one is the consistency of the data between 3 files (mingen.txt
, mod.txt
, maxpower_{area}.txt
).
Full documentation is available in the function writeInputTS()
. We will see further information for values checks.
Values checks :
Checks depends of values of parameters in hydro.ini
file.
After creating study, .txt
files containing time series are empty. We will describe steps to edit mingen.txt
.
Initial values :
# see hydro parameters
<- file.path("input", "hydro", "hydro.ini")
path_file_hydro <- readIni(pathIni = path_file_hydro)
hydro_ini_values <- c('follow load', 'use heuristic', "reservoir")
hydro_params
hydro_ini_values[hydro_params]#> $`follow load`
#> $`follow load`$fr
#> [1] TRUE
#>
#> $`follow load`$it
#> [1] TRUE
#>
#>
#> $`use heuristic`
#> $`use heuristic`$fr
#> [1] TRUE
#>
#> $`use heuristic`$it
#> [1] TRUE
#>
#>
#> $reservoir
#> $reservoir$fr
#> [1] FALSE
#>
#> $reservoir$it
#> [1] FALSE
Steps to create mingen file :
# Initialize mingen data (time series)
= matrix(0.06,8760,5)
mingen_data
# 1 - edit mod file (time series)
= matrix(6,365,5)
mod_data suppressWarnings(
writeInputTS(area = "fr", type = "hydroSTOR",
data = mod_data,
overwrite = TRUE)
)#> Importing mingen
#>
|
| | 0%
|
|======================================================================| 100%
#> Importing hydroStorage
#>
|
| | 0%
|
|======================================================================| 100%
# 2 - edit maxpower
<- matrix(6,365,4)
maxpower_data suppressWarnings(
writeHydroValues(area = "fr",
type = "maxpower",
data = maxpower_data)
)#> x being coerced from class: matrix to data.table
#> Importing mingen
#>
|
| | 0%
|
|======================================================================| 100%
#> Importing hydroStorageMaxPower
#>
|
| | 0%
|
|======================================================================| 100%
# 3 - edit mingen
suppressWarnings(
writeInputTS(area = "fr", type = "mingen",
data = mingen_data,
overwrite = TRUE)
)#> Importing mingen
#>
|
| | 0%
|
|======================================================================| 100%
#> Importing hydroStorage
#>
|
| | 0%
|
|======================================================================| 100%
#> Importing mingen
#>
|
| | 0%
|
|======================================================================| 100%
#> Importing hydroStorageMaxPower
#>
|
| | 0%
|
|======================================================================| 100%
Now we can read time series.
# read input time series
<- readInputTS(mingen = "all")
read_ts_file #> Importing mingen
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
::paged_table(head(read_ts_file)) rmarkdown