Skip to content
Snippets Groups Projects
Commit 14018c51 authored by thierrychambert's avatar thierrychambert
Browse files

Added the second table for "cumulated impacts" analysis (global impact)

parent a123d11e
No related branches found
No related tags found
No related merge requests found
......@@ -1276,38 +1276,57 @@ server <- function(input, output, session){
## OUTPUTS
##-----------------------------------------------------------------------------------
##-------------------------------------------
## Impact
##-------------------------------------------
#######################################################################
## Impact : individual farms (for "cumulated impact" analysis only)
##---------------------------------------------------------------------
print_indiv_impact <- function(){
req(out$run)
res = get_metrics(N = out$run$N, cumulated_impacts = TRUE)
n_farm <- (dim(res$indiv_farm$impact)[3]-1)
fil <- paste0(round(t(res$indiv_farm$impact[time_horzion, -2, -1]),2)*100, "%")
matrix(fil,
nrow = n_farm,
dimnames = list(paste("Parc",1:n_farm), c("Impact", "IC (min)", "IC (max)"))
)
} # end function print_impact
# Display title
output$title_indiv_impact_result <- renderText({
req(input$run > 0, out$analysis_choice == "cumulated")
"Rsultat : Impact de chaque parc olien, estim au bout de 30 ans"
})
# Display impact result (table)
output$indiv_impact_table <- renderTable({
req(input$run & out$analysis_choice == "cumulated")
print_indiv_impact()
}, rownames = TRUE)
##################################################
## Impact : GLOBAL (for all types of analysis)
##------------------------------------------------
print_impact <- function(){
req(out$run)
# cumulated impact
if(param$cumulated_impacts){
res = get_metrics(N = out$run$N, cumulated_impacts = TRUE)
n_farm <- (dim(res$indiv_farm$impact)[3]-1)
fil <- paste0(round(t(res$indiv_farm$impact[time_horzion, -2, -1]),2)*100, "%")
matrix(fil,
nrow = n_farm,
dimnames = list(paste("Parc",1:n_farm), c("Impact", "IC (min)", "IC (max)"))
)
# Not cumulated impacts
}else{
res = get_metrics(N = out$run$N, cumulated_impacts = FALSE)
n_scen <- (dim(res$scenario$impact)[3]-1)
fil <- paste0(round(t(res$scenario$impact[time_horzion, -2, -1]),2)*100, "%")
matrix(fil,
nrow = n_scen,
dimnames = list(paste("Scenario",1:n_scen), c("Impact", "IC (min)", "IC (max)"))
)
}
res = get_metrics(N = out$run$N, cumulated_impacts = FALSE)
n_scen <- (dim(res$scenario$impact)[3]-1)
RowNam <- NULL
if(out$analysis_choice == "single_farm") RowNam <- c("Parc 1")
if(out$analysis_choice == "cumulated") RowNam <- c("Parc 1", paste("... + Parc", (2:n_scen)))
if(out$analysis_choice == "multi_scenario") RowNam <- paste("Scenario", (1:n_scen))
fil <- paste0(round(t(res$scenario$impact[time_horzion, -2, -1]),2)*100, "%")
matrix(fil,
nrow = n_scen,
dimnames = list(RowNam, c("Impact", "IC (min)", "IC (max)"))
)
} # end function print_impact
# Display title
output$title_impact_result <- renderText({
if(input$run > 0){
"Rsultat : Impact estim au bout de 30 ans"
}
req(input$run)
"Rsultat : Impact global estim au bout de 30 ans"
})
# Display impact result (table)
......@@ -1317,8 +1336,7 @@ server <- function(input, output, session){
}, rownames = TRUE)
##-------------------------------------------
#############################################
## Probability of extinction
##-------------------------------------------
print_PrExt <- function(){
......@@ -1340,9 +1358,8 @@ server <- function(input, output, session){
# Display title
output$title_PrExt_result <- renderText({
if(input$run > 0){
"Rsultat : Probabilit d'extinction 30 ans"
}
req(input$run)
"Rsultat : Probabilit d'extinction 30 ans"
})
# Display impact result (table)
......@@ -1352,7 +1369,7 @@ server <- function(input, output, session){
}, rownames = TRUE)
##-------------------------------------------
#############################################
## Plot Impacts
##-------------------------------------------
## Function to plot the impact
......@@ -1373,7 +1390,7 @@ server <- function(input, output, session){
plot_out_impact()
})
##-------------------------------------------
#############################################
## Plot Demographic Trajectories
##-------------------------------------------
# Function to plot trajectories
......
......@@ -709,6 +709,11 @@ rm(list = ls(all.names = TRUE))
actionButton(inputId = "run", label = "Lancer l'analyse"),
hr(),
span(textOutput("title_indiv_impact_result"), align = "left", style = "font-weight: bold; font-size: 18px;"),
strong(span(tableOutput("indiv_impact_table"), style="color:orange; font-size:18px", align = "left")),
hr(),
span(textOutput("title_impact_result"), align = "left", style = "font-weight: bold; font-size: 18px;"),
strong(span(tableOutput("impact_table"), style="color:blue; font-size:18px", align = "left")),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment