Application of a multiagent approach for optimal load distribution between sources in an integrated energy system taking into account the operation of active consumers

. In the context of the energy transition, research on the creation of integrated energy systems and their control is an actual task. They combine a significant share of renewable energy sources, contribute to the overall efficiency of the system, and enable active consumers to participate in the energy supply process. At the same time, in connection with the growing capacity of distributed energy sources, new problems arise related to the operation of distribution networks and difficulties in adapting the operation of active consumers in the centralized energy system. Active consumers can regulate their energy consumption by distributing the load between centralized and distributed energy sources, and as a result, they can provide flexibility, maneuverability in the operation of the system and increase the efficiency of its redundancy. To organize the work of active consumers in an integrated energy system, a multiagent approach is used. This approach is widely used by researchers to solve various practical tasks. Allows us to represent active consumers in the form of agents with an individual behavior algorithm and organize their interaction with the energy system to ensure optimal energy supply. The proposed mathematical model for finding the optimal composition of generating capacity takes into account the structural organization of centralized and distributed energy sources, as well as the participation of active consumers in the process of energy supply. Modeling of an integrated energy system and carrying out a computational experiment based on multiagent technologies are performed in the AnyLogic software environment.


Introduction
A promising direction in the field of energy research is the methodology for the creation and operation of integrated energy systems that combine centralized and distributed energy sources into a single metasystem in order to increase their overall flexibility and efficiency [1][2]. Through technical and socio-economic research as well as practical experience, it can be concluded that the integration and active participation of consumers is critical for smart energy systems. Existing Smart Grid solutions have shown that coordinated control of distributed generation and consumption facilities can help ensure reliable and economical operation of the system [3][4][5][6]. Consumers who are proactive in seeking a great deal and advocating for their interests can benefit from lower energy prices or the opportunity to improve service quality. The paper [7] provides an overview of the required steps and difficulties in developing and implementing user-centered business models, including consideration of the required data, computational methods and psychological aspects of consumer participation. In the study [8], the authors develop a realtime pricing scheme that provides the necessary level of financial incentives for consumers, equitably rewarding desired changes in electricity consumption. The results of the performance evaluation show that the proposed billing scheme affects consumer behavior much more effectively than traditional real-time pricing, surpassing the latter on all common metrics.
To achieve the goals in the tasks set, it is proposed to use a multiagent approach [9][10][11], which has established itself as a promising tool for studying energy systems and is used by many researchers around the world [12][13][14]. A solution in a multiagent system is formed as a result of the interaction of a set of agents that represent objects in the energy system. This interaction makes it possible to find the most optimal option for energy supply to consumers, taking into account the sources of distributed generation. The article [15] proposes a model based on a multiagent system for optimal management of microgrids integrated with renewable energy sources at the distributed generation level. Electricity generation at the distributed generation level consists of many distributed energy sources with different types of loads. The managed microgrid architecture, based on a multiagent approach, is used to improve the adequacy of microgrid management and ensure the delivery of the required power, and also implements intelligent microgrid management at the distributed generation level. In [16], the authors propose a multipurpose renewable energy management scheme to meet the electricity demand of a variety of consumers, in which a multiagent system is used to coordinate and control the generation and consumption of energy. In accordance with the proposed scheme, a multiagent energy grid and energy consumption control system is first built. Subsequently, models are created for renewables, electric vehicles, residential loads and cost functions, and the operating constraints of the microgrid are also shaped. Three optimization models are proposed to minimize the cost of electricity purchased from the main grid and improve its quality. To this end, three criteria are introduced to take into account the agreed interests of consumers in cost savings, environmentally friendly consumption and energy security. To balance these criteria, it is proposed to use the methodology in the form of a coordination strategy.
This paper presents the methodological principles and coordination mechanisms for regulating the operation of active consumers in an integrated energy system using a multiagent approach. Their application is proposed for solving the following tasks:  Development of a mathematical model to find the optimal load distribution between the sources of the centralized system and distributed generation of active consumers.
 Development of a multiagent model of an integrated energy system, taking into account the operation of active consumers.
 Carrying out a computational experiment that takes into account the interaction of active consumers with the centralized energy system and the analysis of the results for obtaining practical recommendations.

The structure of a multiagent system
The structure of a multiagent system, developed to regulate the operation of active consumers in an integrated energy system, is shown in Fig. 1. All objects in the considered integrated energy system are divided into consumers, networks and energy sources. Each object has its own agent that reflects its behavior in the system. The agent has its own characteristics, parameters and restrictions, has the ability to exchange information with other agents. For all active consumers, there is a common regulatory agent (agent-manager of active consumers), which coordinates and interacts active consumers with the centralized energy system.
The interaction of agents in an integrated energy system is carried out through direct and feedback links between them. Agents of active consumers form applications in which they indicate the amount of required energy, data on the produced capacity of own energy sources and the costs of its production are also prepared separately, all this information is sent to the agent-manager of active consumers. In turn, the agentmanager of active consumers exchanges data with the centralized energy system, and as a result of the information received, together with the agents of active consumers, forms a decision on their energy supply. The interaction of agents with each other in the energy system itself, as well as their goals and objectives, are discussed in detail in [17]. It is necessary to find a rational distribution of the load between energy sources so that the costs of energy supply are minimal, taking into account the energy supplied from the centralized energy system. We take into account that in this task a balance must be observed between the total generated and consumed energy (1). ,  limitation of the generated power of energy sources. , It is required to minimize the function of total costs for energy supply to active consumers, which has the following form (4).
where y l C -the unit costs for the transmission of energy through the networks; The task of finding the optimal distribution of the load between the sources of centralized distributed generation with active consumers by its nature is reduced to solving the problem of mixed integer linear programming [18][19].

Multiagent model
Based on the above structure of a multiagent system, a model of an integrated energy system has been developed. This model reflects the interaction of agents of two energy systems (electric and heating). In fig. 2 shows a scheme of an integrated heat and electric system, which includes the following elements of its components: 15 consumers, 8 of which are active consumers (have their own sources of heat and electric energy); 16 electrical cable lines; 33 heat mains; one centralized source of electricity and one centralized source of heat. The presented scheme was prepared on the basis of a real energy supply scheme for one of the urban districts of Irkutsk, which includes ordinary and active consumers with their own energy sources. Within the framework of the developed model, a search for a solution for the optimal energy supply of active consumers is carried out.
A multiagent model of an integrated energy system has been developed in the AnyLogic software environment. In this model, the elements of the heat and electric system are presented in the form of agents and the behaviour of these agents is described in order to study the interaction of active consumers with the energy system. The description of the behaviour of agents in the model is carried out through the formation of state diagrams (Fig. 3). It contains a description of the various agent states, as well as the transitions between these states. The transition from one state to another is carried out as a result of receiving a message, reaching a specified time, fulfilling a specified logical condition, etc. state diagrams of agents of ordinary consumers and agents of active consumers are shown in Fig. 3 and Fig.  4. State diagrams of other agents are discussed in detail in the paper [20].
The agent of an ordinary consumer (Fig. 3) forms a request for heat energy (1) and sends it to the network agent (2). Because the agent does not have active behaviour and does not have its own sources of generation, then in the process of forming a solution, its amount of energy consumed from centralized sources is known in advance. An agent of an ordinary consumer receives a heat supply solution from a network agent and checks the compliance of this solution with his requests (4). Based on this check, it goes either into the state of heat energy received (5) or the state of not received (6). Then, similar actions are performed for the electric supply. An application is formed (6), then it is sent to the network agent (7). A decision on electrical supply comes from the network agent and the consumer agent checks it for compliance with the sent request (8), followed by a transition to one of the possible states: energy received (9) or energy not received (10). Further, the agent of an ordinary consumer returns to state (1) and waits for further requests for the amount of energy it needs.

