Commit 1f046c2c authored by Matteo DE FELICE's avatar Matteo DE FELICE

Improved single reservoir visualization and added EU simulationn

parent 645641ed
......@@ -66,12 +66,12 @@ shinyServer(function(input, output, session) {
select(-X__1 ) %>%
gather(source, value, -date) %>%
group_by(source) %>%
mutate(avg_cost = mean(value))
mutate(avg_cost = mean(value, na.rm = TRUE))
g = ggplot(sel,
aes(x = date, y = source, #y = fct_reorder(source, avg_cost),
fill = cut(value, right = FALSE,
breaks = quantile(unique(sel$value), seq(0, 1, length.out = 9))))) +
breaks = quantile(unique(sel$value), seq(0, 1, length.out = 9), na.rm = TRUE)))) +
geom_tile() +
scale_fill_brewer(palette = 'YlOrRd', name = 'water value', drop = FALSE) +
ylab('Zone') +
......@@ -108,7 +108,8 @@ shinyServer(function(input, output, session) {
'OIL' = 'brown',
'ICEN' = 'grey66',
'HRD' = 'black',
'ZZZ' = 'grey75')
'ZZZ' = 'grey75',
'slack' = 'grey75')
g = sel_zone %>%
gather(source, generation, -date) %>%
......@@ -273,6 +274,13 @@ shinyServer(function(input, output, session) {
mutate(outflow = discharge + spillage) %>%
gather(variable, output, -date, -day_of_the_year, -area)
if (length(unique(res_zone$area) < 2)) {
merged = merged %>% filter(variable != 'norm_level')
}
if (all(is.na(merged %>% filter(variable == 'pumping') %>% pull(output)))) {
merged = merged %>% filter(variable != 'pumping')
}
entsoe_data = entsoe_storage %>%
filter(country == input$zone)
......@@ -290,7 +298,9 @@ shinyServer(function(input, output, session) {
if (nrow(entsoe_data) > 0) {
g = g +
geom_line(data = entsoe_data, aes(x = day_of_the_year, y = value, color = as.factor(year)))
geom_line(data = entsoe_data %>% mutate(variable = 'level',
value = value * 1000),
aes(x = day_of_the_year, y = value, color = as.factor(year)))
}
print(g)
# Reservoir levels all ------------------------------------------------------------------
......
......@@ -3,7 +3,11 @@ library(tidyverse)
library(readxl)
library(lubridate)
get_ordered_files <- function(variables) {
details = file.info(list.files('xls/', pattern = 'xlsx', full.names = TRUE))
if (Sys.info()["nodename"] == 'D01RP1700309') {
details = file.info(list.files('H:\\Code\\WaterFlex\\results\\', pattern = 'xlsx', full.names = TRUE))
} else {
details = file.info(list.files('xls/', pattern = 'xlsx', full.names = TRUE))
}
details = details[with(details, order(as.POSIXct(mtime), decreasing = TRUE)), ]
files = rownames(details)
......@@ -30,7 +34,7 @@ shinyUI( fluidPage(
'generation stacked' = 'gen_stacked',
'generation yearly' = 'gen_year',
'power flows' = 'pf')),
checkboxInput('middle_year', 'Show only middle period', value = TRUE),
checkboxInput('middle_year', 'Show only middle period', value = FALSE),
conditionalPanel(
condition = "input.plot_type == 'gen_mix' || input.plot_type == 'res_single'",
uiOutput("zone_selection")
......
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