# NOT RUN {
# }
# NOT RUN {
# Select interactively a study. It only works on windows.
setSimulationPath()
# Specify path of the study. Note: if there are more than one simulation
# output in the study, the function will asks the user to interactively choose
# one simulation.
setSimulationPath("path_of_the_folder_of_the_study")
# Select the first simulation of a study
setSimulationPath("path_of_the_folder_of_the_study", 1)
# Select the last simulation of a study
setSimulationPath("path_of_the_folder_of_the_study", -1)
# Select a simulation by name
setSimulationPath("path_of_the_folder_of_the_study", "name of the simulation")
# Just need to read input data
setSimulationPath("path_of_the_folder_of_the_study", "input")
# or
setSimulationPath("path_of_the_folder_of_the_study", 0)
# WORKING WITH MULTIPLE SIMULATIONS
#----------------------------------
# Let us assume ten simulations have been run and we want to collect the
# variable "LOAD" for each area. We can create a list containing options
# for each simulation and iterate through this list.
opts <- lapply(1:10, function(i) {
setSimulationPath("path_of_the_folder_of_the_study", i)
})
output <- lapply(opts, function(o) {
res <- readAntares(areas = "all", select = "LOAD", timeStep = "monthly", opts = o)
# Add a column "simulation" containing the name of the simulation
res$simulation <- o$name
res
})
# Concatenate all the tables in one super table
output <- rbindlist(output)
# Reshape output for easier comparisons: one line per timeId and one column
# per simulation
output <- dcast(output, timeId + areaId ~ simulation, value.var = "LOAD")
output
# Quick visualization
matplot(output[area == area[1], !c("area", "timeId"), with = FALSE],
type = "l")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab