Skip to content

Commit 71ac783

Browse files
author
Juliette-Gerbaux
committed
Update readme
1 parent a94dbf9 commit 71ac783

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ library(antaresWaterValues)
3232
Now we are ready to use our package.
3333

3434
``` r
35-
shiny_water_values()
35+
study_path <- "your/path/to/the/antares/study"
36+
shiny_water_values(antaresRead::setSimulationPath(study_path,"input"))
3637
```
3738

3839
![](inst/images/calculate_water_values.gif)
@@ -58,14 +59,14 @@ simulation_res <- runWaterValuesSimulation(
5859
area=area,
5960
nb_disc_stock = 5, #number of simulations
6061
nb_mcyears = mcyears,
61-
path_solver = "your/path/to/antares/bin/antares-8.1-solver.exe",
62+
path_solver = "your/path/to/antares/bin/antares-8.6-solver.exe",
6263
fictive_area = paste0("watervalue_",area),
6364
thermal_cluster = "watervaluecluster",
6465
overwrite = TRUE,
6566
link_from=area,
6667
opts = opts,
6768
otp_dest=paste0(study_path,"/user"),
68-
file_name=paste0(j,"_",area), #name of the saving file
69+
file_name="water_values", #name of the saving file
6970
pumping=pumping,
7071
efficiency=pump_eff,
7172
launch_simulations=T,
@@ -100,20 +101,20 @@ results <- Grid_Matrix(
100101
nb_disc_stock = 20,
101102
pumping = pumping,
102103
pumping_efficiency = pump_eff,
103-
opts=opts),# used for marginal prices interpolation
104-
force_final_level = F # T if you want to constrain final level with penalties (see Grid_Matrix documentation for more information)
104+
opts=opts,
105+
mcyears=mcyears),# used for marginal prices interpolation
106+
force_final_level = F, # T if you want to constrain final level with penalties (see Grid_Matrix documentation for more information)
107+
final_level = get_initial_level(area=area,opts=opts), # wanted final level (between 0 and 100%)
108+
penalty_final_level_low = 4,
109+
penalty_final_level_high = 1
105110
)
106111
aggregated_results <- results$aggregated_results
107112
```
108113

109114
Water values are written to Antares thanks to the following instructions
110115

111116
``` r
112-
reshaped_values <- aggregated_results[aggregated_results$weeks!=53,] %>%
113-
to_Antares_Format(penalty_level_low=3,
114-
penalty_level_high=0,
115-
force_final_level=F,
116-
penalty_final_level=0)
117+
reshaped_values <- to_Antares_Format(aggregated_results)
117118
antaresEditObject::writeWaterValues(
118119
area = area,
119120
data = reshaped_values
@@ -130,19 +131,21 @@ waterValuesViz(Data=aggregated_results,filter_penalties = F)
130131

131132
``` r
132133
plot_Bellman(value_nodes_dt = aggregated_results,
133-
week_number = c(1,3),
134-
penalty_high = 0,
135-
penalty_low = 3,
136-
force_final_level = F, #T if final level is constrained
137-
penalty_final_level = 0 # used if final level is constrained
138-
)
134+
week_number = c(1,3))
139135
```
140136

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

143139
You can also plot reward functions
144140

145141
``` r
142+
controls_reward_calculation <-constraint_generator(area=area,
143+
nb_disc_stock = 20,
144+
pumping = pumping,
145+
pumping_efficiency = pump_eff,
146+
opts=opts,
147+
mcyears=mcyears)
148+
controls_reward_calculation <-dplyr::arrange(dplyr::distinct(dplyr::select(rbind(simulation_res$simulation_values,controls_reward_calculation),-c("sim"))),.data$week,.data$u)
146149
reward <- get_Reward(
147150
simulation_names = simulation_res$simulation_names,
148151
simulation_values = simulation_res$simulation_values,
@@ -153,11 +156,8 @@ reward <- get_Reward(
153156
method_old = T,# T if you want a simple linear interpolation of rewards,
154157
# F if you want to use marginal price to interpolate
155158
hours = c(seq.int(0,168,10),168),# used for marginal prices interpolation
156-
possible_controls = constraint_generator(area=area,
157-
nb_disc_stock = 20,
158-
pumping = pumping,
159-
pumping_efficiency = pump_eff,
160-
opts=opts)# used for marginal prices interpolation
159+
possible_controls = controls_reward_calculation,# used for marginal prices interpolation
160+
max_hydro = get_max_hydro(area,timeStep = "hourly")
161161
)
162162
reward <- reward$reward
163163
```
39.8 KB
Loading

0 commit comments

Comments
 (0)