Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions core/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,21 @@ o_pm_pebiolc_demandmag(iteration,ttot,all_regi) "track pm_pebiolc_demandmag
o_pm_macBaseMagpie(iteration,ttot,all_regi,all_enty) "track pm_macBaseMagpie across Nash iterations"
o_pm_macSwitch(iteration,ttot,all_regi,all_enty) "track pm_macSwitch across Nash iterations"
o_p_efFossilFuelExtr_n2obio(iteration,all_regi) "track p_efFossilFuelExtr for n2obio across Nash iterations"
o_vm_fuExtr_pebiolc(iteration,ttot,all_regi) "track vm_fuExtr for pebiolc across Nash iterations"
o_vm_pebiolc_price(iteration,ttot,all_regi) "track vm_pebiolc_price across Nash iterations"
o_PEDem_Bio_ECrops(iteration,ttot,all_regi) "track pebiolc demand across Nash iterations"
o_vm_emiMacSector_co2luc(iteration,ttot,all_regi) "track co2luc across Nash iterations"
o_vm_fuExtr_pebiolc_iter(iteration,ttot,all_regi) "track vm_fuExtr for pebiolc across Nash iterations"
o_vm_pebiolc_price_iter(iteration,ttot,all_regi) "track vm_pebiolc_price across Nash iterations"
o_PEDem_Bio_ECrops_iter(iteration,ttot,all_regi) "track pebiolc demand across Nash iterations"
o_vm_emiMacSector_co2luc_iter(iteration,ttot,all_regi) "track co2luc across Nash iterations"

*** CES tree and energy services
o_vm_cesIO_iter(ttot,all_regi,all_in,iteration) "Production factor over iterations"
o_vm_demFeForEs_iter(ttot,all_regi,all_enty,all_esty,all_teEs,iteration) "Final energy which will be used in the energy service layer over iterations [TWa]"
o_v_prodEs_iter(ttot,all_regi,all_enty,all_esty,all_teEs,iteration) "Energy services over iterations [Tpkm for passenger transport, Ttkm for freight transport]"

*** edgeTransport
o_pm_esCapCost_iter(ttot,all_regi,all_teEs,iteration) "Capital energy cost per unit of consumption for end-use capital (energy service layer) over iterations [T$/unit energy service]"
o_pm_fe2es_iter(ttot,all_regi,all_teEs,iteration) "Conversion factor from final energies to transport energy services over iterations [Tpkm/TWa, Ttkm/TWa]"
o_pm_shFeCes_iter(ttot,all_regi,all_enty,all_in,all_teEs,iteration) "Shares of fuels by CES node over iterations"

;

*** ------------- Scalars ----------------------------
Expand Down
27 changes: 23 additions & 4 deletions core/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,28 @@ p_FEPrice_by_EmiMkt_iter(iteration,t,regi,entyFe,emiMkt) = p_FEPrice_by_EmiMkt(t
p_FEPrice_by_FE_iter(iteration,t,regi,entyFe) = p_FEPrice_by_FE(t,regi,entyFe);

*** Track demand for purpose-grown ligno-cellulosic biomass across iterations
o_vm_pebiolc_price(iteration,ttot,regi) = vm_pebiolc_price.l(ttot,regi);
o_vm_fuExtr_pebiolc(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1");
o_PEDem_Bio_ECrops(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(regi,"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi,"pebiolc");
o_vm_emiMacSector_co2luc(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");
o_vm_pebiolc_price_iter(iteration,ttot,regi) = vm_pebiolc_price.l(ttot,regi);
o_vm_fuExtr_pebiolc_iter(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1");
o_PEDem_Bio_ECrops_iter(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(regi,"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi,"pebiolc");
o_vm_emiMacSector_co2luc_iter(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");

*** track CES tree and energy services over iterations
loop(ttot$(ttot.val ge 2005),
o_vm_cesIO_iter(ttot,regi,in,iteration) = vm_cesIO.l(ttot,regi,in) ;
loop(entyFe2Sector(entyFe,"trans"),
o_vm_demFeForEs_iter(ttot,regi,entyFe,esty,teEs,iteration)$fe2es(entyFe,esty,teEs) = vm_demFeForEs.l(ttot,regi,entyFe,esty,teEs);
o_v_prodEs_iter(ttot,regi,entyFe,esty,teEs,iteration)$fe2es(entyFe,esty,teEs) = v_prodEs.l(ttot,regi,entyFe,esty,teEs);
);
);

*** track parameters read in from edgeTransport over iterations
if(edgeTransportIter(iteration),
loop(ttot$(ttot.val ge 2005),
o_pm_esCapCost_iter(ttot,regi,teEs_dyn35,iteration) = pm_esCapCost(ttot,regi,teEs_dyn35);
o_pm_fe2es_iter(ttot,regi,teEs_dyn35,iteration) = pm_fe2es(ttot,regi,teEs_dyn35);
o_pm_shFeCes_iter(ttot,regi,entyFe,ppfen_dyn35,teEs_dyn35,iteration) = pm_shFeCes(ttot,regi,entyFe,ppfen_dyn35,teEs_dyn35);
);
);


*** EOF ./core/postsolve.gms
4 changes: 4 additions & 0 deletions modules/80_optimization/nash/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ p80_defic_sum_rel(iteration) "Surplus monetary value over all tim
p80_etaLT_correct(all_enty,iteration) "long term price correction factor in percent"
p80_etaST_correct(tall,all_enty,iteration) "short term price correction factor in percent"

*** RP parameters to track model results over iterations to help diagnose convergence problems
*** Trade
p80_Mport_iter(ttot,all_regi,all_enty,iteration) "Imports over iterations"
p80_Xport_iter(ttot,all_regi,all_enty,iteration) "Exports over iterations"
p80_prodPe_iter(ttot,all_regi,all_enty,iteration) "PE production over iterations"
p80_fuExtr_iter(ttot,all_regi,all_enty,rlf,iteration) "Fuel extraction over iterations"



p80_etaST_correct_safecopy(tall,all_enty,iteration) "auxiliary parameter to remember short term price correction factor in percent, before new convergence adjustments"
o80_counter_iteration_trade_ttot(ttot,all_enty,iteration) "auxiliary parameter to display in which iteration and for which item (ttot, trade) additional convergence measures were taken"
o80_trackSurplusSign(ttot,all_enty,iteration) "auxiliary parameter to track how long the surplus for an item (ttot, trade) had the same sign over iterations"
Expand Down
34 changes: 17 additions & 17 deletions scripts/output/comparison/plotRemMagNash.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,23 @@ plot_iterations <- function(dat, runname) {

# ---- Plot: MAgPIE co2luc ----

p_emi_mag <- myplot(dat, "o_vm_emiMacSector_co2luc", runname, ylab = "Mt CO2/yr")
p_emi_mag_it <- myplot(dat, "o_vm_emiMacSector_co2luc", xaxis = "iteration", color = "ttot", runname, ylab = "Mt CO2/yr")
p_emi_mag <- myplot(dat, "o_vm_emiMacSector_co2luc_iter", runname, ylab = "Mt CO2/yr")
p_emi_mag_it <- myplot(dat, "o_vm_emiMacSector_co2luc_iter", xaxis = "iteration", color = "ttot", runname, ylab = "Mt CO2/yr")


# ---- Plot: REMIND Production of purpose grown bioenergy ----

p_fuelex <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, ylab = "EJ/yr")
p_fuelex_it <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_fuelex_it_fix <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")
p_fuelex <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, ylab = "EJ/yr")
p_fuelex_it <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_fuelex_it_fix <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")
p_fuelex_it_2060 <- myplot(dat |> filter(ttot == 2060),
"o_vm_fuExtr_pebiolc", runname, type = "bar",
"o_vm_fuExtr_pebiolc_iter", runname, type = "bar",
xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")

# ---- Plot: REMIND Demand for purpose grown bioenergy ----

p_demPE <- myplot(dat, "o_PEDem_Bio_ECrops", runname, ylab = "EJ/yr")
p_demPE_it <- myplot(dat, "o_PEDem_Bio_ECrops", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_demPE <- myplot(dat, "o_PEDem_Bio_ECrops_iter", runname, ylab = "EJ/yr")
p_demPE_it <- myplot(dat, "o_PEDem_Bio_ECrops_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")

# ---- Plot: REMIND Price scaling factor ----

Expand Down Expand Up @@ -151,9 +151,9 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
# "Emi|CO2|+|Land-Use Change (Mt CO2/yr)"
# vm_emiMacSector <- readGDX(gdx, "vm_emiMacSector", field = "l", restore_zeros = FALSE)
# dimSums(vm_emiMacSector[, , "co2luc"] , dim = 3) * GtC_2_MtCO2
# "o_vm_emiMacSector_co2luc"
# "o_vm_emiMacSector_co2luc_iter"
# core/postsolve.gms:
# o_vm_emiMacSector_co2luc(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");
# o_vm_emiMacSector_co2luc_iter(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");

# "Primary Energy Production|Biomass|Energy Crops (EJ/yr)"
# remind2::reportExtraction.R
Expand All @@ -162,16 +162,16 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
# dimSums(fuelex_bio[, , "pebiolc.1"], dim = 3) * TWa_2_EJ
# -> "PE|Production|Biomass|+|Lignocellulosic (EJ/yr)"
# -> "Primary Energy Production|Biomass|Energy Crops (EJ/yr)" (used also in coupling interface in MAgPIE)
# "o_vm_fuExtr_pebiolc"
# "o_vm_fuExtr_pebiolc_iter"
# core/postsolve.gms:
# o_vm_fuExtr_pebiolc = vm_fuExtr.l(ttot,regi,"pebiolc","1");
# o_vm_fuExtr_pebiolc_iter = vm_fuExtr.l(ttot,regi,"pebiolc","1");

# "PE|Biomass|+++|Energy Crops (EJ/yr)"
# remind2::reportPE.R
# fuelex[,,"pebiolc.1"] + (1-p_costsPEtradeMp[,,"pebiolc"]) * Mport[,,"pebiolc"] - Xport[,,"pebiolc"] -> "PE|Biomass|+++|Energy Crops (EJ/yr)"
# "o_PEDem_Bio_ECrops"
# "o_PEDem_Bio_ECrops_iter"
# core/postsolve.gms:
# o_PEDem_Bio_ECrops(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(ttot,regi"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi"pebiolc");
# o_PEDem_Bio_ECrops_iter(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(ttot,regi"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi"pebiolc");

# "Internal|Price|Biomass|Multfactor ()"
# remind2::reportPrices.R
Expand All @@ -197,9 +197,9 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
items <- tribble(
~par , ~var , ~factor,
"o_p30_pebiolc_pricemag" , "Internal|Price|Biomass|MAgPIE (US$2017/GJ)" , sm_tdptwyr2dpgj,
"o_vm_emiMacSector_co2luc", "Emi|CO2|+|Land-Use Change (Mt CO2/yr)" , GtC_2_MtCO2,
"o_vm_fuExtr_pebiolc" , "Primary Energy Production|Biomass|Energy Crops (EJ/yr)", TWa2EJ,
"o_PEDem_Bio_ECrops" , "PE|Biomass|+++|Energy Crops (EJ/yr)" , TWa2EJ,
"o_vm_emiMacSector_co2luc_iter", "Emi|CO2|+|Land-Use Change (Mt CO2/yr)" , GtC_2_MtCO2,
"o_vm_fuExtr_pebiolc_iter" , "Primary Energy Production|Biomass|Energy Crops (EJ/yr)", TWa2EJ,
"o_PEDem_Bio_ECrops_iter" , "PE|Biomass|+++|Energy Crops (EJ/yr)" , TWa2EJ,
"o_p30_pebiolc_pricmult" , "Internal|Price|Biomass|Multfactor ()" , 1,
"pm_taxCO2eq_iter" , "Price|Carbon (US$2017/t CO2)" , 1000 * 12 / 44,
)
Expand Down
34 changes: 17 additions & 17 deletions scripts/output/single/plotRemMagNash.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,23 @@ plot_iterations <- function(dat, runname) {

# ---- Plot: MAgPIE co2luc ----

p_emi_mag <- myplot(dat, "o_vm_emiMacSector_co2luc", runname, ylab = "Mt CO2/yr")
p_emi_mag_it <- myplot(dat, "o_vm_emiMacSector_co2luc", xaxis = "iteration", color = "ttot", runname, ylab = "Mt CO2/yr")
p_emi_mag <- myplot(dat, "o_vm_emiMacSector_co2luc_iter", runname, ylab = "Mt CO2/yr")
p_emi_mag_it <- myplot(dat, "o_vm_emiMacSector_co2luc_iter", xaxis = "iteration", color = "ttot", runname, ylab = "Mt CO2/yr")


# ---- Plot: REMIND Production of purpose grown bioenergy ----

p_fuelex <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, ylab = "EJ/yr")
p_fuelex_it <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_fuelex_it_fix <- myplot(dat, "o_vm_fuExtr_pebiolc", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")
p_fuelex <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, ylab = "EJ/yr")
p_fuelex_it <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_fuelex_it_fix <- myplot(dat, "o_vm_fuExtr_pebiolc_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")
p_fuelex_it_2060 <- myplot(dat |> filter(ttot == 2060),
"o_vm_fuExtr_pebiolc", runname, type = "bar",
"o_vm_fuExtr_pebiolc_iter", runname, type = "bar",
xaxis = "iteration", color = "ttot", ylab = "EJ/yr", scales = "fixed")

# ---- Plot: REMIND Demand for purpose grown bioenergy ----

p_demPE <- myplot(dat, "o_PEDem_Bio_ECrops", runname, ylab = "EJ/yr")
p_demPE_it <- myplot(dat, "o_PEDem_Bio_ECrops", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")
p_demPE <- myplot(dat, "o_PEDem_Bio_ECrops_iter", runname, ylab = "EJ/yr")
p_demPE_it <- myplot(dat, "o_PEDem_Bio_ECrops_iter", runname, xaxis = "iteration", color = "ttot", ylab = "EJ/yr")

# ---- Plot: REMIND Price scaling factor ----

Expand Down Expand Up @@ -153,9 +153,9 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
# "Emi|CO2|+|Land-Use Change (Mt CO2/yr)"
# vm_emiMacSector <- readGDX(gdx, "vm_emiMacSector", field = "l", restore_zeros = FALSE)
# dimSums(vm_emiMacSector[, , "co2luc"] , dim = 3) * GtC_2_MtCO2
# "o_vm_emiMacSector_co2luc"
# "o_vm_emiMacSector_co2luc_iter"
# core/postsolve.gms:
# o_vm_emiMacSector_co2luc(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");
# o_vm_emiMacSector_co2luc_iter(iteration,ttot,regi) = vm_emiMacSector.l(ttot,regi,"co2luc");

# "Primary Energy Production|Biomass|Energy Crops (EJ/yr)"
# remind2::reportExtraction.R
Expand All @@ -164,16 +164,16 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
# dimSums(fuelex_bio[, , "pebiolc.1"], dim = 3) * TWa_2_EJ
# -> "PE|Production|Biomass|+|Lignocellulosic (EJ/yr)"
# -> "Primary Energy Production|Biomass|Energy Crops (EJ/yr)" (used also in coupling interface in MAgPIE)
# "o_vm_fuExtr_pebiolc"
# "o_vm_fuExtr_pebiolc_iter"
# core/postsolve.gms:
# o_vm_fuExtr_pebiolc = vm_fuExtr.l(ttot,regi,"pebiolc","1");
# o_vm_fuExtr_pebiolc_iter = vm_fuExtr.l(ttot,regi,"pebiolc","1");

# "PE|Biomass|+++|Energy Crops (EJ/yr)"
# remind2::reportPE.R
# fuelex[,,"pebiolc.1"] + (1-p_costsPEtradeMp[,,"pebiolc"]) * Mport[,,"pebiolc"] - Xport[,,"pebiolc"] -> "PE|Biomass|+++|Energy Crops (EJ/yr)"
# "o_PEDem_Bio_ECrops"
# "o_PEDem_Bio_ECrops_iter"
# core/postsolve.gms:
# o_PEDem_Bio_ECrops(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(ttot,regi"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi"pebiolc");
# o_PEDem_Bio_ECrops_iter(iteration,ttot,regi) = vm_fuExtr.l(ttot,regi,"pebiolc","1") + (1 - pm_costsPEtradeMp(ttot,regi"pebiolc")) * vm_Mport.l(ttot,regi,"pebiolc") - vm_Xport.l(ttot,regi"pebiolc");

# "Internal|Price|Biomass|Multfactor ()"
# remind2::reportPrices.R
Expand All @@ -199,9 +199,9 @@ readDataFromGdx <- function(runfolder, allIter = TRUE) {
items <- tribble(
~par , ~var , ~factor,
"o_p30_pebiolc_pricemag" , "Internal|Price|Biomass|MAgPIE (US$2017/GJ)" , sm_tdptwyr2dpgj,
"o_vm_emiMacSector_co2luc", "Emi|CO2|+|Land-Use Change (Mt CO2/yr)" , GtC_2_MtCO2,
"o_vm_fuExtr_pebiolc" , "Primary Energy Production|Biomass|Energy Crops (EJ/yr)", TWa2EJ,
"o_PEDem_Bio_ECrops" , "PE|Biomass|+++|Energy Crops (EJ/yr)" , TWa2EJ,
"o_vm_emiMacSector_co2luc_iter", "Emi|CO2|+|Land-Use Change (Mt CO2/yr)" , GtC_2_MtCO2,
"o_vm_fuExtr_pebiolc_iter" , "Primary Energy Production|Biomass|Energy Crops (EJ/yr)", TWa2EJ,
"o_PEDem_Bio_ECrops_iter" , "PE|Biomass|+++|Energy Crops (EJ/yr)" , TWa2EJ,
"o_p30_pebiolc_pricmult" , "Internal|Price|Biomass|Multfactor ()" , 1,
"pm_taxCO2eq_iter" , "Price|Carbon (US$2017/t CO2)" , 1000 * 12 / 44,
)
Expand Down
Loading