Considering the pollution of fossil fuels and their environmental effects, especially in the field of global warming; to provide energy, sustainable, non-polluting or very low polluting sources are needed. In this context, renewable resources are proposed as a main candidate. However, the use of renewable generations is faced with issues such as the unpredictable nature (prediction error) and the lack of full control over the generation of these resources. Considering these issues and the need to consider the constraints of the balance of generation and consumption in the power system; in order to use the maximum potential of these resources, it is necessary to create a balance between generation and consumption by increasing the energy flexibility of the power system. One of the available ways to increase the flexibility of the power system is to use a variety of storage devices, which are widely used today, especially in the form of battery storage devices. In the discussion of creating energy flexibility in a long period on an annual or seasonal basis, batteries are not a suitable option due to some characteristics such as self-discharging and reduction of lifespan with increasing charging and discharging frequency. In order to solve this issue, hydrogen is proposed as a long-term / large volume and pollution-free storage that can be stored without the defects of batteries and without the need for special location conditions such as storage pump power plants. Also, due to the flexibility created by using electrolyzers as flexible loads and the co-generation of electricity and heat during hydrogen consumption in fuel cells, there is a great potential for hydrogen storage in systems with various energy carriers.
In this thesis, modeling and improvement of energy flexibility in nearly zero energy districts (nZEDs) will be done with an emphasis on a special type of hydrogen called green hydrogen. Green hydrogen produced using electrolysis process in which the required energy is supplied through renewable resources. Then, in times of generation shortage, energy can be generation by different methods, for example, by injecting stored hydrogen into fuel cells. With the production of hydrogen by electrolyzers, the maximum potential of renewable generation is used in times of low load, and generation curtailments are prevented.