|
| 1 | +--- |
| 2 | +title: "Antares new features v9.3" |
| 3 | +output: rmarkdown::html_vignette |
| 4 | +vignette: > |
| 5 | + %\VignetteIndexEntry{Antares new features v9.3} |
| 6 | + %\VignetteEngine{knitr::rmarkdown} |
| 7 | + %\VignetteEncoding{UTF-8} |
| 8 | +--- |
| 9 | + |
| 10 | +```{r, include = FALSE} |
| 11 | +knitr::opts_chunk$set( |
| 12 | + collapse = TRUE, |
| 13 | + comment = "#>" |
| 14 | +) |
| 15 | +``` |
| 16 | + |
| 17 | +```{r setup} |
| 18 | +library(antaresEditObject) |
| 19 | +``` |
| 20 | + |
| 21 | +This article will present the new features in line with **Antares v9.3** (cf [Antares Simulator](https://antares-simulator.readthedocs.io/en/latest/user-guide/04-migration-guides/#v930)) |
| 22 | + |
| 23 | +## Create new study v9.3 |
| 24 | + |
| 25 | +```{r init} |
| 26 | +dir_path <- tempdir() |
| 27 | +suppressWarnings( |
| 28 | + createStudy(path = dir_path, |
| 29 | + study_name = "test930", |
| 30 | + antares_version = "9.3") |
| 31 | +) |
| 32 | +
|
| 33 | +``` |
| 34 | + |
| 35 | +For Antares Simulator, format version is now "9.3". For packages, we make the adjustment and we keep "930". |
| 36 | + |
| 37 | +**Check version of my current study** : |
| 38 | + |
| 39 | +```{r} |
| 40 | +current_study_opts <- simOptions() |
| 41 | +current_study_opts$antaresVersion |
| 42 | +``` |
| 43 | + |
| 44 | +Some minor changes to the creation of the study. |
| 45 | + |
| 46 | +Initializes the study by updating the `generaldata.ini` file : |
| 47 | + |
| 48 | + - The following properties were removed from settings/generaldata.ini. |
| 49 | + |
| 50 | + - refreshtimeseries |
| 51 | + - refreshintervalload |
| 52 | + - refreshintervalhydro |
| 53 | + - refreshintervalwind |
| 54 | + - refreshintervalthermal |
| 55 | + - refreshintervalsolar |
| 56 | + |
| 57 | +## Create area |
| 58 | + |
| 59 | +We just need create *areas* to create *st-storages*. |
| 60 | +```{r areas} |
| 61 | +createArea(name = "fr") |
| 62 | +createArea(name = "it") |
| 63 | +``` |
| 64 | + |
| 65 | +## Short term storage |
| 66 | + |
| 67 | +We can create new clusters, st-storage (from v8.6), with function `createClusterST()`. You can see function documentation with `?createClusterST`. |
| 68 | + |
| 69 | +By default you can call function only with two parameters (`area`, `cluster_name`). |
| 70 | + |
| 71 | +Clusters are created with default properties and time series. |
| 72 | + |
| 73 | + |
| 74 | +### New properties |
| 75 | + |
| 76 | +you can create or edit new clusters with new properties (see doc `?createClusterST`). |
| 77 | + |
| 78 | +```{r default values} |
| 79 | +# new properties (default values) |
| 80 | +rmarkdown::paged_table(as.data.frame(storage_values_default(), check.names = FALSE)) |
| 81 | +``` |
| 82 | + |
| 83 | +```{r creation/properties} |
| 84 | +# creation |
| 85 | +my_parameters <- storage_values_default() |
| 86 | +my_parameters$`allow-overflow` <- TRUE |
| 87 | +
|
| 88 | +createClusterST(area = "fr", |
| 89 | + cluster_name = "test_storage", |
| 90 | + group = "new_properties", |
| 91 | + storage_parameters = my_parameters, |
| 92 | + overwrite = TRUE) |
| 93 | +
|
| 94 | +createClusterST(area = "it", |
| 95 | + cluster_name = "test_storage", |
| 96 | + group = "new_properties", |
| 97 | + storage_parameters = my_parameters, |
| 98 | + overwrite = TRUE) |
| 99 | +
|
| 100 | +# read cluster properties |
| 101 | +tab <- readClusterSTDesc() |
| 102 | +rmarkdown::paged_table(tab) |
| 103 | +``` |
| 104 | + |
| 105 | +```{r edit/properties} |
| 106 | +# edit properties of existing st-storage cluster |
| 107 | +my_parameters$`allow-overflow` <- FALSE |
| 108 | +
|
| 109 | +editClusterST(area = "fr", |
| 110 | + cluster_name = "test_storage", |
| 111 | + storage_parameters = my_parameters) |
| 112 | +
|
| 113 | +# read cluster properties |
| 114 | +tab <- readClusterSTDesc() |
| 115 | +rmarkdown::paged_table(tab) |
| 116 | +``` |
| 117 | + |
| 118 | +### New dimension of **time series** |
| 119 | + |
| 120 | +All matrices will be of (8760, N), noting that N >= 1 |
| 121 | + |
| 122 | + |
| 123 | +```{r create/ts} |
| 124 | +# creation |
| 125 | +ratio_value <- matrix(0.7, 8760,2) |
| 126 | + |
| 127 | +# default properties with new optional TS |
| 128 | +createClusterST(area = "fr", |
| 129 | + cluster_name = "good_ts_value", |
| 130 | + cost_injection = ratio_value, |
| 131 | + cost_withdrawal = ratio_value, |
| 132 | + cost_level = ratio_value, |
| 133 | + cost_variation_injection = ratio_value, |
| 134 | + cost_variation_withdrawal = ratio_value) |
| 135 | +
|
| 136 | +# read cluster TS values |
| 137 | +tab <- readInputTS(st_storage = "all", |
| 138 | + showProgress = FALSE) |
| 139 | +rmarkdown::paged_table(head(tab)) |
| 140 | +``` |
| 141 | + |
| 142 | +```{r edit/ts} |
| 143 | +# edit TS values of existing st-storage cluster |
| 144 | +new_ratio_value <- matrix(0.85, 8760,3) |
| 145 | +
|
| 146 | +# edit everything or anyone you want |
| 147 | +editClusterST(area = "fr", |
| 148 | + cluster_name = "good_ts_value", |
| 149 | + cost_injection = new_ratio_value, |
| 150 | + cost_withdrawal = new_ratio_value) |
| 151 | +
|
| 152 | +# read cluster TS values |
| 153 | +tab <- readInputTS(st_storage = "all", |
| 154 | + showProgress = FALSE) |
| 155 | +rmarkdown::paged_table(head(tab)) |
| 156 | +``` |
| 157 | + |
| 158 | +### Additional |
| 159 | + |
| 160 | +All RHS will be of (8760, N), noting that N >= 1 |
| 161 | + |
| 162 | +```{r, message=FALSE} |
| 163 | +# Create |
| 164 | +good_ts <- matrix(0.7, nrow = 8760, ncol =3) |
| 165 | +createClusterST(area = "fr", |
| 166 | + cluster_name = "RHS_new_dimensions", |
| 167 | + storage_parameters = my_parameters, |
| 168 | + PMAX_injection = NULL, |
| 169 | + PMAX_withdrawal = NULL, |
| 170 | + inflows = NULL, |
| 171 | + lower_rule_curve = NULL, |
| 172 | + upper_rule_curve = NULL, |
| 173 | + cost_injection = NULL, |
| 174 | + cost_withdrawal = NULL, |
| 175 | + cost_level = NULL, |
| 176 | + cost_variation_injection = NULL, |
| 177 | + cost_variation_withdrawal =NULL, |
| 178 | + constraints_properties = list( |
| 179 | + "test"=list( |
| 180 | + variable = "withdrawal", |
| 181 | + operator = "equal", |
| 182 | + hours = c("[1,3,5]", |
| 183 | + "[120,121,122,123,124,125,126,127,128]") |
| 184 | + #enabled = FALSE |
| 185 | + ), |
| 186 | + "test2"=list( |
| 187 | + variable = "netting", |
| 188 | + operator = "less", |
| 189 | + hours = c("[1, 168]") |
| 190 | + )), |
| 191 | + # constraints_ts |
| 192 | + constraints_ts = list( |
| 193 | + "test" = good_ts, |
| 194 | + "test2" = good_ts |
| 195 | + )) |
| 196 | +
|
| 197 | +# Edit |
| 198 | +good_ts <- matrix(0.7, nrow = 8760, ncol =2) |
| 199 | +editClusterST (area = "fr", |
| 200 | + cluster_name = "RHS_new_dimensions", |
| 201 | + constraints_ts = list( |
| 202 | + "test" = good_ts, |
| 203 | + "test2" = good_ts |
| 204 | + ) , |
| 205 | + add_prefix = TRUE) |
| 206 | +#Read |
| 207 | +res=read_storages_constraints() |
| 208 | +``` |
| 209 | + |
| 210 | + |
| 211 | +```{r, echo=FALSE, message=FALSE, warning=FALSE} |
| 212 | +library(data.tree) |
| 213 | +as.Node(res) |
| 214 | +``` |
| 215 | + |
| 216 | +### Remove clusters |
| 217 | + |
| 218 | +Nothing has changed to remove clusters. |
| 219 | + |
| 220 | +```{r remove} |
| 221 | +# read cluster names |
| 222 | +levels(readClusterSTDesc()$cluster) |
| 223 | +
|
| 224 | +# remove a cluster |
| 225 | +removeClusterST(area = "fr", |
| 226 | + cluster_name = "good_ts_value") |
| 227 | +
|
| 228 | +# read cluster |
| 229 | +tab <- readClusterSTDesc() |
| 230 | +rmarkdown::paged_table(tab) |
| 231 | +``` |
| 232 | + |
| 233 | + |
| 234 | +## Generaldata |
| 235 | + |
| 236 | +The “generaldata.ini” settings file (*settings/generaldata.ini*) contains several sections. |
| 237 | + |
| 238 | +Antares Simulator v9.3 deletes some parameters: |
| 239 | + |
| 240 | + - *general/refreshtimeseries* |
| 241 | + - *general/refreshintervalload* |
| 242 | + - *general/refreshintervalhydro* |
| 243 | + - *general/refreshintervalwind* |
| 244 | + - *general/refreshintervalthermal* |
| 245 | + - *general/refreshintervalsolar* |
| 246 | + |
| 247 | +A message is displayed. |
| 248 | + |
| 249 | +```{r generaldata} |
| 250 | +# user messages |
| 251 | +updateGeneralSettings( |
| 252 | + refreshtimeseries = 100, |
| 253 | + refreshintervalload = 100, |
| 254 | + refreshintervalhydro = 100, |
| 255 | + refreshintervalwind = 100, |
| 256 | + refreshintervalthermal = 100, |
| 257 | + refreshintervalsolar = 100) |
| 258 | + |
| 259 | +``` |
| 260 | + |
| 261 | + |
| 262 | +## Scenario builder |
| 263 | + |
| 264 | +The scenario builder allows you to use a new code `sts` for short-term storage inflows in the following format : sts,area,year,storage = TS number. |
| 265 | +The scenario builder allows you to use a new code `sta` for short-term storage additional constraints in the following format : sta,area,year,storage,constraint = TS number. |
| 266 | + |
| 267 | +```{r scenariobuilder} |
| 268 | +#Add sts |
| 269 | +createClusterST(area = "fr", |
| 270 | + cluster_name = "Scenario_builder_sts") |
| 271 | + |
| 272 | +ldata <- scenarioBuilder( |
| 273 | + n_scenario = 5, |
| 274 | + n_mc = 5, |
| 275 | + areas = "fr" |
| 276 | +) |
| 277 | + |
| 278 | +updateScenarioBuilder(ldata = ldata, |
| 279 | + series = "sts") |
| 280 | +
|
| 281 | +#Add sta |
| 282 | +name_no_prefix <- "add_constraints_sta" |
| 283 | + |
| 284 | +constraints_properties <- list( |
| 285 | + "withdrawal-1"=list( |
| 286 | + variable = "withdrawal", |
| 287 | + operator = "equal", |
| 288 | + hours = c("[1,3,5]", |
| 289 | + "[120,121,122,123,124,125,126,127,128]") |
| 290 | + ), |
| 291 | + "netting-1"=list( |
| 292 | + variable = "netting", |
| 293 | + operator = "less", |
| 294 | + hours = c("[1, 168]") |
| 295 | + )) |
| 296 | + |
| 297 | +createClusterST(area = "fr", |
| 298 | + cluster_name = name_no_prefix, |
| 299 | + constraints_properties = constraints_properties) |
| 300 | + |
| 301 | +ldata <- scenarioBuilder( |
| 302 | + n_scenario = 5, |
| 303 | + n_mc = 5, |
| 304 | + areas = "fr" |
| 305 | +) |
| 306 | + |
| 307 | +updateScenarioBuilder(ldata = ldata, |
| 308 | + series = "sta") |
| 309 | + |
| 310 | +readScenarioBuilder(as_matrix = TRUE) |
| 311 | +``` |
| 312 | + |
| 313 | +## Thematic |
| 314 | + |
| 315 | +In settings/generaldata.ini, in section variables selection, the following variables were removed: |
| 316 | + |
| 317 | +- *variables selection/NUCLEAR* |
| 318 | +- *variables selection/LIGNITE* |
| 319 | +- *variables selection/COAL* |
| 320 | +- *variables selection/BATTERY* |
| 321 | +- *variables selection/GAS* |
| 322 | +- *variables selection/OIL* |
| 323 | +- *variables selection/MIX. FUEL* |
| 324 | +- *variables selection/MISC. DTG* |
| 325 | +- *variables selection/MISC. DTG 2* |
| 326 | +- *variables selection/MISC. DTG 3* |
| 327 | +- *variables selection/MISC. DTG 4* |
| 328 | +They're replaced by the dynamic variable DISPATCH. GEN. |
| 329 | + |
| 330 | +The following variables were removed: |
| 331 | + |
| 332 | +- *variables selection/WIND OFFSHORE* |
| 333 | +- *variables selection/WIND ONSHORE* |
| 334 | +- *variables selection/SOLAR CONCRT.* |
| 335 | +- *variables selection/SOLAR PV* |
| 336 | +- *variables selection/SOLAR ROOFT* |
| 337 | +- *variables selection/RENW. 1* |
| 338 | +- *variables selection/RENW. 2* |
| 339 | +- *variables selection/RENW. 3* |
| 340 | +- *variables selection/RENW. 4* |
| 341 | +They're replaced by the dynamic variable RENEWABLE GEN. |
| 342 | + |
| 343 | +```{r} |
| 344 | +#List of variables version >=9.3 |
| 345 | +vector_select_vars= list_thematic_variables() |
| 346 | +#Add all variables |
| 347 | +list_thematic=setThematicTrimming(selection_variables = vector_select_vars$col_name[68:72]) |
| 348 | +list_thematic$parameters$`variables selection` |
| 349 | +``` |
| 350 | + |
| 351 | + |
| 352 | +```{r delete study, include=FALSE} |
| 353 | +# Delete study |
| 354 | +unlink(current_study_opts$studyPath, |
| 355 | + recursive = TRUE) |
| 356 | +# clean global options |
| 357 | +options(antares = NULL) |
| 358 | +``` |
| 359 | + |
| 360 | + |
0 commit comments