-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geographic trimming + updated thermal functions (#195)
* added thermalData option in readInputThermal * added readInputRES() * geographic trimming function * updated doc * updated website --------- Co-authored-by: MANSOURI Assil Ext <[email protected]>
- Loading branch information
Showing
19 changed files
with
587 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#Copyright © 2016 RTE Réseau de transport d’électricité | ||
|
||
#' Read geographic trimming (filtering) options | ||
#' | ||
#' @param areas Character. vector of areas | ||
#' @param links Logical. if TRUE, return filtering options for all links starting from selected areas | ||
#' @param opts List. simulation options | ||
#' | ||
#' @return list of filtering options for areas and links | ||
#' | ||
#' @export | ||
getGeographicTrimming <- function(areas = NULL, links = TRUE, opts = simOptions()){ | ||
if (is.null(areas)) stop("You need to select at least one area.") | ||
if (areas == "all") areas <- opts$areaList | ||
|
||
res <- list() | ||
|
||
if(!is.null(areas)){ | ||
areaData <- lapply(as.list(areas), .readPropertiesFunction, opts2 = opts, type = "areas") | ||
names(areaData) <- areas | ||
res$areas <- areaData | ||
} | ||
|
||
if (links){ | ||
linkData <- lapply(as.list(areas), .readPropertiesFunction, opts2 = opts, type = "links") | ||
names(linkData) <- areas | ||
linkData <- unlist(linkData, recursive = F) | ||
names(linkData) <- gsub("\\.", " - ", names(linkData)) | ||
res$links <- linkData | ||
} | ||
|
||
res | ||
} | ||
|
||
.readPropertiesFunction <- function(x, opts2, type){ | ||
if (type == "areas"){ | ||
if (opts2$typeLoad != "api"){ | ||
inputPath <- file.path(opts2$inputPath, "areas", x, "optimization.ini") | ||
readIniFile(inputPath)$filtering | ||
} else readIni(file.path("input", "areas", x, "optimization"))$filtering | ||
|
||
} else if (type == "links"){ | ||
if (opts2$typeLoad != "api"){ | ||
inputPath <- file.path(opts2$inputPath, "links", x, "properties.ini") | ||
lapply(as.list(readIniFile(inputPath)), function(x){x[grep("filter", names(x))]}) | ||
} else lapply(as.list(readIni(file.path("input", "links", x, "properties"))), function(x){x[grep("filter", names(x))]}) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.