Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliette-Gerbaux committed May 29, 2024
1 parent a94dbf9 commit 71ac783
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ library(antaresWaterValues)
Now we are ready to use our package.

``` r
shiny_water_values()
study_path <- "your/path/to/the/antares/study"
shiny_water_values(antaresRead::setSimulationPath(study_path,"input"))
```

![](inst/images/calculate_water_values.gif)
Expand All @@ -58,14 +59,14 @@ simulation_res <- runWaterValuesSimulation(
area=area,
nb_disc_stock = 5, #number of simulations
nb_mcyears = mcyears,
path_solver = "your/path/to/antares/bin/antares-8.1-solver.exe",
path_solver = "your/path/to/antares/bin/antares-8.6-solver.exe",
fictive_area = paste0("watervalue_",area),
thermal_cluster = "watervaluecluster",
overwrite = TRUE,
link_from=area,
opts = opts,
otp_dest=paste0(study_path,"/user"),
file_name=paste0(j,"_",area), #name of the saving file
file_name="water_values", #name of the saving file
pumping=pumping,
efficiency=pump_eff,
launch_simulations=T,
Expand Down Expand Up @@ -100,20 +101,20 @@ results <- Grid_Matrix(
nb_disc_stock = 20,
pumping = pumping,
pumping_efficiency = pump_eff,
opts=opts),# used for marginal prices interpolation
force_final_level = F # T if you want to constrain final level with penalties (see Grid_Matrix documentation for more information)
opts=opts,
mcyears=mcyears),# used for marginal prices interpolation
force_final_level = F, # T if you want to constrain final level with penalties (see Grid_Matrix documentation for more information)
final_level = get_initial_level(area=area,opts=opts), # wanted final level (between 0 and 100%)
penalty_final_level_low = 4,
penalty_final_level_high = 1
)
aggregated_results <- results$aggregated_results
```

Water values are written to Antares thanks to the following instructions

``` r
reshaped_values <- aggregated_results[aggregated_results$weeks!=53,] %>%
to_Antares_Format(penalty_level_low=3,
penalty_level_high=0,
force_final_level=F,
penalty_final_level=0)
reshaped_values <- to_Antares_Format(aggregated_results)
antaresEditObject::writeWaterValues(
area = area,
data = reshaped_values
Expand All @@ -130,19 +131,21 @@ waterValuesViz(Data=aggregated_results,filter_penalties = F)

``` r
plot_Bellman(value_nodes_dt = aggregated_results,
week_number = c(1,3),
penalty_high = 0,
penalty_low = 3,
force_final_level = F, #T if final level is constrained
penalty_final_level = 0 # used if final level is constrained
)
week_number = c(1,3))
```

<img src="man/figures/README-bellman-1.png" width="100%" />

You can also plot reward functions

``` r
controls_reward_calculation <-constraint_generator(area=area,
nb_disc_stock = 20,
pumping = pumping,
pumping_efficiency = pump_eff,
opts=opts,
mcyears=mcyears)
controls_reward_calculation <-dplyr::arrange(dplyr::distinct(dplyr::select(rbind(simulation_res$simulation_values,controls_reward_calculation),-c("sim"))),.data$week,.data$u)
reward <- get_Reward(
simulation_names = simulation_res$simulation_names,
simulation_values = simulation_res$simulation_values,
Expand All @@ -153,11 +156,8 @@ reward <- get_Reward(
method_old = T,# T if you want a simple linear interpolation of rewards,
# F if you want to use marginal price to interpolate
hours = c(seq.int(0,168,10),168),# used for marginal prices interpolation
possible_controls = constraint_generator(area=area,
nb_disc_stock = 20,
pumping = pumping,
pumping_efficiency = pump_eff,
opts=opts)# used for marginal prices interpolation
possible_controls = controls_reward_calculation,# used for marginal prices interpolation
max_hydro = get_max_hydro(area,timeStep = "hourly")
)
reward <- reward$reward
```
Expand Down
Binary file modified inst/images/calculate_water_values.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 71ac783

Please sign in to comment.