deflex.model_scenario

deflex.model_scenario(path=None, file_type=None, dump=True, results=False, solver='cbc')[source]

Compute a deflex scenario with the full work flow:

  • creating a scenario
  • loading the input data
  • computing the scenario
  • storing the results
Parameters:
  • path (str or None) – File or directory with a valid deflex scenario. If no path is given an energy system (es) has to be passed.
  • file_type (str or None) – Type of the input data. Valid values are ‘csv’, ‘xlsx’, None. If the input is non the path should end on ‘csv’ or ‘.xlsx’.
  • dump (str or bool) – Path to store the dump file. If True the results will be stored along with the scenarios using the same name and the suffix .dflx. If False no dump will be stored (default: True).
  • results (str or bool) – Path to store the results in an spreadsheet. If True the results will be stored along with the scenarios using the same name and the suffix _results.xlsx. If False no results will be stored (default: False).
  • solver (str) – The solver to use for the optimisation (default: cbc).

Examples

>>> from deflex import fetch_test_files, TEST_PATH
>>> fn = fetch_test_files("de02_no-heat.xlsx")
>>> r = model_scenario(fn, file_type="xlsx", dump=True
...     )  # doctest: +ELLIPSIS
Welcome to the CBC MILP ...
>>> os.remove(fn.replace(".xlsx", ".dflx"))