Fig. 2. Scheme of an integrated energy system
The state diagram of an active consumer (Fig. 4) is more complicated than that of an ordinary consumer, due to the fact that he has the ability to regulate his energy consumption and take an active part in the process of forming a decision on energy supply in an integrated energy system, defending his interests and using his own sources of heat and electrical energy. The calculation of energy supply is carried out in two stages, at the first stage, a solution for heat supply is formed, at the second stage, a solution is sought for electrical supply, taking into account the electric boilers involved. The active consumer agent receives a message from the agentmanager of active consumer and forms a request for heat or electric energy (2). Then the formed requests for heat energy (3) or for electrical energy (4) are sent to the agent-manager of active consumers. After that, a notification is received from the agent-manager of active consumers, which indicates the sources of distributed generation participating in the energy supply (5). The possibility of using these energy sources is checked and the corresponding data is sent to the electric boiler (7) or solar panels (8) located at the consumer. After that, a decision on energy supply comes from the agentmanager, taking into account the preferences of the active consumer (9). In this case, an option may arise when the own energy sources of an active consumer cannot be used for various reasons. In this case, the agent of the active consumer goes into state (10), informs the agent-manager about the impossibility of participating in the energy supply process and sends the corresponding data on the reasons for the failure (11). Next, the active consumer agent returns to the pending state (1) and waits for further requests.

Computational experiment
A practical solution to the posed task of finding the optimal load distribution between the sources of centralized and distributed generation with active consumers using the developed computational tools based on the application of the multiagent approach can be clearly presented for an integrated energy system, the scheme of which is shown in Fig. 2. The parameters of the system objects are set as the initial data: the power of energy sources, the loads of consumers, the transmission capacity of network sections, the cost of energy production, etc. The results of the computational experiment performed in the AnyLogic software environment are shown in Fig. 5 (electrical supply is highlighted in blue, heat supply is highlighted in orange, agents themselves are marked in red). Fig. 6 and Fig. 7 show the data for calculating energy supply to consumers, taking into account the involved capacities of own energy sources of active consumers, respectively, for the heating and electric systems. Based on the criteria for minimizing energy supply costs and reducing energy losses in the network elements, the following results were obtained for heat supply (see Fig.  6), most of the consumers received heat energy from the energy system, with the exception of active consumers No. 1, 5, 10, 11 and 15. Active consumers No. 5 and 10 have completely received heat energy from their electric boilers, because this option is the most profitable for them. Active consumer No. 1 received most of its heat energy from its electric boiler, and the rest of required energy from the centralized energy system. It is more economical for active consumers No. 11 and 15 to receive heat energy from the energy system, but the transmission capacity of heat mains No. 19 and 14 does not allow to fully implement this option of energy supply, therefore they made up for the lack of heat energy from electric boilers, which are more expensive for these active consumers energy sources. The decision on electrical supply is as follows (see Fig. 7), as well as on heat supply, most of the consumers received electricity from the energy system, with the exception of active consumers No. 1, 6, 10, 11, 15. Active consumers No. 6, 10, 15 got electricity from their solar panels, as it is affordable and cheaper. In turn, active consumer No. 1 receives most of the electricity from its solar panels, and replenishes the missing electricity from the energy system. In fig. 7, active consumer No. 11 is highlighted in gray, since its electrical supply, unlike other consumers, is carried out from solar panels of active consumer No. 6, since this option of electrical supply is the most profitable for him.
As a result of the experiment, it can be concluded that the multiagent model of the integrated energy system, due to the interaction of agents and the participation of active consumers in the energy supply process, formed the most optimal solution for distributing the load between distributed generation sources of active consumers, taking into account energy losses in the network elements. Thus, the participation of active consumers in the energy supply process allows reducing the costs of the system, increasing the reliability and flexibility of its operation.

Results
In this paper, the multiagent system structure has been proposed that ensures the coordination of active consumers with the energy system in order to find the most optimal energy supply solution. A mathematical model has been developed to find a rational distribution of the load between the sources of distributed generation of active consumers. Based on the structure of a multiagent system, a multiagent model of an integrated energy system in the AnyLogic software environment is proposed, reflecting the interaction of objects in the system. State diagrams of agents for ordinary consumers and active consumers are considered.   As a result, an optimal solution for energy supply to consumers was obtained, taking into account the interests of active consumers and their capabilities for generating energy. The obtained solution made it possible to minimize the cost of energy supply, reduce losses in network elements and increase the reliability of the system due to the use of energy sources of active consumers.