Commit 37e59c8f authored by Matteo DE FELICE's avatar Matteo DE FELICE

New plot with inflows and new setup of simulation results

parent 18eb8629
......@@ -99,8 +99,6 @@ shinyServer(function(input, output, session) {
}
# Generation stacked ----------------------------------------------------------------------------
else if (input$plot_type == 'gen_stacked') {
color_palette = c('HPHS' = 'blue4',
'HDAM' = 'blue3',
'HROR' = 'cornflowerblue',
......@@ -185,19 +183,36 @@ shinyServer(function(input, output, session) {
# Reservoir levels single ------------------------------------------------------------------
else if (input$plot_type == 'res_single') {
inflows = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Inflows') %>%
select(contains(paste0(input$zone, '_HPHS')),
contains(paste0(input$zone, '_HDAM'))) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, inflow, -date, -day_of_the_year)
res_zone = select(res, date, contains(paste0(input$zone, '_HPHS')),
contains(paste0(input$zone, '_HDAM'))) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, level, -date, -day_of_the_year)
gen_zone = select(gen, date, contains(paste0(input$zone, '_HPHS')),
contains(paste0(input$zone, '_HDAM'))) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, generation, -date, -day_of_the_year)
merged = inner_join(inner_join(inflows, res_zone), gen_zone) %>%
gather(variable, output, -date, -day_of_the_year, -area)
entsoe_data = entsoe_storage %>%
filter(country == input$zone)
g = ggplot(res_zone, aes_string(x = ifelse(diff(range(res_zone$date)) > years(1),
g = ggplot(merged, aes_string(x = ifelse(diff(range(res_zone$date)) > years(1),
"date",
"day_of_the_year"), y = "level", color = "area")) +
"day_of_the_year"),
y = "output", color = "area")) +
geom_line(size = 2) +
# ylab('GWh/day') +
facet_grid(variable ~ area, scales = 'free_y') +
theme_light() +
theme(axis.text.x = element_text(size = 8, angle = 45, hjust = 1),
legend.position = 'bottom')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment