EHDO: A free and open‐source webtool for designing and optimizing multi‐energy systems based on MILP

This paper presents a novel webtool, called Energy Hub Design Optimization tool, for designing and optimizing complex multi‐energy systems. The tool determines the optimal technology selection and sizing of all energy conversion units of a supply system while satisfying heat, cold, electricity, and hydrogen demands. A large variety of different technologies including renewable energies (wind power, photovoltaic, solar thermal, and hydroelectricity) and energy carriers like natural gas, hydrogen, biomass, and waste can be considered. Energy demands are provided by the user with an hourly resolution and all technical and economic model parameters can be tailored to specific use cases. The objective functions of the design optimization are total annualized costs, CO2 emissions, or trade‐offs between both objectives (multi‐objective optimization). The calculation is based on mathematical optimization and uses a mixed‐integer linear program. The webtool is accessible online for free and the optimization model is open‐source. The webtool has been developed to support academic teaching in energy engineering courses. With the tool, students understand how energy supply systems with intermittent renewable energies and cross‐sectoral conversion and storage technologies can be designed with innovative planning approaches.

advanced techno-economic models based on mathematical optimization, for example, mixed-integer linear programs (MILPs), are increasingly used to design energy hubs and estimate their economic performance and environmental impact [5,9].
In recent literature, numerous optimization models and frameworks have been presented [2,10], for example the oemof framework [12], Ehub Modeling Tool by EMPA (Switzerland) [4], or the DER-CAM model by Lawrence Berkeley National Laboratory [21]. In addition, userfriendly applications for designing energy systems have been developed: The National Renewable Energy Laboratory, developed the free and open-source webtool REopt for designing electrical systems (microgrids with photovoltaics [PV], wind turbines, and batteries), which uses an MILP in the calculation [17]. The tool HOMER Energy is another user-friendly tool for sizing and planning energy systems [13]. However, it focuses on electrical components and is commercial. Another commercial tool for planning multienergy systems is TOP-Energy, which employs an MILP model [22]. The tool EnergyPLAN, distributed by Aalborg University (Denmark), is used for academic teaching and for real-world system planning [18]. It simulates the operation of different configurations of multi-energy systems. However, the system design (technology selection and sizing) must be defined by the user before the calculation. A detailed review of different planning and optimization tools for multi-energy systems is presented in Reference [3].
The aforementioned tools require downloading and installation of (commercial) software and are not created as a user-friendly calculation tool that can be used by students without prior training. In this paper, a webtool called Energy Hub Design Optimization (EHDO) tool is presented. EHDO is accessible online for free (http:// ehdo.eonerc.rwth-aachen.de). The tool can be applied to energy hubs of different sizes: from energy supply systems for building complexes to large district energy systems. On the basis of an MILP model, the tool selects the optimal technology configuration from a user-defined optimization superstructure and determines the optimal sizing. This paper is structured as follows: In Section 2, the application of the EHDO tool in an energy engineering course at RWTH Aachen University is explained. The optimization tool is described in detail in Section 3. In Section 4, the webtool is applied to two exemplary use cases. Conclusions are provided in Section 5.

| EDUCATIONAL FRAMEWORK
The EHDO tool is used in the course Alternative Energy Technologies in the master program Energy Engineering at RWTH Aachen University, Germany. In the course, a wide range of renewable energy sources and storage technologies is discussed in detail. This comprises PV, solar thermal collectors, concentrated solar power, wind energy, hydroelectricity, biomass, and geothermal energy. In addition to technical details of every technology, the course fosters the understanding of the interaction between different technologies in the technical, economic, and political field.

| Educational objective
The EHDO tool aims at improving the student's understanding how future energy supply systems are designed to achieve a sustainable and low-cost energy supply. Students can learn how renewable energies are integrated into complex energy supply systems and how storage units balance their intermittent generation profiles. By calculating different supply scenarios, students can investigate how storage capacities, renewable penetration, and overall system performance are related to each other. Also, the nonlinear relation between the share of renewable energies and total annualized costs of a system can be analyzed. Furthermore, practical questions can be investigated with the tool, for example: What is the optimal balance between storage capacities and oversizing of renewable energies (which leads to substantial curtailment) from an economic and environmental point of view? How do political measures, like CO 2 tax, affect the optimal system configuration? In addition, by varying the optimization weight of economic and environmental objectives, students understand the concept of multiobjective optimization and the way to calculate Pareto-optimal solutions.
Using an interactive webtool is beneficial, as students gain deeper insights into how complex energy systems perform without extensive manual calculations. In this context, students also get in touch with the important methodology of mathematical optimization in the field of energy system design.

| Evaluation and feedback
In summer semester 2020, the EHDO tool was used in the course Alternative Energy Technologies for the first time. As the tool was completely new, the exercise was not graded. In the exercise, different energy supply scenarios were described and students had to extract relevant information from the textual description to enter them in the tool. The scenarios comprised a 100% renewable supply system that uses different storage technologies (batteries and hydrogen storages). Other scenarios described an energy hub that supplies district heating and cooling networks. By varying the input data, sensitivity analyses were conducted to investigate how the system configuration and storage capacities change if a CO 2 tax is introduced. The students were provided with sample solutions in the form of short video tutorials, in which the data input was illustrated and the obtained solution was explained in detail.
Along with the exercise, a short voluntary survey was conducted. The survey comprised preformulated positive and negative statements to which the students could agree or disagree as well as a text field for describing their experience with the tool. In total, 13 students took part in the survey. In general, the feedback was positive: 12 of 13 students agreed to the statement that the usage of the tool in the course should be extended in the future; 9 of 13 students found the exercise and problem analysis interesting; 7 students agreed with the statement that they learned something new; 3 students stated that they used the tool for additional calculations beyond the scope of the exercise; and 10 of 13 students would recommend the tool to other students.
Moreover, an individual feedback has been received through the survey and by e-mail: Students considered the exercise a good alternative to the manual calculations in the rest of the course. They liked the straightforward solution process and the experimental character of the exercise. In addition, helpful feedback for further improvements was collected: Especially, the usability of the tool on screens with narrow aspect ratios was suboptimal. After the course, the usability of the tool has been improved, so that it can now be used with screens of different aspect rations including tablets and smartphones. In addition, it seems that the tool is of special interest for students who had prior experience with mathematical optimization in other courses before. Due to the positive feedback, it is planned to integrate additional exercises with EHDO in the course.

| Graphical user interface
The implementation of the webtool is based on the free and open-source Python web framework Django [6]. The fundamental advantage of a web-based calculation tool is the user-friendliness and low effort to use the tool: No software installation is required and the tool can be globally accessed with any web browser. This allows other universities to use the tool easily, and it widens the potential user group even beyond academic teaching. The EHDO tool comprises a landing page, an input, and a result page. On the landing page, the user can initialize a new calculation. The input data of each calculation are stored in a database and a unique calculation ID for each optimization is issued on the result page. This allows to retrieve the input data or results of a previous optimization run by entering the corresponding calculation ID on the landing page. Thus, input data of previous optimizations can be easily manipulated and parameter studies can be carried out with little effort. Furthermore, the calculation ID can be exchanged among students to exchange parameter settings and reproduce results. In the following section, the input and result pages are described in detail.

| Input page
The input page has three tabs: Demands & Location, Technologies, and Model parameters. In the first tab, the user defines heating, cooling, electricity, and hydrogen demands that the energy system needs to satisfy. The user can define a constant demand or upload a time series in form of a .txt-file. Time series define the demand in kWh/h for all 8,760 hours of a year. Alternatively, an example use case can be selected, which represents a small district with 100 buildings in Germany. In addition, the user selects a location where the energy system is planned. Each location is linked with a set of weather data, which comprises ambient air temperature, global horizontal irradiance, and wind speed. The weather data are used to calculate the electricity generation of PV modules and wind turbines as well as to determine the coefficient of performance of air source heat pumps. Currently, weather data for 184 different cities around the world are available in the tool. The weather data are based on EnergyPlus weather files [7]. If a desired city is not available, the user can upload a customized time series, which replaces the default weather data in the calculation.
The second tab contains all technology-specific input parameters. The following energy conversion or storage technologies are available:  Figure 1. If a technology is activated, it will be considered in the optimization; if it is deactivated, the capacity is set to zero by a constraint in the optimization model. Furthermore, a minimum and maximum capacity can be defined. In the optimization model, the capacity is enforced to be larger or equal to the minimum capacity. Likewise, model constraints ensure that the maximum capacity of each technology is not exceeded. In addition, the user can manipulate all model parameters of every technology. The two parameters with the largest impact on the optimization results are conversion efficiencies and specific investments.
In the third input tab, further model parameters are entered, as depicted in Figure 2. In the first column (Energy costs), electricity, gas, biomass, and hydrogen costs are defined. The annual imported energy (in MWh/year) can be limited individually for each energy carrier. In addition, a capacity price (in EUR/ kW) and a maximum grid capacity (in kW) can be defined for electricity and gas. The feed-in of electricity or natural gas to the respective grid can be forbidden or enabled. In the latter case, a feed-in tariff needs to be defined. All default values are based on German market conditions.
In the second column (Ecological impact), a CO 2 tax can be defined (in EUR/t CO 2 ). In addition, the CO 2 equivalents for electricity and hydrogen import as well as CO 2 emissions for burning gas, biomass, and waste are defined. A CO 2 credit can be defined for electricity or gas feed-in. In the third column (Optimization), the user can select an optimization focus, which describes how much weight is assigned to each of the objectives' annual costs and CO 2 emissions. Thus, a multi-objective optimization can be realized, and by varying the weight in different optimizations, a Pareto frontier can be determined. Moreover, an interest rate and project lifetime are defined for the annualization of investments. The number of design days used for the optimization can be defined by the user as well. The number of design days affects the design day clustering, which takes place before optimization and in which an annual time series (like energy demands or weather data) is aggregated to design days with a k-medoids clustering algorithm based on [20]. In the fourth column, a reference scenario is defined. The reference scenario indicates the costs and emissions that are saved by the optimized energy hub configuration in contrast to a state-of-the-art supply system. The performance and technology sizing in the reference scenario are based on simple heuristics. Depending on the use case, the user can choose from different reference systems: For heating, either a gas boiler or an electric heat pump with fixed coefficient of performance can be selected. Cooling and hydrogen demands are covered by a compression chiller and electrolyzer, respectively. Either all electricity demands (including power demands of the compression chiller and electrolyzer) are covered with the electricity grid or, alternatively, a CHP unit can be considered. The CHP unit is electricity-driven. However, heat from the CHP unit must be used (to cover heating demands) and cannot be dissipated to the environment. In total, four different reference configurations can be selected (gas boiler or heat pump; with or without CHP unit).

| Optimization model
The superstructure of the optimization model is shown in Figure 3. A superstructure comprises all possible technologies and energy flows. Within the optimization, an optimal subset of technologies is selected and the optimal capacities for each technology are determined. As objective functions, total annualized costs and CO 2 emissions are considered. Total annualized costs are calculated according to VDI 2067 [23] and include annualized investments (C inv,ann ), operation and maintenance costs (C om ), costs of electricity, gas, biomass, hydrogen, and waste imports, CO 2 tax (C CO 2 ), as well as revenues of electricity and gas feed-in (R feed-in ): are the discharging/charging flows of the heat storage. The userdefined heat demand that is covered by the energy hub is denoted byQ d t dem, , . Additional constraints ensure that the ratio of incoming and outgoing energy flows of each component equals the conversion efficiency of the respective technology. In case of a gas boiler, which consumes a natural gas flowĠ and generates a heat flowQ , this results in the following:̇Q Further constraints ensure that the load of each component does not exceed its nominal capacity. For a gas boiler, the corresponding constraint is as follows: The model has a low level of detail to guarantee fast computing times. Especially, no minimum part-load limits, part-load efficiencies, nonlinear investment functions, or start-up costs are considered. Energy balances for storages link two subsequent time steps with each other and take into account stand-by losses. To enable a seasonal course of the state of charge, a model formulation presented in [8,14] is used. For a detailed model description, the authors refer to the model implementation, which is open source and can be viewed on https://github.com/RWTH-EBC/EHDO.
The optimization model is implemented in Python and solved by the solver Gurobi™ [11]. The optimization usually takes around 10-60 s (depending on the amount of activated technologies and constraints). The entire computation (including design day clustering) takes around 1-2 min.

| Result page
The result page consists of seven sections. In the first section (Optimal energy hub), the optimal capacity of all technologies is listed. In addition, the equivalent collector area (for PV and solar thermal collectors) and volume for thermal storages as well as the annual generation and full load hours are shown.
The superstructure of the optimization model with all possible energy conversion and storage technologies 988 | An overview of the energy demands is provided in the second section (Energy demand). Here, the imported energy from the electricity and gas grid, the imported biomass and hydrogen as well as the generated and curtailed renewable energy (PVs, wind, solar thermal, and hydropower) are listed. Moreover, the amount of energy fed into the electricity or gas grid is depicted.
In the third and fourth sections (Cost overview and Ecological impact), an overview of all proportions of the objective functions (total annualized costs and CO 2 emissions) is provided.
Section Reference scenario provides a comparison between the optimized energy hub and the reference system, as illustrated in Figure 6. On the left, the most important KPIs (total annualized costs, net CO 2 emissions, and share of renewable energy) are listed for a direct comparison. Moreover, the amount of imported electricity and gas is given. On the right, the capacities of all components of the reference system are listed.
The result section (Demand analysis) provides an overview of the demands that the user defined on the input page. The total annual demand (MWh/year) and the peak demand (kW) are listed. The illustration of the annual course of the energy demands helps to doublecheck the inputs of the user.
In the last section, Renewable energies, the annual renewable energy generation and the annual peak power are listed. In addition, the annual course of the renewable energy generation is displayed for each month.

| CASE STUDIES
4.1 | Case study 1: District heating and cooling supply In this case study, the tool determines the optimal technology sizing of an energy hub, which supplies district heating and cooling networks of a research campus. A detailed description of the demands of the campus used in this study is presented in Reference [24]. The first tab of the input page is shown in Figure 4. In addition to the thermal demands, a constant electricity demand of 1 MW el is assumed. Weather data of the nearby city Cologne (Germany) are used for the optimization. In this scenario, the energy hub is connected to a public gas and electricity grid. The available technologies are CHP unit, gas boiler, compression and absorption chiller, heat storage, battery as well as PV collectors and wind turbines. The maximum PV collector area is 10,000 m 2 and the maximum wind power capacity is 2,000 kW el . The third tab of the input page is shown in Figure 2. The capacity price for F I G U R E 4 In the first input tab (demands & location), energy demands and the location of the energy system (with the corresponding weather data) are selected electricity supply is considered (60 EUR/kW el ). The revenue for electricity feed-in is 0.10 EUR/kWh and the number of design days is 12. The optimization focus is 0.1, which means that the optimal solution is a trade-off between optimal costs and CO 2 emissions. In the reference scenario, a CHP unit and gas boiler are enabled.
The optimal design of the energy hub is presented on the result page ( Figure 5). A CHP unit covers almost all electricity demands that are not met by renewables. The CHP unit has 6,394 full load hours. PV collectors show 941 full load hours and wind turbines 1,073 h/a. To increase the flexibility of the CHP unit, a heat storage with a capacity of 2,319 kWh is installed, which equals 50 m 3 . The heat storage is used on a daily basis and has 336 full charging cycles. In addition, a battery is installed (1,000 kWh), which is frequently charged and discharged (>600 full charging cycles per year). The optimized energy system is mostly based on natural gas: 19.6 GWh natural gas is imported from the gas grid, 1.7 GWh is generated by PV, and 2.1 GWh by wind turbines. Also, 0.1 GWh is fed into the electricity grid. The comparison of the optimized energy hub system with the reference system is presented in Figure 6. Compared with the F I G U R E 5 In the result section optimal energy hub, the optimal configuration of the energy hub (rated power and storage capacities) is listed. In this figure, the results of case study 1 are shown F I G U R E 6 In the result section reference scenario, a direct comparison between the performance of the optimized energy system and a reference system is provided reference system with CHP unit, gas boiler, and compression chiller, the optimized energy hub shows cost savings of 29.9%. At the same time, the optimized system causes 21.6% less CO 2 emissions.

| Case study 2: 100% renewable energy supply
The second scenario aims at a 100% renewable energy supply of an island system (location: Easter island, Chile). In this island scenario, a connection to an electricity or gas grid is not available. Instead, large capacities of wind turbines and PV collectors can be installed. Energy can be stored in batteries and in hydrogen storages. The demand of the island is assumed to be 1-MW el electricity and 200-kW hydrogen (for mobility). Heating and cooling demands are not considered. The available technologies for the optimization are PV (<20,000 m 2 ), wind turbines (<5 MW el ), battery (<50 MWh el ), electrolyzer, fuel cell, and hydrogen storage. For the clustering process of demands and weather data, 24 design days are used.
The optimal energy hub design comprises all enabled technologies: The maximum area of 20,000 m 2 (equals 3,600 kW p ) and the maximum wind turbine capacity (5 MW el ) are selected. An electrolyzer with a capacity of 1,059 kW el (2,705 full load hours) and a fuel cell (104 kW el , 858 h/a) are installed. The optimal battery size is 30 MWh and the optimal hydrogen storage capacity is 78 MWh. The hourly state of charge of the battery and hydrogen storage can be downloaded as an Excel™ file on the result page. On the basis of these data, the state of charge of both storages over the course of 1 month (January) is illustrated in Figure 7. The battery is used for balancing daily fluctuations of PV power, whereas the hydrogen storage balances surplus energy over longer periods (weeks and months). As a result, the battery performs 147 full charging cycles and the hydrogen storage performs 18 during 1 year. F I G U R E 7 The illustration of the state of charge of the battery and the hydrogen storage over the course of one month (January) in the 100% renewable energy scenario (case study 2) F I G U R E 8 Photovoltaic and wind power generation in the 100% renewable energy scenario (case study 2) Larger PV and wind power capacities are build than actually needed (39% of the PV generation potential and 29% of the wind power potential are curtailed). However, due to the oversizing of the renewables, energy storages can be sized smaller. This shows that curtailment leads to lower costs as compared with the installation of larger storage capacities. However, this trade-off is not trivial and depends on the time series of solar irradiance and wind speed, cost parameters, and efficiencies. The PV generation and wind power generation are illustrated on the result page, c.f. Figure 8. The typical seasonal course of a location in the southern hemisphere (Chile) can be identified: During summer (November-April), the solar irradiance is higher and the wind speed is lower as compared with winter.

| CONCLUSIONS
In this paper, a novel webtool for designing energy hubs is presented. The tool uses mixed-integer linear programming to select and size an optimal generation and storage configuration to cover heating, cooling, electricity, and hydrogen demands at lowest possible costs. The webtool enables students to learn how renewable energies contribute to CO 2 emission savings as well as the role of energy storage technologies to balance the intermittent generation. In this context, students can study the role of new energy carriers like hydrogen and learn about the potential of sector coupling in multi-energy systems. By varying the weight between different objectives (total annualized costs and CO 2 emissions), students can study the trade-off between costs and environmental impact of an energy supply system. All in all, the webtool can be of great benefit for the learning process of students in energy engineering courses.