From cd11062309a9f8239ec75c1cdb39372791727f8b Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 13 Dec 2024 18:55:29 +0100 Subject: [PATCH 01/11] bugfix BII --- .../bii_target_apr24/declarations.gms | 1 - .../bii_target_apr24/equations.gms | 4 +-- .../bii_target_apr24/preloop.gms | 5 ++-- .../bii_target_apr24/presolve.gms | 28 +++++++++---------- .../bii_target_apr24/realization.gms | 1 + .../bii_target_apr24/scaling.gms | 8 ++++++ 6 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 modules/44_biodiversity/bii_target_apr24/scaling.gms diff --git a/modules/44_biodiversity/bii_target_apr24/declarations.gms b/modules/44_biodiversity/bii_target_apr24/declarations.gms index 12eb55056c..74275701ab 100644 --- a/modules/44_biodiversity/bii_target_apr24/declarations.gms +++ b/modules/44_biodiversity/bii_target_apr24/declarations.gms @@ -16,7 +16,6 @@ positive variables parameters p44_bii_lower_bound(t,i,biome44) Interpolated lower bound for BII over time (1) p44_start_value(i,biome44) Start value for BII lower bound (1) - p44_target_value(i,biome44) Target value for BII lower bound (1) i44_biome_share(j,biome44) Share of biome type in each spatial unit (1) i44_biome_area_reg(i,biome44) Area of range-rarity weighted biome type in each region (mio. ha) ; diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index 19c78350ce..cee2680c23 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -14,13 +14,13 @@ q44_bii(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. v44_bii(i2,biome44) =e= - sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * i44_biome_share(j2,biome44)) + sum((cell(i2,j2),landcover44,potnatveg), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * i44_biome_share(j2,biome44)) / i44_biome_area_reg(i2,biome44); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. + q44_bii_target(i2,biome44) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index f296466db2..b751628362 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de * Calculate biome share -i44_biome_share(j,biome44) = - (f44_biome_area(j,biome44) + 1e-10) / sum(biome44_2, f44_biome_area(j,biome44_2) + 1e-10); +i44_biome_share(j,biome44) = 0; +i44_biome_share(j,biome44)$(sum(biome44_2, f44_biome_area(j,biome44_2)) > 0) = + f44_biome_area(j,biome44) / sum(biome44_2, f44_biome_area(j,biome44_2)); * Set i44_biome_area_reg i44_biome_area_reg(i,biome44) = diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index f9cd49db45..e3f7741c3b 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -13,33 +13,31 @@ loop(i, v44_bii_missing.fx(i,biome44) = 0; else v44_bii.l(i,biome44) = - sum((cell(i,j),potnatveg,landcover44), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) + sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) / i44_biome_area_reg(i,biome44); ); ); ); +if (m_year(t) = s44_start_year AND s44_bii_lower_bound > 0, * The start value for the linear interpolation is the BII at biome level in the start year. -p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); + p44_start_value(i,biome44) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. -p44_target_value(i,biome44) = s44_bii_lower_bound; +* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. + p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (s44_bii_lower_bound - p44_start_value(i,biome44)); + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = s44_bii_lower_bound; +* Avoid implausible values + p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; + p44_bii_lower_bound(t2,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; +); if (m_year(t) <= sm_fix_SSP2, v44_bii.lo(i,biome44) = 0; else -* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. - p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); - p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); if(c44_bii_decrease = 0, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = v44_bii.l(i,biome44); - elseif c44_bii_decrease = 1, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44)$(v44_bii.l(i,biome44) >= s44_bii_lower_bound) = v44_bii.l(i,biome44); ); - p44_bii_lower_bound(t,i,biome44)$(p44_bii_lower_bound(t,i,biome44) >= 1) = 1; - p44_bii_lower_bound(t,i,biome44)$(m_year(t) < s44_start_year) = 0; - p44_bii_lower_bound(t,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; -* The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. - v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); - display p44_bii_lower_bound; ); diff --git a/modules/44_biodiversity/bii_target_apr24/realization.gms b/modules/44_biodiversity/bii_target_apr24/realization.gms index 1b1298ab5a..f8fbd4252e 100644 --- a/modules/44_biodiversity/bii_target_apr24/realization.gms +++ b/modules/44_biodiversity/bii_target_apr24/realization.gms @@ -19,6 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target_apr24/se $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target_apr24/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/44_biodiversity/bii_target_apr24/scaling.gms new file mode 100644 index 0000000000..e7cc6622f7 --- /dev/null +++ b/modules/44_biodiversity/bii_target_apr24/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +q44_bii.scale(i,biome44) = 1e20; From bec50ed9d0f80c2675da002cbf708350f96ece1b Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 08:52:16 +0100 Subject: [PATCH 02/11] test --- modules/10_land/landmatrix_dec18/scaling.gms | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 7cf3630df2..a3971421e3 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,3 +6,6 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; + +q10_transition_to.scale(j,land_to) = 1e20; +q10_transition_from.scale(j,land_from) = 1e20; From a8299bf2ccfe9b1c8ee6026e7afc825c1eeb4fa2 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 10:02:59 +0100 Subject: [PATCH 03/11] update scaling --- config/default.cfg | 2 +- modules/10_land/landmatrix_dec18/scaling.gms | 3 --- modules/80_optimization/nlp_apr17/input.gms | 2 +- modules/80_optimization/nlp_apr17/solve.gms | 12 +++++++----- modules/80_optimization/nlp_par/input.gms | 2 +- modules/80_optimization/nlp_par/solve.gms | 12 +++++++----- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 8b5941ac4c..6581d686f4 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -2086,7 +2086,7 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 1: using optfile for specified solver settings # * 0: default settings (optfile will be ignored) -cfg$gms$s80_optfile <- 0 # def = 0 +cfg$gms$s80_optfile <- 1 # def = 1 # * Optional second solve statement (0=off, 1=on) cfg$gms$s80_secondsolve <- 0 # def = 0 diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index a3971421e3..7cf3630df2 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,6 +6,3 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; - -q10_transition_to.scale(j,land_to) = 1e20; -q10_transition_from.scale(j,land_from) = 1e20; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 5c645af1c2..07264b2e09 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -7,6 +7,6 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 7dc3b1198d..3567030625 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -19,14 +19,16 @@ magpie.solprint = 0 ; magpie.holdfixed = 1 ; $onecho > conopt4.opt -Lim_Variable = 1.e25 +Tol_Scale_Min = 1e-4; $offecho $onecho > conopt4.op2 -Flg_Prep = FALSE +Tol_Scale_Min = 1e-4; +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op3 +Tol_Scale_Min = 1e-4; Flg_NoDefc = TRUE $offecho @@ -58,15 +60,15 @@ if (magpie.modelstat > 2, option nlp = conopt4; magpie.optfile = 0; elseif s80_resolve_option = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 1"; option nlp = conopt4; magpie.optfile = 1; elseif s80_resolve_option = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 2"; option nlp = conopt4; magpie.optfile = 2; elseif s80_resolve_option = 4, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o search for definitional constraints"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 3"; option nlp = conopt4; magpie.optfile = 3; elseif s80_resolve_option = 5, diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 1004040b7e..f282808333 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -7,6 +7,6 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 60d888a72e..5c4afe4c53 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -22,14 +22,16 @@ magpie.holdfixed = 1 ; magpie.savepoint = 0; $onecho > conopt4.opt -Lim_Variable = 1.e25 +Tol_Scale_Min = 1e-4; $offecho $onecho > conopt4.op2 -Flg_Prep = FALSE +Tol_Scale_Min = 1e-4; +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op3 +Tol_Scale_Min = 1e-4; Flg_NoDefc = TRUE $offecho @@ -107,15 +109,15 @@ repeat option nlp = conopt4; magpie.optfile = 0; elseif p80_resolve_option(h) = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 1"; option nlp = conopt4; magpie.optfile = 1; elseif p80_resolve_option(h) = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 2"; option nlp = conopt4; magpie.optfile = 2; elseif p80_resolve_option(h) = 4, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o search for definitional constraints"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 3"; option nlp = conopt4; magpie.optfile = 3; elseif p80_resolve_option(h) = 5, From 6846f7a763c74bc8fcb3502a932387a3d97c54ce Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 10:56:44 +0100 Subject: [PATCH 04/11] test --- config/default.cfg | 2 +- modules/44_biodiversity/bii_target_apr24/scaling.gms | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 6581d686f4..8b5941ac4c 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -2086,7 +2086,7 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 1: using optfile for specified solver settings # * 0: default settings (optfile will be ignored) -cfg$gms$s80_optfile <- 1 # def = 1 +cfg$gms$s80_optfile <- 0 # def = 0 # * Optional second solve statement (0=off, 1=on) cfg$gms$s80_secondsolve <- 0 # def = 0 diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/44_biodiversity/bii_target_apr24/scaling.gms index e7cc6622f7..b954d39231 100644 --- a/modules/44_biodiversity/bii_target_apr24/scaling.gms +++ b/modules/44_biodiversity/bii_target_apr24/scaling.gms @@ -5,4 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -q44_bii.scale(i,biome44) = 1e20; +q44_bii.scale(i,biome44) = 1e10; From 9b3a59c54c43f18c995ac85bae4db5c715be2189 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 12:38:21 +0100 Subject: [PATCH 05/11] revert --- modules/80_optimization/nlp_apr17/input.gms | 2 +- modules/80_optimization/nlp_apr17/solve.gms | 12 +++++------- modules/80_optimization/nlp_par/input.gms | 2 +- modules/80_optimization/nlp_par/solve.gms | 12 +++++------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 07264b2e09..5c645af1c2 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -7,6 +7,6 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 1 / + s80_optfile switch to use specfied solver settings (1) / 0 / s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 3567030625..7dc3b1198d 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -19,16 +19,14 @@ magpie.solprint = 0 ; magpie.holdfixed = 1 ; $onecho > conopt4.opt -Tol_Scale_Min = 1e-4; +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op2 -Tol_Scale_Min = 1e-4; -Lim_Variable = 1.e25 +Flg_Prep = FALSE $offecho $onecho > conopt4.op3 -Tol_Scale_Min = 1e-4; Flg_NoDefc = TRUE $offecho @@ -60,15 +58,15 @@ if (magpie.modelstat > 2, option nlp = conopt4; magpie.optfile = 0; elseif s80_resolve_option = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 1"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; option nlp = conopt4; magpie.optfile = 1; elseif s80_resolve_option = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 2"; + display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; option nlp = conopt4; magpie.optfile = 2; elseif s80_resolve_option = 4, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 3"; + display "Modelstat > 2 | Retry solve with CONOPT4 w/o search for definitional constraints"; option nlp = conopt4; magpie.optfile = 3; elseif s80_resolve_option = 5, diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index f282808333..1004040b7e 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -7,6 +7,6 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 1 / + s80_optfile switch to use specfied solver settings (1) / 0 / s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5c4afe4c53..60d888a72e 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -22,16 +22,14 @@ magpie.holdfixed = 1 ; magpie.savepoint = 0; $onecho > conopt4.opt -Tol_Scale_Min = 1e-4; +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op2 -Tol_Scale_Min = 1e-4; -Lim_Variable = 1.e25 +Flg_Prep = FALSE $offecho $onecho > conopt4.op3 -Tol_Scale_Min = 1e-4; Flg_NoDefc = TRUE $offecho @@ -109,15 +107,15 @@ repeat option nlp = conopt4; magpie.optfile = 0; elseif p80_resolve_option(h) = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 1"; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; option nlp = conopt4; magpie.optfile = 1; elseif p80_resolve_option(h) = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 2"; + display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; option nlp = conopt4; magpie.optfile = 2; elseif p80_resolve_option(h) = 4, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE 3"; + display "Modelstat > 2 | Retry solve with CONOPT4 w/o search for definitional constraints"; option nlp = conopt4; magpie.optfile = 3; elseif p80_resolve_option(h) = 5, From 55f248b4fba4ef023b4802352342bcce4fa314a7 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 12:43:41 +0100 Subject: [PATCH 06/11] cleanup --- CHANGELOG.md | 2 +- .../bii_target/declarations.gms | 1 - .../44_biodiversity/bii_target/equations.gms | 4 +-- .../44_biodiversity/bii_target/preloop.gms | 9 +++--- .../44_biodiversity/bii_target/presolve.gms | 31 +++++++++---------- .../bii_target/realization.gms | 1 + .../44_biodiversity/bii_target/scaling.gms | 8 +++++ 7 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 modules/44_biodiversity/bii_target/scaling.gms diff --git a/CHANGELOG.md b/CHANGELOG.md index e8993779c4..65e1c7fa0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### fixed -- +- **44_biodiversity** bugfix i44_biome_share, code cleanup, added scaling of `q44_bii` ## [4.9.0] - 2024-12-05 diff --git a/modules/44_biodiversity/bii_target/declarations.gms b/modules/44_biodiversity/bii_target/declarations.gms index 7f4552e059..4134fc41a6 100644 --- a/modules/44_biodiversity/bii_target/declarations.gms +++ b/modules/44_biodiversity/bii_target/declarations.gms @@ -16,7 +16,6 @@ positive variables parameters p44_bii_lower_bound(t,i,biome44) Interpolated lower bound for BII over time (1) p44_start_value(i,biome44) Start value for BII lower bound (1) - p44_target_value(i,biome44) Target value for BII lower bound (1) i44_biome_share(j,biome44) Share of biome type in each spatial unit (1) i44_biome_area_reg(i,biome44) Area of range-rarity weighted biome type in each region (mio. ha) ; diff --git a/modules/44_biodiversity/bii_target/equations.gms b/modules/44_biodiversity/bii_target/equations.gms index d372e2a7c3..f0ce37c2be 100644 --- a/modules/44_biodiversity/bii_target/equations.gms +++ b/modules/44_biodiversity/bii_target/equations.gms @@ -13,13 +13,13 @@ q44_bii(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. v44_bii(i2,biome44) =e= - sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * i44_biome_share(j2,biome44)) + sum((cell(i2,j2),landcover44,potnatveg), vm_bv(j2,landcover44,potnatveg) * i44_biome_share(j2,biome44)) / i44_biome_area_reg(i2,biome44); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(i44_biome_area_reg(i2,biome44) > 0) .. + q44_bii_target(i2,biome44) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target/preloop.gms b/modules/44_biodiversity/bii_target/preloop.gms index 962ffcaea1..b751628362 100644 --- a/modules/44_biodiversity/bii_target/preloop.gms +++ b/modules/44_biodiversity/bii_target/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -6,11 +6,12 @@ *** | Contact: magpie@pik-potsdam.de * Calculate biome share -i44_biome_share(j,biome44) = - (f44_biome_area(j,biome44) + 1e-10) / sum(biome44_2, f44_biome_area(j,biome44_2) + 1e-10); +i44_biome_share(j,biome44) = 0; +i44_biome_share(j,biome44)$(sum(biome44_2, f44_biome_area(j,biome44_2)) > 0) = + f44_biome_area(j,biome44) / sum(biome44_2, f44_biome_area(j,biome44_2)); * Set i44_biome_area_reg i44_biome_area_reg(i,biome44) = - sum((cell(i,j),land), pcm_land(j,land) * i44_biome_share(j,biome44)); + sum((cell(i,j),land), pcm_land(j,land) * f44_rr_layer(j) * i44_biome_share(j,biome44)); p44_bii_lower_bound(t,i,biome44) = 0; diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index edca9fc629..e3f7741c3b 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -13,32 +13,31 @@ loop(i, v44_bii_missing.fx(i,biome44) = 0; else v44_bii.l(i,biome44) = - sum((cell(i,j),potnatveg,landcover44), vm_bv.l(j,landcover44,potnatveg) * i44_biome_share(j,biome44)) + sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) / i44_biome_area_reg(i,biome44); ); ); ); +if (m_year(t) = s44_start_year AND s44_bii_lower_bound > 0, * The start value for the linear interpolation is the BII at biome level in the start year. -p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); + p44_start_value(i,biome44) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. -p44_target_value(i,biome44) = s44_bii_lower_bound; +* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. + p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (s44_bii_lower_bound - p44_start_value(i,biome44)); + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = s44_bii_lower_bound; +* Avoid implausible values + p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; + p44_bii_lower_bound(t2,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; +); if (m_year(t) <= sm_fix_SSP2, v44_bii.lo(i,biome44) = 0; else -* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. - p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); - p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); if(c44_bii_decrease = 0, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = v44_bii.l(i,biome44); - elseif c44_bii_decrease = 1, - p44_bii_lower_bound(t,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = p44_target_value(i,biome44); + v44_bii.lo(i,biome44)$(v44_bii.l(i,biome44) >= s44_bii_lower_bound) = v44_bii.l(i,biome44); ); - p44_bii_lower_bound(t,i,biome44)$(p44_bii_lower_bound(t,i,biome44) >= 1) = 1; - p44_bii_lower_bound(t,i,biome44)$(m_year(t) < s44_start_year) = 0; - p44_bii_lower_bound(t,i,biome44)$(i44_biome_area_reg(i,biome44) <= 0) = 0; -* The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. - v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); - display p44_bii_lower_bound; ); + diff --git a/modules/44_biodiversity/bii_target/realization.gms b/modules/44_biodiversity/bii_target/realization.gms index ff48d813de..7e1ef74dd4 100644 --- a/modules/44_biodiversity/bii_target/realization.gms +++ b/modules/44_biodiversity/bii_target/realization.gms @@ -19,6 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target/sets.gms $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target/scaling.gms b/modules/44_biodiversity/bii_target/scaling.gms new file mode 100644 index 0000000000..b954d39231 --- /dev/null +++ b/modules/44_biodiversity/bii_target/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +q44_bii.scale(i,biome44) = 1e10; From b3a7ba7c669b5f3eb61e2a15bc1e8360579b175f Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 12:46:08 +0100 Subject: [PATCH 07/11] bugfix --- modules/44_biodiversity/bii_target/preloop.gms | 2 +- modules/44_biodiversity/bii_target/presolve.gms | 2 +- modules/44_biodiversity/bii_target_apr24/declarations.gms | 2 +- modules/44_biodiversity/bii_target_apr24/equations.gms | 2 +- modules/44_biodiversity/bii_target_apr24/input.gms | 2 +- modules/44_biodiversity/bii_target_apr24/postsolve.gms | 2 +- modules/44_biodiversity/bii_target_apr24/preloop.gms | 2 +- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- modules/44_biodiversity/bii_target_apr24/realization.gms | 2 +- modules/44_biodiversity/bii_target_apr24/sets.gms | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/44_biodiversity/bii_target/preloop.gms b/modules/44_biodiversity/bii_target/preloop.gms index b751628362..7cab290a5d 100644 --- a/modules/44_biodiversity/bii_target/preloop.gms +++ b/modules/44_biodiversity/bii_target/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index e3f7741c3b..c5d6f8dd08 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/declarations.gms b/modules/44_biodiversity/bii_target_apr24/declarations.gms index 74275701ab..01351790de 100644 --- a/modules/44_biodiversity/bii_target_apr24/declarations.gms +++ b/modules/44_biodiversity/bii_target_apr24/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index cee2680c23..4c34556907 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/input.gms b/modules/44_biodiversity/bii_target_apr24/input.gms index 042c3e03fb..099ce53b9d 100644 --- a/modules/44_biodiversity/bii_target_apr24/input.gms +++ b/modules/44_biodiversity/bii_target_apr24/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/postsolve.gms b/modules/44_biodiversity/bii_target_apr24/postsolve.gms index 1974fa3da6..3d8723d8f2 100644 --- a/modules/44_biodiversity/bii_target_apr24/postsolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index b751628362..7cab290a5d 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index e3f7741c3b..c5d6f8dd08 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/realization.gms b/modules/44_biodiversity/bii_target_apr24/realization.gms index f8fbd4252e..6963031558 100644 --- a/modules/44_biodiversity/bii_target_apr24/realization.gms +++ b/modules/44_biodiversity/bii_target_apr24/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the diff --git a/modules/44_biodiversity/bii_target_apr24/sets.gms b/modules/44_biodiversity/bii_target_apr24/sets.gms index 4e19d2313d..69751ecef9 100644 --- a/modules/44_biodiversity/bii_target_apr24/sets.gms +++ b/modules/44_biodiversity/bii_target_apr24/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the From 043e72abd1b5926f525dccb567857d8f13816e10 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 12:47:45 +0100 Subject: [PATCH 08/11] bugfix --- modules/44_biodiversity/bii_target/preloop.gms | 2 +- modules/44_biodiversity/bii_target/presolve.gms | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/44_biodiversity/bii_target/preloop.gms b/modules/44_biodiversity/bii_target/preloop.gms index 7cab290a5d..8d54341f40 100644 --- a/modules/44_biodiversity/bii_target/preloop.gms +++ b/modules/44_biodiversity/bii_target/preloop.gms @@ -12,6 +12,6 @@ i44_biome_share(j,biome44)$(sum(biome44_2, f44_biome_area(j,biome44_2)) > 0) = * Set i44_biome_area_reg i44_biome_area_reg(i,biome44) = - sum((cell(i,j),land), pcm_land(j,land) * f44_rr_layer(j) * i44_biome_share(j,biome44)); + sum((cell(i,j),land), pcm_land(j,land) * i44_biome_share(j,biome44)); p44_bii_lower_bound(t,i,biome44) = 0; diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index c5d6f8dd08..288cd7de62 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -13,7 +13,7 @@ loop(i, v44_bii_missing.fx(i,biome44) = 0; else v44_bii.l(i,biome44) = - sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * f44_rr_layer(j) * i44_biome_share(j,biome44)) + sum((cell(i,j),landcover44,potnatveg), vm_bv.l(j,landcover44,potnatveg) * i44_biome_share(j,biome44)) / i44_biome_area_reg(i,biome44); ); ); From 0a68dcf2bc779de952c8b6d96cc8733f3169ff8b Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 12:51:17 +0100 Subject: [PATCH 09/11] bugfix --- scripts/start/test_runs.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index d61b2133c6..e1c67aa543 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -75,24 +75,28 @@ codeCheck <- FALSE ### Business-as-usual cfg <- fsecScenario(scenario = "c_BAU") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### NatureSparing cfg <- fsecScenario(scenario = "b_NatureSparing") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### LandscapeElements cfg <- fsecScenario(scenario = "a_LandscapeElements") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) ### FSDP Scenario cfg <- fsecScenario(scenario = "e_FSDP") +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) From fb8fe706d4d095051e775f30b3b80424e5a51b69 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 14 Dec 2024 19:37:29 +0100 Subject: [PATCH 10/11] lock_timeout --- CHANGELOG.md | 2 +- scripts/start/projects/project_FSEC_Scenarios.R | 2 +- scripts/start_functions.R | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e1c7fa0f..62acae1b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### added -- +- **start_scripts** added `lock_timeout` as option to `start_run` function ### removed - diff --git a/scripts/start/projects/project_FSEC_Scenarios.R b/scripts/start/projects/project_FSEC_Scenarios.R index 6ef4c15a87..2d54116ae0 100644 --- a/scripts/start/projects/project_FSEC_Scenarios.R +++ b/scripts/start/projects/project_FSEC_Scenarios.R @@ -39,5 +39,5 @@ for (scenarioName in c( # Start runs cfg <- fsecScenario(scenario = scenarioName) - start_run(cfg = cfg, codeCheck = codeCheck) + start_run(cfg = cfg, codeCheck = codeCheck, lock_timeout = 6) } diff --git a/scripts/start_functions.R b/scripts/start_functions.R index af8da9ddb1..dc616e690e 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -202,7 +202,7 @@ download_and_update <- function(cfg) { } -start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) { +start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE, lock_timeout = 1) { timePrepareStart <- Sys.time() @@ -222,7 +222,7 @@ start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) withr::defer(setwd(maindir)) if(lock_model) { - lock_id <- gms::model_lock(timeout1 = 1) + lock_id <- gms::model_lock(timeout1 = lock_timeout) withr::defer(gms::model_unlock(lock_id)) } From 72dffb6448e0d1fc6378276a564a78edd087de1e Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 20 Dec 2024 14:04:35 +0100 Subject: [PATCH 11/11] increase R package versions --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c96ed5b726..77156ed8ae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,14 +21,14 @@ Imports: m4fsdp, madrat, magclass (>= 6.14.0), - magpie4 (>= 2.15.8), + magpie4 (>= 2.16.1), MagpieNCGains, magpiesets (>= 0.46.1), mip, mrcommons, patchwork, piamenv (>= 0.5.5), - piamInterfaces (>= 0.37.1), + piamInterfaces (>= 0.40.3), piamutils, quitte, raster,