Skip to content

Latest commit

 

History

History
205 lines (153 loc) · 16.7 KB

app_README.md

File metadata and controls

205 lines (153 loc) · 16.7 KB

TIMES - The Integrated MARKAL-EFOM System

This is a GAMS MIRO app for the IEA-ETSAP TIMES model. The TIMES (The Integrated MARKAL-EFOM System) model generator was developed by ETSAP the Energy Technology Systems Analysis Program, which is a Technology Cooperation Program of the International Energy Agency. ETSAP is an international community which uses long term energy scenarios to conduct in-depth energy and environmental analyses. The TIMES model generator combines two different, but complementary, systematic approaches to modelling energy: a technical engineering approach and an economic approach. TIMES is a technology rich, bottom-up model generator, which uses linear-programming to produce a least-cost energy system, optimized according to a number of user constraints, over medium to long-term time horizons. In a nutshell, TIMES is used for, "the exploration of possible energy futures based on contrasted scenarios" (Loulou et al., 2005).

TIMES MIRO is seen as an open source platform primarily intended to promote the dissemination and use of existing TIMES models. It allows users to make changes to model assumptions and perform sensitive runs based on the initial model assumptions. It then facilitates the comparison of results across multiple scenarios to evaluate the impact of the alternate futures. The app comes with predefined TIMES MIRO Scenarios, e.g. the TIMES_Demo (default) and the the TIMES-DK_COMETS data sets. Others can be created from TIMES model Excel input files (*.xlsx) or *.dd files (see below).


Following the common MIRO App Structure, the app has a navigation bar on the left side to switch between the following views:

  • Input
  • Output
  • GAMS Interaction
  • Load Scenarios
  • Compare Scenarios

Import Data

The input section can be used to prepare data for the next model run.

Database Scenarios

A TIMES MIRO Scenario (all visible data and attachments) can be stored in the database at any time as a MIRO scenario for later use under ScenarioSave as. To load an existing scenario from the database, click the Load data button in the input view. In the dialog that opens, the Database tab lists all available scenarios. If there are many saved scenarios, the Load scenarios view can give a better overview.


Local File Scenarios

Scenario files previously exported from MIRO can be re-imported via the Local tab in the same dialog.

External Scenarios

New data can be imported via the External tab. Either TIMES model Excel input files (*.xlsx) or *.dd files can be used as data source. Optionally, it is possible to provide a *.run file as produced by VEDA. The data must be zipped (file paths can remain) and uploaded via the fileinput widget. Click on Load to start the data import. As soon as this is finished, MIRO will inform you whether the import was successful.


NOTE

To be able to import Excel input files, python and the python package xl2times are required. The Excel input format accepted by this tool is documented in the TIMES Model Documentation PART IV. Make sure that python and the tool can be found by putting it in the PATH environment variable.


The following happens when importing data via the External tab:

  • XLSX: If xlsx files are provided as input data, the python tool xl2times is first called in the background, which converts these files into *.dd files (output.dd and ts.dd). In the next step, GAMS is called to convert these *.dd files into MIRO-compatible input data.
  • DD: If *.dd files are provided as input data, GAMS is directly called to convert the *.dd files into MIRO-compatible input data.

If a (optional) run file is used in any of these cases, the MIRO input data will be completed by automatically extracting TIMES extensions, active *.dd files, etc. from the *.run file. Note that this approach is convenient but also fragile because if the *.run file contains unexpected content, things might fail. You should therefore ensure that the content of the run file is compatible with the data provided.

Milestone years

The representative years for the model periods are taken from different sources depending on the input files used.

  • If .xlsx files are imported, the milestone years are always extracted from them, regardless of any .run file that may have been provided.
  • If .dd files are imported together with a run file, the milestone years are extracted from the run file. There must be no milestonyr entry in the dd files.
  • If .dd files are imported without a run file, the milestone years are set to the default: 2005, 2010, 2015, 2020, 2030, 2050. There must be no milestonyr entry in the dd files.

Prepare Model Run

In the Settings tab the main configuration is done. There are three sections: Model setup, Options / Extensions and Solver.

Model Setup

  • DD Files order / Read under $offEps: In this table, the names of all *.dd files that belong to the current TIMES MIRO scenario are listed. The user can adjust the read order and specify whether a *.dd file should be read in GAMS under $offEps. If a *.dd file should not be used for the next model run, this can be specified by an order value of 0. Note that the xl2times tool, which is used when importing xlsx files, only generates 2 *.dd files as output.
  • Milestone years: This table allows to select the set of years for which the model will run.
  • Time slices available: This table cannot be edited by the user, but only serves as an overview of the available time slices in the data. The set of timeslices and the representation of the intra-annual resolution is pre-configured and of central importance to many model data structures. A re-configuration of this set would require extensive modifications in the input data cube.
  • Additional statements: This table allows you to add GAMS code to the run file that is generated during the model run. The custom code will be placed before the $batInclude maindrv.mod. This setting is recommended for expert TIMES users only.

Options / Extensions

In this tab, TIMES options/extensions can be configured. A tooltip with a description of the option appears when you hover over an option. Each value cell contains a dropdown menu which allows you to select available options. Note that values can also be entered manually.


