RESEARCH OF A MULTIAGENT MODEL OF AN INTEGRATED ENERGY SUPPLY SYSTEM DEVELOPED IN THE ANYLOGIC SOFTWARE ENVIRONMENT

. The main goal of the paper is to develop and study an integrated energy supply system model in the AnyLogic software environment using a multiagent approach. Creating a single integrated system will allow: to implement new functionalities; increase reliability by improving redundancy and faster decision making in normal and emergency situations; determine the most profitable supply route individually for each consumer, based on cost and design features; participate consumers with their own energy sources in the process of energy supply of the system. The multiagent model of the integrated energy supply system was created in the AnyLogic software environment, which uses advanced technologies for modeling complex systems that will allow the most visual and detailed display of the interaction mechanisms of objects in the system and analyze the results. This study describes in detail the resulting multiagent model, its main agents, and their state diagrams. A description and analysis of an experiment conducted using this model is also provided. The results show that the multiagent model of the integrated energy supply system works correctly and performs all the specified functions.


Introduction
Currently, energy worldwide is undergoing a technological paradigm shift, the focus of which is associated with the transition to the implementation of intelligent integrated energy supply systems (IESS). Their creation provides a reduction in operating costs, expanding the scope of services provided, increasing reliability, controllability, security and ensuring the possibility of the participation of an active consumer in the energy supply process [1][2][3]. Such IESS metasystems have already been developed in other countries [4][5]. For their study, it was proposed to apply a multiagent approach. The model developed on its basis allows one to study the mechanisms of functioning and interaction of agents [6][7][8][9]. The principles of building integrated systems and the features of applying the multiagent approach for their study were considered previously [10]. This article presents a multiagent model of an integrated energy supply system developed in the AnyLogic software environment, and also describes an experiment with this model.

AnyLogic software environment features
The AnyLogic software environment is a professional tool of a new generation, which is designed for the development and study of simulation models [11][12].
AnyLogic was developed on the basis of new ideas in the field of information technology, the theory of parallel interacting processes and the theory of hybrid systems [13]. Thanks to these ideas, it is simplified to build complex simulation models, for example, to control systems such as IESS.
The software modeling environment supports the design, development, documentation of the model being developed, computer experiments, optimization of parameters with respect to a certain criterion, which makes it possible to visualize the mechanisms of interaction and communication between agents [14]. When developing a model, elements of visual graphics can be used: state diagrams, signals, events, ports, etc.; synchronous and asynchronous event planning; libraries of active objects [15][16].
When developing a model using the AnyLogic software environment, one can apply concepts and tools from several classical areas of simulation: discrete event simulation, system dynamics, agent modeling [17][18]. In addition, with the further development and complication of the multiagent model of an integrated energy supply system, the AnyLogic software environment will allow you to integrate various approaches in order to obtain an even more complete representation of the interaction of complex technological processes. Therefore, to create a multiagent model of an integrated energy supply system, this software environment was chosen as the most suitable tool for modeling a complex system with many interacting elements.

Development of a multiagent model
Based on the structure of a multiagent integrated energy supply system described in [10], its model was developed in the AnyLogic software environment. The basis of this model is the interaction of agents of two systems (electrical and heating) in order to study the mechanisms of functioning of agents and their coordination.
In Figure 1 shows an enlarged scheme of an integrated energy supply system consisting of two consumers, two power stations, two boiler plants, four power lines and four heat mains, the second consumer has an electric boiler. This scheme allows us to study the behavior patterns of agents and the interaction between them.
The following types of agents were distinguished: • Consumer-agent; • Agent network; • Source-agent; • Networks-agent. According to the developed structure of the multiagent integrated energy supply system (Fig. 2), the consumer-agent forms a load request and sends it to the agent network, in turn, the agent network sends this request to source-agents and networks-agents. Sourceagents and networks-agents interact with each other and with an agent network, and as a result, a solution is formed to fulfill the request.
Next, each agent and their state diagrams are examined in more detail. If an agent can distinguish several states or behaviors that perform various actions when certain events occur, then the behavior of such an object can be described in terms of a state diagram. A state diagram is a state connected by transitions. Transitions can work as a result of its event specified as a condition, for example, it can be the expiration of a given time, receipt of a message according to the state diagram, fulfillment of a given logical condition, etc. [19][20].
The state diagram of the agent of the second consumer, which has an electric boiler, is more complex than that of the agent of the first consumer. This follows from the state diagram shown in Fig. 3.
The consumer-agent forms a request for heating energy (1) and sends it to the agent network (2). A request is sent from it to the consumer's electric boiler about the possibility of generating a given amount of heat or about the absence of heat (3). Based on this request, the data request is compared with the generated heat of the electric boiler (4) and a response is sent to the agent network. If the production of a given amount of heat is possible (5), then the agent of the second consumer receives a price request from the agent network and sends information about the price of heat (6). After this, a response will be received from the agent network with the most suitable supply option for the consumer (7), and there can be two options, either the supply will be from the heating system (boiler plants), or from the electric boiler installed by the consumer. Depending on where the consumer will be supplied with heat, a request for electrical energy will be generated. So, if it will be supplied from boiler plants, the electric load parameter will not change, but if it is supplied from an electric boiler, then the electric load of the boiler will be added to the initial electric load of the consumer.
Having formed a request for electric energy (8), the agent of the second consumer sends it to the agent network (9). After that, it is waiting a response from the agent network, and it can receive one of two messages "Consent" or "Failure". Accordingly, if it receives the first message, it goes into the "Energy_received" state (10) (see Fig. 3), i.e. the request for energy is completed, and then it goes into a waiting state (11). If it receives a second message, then it enters the state "Energy_not_received" (12) (see Fig. 3  for energy has not been completed, and then it goes into a waiting state (13).
The agent of the first consumer has a similar state diagram, only there are no diagram blocks associated with an electric boiler.
The agent network state diagram is shown in fig. 4. After receiving a request from a consumer for energy (1), the network agent sends it to source agents and network agents (2), which are associated with this consumer and can supply him with energy. In turn, the source-agents and network-agents, having received the request, check the necessary conditions and send a response to the agent network about the possibility of their participation in the supply of the consumer. After receiving responses from source-agents and networkagents (3), the agent network checks the necessary restrictions and determines whether the supply to the consumer is possible or not (4). If the supply of the consumer is possible (5), the agent network generates a request for the cost of energy to the source-agents (6), then compares the prices received and selects the most profitable option (7). After that, it sends it consent to the necessary energy sources for energy supply, and the rest refuses and notifies the consumer that his request for energy has been completed (8). After sending a message to the consumer-agent, the agent network goes into the waiting state of requests (9). If supplying the consumer is not possible, then the agent network enters the rejection state of the request (10) and sends a refusal to the consumer (11). And after sending a message to the consumer, it goes into a waiting state of requests (12).
Let us analyze the state diagram of network-agents (power lines and heat mains) (Fig. 5). Consider the first power line as an example. Other network-agents have similar state diagrams; they can vary in throughput, type of energy, and consumer connections with corresponding energy sources.
The power line agent receives a request from the agent network (1) and compares the received parameter (required power) with power line throughput (2), while there can be two options for the development of events.
In the first case, if the power line can pass the specified power, the agent goes into a consent state and sends a message with the "Consent" parameter (3) to the agent network.
After that, the power line agent is waiting a response from the power station agent associated with it. Having received a message (4), it sends back to the power station agent a message with the "Yes" parameter (5), which means that it is ready to deliver energy. At the end, the power line agent can receive one of two messages from the power station agent, if the message "Failure" (6) arrives, then it goes to the waiting state of the request, and energy is not delivered through this power line if the message "Delivery" (7), then it goes into the "Delivery" state (8) (see Fig. 5) and delivers  energy to the consumer, then it goes to the waiting state of the request (9).
In the second case, if the power line cannot miss the specified power, the power line agent goes into a failure state and sends a message to the agent network with the "Refusal" parameter (10). After that, the power line agent is waiting a response from the power station agent associated with it. Having received the message (11), it sends back to the power station agent a message with the parameter "No" (12), which means that power cannot be delivered, and then it goes to the waiting state of the request (13).
The state diagram of source-agents (power stations and boiler plants) is presented in Fig. 6. As an example, take the first power station. The second power station and boiler plants have similar state diagrams, while the type and amount of energy, as well as connections with network-agents, may be different.
Having received a request for electricity (1) redirected by an agent network, the power station agent compares this parameter with its available capacity (2), and two cases of events may occur.
In the first case, the available capacity of the power station is less than declared by the consumer, therefore the power station agent goes into the "Generation_failure" state (3) (see Fig. 6). It sends a message with the "Refusal" parameter to the agent network (4), and also sends a "Failure" message to the power line agents with which it is associated (5). In addition, the power station agent goes into a state of waiting for requests (6).
In the second case, the available capacity of the power station is sufficient to fulfill the request, therefore the power station agent goes into the "Consent_to_generation" state (7) (see Fig. 6) and sends a message with the parameter "Consent" to the agent network and the message "Generation" to the power lines agents with which it is associated. After that, it expects a response from power line agents in the form of one of the following two messages. The first message with the parameter "No" means that power lines cannot miss the required power, then the power station agent goes into the state "Line_failure_received" (8) (see Fig.  6). And it sends a message to the agent network with the "Refusal" parameter (9), and then goes back to the waiting state of requests (10). At the same time, the consumer is not supplied from this power station. The second message with the "Yes" parameter means that the power lines can transmit the necessary power, then the power station agent goes into the "Line_consent_received" state (11) (see Fig. 6) and, after requesting the price of energy from the agent network, sends a corresponding message with the parameter "Price" (12). After that, it expects a response from the agent network, if the power station agent receives a "Failure" response (13), it sends a "Failure" message to the power line agents (14) and goes back to the waiting state of requests (15), while the consumer is not supplied.
Upon receipt of the "Consent" message (16), it goes into the "Generation_consent_received" state (17) (see Fig. 6), sends a "Delivery" message to power line agents, and supplies the consumer with energy. After that, the power station agent goes back to the state of waiting for the requests (18).

Experiment with the multiagent model
The generalized scheme of the IESS is shown in Fig. 1. Both power stations are in good condition and can provide the delivery of available capacity. Electric networks are also in working condition and can pass the necessary electric power, except for the power line No. 1, which is under repair. The first boiler plant is already loaded and will not be able to participate in the energy supply process, and the heat of the second boiler plant is sufficient to fulfill the request only from the first consumer. Heating networks are in working condition and can pass the necessary thermal power. In accordance with the given conditions, we will examine in more detail the entire process of energy supply to consumers (Fig. 7). Consumer-agents forms requests for energy a day in advance, and first, requests for heat were formed: the first consumer forms a request for 200 Gcal/h, the second consumer -100 Gcal/h. Then these requests are sent to the agent network, and it, in turn, redirects the request data to boiler plants, an electric boiler located at the second consumer, and heating networks. Next, a solution is sought through the interaction of heat network agents and heat sources between themselves. As a result of this search, the multiagent model of the integrated system obtained a solution according to which boiler plant No. 2 and heat main No. 3 can provide heat only to the first consumer, and the second consumer will be supplied with heat by an electric boiler located at it, since boiler plant No. 1 does not have necessary heat.
After calculating the heat supply of consumers, the formation of requests for electricity occurs: the first consumer forms a request for 100 MW, and the second consumer forms 186 MW, taking into account the additional load of the electric boiler. Then, the formed requests are sent to the agent network, and it, in turn, redirects them to the agents of two power stations and electric networks. A search for a solution was also carried out through the interaction of agents of electrical networks and power plants. As a result, the multiagent model has received a solution for an integrated system, according to which power supply of the first consumer with electric energy will be provided from power station No. 2 by power line No. 3, since power line No. 1 has been taken out for repairs, as a result of which, power station No. 1 will not be able to participate in power supply to the first consumer, and the power supply of the second consumer will be provided from the power station No. 1 by power line No. 2, as it has a lower cost for electricity than power station No. 2. The total cost of the received option for supplying energy to the first consumer per day amounted to 9840000 rubles, including 3120000 rubles for electricity, 6720000 rubles for heat. The total cost of the received option for power supply of the second consumer per day amounted to 5688000, including 1848000 rubles for electricity. (excluding the cost of energy supply of an electric boiler, which are included in the cost of the heat energy generated by it), heat energy 3840000 rubles.
The experiment shows that all the necessary computational and logical operations have been performed in the model. The power supply of consumers was organized according to the most optimal option, therefore, the logical chains worked out correctly, and the data transmission through the system was carried out correctly, all agents performed the functions assigned to them, and the consumers received the required amount of energy with the given parameters.

Results
To implement a multiagent model of an integrated energy supply system, the AnyLogic software environment is proposed as the most adequate tool using advanced technologies for modeling complex systems. In the AnyLogic software environment, a multiagent model of IESS has been developed. For its implementation, the types of agents are determined and their state diagrams are formed, reflecting the behavior and interaction of the agents among themselves, aimed at energy supply to consumers. The experiment showed that the multiagent model works correctly and all specified conditions are fulfilled, system agents correctly perform the functions assigned to them. Further development and improvement of the model will allow us to simulate real energy supply systems and explore complex technological processes occurring in them.