backbonetools.exec

backbonetools.exec#

contains execution helpers like a function to run backbone via python or automated scenario analysis

Functions

invest2schedule(input_xlsx, result_gdx[, ...])

inserts investment decisions of a result_gdx into an input excel file and disables all investment options to produce a schedule input xlsx

run_backbone(backbone_dir, input_dir, ...[, ...])

runs Backbone with the specified arguments

sensitivity(input_file_gdx, bb_input_dir[, ...])

Runs sensitivity analysis with a given input file, varying one parameter over certain values

backbonetools.exec.invest2schedule(input_xlsx, result_gdx, schedule_xlsx_path=None)#

inserts investment decisions of a result_gdx into an input excel file and disables all investment options to produce a schedule input xlsx

Parameters:
  • input_xlsx (str) – path to input data with complete time series and other data (like p_gnu_io) the same as used for invest run

  • result_gdx (str) – path to investment result

  • schedule_xlsx_path (str, optional) – Path to output xlsx. Defaults to None.

Returns:

path to output xlsx

Return type:

str

backbonetools.exec.run_backbone(backbone_dir, input_dir, input_file_gdx, output_dir, output_file=None, **kwargs)#

runs Backbone with the specified arguments

Parameters:
  • backbone_dir (str) – Path to the Backbone Framework.

  • input_dir (str) – Path to the input directory for Backbone to read configurations (e.g. investInit.gms)

  • input_file_gdx (str) – Path to the Backbone input file

  • output_dir (str) – Path to the output directory, where results shall be written

  • output_file (str) – Name of the Backbone result file

Raises:

ValueError – if any path contains spaces, an error occurs

Returns:

path to output file

Return type:

str

backbonetools.exec.sensitivity(input_file_gdx, bb_input_dir, output_dir=None, parallel=True, param='CO2', percentages=[0.05, 0.1, 0.2, 0.4, 0.8])#

Runs sensitivity analysis with a given input file, varying one parameter over certain values

Parameters:
  • input_file_gdx (str) – path to original input data file (.gdx)

  • bb_input_dir (str) – path to backbone input dir (contains e.g. investInit.gms)

  • output_dir (str, optional) – path to outputdir. Defaults to None.

  • parallel (bool, optional) – If backbone shall be run in parallel for the different scenarios. Defaults to True.

  • param (str, optional) – parameter to be varied. Defaults to “CO2”. At the moment, only CO2 is implemented

  • percentages (list, optional) – values for parameter, as a share of the value the parameter has when running the original input file. Defaults to [0.05, 0.1, 0.2, 0.4, 0.8].

Raises:

NotImplementedError – rises exception if no sensitivity analysis for the used parameter is implemented

Returns:

path to result gdx files

Return type:

list