Research Article Flexibility Pricing of Grid-Connected Energy Hubs in the Presence of Uncertain Energy Resources Mousa Hamrahi , Mehrdad Mallaki , Naghi Moaddabi Pirkolachahi , and Najme Cheraghi Shirazi Electrical Engineering Department, Islamic Azad University, Bushehr Branch, Bushehr, Iran Correspondence should be addressed to Mehrdad Mallaki; mallaki@aut.ac.ir Received 16 October 2022; Revised 18 December 2022; Accepted 12 April 2023; Published 24 May 2023 Academic Editor: Luis M. Fernández-Ramírez Copyright © 2023 Mousa Hamrahi et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The paper expresses the problem of exibility pricing in energy hubs (EHs) that are in connection with electricity, heat, and gas networks considering of uncertain energy generation sources. Scheme includes a bilevel formulation. Its upper-level states for modeling of the exibility services are provided by various resources within the EH. The problem considers maximization of the expected prot of these resources in the exibility market. The problem constraints include the exibility model of exible resources such as storage devices, responsive loads, and controllable distributed generations (DGs). The exibility model of resources relies on their active and heat power. The lower-level problem calculates energy and exibility prices and formulates the exible operation of energy resources considering EHs. Here, constraints include optimal power ow equations in the energy networks; operation model of EHs with power sources, storage devices, and dierent responsive loads; and exibility limits of EHs. Also, a linear approximation model is adopted in the suggested design using conventional linearization techniques. Next, the KarushKuhnTucker (KKT) method is used to derive a single-level model for the problem. The scheme adopts scenario-based stochastic programming (SBSP) so that uncertainties of renewable power, energy price, load, and energy consumption of mobile storage devices are properly modeled. Finally, the results validate the suggested designs potential in modifying and enhancing the operation, exibility, and economic situation of energy networks and EHs. 1. Introduction 1.1. Motivation. Demand response programs (DRPs), energy storage systems (ESSs), and distributed generations (DGs) are extensively utilized in the power network, specically in distribution systems, hoping for decrease the amount of pollutant emission [1]. This is in accordance with the deci- sion complexity of the distribution system operator (DSO), because the volume of information in the distribution sys- tem will be signicant. Thus, the smart grid concept recom- mends the use of aggregator frames like energy hub (EH) to coordinate the operation of the abovementioned elements in the power system [2]. The EH considers simultaneous man- agement of several types of energy so that it can improve total energy eciency [3]. Moreover, due to the low opera- tion cost of renewable energy sources (RESs), EH possibly include several RES units. However, the prediction of RES generation power is uncertain as it depends on condition like wind speed and irradiation. Since the prediction of a parameter is always exposed to error, it is expected that the parameter has an uncertain status [1]. Therefore, the pres- ence of RESs in the EH makes the real-time (RT) and day- ahead (DA) scheduling results dierent, and this might lead to imbalance in network operation and the reduced exibil- ity of the EH in the electricity section. Flexibility as described in [4] is the change in generation injection and/or consump- tion paths due to an external price of an activation signal so that a specic service is provided across the system. In other words, while the RT and DA scheduling results of a system dier in the presence of RESs, it is expected that the Hindawi International Journal of Energy Research Volume 2023, Article ID 6798904, 21 pages https://doi.org/10.1155/2023/6798904