clicSAND for OSeMOSYS: a user-friendly interface using open-source optimisation software for energy system modelling analysis

Energy models are crucial for helping governments and policymakers plan long-term investments in the energy transition context. One of the most established open-source optimisation models is OSeMOSYS— the Open-Source Energy Modelling System. This paper presents a new interface—clicSAND—for OSeMOSYS, which shortens the learning curve and supports beginner energy modellers to perform long-term investment analyses e�ciently. The freely available and open-source clicSAND software consists of a user-friendly Excel interface for entering data, powerful solvers, and a dashboard for visualising results. The results, which extend to 2070, can inform policy decisions and mobilise �nancial resources for sustainable development measures—for example, ensuring affordable and secure energy supply and mitigating the effects of climate change. This paper describes clicSAND's main bene�ts, architecture, and functionalities. Furthermore, a South-African case study undertaken by participants of the international capacity-building event—the EMP-A (Energy Modelling Platform for Africa) 2021—shows the results achieved by inexperienced users following a three-week training course. Finally, current applications and future extensions of the software are also presented.


Motivation And Signi cance 1.1 Scienti c background and motivation for developing the software
The climate change crisis requires bold and courageous action by individuals and governments.One of these actions is the so-called 'energy transition', which implies moving away from a carbon-based economy towards less polluting options such as renewable energy sources.This shift requires multibillion-dollar investments and long-term scenario planning to 2050, 2070, and beyond.To achieve this, governments, academics, international organisations, and private sector consultancies increasingly rely on energy models for long-term investment planning.Such models provide valuable insights for e cient and reliable energy production in line with climate change mitigation action.One of the most used is the Open-Source Energy Modelling System (OSeMOSYS).Initially developed at the Royal Institute of Technology (KTH) [1] in collaboration with various institutions and organisations, OSeMOSYS is a longterm bottom-up optimisation model for energy system analysis leading to better investment planning [2], as demonstrated in [3] [4] [5].
Throughout the continued development of OSeMOSYS over the past 14 years, developers focused on improving the user interface usability and user-friendliness, which enable skills to be developed faster and accelerate the uptake of models towards the formulation of sustainable development policies.Initially, users had to interact directly with the code and the input data le via text editor software and the command line, which was time-consuming and di cult for non-advanced users.As a result, a standalone open-source interface called MoManI (Model Management Infrastructure) was developed [6].
However, this interface had signi cant limitations in terms of data management [7].The OSeMOSYS community tried to replicate the same functionality within an Excel workbook, but this informal process led to duplication of effort and scattered resources.
Cannone [7] addressed this problem by developing an Excel-based interface for OSeMOSYS called SAND (Simple And Nearly Done).Although the Excel interface improved the collection and input of data, the user still had to interact with the command line via simple lines of code to run the models and computation time could be a few hours.Therefore, building from the Excel SAND Interface, clicSAND is a user-friendly interface for OSeMOSYS, developed to overcome these limitations.It adds more powerful solvers, one-click installation, and a user-interface application.clicSAND provides the OSeMOSYS community with an easy-to-use interface for energy modelling analysis and has been widely used in different spheres (see Section 4.1).The clicSAND software helps model alternative long-term pathways of a selected region, identifying the optimal energy mix con guration, including allocation of energy resources, and associated nancial investment.
The remainder of the paper is as follows.Section 2 presents clicSAND's architecture and main functionalities.Section 3 provides a brief, illustrative example of clicSAND use.Section 4 concludes by presenting current and past software applications, extensions, and future work.

Materials and Methods
A basic overview of the clicSAND software and its main functionalities are shown in Figure 1, with the main advantages and limitations appearing in Figure 2. It uses the SAND Excel interface as the only data entry point for the user.A key advantage from a usability perspective is that no interaction with the command line is required during the modelling process.The software works completely o ine, which is particularly promising for regions with low bandwidth connections.
A one-click installation package with all the necessary components of the software is freely available for download on Github [8], and instructions on how to correctly install the software and the two free solvers can be found on Zenodo [9].Moreover, a step-by-step online certi ed course hosted on the Open Learn Create (OLC) Platform is available as a public good [10].The course combines theoretical lessons with practical exercises, teaching users the theory behind energy modelling for investment planning and how to build an energy model from scratch using the clicSAND software for OSeMOSYS.The authors recommend to rst-time users of the clicSAND software enrol in this online course and carefully follow the instructions provided in practical exercises 1, 2 and 3: Hands-on 1: Download and installation of the clicSAND software and the solvers (GLPK and CBC).
Hands-on 2: Best practices to input data to the Excel SAND Interface and practical example for one technology.
Hands-on 3: Instructions on how to save, run and visualise results using the Microsoft Access Database and the Excel Template provided with the software.
Another asset of the clicSAND software lies in its compatibility with the Starter Data Kits [11], the starting point national energy system models currently available for 70 countries in Africa, East Asia, and South America.Indeed, the Starter Data Kits models were built using the SAND Interface, and the results were obtained by running the clicSAND software.
One limitation of the software is the need for at least 8 GB RAM for smooth operation and a Windows computer with Microsoft Access and Excel installed -which are commercial software.However, to offer this public good to a broader audience, a second version of the clicSAND software, which is mac-OS compatible and does not require Microsoft Access, was recently released -more details in Section 4.
Experienced users working on complex models might nd the SAND interface not best suited for multiregional studies and models with a high temporal resolution (more than 96-time slices).Indeed, as explained in Section 2.3, the Excel SAND Interface represents the shell where the user can intuitively add data up to 200 technologies, 50 commodities, ve types of emissions, one region and 96-time slices.It is worth pointing out that when rst using the Excel Interface to input data, the user must pay attention to pasting in data while a lter is applied, as Excel will copy the data to the subsequent row and not to the next ltered row.However, to avoid rst-users mistakes while compiling a model, step-by-step video guidance was released on YouTube, showing best practices to copy data effectively and quickly [12].
Another weakness of the clicSAND software for Windows is detecting errors if the model fails during the run.Indeed, the software platform shown in Figure 1 does not indicate the error, only that the model is not working (this problem also occurs when running OSeMOSYS models with other interfaces).To overcome this limitation and improve the troubleshooting experiences, the third version of the software -which is currently being tested -introduced the functionality to identify which step of the process the model is failing (Section 4 of this paper).
The clicSAND software is fully compatible with the existing OSeMOSYS architecture-the constraints, variables, and parameters are all represented.Two powerful solvers to nd a model's optimal solution, GLPK (GNU Linear Programming Kit) [13] and CBC (COIN-OR branch and cut) [14], are part of the opensource and freely available clicSAND software.Moreover, the software's results are fully compatible with other tools such as the CLEWS (Climate, Land (Food), Energy and Water systems approach) [15], the IRENA FlexTool that analyses the exibility of the system, MUSE (ModUlar energy system Simulation Environment) [16], and other OSeMOSYS platforms, including the OSeMOSYS Cloud Platform [17] (Online solvers available through a cloud service), as explained in Section 4 of this paper.

Software architecture
The clicSAND software and its components are licensed under an MIT license (open-source and free of charge), allowing the public to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software.Users can do this by giving credit, linking to the license, and indicating if they changed the work in all copies or substantial portions of the Software.clicSAND is written using the C# language, allowing easy uptake, improvements, and adaptability.

Operating the software
As mentioned before, the user downloads the one-click installation package from GitHub [8], runs the executable, and follows the instructions for installing the GLPK solver and CBC solver available on Zenodo [9] as part of the OLC online course [10].The one-click installation package contains the following: User platform (Figure 1), Excel SAND Interface to input data, Access database to import results, Excel template to visualise the results, OSeMOSYS code needed by the solvers.
The user populates the SAND Interface on Excel using a single spreadsheet where all the OSeMOSYS Sets and Parameters can be de ned.The spreadsheet uses lters to guide the user compile the data le.
The owchart in Figure 3 describes all the process steps, while speci c functionalities of the SAND Interface are presented in Figure 4. Next, the user saves and closes the Excel le to open the clicSAND executable (Figure 1).The user selects the SAND Excel le and then the OSeMOSYS code by clicking respectively on the green and blue buttons highlighted in Figure 1.By using the arrows of the "Ratio (CBC)" button, the user can, if needed, change the accuracy of the model solution -a 0.05 ratio which is usually used, means that a 5% range of error on the optimal solution is accepted.A lower ratio will result in a longer computational time.A VBA (Visual Basic for Applications) Macro in the selected SAND Excel workbook is executed by clicking 'Run'.The macro copies the last tab in SAND, named ToDataFile, into a new text le.The rst solver, GLPK, will generate the matrix based on the data le and code selected.
Then the second solver, CBC, will nd the optimal solution and produce results in a text le format.If the model successfully runs, the large text box in Figure 1 will show lines of text describing the process followed and ends up with a sentence saying the "Optimal Solution was found".At that point, the results obtained will have been saved in a .txtle and should then be imported into the Access Database.The last step to visualise the results requires the user to link the Excel Result Visualization template with the Access Database.The process should be repeated for each of the 11 graphs the user would like to visualise.The authors highly recommend following the step-by-step instructions on how to run and visualise the results provided in the Hands-on 3 of the OLC Course [10] and the YouTube video [12].

Software functionalities 2.3.1. SAND Excel Interface
The clicSAND software consists of various components.Here we will focus on two of them-the SAND Excel interface and the Result Visualisation template-as users interact with these for data management.As shown in Figure 4, the SAND Interface is an Excel workbook consisting of four sheets: Naming, SETS, Parameters, and ToDataFile.
In Naming, there is a description of all the parameters used to build and constrain the model.In SETS, the user de nes the names of up to 200 technologies, 50 commodities, and ve types of emissions in their model.The user can return to this sheet and make unlimited changes without losing progress.The naming convention added in SETS is automatically inserted in the other two sheets: Parameters and ToDataFile.
The Parameters sheet (screenshot: Figure 4) is a worksheet with 48,757 rows containing all the user's OSeMOSYS parameters necessary to build a model.Filters have been prepared in each column to improve the interface's usability.Thus, the user can apply multiple lters to identify the data entry point of interest.For example, to add xed costs for renewable technologies such as geothermal, solar, wind, and hydro (shown in Figure 4), the user opens the Parameters sheet, lters out the xed costs in column A, and then lters out the selected technologies in column C, and nally copies the data into columns K to BN (years 2015 to 2070).
The user repeats this process for all data inputs of their model.The interface offers a modelling period of up to 55 years (from 2015 to 2070) and up to 96 time slices.However, the user can also choose to model a shorter period or reduce the temporal resolution (number of time slices) (see guided exercises at [18] and [19]; video recordings at [20] and [21]).
The user does not interact directly with ToDataFile to enter modelling data.This sheet is already in the format required by the solvers; this automatically reads and copies all the data added from SETS and the Parameters sheet.When the user clicks 'Run' in the clicSAND software (Figure 1), a VBA macro embedded in the Excel SAND Interface is rst executed, which opens the SAND Interface, reads the ToDataFile sheet, and saves it in a new .txtle that the two solvers use to nd the optimal solution.

Results Visualisation Template
In the Results Visualisation Template le (a separated Excel workbook), the user can visualise the results of the modelling exercises (see available graphs in the green box of Figure 4).Graphs are generated using Pivot Tables and rely on Access Database to store the data in a compatible format.In the next chapter, an illustrative example of an analysis using this software will be presented.

Illustrative Example
This section presents the results of a South African case study undertaken by participants of the international capacity-building event: the EMP-A (Energy Modelling Platform for Africa) 2021 [22].The results are the output of a three-week online training course based on clicSAND for OSeMOSYS.The participants did not have any previous knowledge of OSeMOSYS.It is worth mentioning that the format of the results presented in Figure 5 was obtained using an additional scienti c plotting package, called Veusz [23], for post-processing graphics production, fully compatible with the Excel Template generated with clicSAND software.

Background and modelling questions
The South African power system exhibits signi cant coal dependence [24].Consequently, an exercise was undertaken regarding the potential implications of reduced coal dependence relative to existing policy and the least-cost scenario.To create a representative scenario, all coal capacity is decommissioned by 2040.The following questions were considered: 1. How will the energy mix evolve? 2. How will CO 2 emissions change?
3. What roles will different technologies play?

Modelled scenarios and Starter Kit
The modelled scenarios are summarised in Table 1.The base model for the 'Existing Policy' scenario utilised an adjusted version of the available South African Starter Data Kit for implementation in OSeMOSYS [25] [26], with further adjustments made (described in Table 1) to de ne the 'Least Cost' and 'Game Change' scenarios.

Discussion of Results
Relative to the Existing Policy scenario, the Least Cost and Game Change scenarios evolve toward an increasingly diversi ed clean energy mix (Figure 5).New-build capacity is dominated by solar photovoltaics and onshore wind, replacing decommissioned coal capacity (as planned) and meeting growing demand.When shifting from the Least Cost scenario towards the Game Change scenario, other solar photovoltaics and onshore wind are deployed, supplemented by gas-red generation capacity that lls the gap left by coal capacity decommissioned by 2040.

Policy implications and future work
From the ndings of these representative scenarios (see Figure 5a), it would be prudent to prepare early for a transitioned power sector in South Africa.The primary aim is to shift away from coal-red power generation in a phased manner with geographically speci c policy interventions and assessment of related socio-economic costs/bene ts.
The total system and discounted costs are compared in Figure 5c across the scenarios.Considering the potentially signi cant role of variable renewable energy (VRE) like solar photovoltaics and wind in South Africa (see Figure 5a), localisation of the VRE supply chain wherever possible should be prioritised.
However, this will result in increased electricity costs.
With the technologies considered, although CO2 emissions are reduced (see Figure 5b), a shift to natural gas capacity from coal means a continued reliance on thermal fuels and imported fuel dependence (leading to energy security concerns).This exercise did not explore storage (short-or long-duration) options but could play a notable role if costs continue declining.This was because the scope was limited to demonstration purposes and not to obtain any speci c insights into the potential role of storage.Indeed, with high penetration levels of variable renewable energy in the form of solar PV and wind (onshore/offshore), the potential role for various short-duration and long-duration storage forms would be an exciting scope to pursue further.

Impact and use of clicSAND Software
The clicSAND software has been used research analysis, and policy evaluation.It was initially used and tested with six Imperial College London Master's students for thesis projects in Kenya [28], Nigeria [29], Vietnam [30], Laos [31] [32], and Armenia [33].It proved to be a exible tool supporting national energy planning strategies.These theses have expanded existing research and been incorporated into national government energy strategies (e.g., Vietnam [34]).clicSAND has also been used to develop 69 country Starter Data Kits (for countries in Africa, Asia, and South America), which are zero-order models with complete datasets freely available on Zenodo and pre-print papers on Research Square (complete list: Appendix B).
Furthermore, the clicSAND software was used to train over 200 people during international capacitybuilding events, such as the Summer Schools at the International Centre for Theoretical Physics (ICTP) [35] [36] and the EMP-A [22].The latter was organised, among others, by the United Nations Economic Commission for Africa (UNECA) and the University of Mauritius [37].In these events, the skills previously taught using MoManI are now gained using the clicSAND software.As a result of these events, several researchers and government energy ministry analysts utilise clicSAND to build national energy strategies [38].
A survey circulated to the participants of the capacity-building events called EMP-A 2021 and ICTP 2022 of the track in Energy and Flexibility Modelling evaluated the software's compatibility and usability.The results in Appendix A show that both the Excel SAND Interface and the clicSAND software got a satisfactory score of 75/100 on their user-friendliness and ease of use.On the contrary, results highlighted expected weaknesses in the solvers' computational time.To overcome this challenge, the authors have developed and are currently testing a new version of the software which can compress the size of the data le and exponentially speed up the solving time (more information available in Chapter 4.2).
clicSAND is the base of the practical exercises of the OLC Platform online course on Energy and Flexibility Modelling [10], which 346 people have currently completed obtaining an o cial certi cate.The GitHub supplementary repository available on Zenodo [9] has been viewed and downloaded by 859 and 213 users, respectively.Moreover, clicSAND was used to teach how to perform energy modelling analysis in the Climate Change Politics and Policy Master's Course at Loughborough University [39] and to students of the Imperial College London working on their master thesis in consultation with the UK Government Energy Transition Council (ETC) [40].
Finally, clicSAND was an invaluable asset in the initial phase of OSEMOSYS UI (User Interface) development as a blueprint and prototype for data structure design.Developed by the United Nations Department of Economic and Social Affairs (UNDESA) [41], OSeMOSYS UI is a web-based solution [42], also available as a stand-alone platform that enables users to create quickly, run, and analyse OSeMOSYS results.

Extensions and software updates 4.2.1. clicSAND for MacOS users
A second version of the software, called the clicSAND for the Macintosh User Group (clicSANDMac), was developed [43] [44] [45].This allows clicSAND and the Starter Data Kits [11] to be accessible and adaptable to all.The same principles and functionalities as clicSAND for Windows and source code are maintained; however, a few changes are required for macOS compatibility.For example, Microsoft Access was replaced with a Python-based data manipulation approach (embedded in the software).Additionally, data are run in a text le format rather than an Excel spreadsheet (however the user still inputs the data through Excel).An online course solely for OSeMOSYS MacOS users was released on the OLC Platform [46].

OSeMOSYS Cloud Visualisation
A third, partially web-based way of operating the software was developed to overcome the 8GB RAM old requirement for the smooth operation of the o ine version of clicSAND.In clicSAND 3.0., the user still inputs the data in the SAND Excel interface but will have the additional option to run the model online using the OSeMOSYS Cloud platform [17], which has the advantage, among others, of giving live feedback on the solving process and eventually, pointing at where the error has occurred.If this path is chosen, the results are visualised online through an interactive dashboard or o ine with the same steps as in the operational owchart of the rst version of the software (Figure 3).Instructions to run the model on the OSeMOSYS Cloud can be found in [47].Adding the option within the clicSAND software to visualise input data in a RES (Reference Energy System) is currently being tested [48].Lastly, as previously mentioned, a new functionality that reduces computational time has been implemented and is being tested.Building on what was done in the clicSANDMac, a Python code was embedded in the software to reduce the data le size (matrix and LP-le) by ltering out unused elements beforehand, therefore dramatically shortening the solving time.This functionality also bypasses the need for an Access database to visualise the results, if the user decides to do that o ine and not using the online OSeMOSYS Cloud Platform.

OSeMOSYS UI
As mentioned above, a key advantage of clicSAND is that data management is administered through spreadsheets.Part of the success is also that "What You See Is What You Get" (WYSIWYG) [49], which means a reduced level of abstraction.However, it was identi ed that Excel is not secure; it is error-prone, tough to keep track of, and challenging to scale.These are the reasons for developing clicSAND software as a full-scale web application called OSeMOSYS UI.OSeMOSYS UI, which does not use any Microsoft product, adds the ability to implement different units, create a model, and run the solver in the same interface.

Declaration of competing interest
The declare that they have no known competing nancial interests or personal relationships that could have in uenced the work reported in this paper. Figures

Supplementary Files
This is a list of supplementary les associated with this preprint.Click to download. Appendices.docx

Figure 1 Overview
Figure 1

Figure 4 Main
Figure 4

Figure 5 Figure 5a :
Figure 5 Figure 5c: If an accelerated transition is desirable (Game Change scenario), increased capital investment in renewable energy and continued fossil fuel use for now (proxy of imported natural gas) are needed.Results of the South African case study developed during EMP-A: (a) Comparison of the electricity production; (b) Comparison of the CO2 emissions of scenarios; (c) Comparison of total costs (Capital, Fixed O&M, and Fuel costs).

Table 1 :
Summary of scenarios modelled including description and critical assumptions.