...
 
Commits (3)
shinyServer(function(input, output, session) {
output$zone_selection <- renderUI({
zones = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'LMP') %>%
zones = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'LMP') %>%
names()
selectInput('zone', 'Choose the zone:',
choices = zones[-1])
})
output$main_plot <- renderPlot({
res = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Reservoirs') %>%
res = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Reservoirs') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
hrgen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Hydro power generation') %>%
hrgen = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Hydro power generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
gen = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Generation') %>%
gen = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Generation') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
wv = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Water value') %>%
wv = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Water value') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
pf = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Power flow') %>%
pf = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Power flow') %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
# Load ENTSOE Data
entsoe_storage = read_rds('data/ENTSOE-Storage-2015-2018.rds')
......@@ -201,21 +201,21 @@ 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') %>%
inflows = readxl::read_xlsx(paste0('', 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)
spillage = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Spillage') %>%
spillage = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Spillage') %>%
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, spillage, -date, -day_of_the_year)
pumping = readxl::read_xlsx(paste0('xls/', input$result_xls), sheet = 'Pumping') %>%
pumping = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Pumping') %>%
select(contains(paste0(input$zone, '_HPHS')),
contains(paste0(input$zone, '_HDAM'))) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
......
......@@ -2,6 +2,13 @@ library(shiny)
library(tidyverse)
library(readxl)
library(lubridate)
get_ordered_files <- function(variables) {
details = file.info(list.files('xls/', pattern = 'xlsx', full.names = TRUE))
details = details[with(details, order(as.POSIXct(mtime), decreasing = TRUE)), ]
files = rownames(details)
return(files)
}
shinyUI( fluidPage(
# Application title
......@@ -11,7 +18,9 @@ shinyUI( fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("result_xls", "Choose a result file:",
choices = list.files('xls/', pattern = 'xlsx')),
# choices = list.files('xls/', pattern = 'xlsx')
choices = get_ordered_files()
),
selectInput('plot_type', 'Choose the plot type:',
choices = c('average water value' = 'awv',
'heatmap water value' = 'hwv',
......