// Solution gap: the first one reached will end iteration
optca = 0 // Absolute gap between the found solution and the best possible solution
optcr = 0.0004 // Relative gap between the found solution and the best possible solution
solvelink = %Solvelink.Loadlibrary% // Solvelink controls how the problem is passed from GAMS to the solver. Loadlibrary constant means that the model is passed in core without the use of temporary files.
* profile = 8 // Profile will show the execution speed of statements at the defined depth within loops.
* bratio = 0.25 // How large share of the candidate elements need to be found for advanced basis in LP problems. Default 0.25.
* solveopt = merge // How solution values are stored after multiple solves. Default merge.
* savepoint = 1 // NOTE! Savepoint is controlled by Backbone model options.
threads = -1 // How many cores the solver can use: 0 = all cores; negative values = all cores - n
$ifi not '%debug%' == 'yes'
solprint = Silent // Controls solution file outputs - debug mode will be more verbose
@@ -23,13 +23,16 @@ Backbone has been designed with a modular structure, making it easier to change
* 1d_results.gms - Contains definitions for the model results.
* 1e_inputs.gms - Contains instructions on how to load input data, as well as forms a lot of helpful sets based on said data, for example in order to facilitate writing the constraints.
* 2a_variables.gms - Contains variable definitions used by the models.
* 2b_equations.gms - Contains the equation definitions for the models.
* 2b_eqDeclarations.gms - Contains equation declarations for the models.
* 2c_objective.gms - Contains the objective function definition.
* 2d_constraints.gms - Contains definitions for constraint equations.
**Model Definition Files* - Contains GAMS definitions for different models, essentially lists the equations (constraints) that apply. Current files include *schedule.gms*, *building.gms* and *invest.gms*.
* 3a_periodicInit.gms - Initializes various data and sets for the solve loop.
* 3b_inputsLoop.gms - Instructions for possible data import inside the solve loop, as well as forecast in-the-loop improvements.
* 3c_periodicLoop.gms - Contains instructions for the forecast-time structure of the desired model.
* 3d_setVariableLimits.gms - Defines the variable boundaries for each solve.
* 3e_solve.gms - Contains the GAMS solve command for using the solver.
* 3f_afterSolve.gms - Fixes some variable values after solve.
* 4a_outputVariant.gms - Contains instructions for storing desired results during the solve loop.
* 4b_outputInvariant.gms - Calculates further results post-solve.
* 4c_outputQuickFile.gms
...
...
@@ -37,10 +40,11 @@ Backbone has been designed with a modular structure, making it easier to change
Most of these files are under *\inc* in the Backbone folder, except for the model definition files being housed under *\defModels*. Other than the abovementioned files, a few key input files are required for Backbone to work. These are assumed to be found under *\input* and are briefly described below.
* inputData.gdx - Contains most of the input data about the system to be modelled.
* 1_options.gms - Contains options to control the solver. Not required but included if exists.
* timeAndSamples.inc - Contains definitions for the time, forecast and sample index ranges.
* modelsInit.gms - Contains model parameters for the solve (or a link to a template under *\defModels* to be used). Useful for any additional GAMS scripting.
Backbone folder contains two template files *timeAndSamples_temp.inc* and *modelsInit_temp.gms* to provide examples of the input format. These files can be copied into *\input* and renamed to *timeAndSamples.inc* and *modelsInit.gms*.
Backbone folder contains three template files *1_options_temp.gms*, *timeAndSamples_temp.inc*, and *modelsInit_temp.gms* to provide examples of the input format. These files can be copied into *\input* and renamed to *1_options.gms*, *timeAndSamples.inc*, and *modelsInit.gms*.
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('building', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('building', 't_end') = 8760;
mSettings('building', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('building', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('building', 't_horizon') = 336;
mSettings('building', 't_jump') = 168;
mSettings('building', 't_horizon') = 336; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('building', 't_jump') = 168; // How many time steps the model rolls forward between each solve
mSettings('building', 't_forecastStart') = 0; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('building', 't_forecastLengthUnchanging') = 0; // Length of forecasts in time steps - this does not decrease when the solve moves forward (requires forecast data that is longer than the horizon at first)
mSettings('building', 't_forecastLengthDecreasesFrom') = 0; // Length of forecasts in time steps - this decreases when the solve moves forward until the new forecast data is read (then extends back to full length)
mSettings('building', 't_forecastJump') = 0; // How many time steps before new forecast is available
* --- Define output settings for results --------------------------------------
// Define the length of the initialization period. Results outputting starts after the period. Uses ord(t) > t_start + t_initializationPeriod in the code.
mSettings('building', 't_initializationPeriod') = 0; // r_state and r_online are stored also for the last step in the initialization period, i.e. ord(t) = t_start + t_initializationPeriod
* --- Control the solver ------------------------------------------------------
// Control the use of advanced basis
mSettings('building', 'loadPoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
mSettings('building', 'savePoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('invest', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('invest', 't_end') = 8760;
mSettings('invest', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('invest', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('invest', 't_horizon') = 8760;
mSettings('invest', 't_jump') = 8760;
mSettings('invest', 't_horizon') = 8760; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('invest', 't_jump') = 8760; // How many time steps the model rolls forward between each solve
mSettings('invest', 't_forecastStart') = 0; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('invest', 't_forecastLengthUnchanging') = 0; // Length of forecasts in time steps - this does not decrease when the solve moves forward (requires forecast data that is longer than the horizon at first)
mSettings('invest', 't_forecastLengthDecreasesFrom') = 0; // Length of forecasts in time steps - this decreases when the solve moves forward until the new forecast data is read (then extends back to full length)
mSettings('invest', 't_forecastJump') = 0; // How many time steps before new forecast is available
* --- Define output settings for results --------------------------------------
// Define the length of the initialization period. Results outputting starts after the period. Uses ord(t) > t_start + t_initializationPeriod in the code.
mSettings('invest', 't_initializationPeriod') = 0; // r_state and r_online are stored also for the last step in the initialization period, i.e. ord(t) = t_start + t_initializationPeriod
* --- Control the solver ------------------------------------------------------
// Control the use of advanced basis
mSettings('invest', 'loadPoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
mSettings('invest', 'savePoint') = 2; // 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('schedule', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('schedule', 't_end') = 8760;
mSettings('schedule', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('schedule', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('schedule', 't_horizon') = 8760;
mSettings('schedule', 't_jump') = 3;
mSettings('schedule', 't_horizon') = 8760; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('schedule', 't_jump') = 3; // How many time steps the model rolls forward between each solve
mSettings('schedule', 't_forecastStart') = 1; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('schedule', 't_forecastLengthUnchanging') = 36; // Length of forecasts in time steps - this does not decrease when the solve moves forward (requires forecast data that is longer than the horizon at first)
mSettings('schedule', 't_forecastLengthDecreasesFrom') = 168; // Length of forecasts in time steps - this decreases when the solve moves forward until the new forecast data is read (then extends back to full length)
mSettings('schedule', 't_forecastJump') = 24; // How many time steps before new forecast is available
* --- Define output settings for results --------------------------------------
// Define the length of the initialization period. Results outputting starts after the period. Uses ord(t) > t_start + t_initializationPeriod in the code.
mSettings('schedule', 't_initializationPeriod') = 0; // r_state and r_online are stored also for the last step in the initialization period, i.e. ord(t) = t_start + t_initializationPeriod
* --- 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