## 2 Methodology  
### Wastewater Treatment Plant as an Integrated Energy System  
For the representation of processes and configuration of a wastewater treatment plant, we chose Kaunas WWTP, operated by the Kaunas city water management company UAB \"Kauno vandenys\" (Lithuania). Figure 1 shows the technological diagram of the Kaunas wastewater treatment plant, the second largest city in Lithuania. Kaunas city wastewater treatment plant can be considered a typical wastewater treatment plant of a medium-sized European city. The main energy and mass flows, excluding chemicals, are incoming wastewater, treated water, sludge, electricity, heat, natural gas, diesel as a transport fuel, biogas, CO\({}_{2}\), air, exhaust gases from the boiler plant and cogeneration units, and steam.  
Directive (EU) 2024/3019 [5] indicates that WWTPs should achieve the goal of energy neutrality by 2045. To control the achievement of this goal, the WWTP should be considered as an energy system with certain input and output flows. In this way, the technological diagram can be transformed into another form. Figure 2 shows a diagram of the current state of the WWTP as an energy system.  
As stated in [11], the specific electricity consumption in WWTPs of various sizes ranges from 37 to 96 kWh\({}_{\mathrm{el}}\)/PE/a, with an average of 72 kWh\({}_{\mathrm{el}}\)/PE/a. Other papers show that a typical WWTP consumes 0.35-0.8 kWh/m\({}^{3}\) of incoming sewage, depending on the wastewater type, treatment system, plant capacity, and level of energy efficiency efforts [39; 40] in on-site use (for aeration, pumping and heating) and off-site use (transportation and production of chemicals used in the treatment processes) [41].  
Sewage energy content can be up to 9.7 kWh/m\({}^{3}\) (greatest portion of thermal and chemical, and some amount of hydroenergy), while the current recovery in the form of biogas is only 2.7 kWh (for a chemical oxygen demand (COD) of 800-1000 g/m\({}^{3}\)) and even <1.8 kWh (for a COD of 430-500 g/m\({}^{3}\)) [39; 40].  
Figure 1: Technological diagram of Kaunas WWTP (developed by Kaunas WWTP).  
Like in many other cases [42; 43], Kaunas WWTP now has a relatively high negative energy balance. The total energy consumption is slightly above 26 thousand MWh per year, and energy production in the WWTP itself is less than 18 thousand MWh per year. So, the energy deficit is more than 30%.  
Assuming that the integration of green hydrogen production in WWTP will improve this situation, we can make a new extended energy diagram of WWTP as an energy system, which is shown in Figure 3. This diagram introduces additional energy and mass flows--renewable electricity (solar, wind and possibly hydro), biomethane, biogenic CO\({}_{2}\), hydrogen, oxygen, waste heat from the electrolysis process, and recovered sewage heat.  
Figure 3: Energy diagram of Kaunas WWTP with integrated green H\({}_{2}\) production (developed by the authors).  
Figure 2: Energy diagram of Kaunas WWTP. Existing situation (developed by the authors).  
The task of integration of green hydrogen and biomethane technologies while achieving energy neutrality of WWTP has several related dimensions--technical, technological, environmental, economic and legislative [5; 44]. In this article, we will focus on the technical and technological issues that have the most significant impact on energy production and consumption in the wastewater treatment plant itself.