From e94a1cd9b9b1d6bfd400706143f816298a68ce44 Mon Sep 17 00:00:00 2001 From: GERBAUX Juliette Date: Fri, 25 Aug 2023 12:05:02 +0200 Subject: [PATCH] Small corrections in get_Reward and Shiny --- R/Shiny.R | 2 +- R/get_Reward.R | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/Shiny.R b/R/Shiny.R index 61e6d6b8..a8bee2c7 100644 --- a/R/Shiny.R +++ b/R/Shiny.R @@ -118,7 +118,7 @@ ui <- shiny::fluidPage( ), #end sidebarPanel shiny::mainPanel( - shiny::h2("Controls (u) evaluated for each week and for each simulation (sim)"), + shiny::h2("Controls (u) in MWh per week evaluated for each week and for each simulation (sim)"), DT::dataTableOutput("simulation_constraint") ) diff --git a/R/get_Reward.R b/R/get_Reward.R index 5c21bb04..6ac45ee7 100644 --- a/R/get_Reward.R +++ b/R/get_Reward.R @@ -135,7 +135,7 @@ get_Reward <- function(simulation_values = NULL,simulation_names=NULL, pattern = max_hydro <- dplyr::rename(max_hydro,"P_max"="pump","T_max"="turb") assertthat::assert_that(min(max_hydro$T_max)>0) - assertthat::assert_that(min(max_hydro$P_max)>0) + # Creating possible controls if none if(is.null(possible_controls)){ nb_hours <- length(hours) @@ -521,6 +521,9 @@ reward_offset <- function(opts, df_reward, u0=c(),mcyears,district_cost= "water dplyr::rename(week="timeId",ov_cost="OV. COST") %>% dplyr::select("mcYear","week","ov_cost") %>% as.data.frame() + if (sum(is.na(u0))>=1){ + u0 <- c() + } if (length(u0)>0){ u0 <- data.frame(week=1:52,u0=u0) df_reward <- df_reward %>%