Solver

In this tab, the solver to be used and (optional) options can be defined.

  • Solver options: This table allows to change/define solver options to be used.
  • Solver to use: Select a solver to use.
  • Time limit for solve [seconds]: Time limit for solving the model.
  • Basis indicator (bRatio): The value specified for bRatio will cause a basis to be discarded if the number of basic variables is smaller than bRatio times the number of equations.

Input data

This is the central tab for browsing and editing input data in a powerful pivot table. The concept of this tab follows the idea to look at data based on "important" indices (e.g. Region, Year, Process, Commodity, Time Slice, ...). Each dimension of the cube can be filtered, aggregated, dragged into the columns, etc. using drag and drop. The cells are editable. Note, however, that when a dimension of the cube is in the Aggregate field, the table is read-only. More information about the pivot tool in general can be found here.


RES viewer

In the upper right corner of the input data tab there is a switch view button that allows to look at the RES network. The RES viewer provides process centric, commodity centric and user constraint centric views. All displayed items are clickable which allows convenient switching between different views. The corresponding table at the right and the pivot table at the bottom are updated automatically and show related data.



Solve model

When all data has been prepared and settings have been made in the input view, the model can be solved by clicking on the solve model button in the navigation bar in the Input section.



GAMS Interaction View

The GAMS Interaction View is automatically focused during a run. It shows the log file while it is written. The log and listing file can be accessed after a run. Note that the listing file shown in the app is a combination of the listing files written when running the wrapper times_miro.gms and the driver timesdriver.gms. You can find more information about the underlying code structure here.

For more details on this view, please consult the GAMS MIRO Documentation.

Output View

Once a TIMES model has been solved, the Output view is filled with results data (generated by GDX2VEDA ).

If the TIMES MIRO application is used without further ado, the output section shows data in a powerful pivot table that allows slicing and dicing the results as needed. Similar to the Input data, the concept of the data in the Full Output tab follows the idea to look at data based on "important" indices (e.g. Region, Attribute, Commodity, Process, Time Slice, ...). In addition to a table, the renderer also supports the visualization of data in the form of a heatmap or as a chart (line chart, bar chart, etc.). The MIRO pivot table renderer allows you to store "views" - the current representation of the data - to the database and load it together with the scenario data. This is very convenient for views that are frequently needed.

With a configuration adapted to the model, you can significantly improve the results visualization. Up to 4 output screens are available for integration.

  • Dashboard: Interactive dashboard with different views showing key insight data. The dashboard is navigated via the ‘tiles’ on the right-hand side of the screen. The tiles show headline results for the current scenario. You can switch between charts and tables. Each chart/table can be downloaded.
  • Data Explorer: Interactive tool that provides insights into the most important sectors. You can filter the data based on different indicators and switch between several chart types. Data and charts are available for download.
  • Data Explorer (Pivot): Pivot table that holds the same data as Data Explorer. The pivot table allows you to filter, aggregate and pivot data freely. In addition to a table, the MIRO pivot table renderer also supports the visualization of data in the form of a heatmap or as chart (line chart, bar chart, etc.). Each slice, or 'view' of data can be exported by clicking the download button. If you are currently viewing a chart, the view is exported as a PNG file; if you are viewing a table or heatmap, the data is exported as a CSV file. Read more about the pivot table tool here.
  • Full Output: Pivot table that holds all output data (default renderer, see above).

Load Scenarios View

Load scenarios provides a powerful batch load module that graphically assists you to create and execute complex database queries. Filters can be applied to scenario metadata such as the creation time, scenario name, or optional tags you have assigned to a scenario. You can also filter by any input and output scalars defined in your model as well as any double-dash parameters and GAMS command line parameters. You can combine any of these filters with the logical operators AND and OR. You can execute your query by clicking on the Fetch results button. After the results have been retrieved, the page will be updated and you will see a table with the scenarios that correspond to your query. Once you have found the scenarios you were looking for, you can select them and, for example, compare them or load them into the sandbox for editing. More information about this in the official MIRO documentation.

Compare Scenarios View

This section can be used to compare MIRO scenarios that are stored in the database. There are three different types of comparison available per default: Split view, Tab view and Pivot view. In the split view comparison the data of two scenarios can be compared side by side. Scenarios can also be loaded into tabs (as you know it from e.g. your internet browser) in the tab view comparison. This allows to compare more than two scenarios. In the pivot view comparison the data of all selected scenarios is merged into a pivot table which allows to create charts that combine data from multiple scenarios.

Once the configuration for the four optional renderers (see above) has been completed, the dashboard and the data explorer tab can also be used in a custom scenario comparison module without much additional effort.

License

The MIRO demo app is licensed under the MIT license (see file LICENSE). Note that everything inside the times_model, TIMES_Demo as well as the TIMES-DK_COMETS submodules is licensed under GPL-3. See files times_model\LICENSE.txt, TIMES_Demo\LICENSE.txt as well as TIMES-DK_COMETS\LICENSE for more information. The data processing and data explorer code in the custom renderer files was taken from https://github.com/EECA-NZ/TIMES-NZ-Visualisation (MIT licensed, see here). The code has been modified to meet the requirements of this application.