Current Version: v20250110
CAP Wizard for IAEA MESSAGE is a multifaceted tool developed to streamline result processing and overcome challenges in processing results from the IAEA MESSAGE tool. It offers a suite of modules, each targeting specific issues encountered by IAEA MESSAGE users. While the interactive mode in IAEA MESSAGE addresses some limitations of the CAP program, the interactive mode’s capabilities for analyzing results are restricted. CAP Wizard leverages the IAEA MESSAGE CAP program and addresses known calculation challenges, such as discrepancies in total installed capacity and fixed costs, particularly when plant lifespans don't align with the study years of the model.
The first module of CAP Wizard focuses on generating special Tech and LDR cin
files, which need to be placed within the data
folder of the model folder. At this model the user should run along with CAP to generate the results. The results can be found within the res
folder that is contained in the model folder and are named LDR_CAP_adb.tab
and Tech_CAP_adb.tab
. These results from these files can be copied into MS Excel using text import wizard function of Excel. Once imported into Excel these files, CAP Wizard further processes the outputs and enriches the results with data beyond what is available from MESSAGE interactive outputs by using the ADB database file from the model in its second module for processing the results. It further enhances the results by a customizable template MS Excel file, enabling users to tailor the processed results from the tool to their specific requirements. For instance, users can add generation types to technologies in the model, allowing for more detailed filtering in the processed results. Furthermore, CAP Wizard uniquely supports LDR results processing and introduces a novel approach to cost calculations in a special module, detailed in the cost calculation section.
The processed result file is generated and outputted as an MS Excel file, facilitating more analysis and visualization, including the use of pivot tables with extensive filtering options. This makes the processed results the main file for results analysis and visualization.
A demo case has been added for a reference to showcase how Cap Wizard
works which is a modification of demo_case5 that is built in with MESSAGE.
The streamlined workflow for running a model and analyzing results is as follows:
- Model Execution: Run the MESSAGE model.
- CAP File Generation: Use CAPWizard to generate Tech and LDR files.
- Place Cin Files: Move generated cin files to
data
folder of the model directory. - Select Cin Files: Select cin files in IAEA MESSAGE. Choose
Select
menu in the toolbar then thecinfiles
option. - Run CAP: Execute CAP in IAEA MESSAGE.
- Results Conversion: Import results
- Go to folder for the model containing and open the subfolder named
res
. - Open
Tech_CAP_adb.tab
andLDR_CAP_adb.tab
and copy the results from these files. - Paste into Excel using the MS Excel text import wizard. The delimiter is usually a space or a tab character.
- Save the file where necessary.
- Go to folder for the model containing and open the subfolder named
- Results Processing: Utilize CAPWizard to process these results.
- Data Analysis & Visualization: Refresh the pivot table and plotting data sources in Excel for advanced analysis and visualizations.
Consider the following simple scenario (Figure 1): to produce 100 Tonnes of Oil Equivalent (toe) of Diesel for public transport, a refinery needs 300$ worth of crude oil, 70$ of electricity, and 20$ of total operating costs (e.g., catalysts, wear and tear, etc.). What is the total cost to produce this Diesel?
Intuitively, the cost would just be the cost of the inputs,
Refineries do not just produce one product, so suppose that the refinery also produces 50 toe of Kerosene for aviation, and that the input costs remain unchanged (Figure 2). What is the cost of producing the Diesel?
Figure 2: A refinery that has multiple outputsWithout specific knowledge about how the refinery uses each input to produce each output, it is impossible to answer this question. So we make a simple assumption: the cost of producing each output is proportional to its relative share of all of the refinery's outputs. In this example, Diesel and Kerosene comprise
To summarize, the cost along a particular output edge
where
Real energy systems are not nice like the previous two example; they often contain feedback loops.
In the examples above, the electricity for the refinery could come from a generator, which in turn could be powered by the Diesel that the refinery produces.
In Figure 3, nodes
By applying the cost equation above:
Combining the previous two equations, we get:
As
We can also derive the total cost to produce electricity for final demand:
One more complexity in the real-world is that there can be multiple edges between two nodes.
In Figure 4 for example, the refinery supplies the generator with diesel and HFO. The notation
Similarily to the previous example, we follow the structure of the graph.
At this point we see that:
where
So
The important point in this example is that we can collapse the multiple edges from
Directly deriving the algebriac expressions for arbitrary graphs can be daunting. Instead, we opt for a straightforward numerical implementation that matches the above analytical solutions within few iterations. The algorithm is implemented and thoroughly documented in the calculate_cost()
and calculate_cost_inner()
functions inside CostCalculation.py
.
The energy system structure is not defined exactly as described in the previous examples. Instead, it is described in terms of the fuels that nodes produce and consume. That is, there is no explicit connections between nodes (e.g., a refinery to a generator) as in the previous examples. Because of this, an extra step is needed to convert the energy system into a network representation where costs can be calculated. An example of this is shown in the left part of Figure 5. Here, natural gas is imported (via the I node) and produced by the refinery R. A generator G consumes the natural gas and the rest goes to fulfill transportation demand T. To perform the cost calculation described above, these four nodes should be explicitly linked (Figure 5, right).
Figure 5: converting from the original energy system representation (left) to the cost calculation representation (right). R, I, G, and T correspond to refinery, import, generator, and transportation demand, respectively.To do this, we assume that the contribution of a producer node (R or I) to a consumer node's demand for a fuel (G or T) is equal to the producer's relative production share of that fuel:
where
In the cost calculation examples earlier, the reader might have noticed that the absolute number of units across each link is unimportant; it is their relative weight
In Figure 5, there is only one fuel. The weight from the refinery to the generator is
The conversion above is done by the to_network()
function in TopologyConverter.py
file.
- Windows OS or macOS to run the packaged application.
For end-users:
Additionally, download the template.xlsx
to customize the tool for your specific model.
For developers and advanced users:
- The source code is open-sourced for those who wish to tailor or extend the application.
- Python environment setup and dependencies are documented for development purposes.
- Use
package_app.py
to package your modified version of the application. - On macOS, ensure
create_dmg
is installed for.dmg
file creation.
For details on the latest updates and changes in CAPWizard for IAEA MESSAGE, please see the change log file.
This software is released under the Apache License 2.0. This license is a permissive open-source license that includes provisions for attribution. It allows users to use, modify, and distribute the software while requiring proper credit to be given to the original author. Therefore, any redistribution of this software must clearly attribute development to Yousef S. Al-Qattan & Mohammad M. Khajah from Kuwait Institute for Scientific Research (KISR).
The software has been developed by
- Yousef S. Al-Qattan, Kuwait Institute for Scientific Research (KISR): initial idea, data processing, GUI development, integration, documentation.
- Mohammad M. Khajah, Kuwait Institute for Scientific Research (KISR): network conversion and cost calculation algorithms, documentation.
Special thanks to Dr. Emmanuel Guemene Dountio and Dr. Arvydas Gallinis for their guidance and support throughout the development of this tool. Also, would like to thank Dr. Yousef M. Al-Abdullah for his contributions in writing the readme file.