Skip to content

Commit

Permalink
add automated checks for cm_import_tax
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Dec 6, 2023
1 parent d0e77d0 commit a055da2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ $setGlobal cm_oil_scen medOil !! def = medOil !! regexp = lowOil|medOi
*** (lowGas): low
*** (medGas): medium
*** (highGas): high
$setGlobal cm_gas_scen medGas !! def = medGas !! regexp = low|medium|high
$setGlobal cm_gas_scen medGas !! def = medGas !! regexp = lowGas|medGas|highGas
*** cm_coal_scen "assumption on coal availability"
*** (0): very low (this has been the "low" case; RoSE relevant difference)
*** (lowCoal): low (this is the new case)
Expand Down Expand Up @@ -1386,7 +1386,7 @@ $setglobal cm_steel_secondary_max_share_scenario off !! def off , switch on for
*** Using different markups for each fossil PE is not recommended, "Price|Carbon|Imported" will then report an unweighted average.
*** NOTE: In case of "CO2taxmarkup" and "avCO2taxmarkup" there is double-taxation of the CO2-content of the imported energy carrier:
*** Once when being imported (at the border) and once when being converted to Secondary Energy (normal CO2price applied by REMIND)
$setGlobal cm_import_tax off !! def off
$setGlobal cm_import_tax off !! def = off !! regexp = .*(worldPricemarkup|CO2taxmarkup|avCO2taxmarkup).*
*** cm_import_EU "EU switch for different scenarios of EU SE import assumptions"
*** EU-specific SE import assumptions (used for ariadne)
*** different exogenous hydrogen import scenarios for EU regions (developed in ARIADNE project)
Expand Down
5 changes: 3 additions & 2 deletions scripts/start/checkFixCfg.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ checkFixCfg <- function(cfg, remindPath = ".", testmode = FALSE) {
# how parameter n is defined in main.gms
paramdef <- paste0("^([ ]*", n, "[ ]*=|\\$setglobal[ ]+", n, " )")
# filter fitting parameter definition from code snippets containing regexp
filtered <- grep(paste0(paramdef, ".*regexp[ ]*=[ ]*"), code, value = TRUE)
filtered <- grep(paste0(paramdef, ".*regexp[ ]*=[ ]*"), code, value = TRUE, ignore.case = TRUE)
if (length(filtered) == 1) {
# search for string '!! regexp = whatever', potentially followed by '!! otherstuff' and extract 'whatever'
regexp <- paste0("^(", trimws(gsub("!!.*", "", gsub("^.*regexp[ ]*=", "", filtered))), ")$")
Expand All @@ -67,7 +67,8 @@ checkFixCfg <- function(cfg, remindPath = ".", testmode = FALSE) {
# count errors
if (! is.null(errormsg)) {
errorsfound <- errorsfound + 1
if (testmode) warning(errormsg) else message(errormsg)
message(errormsg)
if (testmode) warning(errormsg)
}
}

Expand Down

0 comments on commit a055da2

Please sign in to comment.