Commit cc1c7fa6 authored by Juha Kiviluoma's avatar Juha Kiviluoma
Browse files

Enable the use of advanced basis. Three options: use the latest solve, use all...

Enable the use of advanced basis. Three options: use the latest solve, use all solves from the previous run, use the first solve from the previous run.
parent 730d9c88
......@@ -112,9 +112,11 @@ $include 'defModels\invest.gms'
// Load model input parameters
$include 'input\modelsInit.gms'
* === Simulation ==============================================================
$include 'inc\3a_periodicInit.gms' // Initialize modelling loop
loop(modelSolves(mSolve, tSolve),
solveCount = solveCount + 1;
$$include 'inc\3b_inputsLoop.gms' // Read input data that is updated within the loop
$$include 'inc\3c_periodicLoop.gms' // Update modelling loop
$$include 'inc\3d_setVariableLimits.gms' // Set new variable limits (.lo and .up)
......
......@@ -111,4 +111,11 @@ if (mType('building'),
// Define when to start outputting results - allows to skip an initialization period. Uses ord(t) > results_t_start in the code.
mSettings('schedule', 'results_t_start') = 1;
* ---- Control the solver
// Control the use of advanced basis
mSettings('schedule', 'loadPoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
mSettings('schedule', 'savePoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
); // END if(mType)
......@@ -117,6 +117,13 @@ if (mType('invest'),
// Define when to start outputting results - allows to skip an initialization period. Uses ord(t) > results_t_start in the code.
mSettings('schedule', 'results_t_start') = 1;
* ---- Control the solver
// Control the use of advanced basis
mSettings('schedule', 'loadPoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
mSettings('schedule', 'savePoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
); // END if(mType)
......@@ -133,4 +133,11 @@ if (mType('schedule'),
// Define when to start outputting results - allows to skip an initialization period. Uses ord(t) > results_t_start in the code.
mSettings('schedule', 'results_t_start') = 1;
* ---- Control the solver
// Control the use of advanced basis
mSettings('schedule', 'loadPoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
mSettings('schedule', 'savePoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
); // END if(mType)
......@@ -36,6 +36,8 @@ Sets
t_jump, // Number of time steps realized with each solve
t_horizon, // Length of the simulation horizon (central forecast)
t_end, // Last time step of the simulation
loadPoint, // load advanced basis; 0 = no basis, 1 = all solves, 2 = first solve
savePoint, // save advanced basis; 0 = no basis, 1 = all solves, 2 = first solve
intervalEnd, // End index of a time step interval
intervalLength, // Number of time steps aggregated within interval
IntervalInHours, // Length of one time step in hours
......
......@@ -18,6 +18,7 @@ $offtext
* --- Internal counters -------------------------------------------------------
Scalars
errorcount /0/
solveCount /0/
tSolveFirst "counter (ord) for the first t in the solve"
tSolveLast "counter for the last t in the solve"
tCounter "counter for t" /0/
......
......@@ -15,6 +15,34 @@ You should have received a copy of the GNU Lesser General Public License
along with Backbone. If not, see <http://www.gnu.org/licenses/>.
$offtext
* =============================================================================
* --- Controlling the use of previous solutions to have a first guess ---------
* =============================================================================
* 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
if (mSettings(mSolve, 'loadPoint') = 1 and solveCount > 1,
put_utility 'gdxin' / mSolve.tl:0 '_p.gdx';
execute_loadpoint;
elseif mSettings(mSolve, 'loadPoint') = 2,
put_utility 'gdxin' / 'schedule_p' solveCount:0:0 '.gdx';
execute_loadpoint;
elseif mSettings(mSolve, 'loadPoint') = 3 and solveCount = 1,
put_utility 'gdxin' / mSolve.tl:0 '_p.gdx';
execute_loadpoint;
);
if (mSettings(mSolve, 'savePoint') = 1,
option savepoint = 1;
elseif mSettings(mSolve, 'savePoint') = 2,
option savepoint = 2;
elseif mSettings(mSolve, 'savePoint') = 3 and solveCount = 1,
option savepoint = 1;
elseif mSettings(mSolve, 'savePoint') = 3 and solveCount > 1,
option savepoint = 0;
);
* =============================================================================
* --- Solve Commands ----------------------------------------------------------
* =============================================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment