Multi-agent software complex for researching the direction of development of the fuel and energy complex taking into account energy security "INTEC-A"

. The article discusses the development of a new version of the INTEC software complex, designed to support research in the areas of development of the fuel and energy complex from the point of view of energy security, called INTEC-A. In the course of direct reengineering of this software complex, a multi-agent approach was used to expand its functionality in the future. In more detail, the article discusses the process of reengineering existing versions of a software package based on the two previous versions. The architecture of the SC "INTEC-A" is presented, the justification of the applied technologies is given. Also SC "INTEC-A" includes a database, the description of which is given. A computational experiment was carried out with energy experts to verify and test the performance of a SF.


Introduction
At the Institute of Energy Systems. L.A. Melentyev, research is being conducted on the directions of development of the fuel and energy complex, taking into account the requirements of energy security [1]. The main research tools are mathematical modeling and computational experiment. The problem of optimizing the balances of fuel and energy resources (FER) for the regions of Russia in the conditions of possible disturbances is solved, which is in the mathematical sense a classical linear programming problem, while using the territorial production model of the fuel and energy complex with blocks of electricity, heat, gas -and coal supply, as well as oil refining -fuel oil supply [2]. The model has a large dimension (172 equations and 553 variables).
To support these studies, software packages and information systems were developed [3], the features of which were determined by the type of computer (BESM-6, ES EVM, SF) and the type of operating systems for the latter.
The software and computing complex "Optimization of the Fuel and Energy Complex" developed on BESM-6 (Voloshin G.N. et al.) For researching the directions of energy development included programs working with databases, programs for generating and maintaining models, programs for obtaining optimal solutions, programs for issuing various tables.
On the basis of the INES DBMS and the "Mathematical Programming PMP-2" package, a software-computing complex (PVC) ENERGY (Antonov GN et al.) Was developed to solve problems of modeling and optimization of energy systems. PVC ENERGY allowed the user to develop models for various problem statements, to store in the database a certain set of variants of initial data and solution results for these problems. Initially, PVK ENERGIYA worked on an ES computer, its next version was implemented on a personal computer.
The continuation of these works was developed under the leadership of L.V. Massel [4].
It should also be noted the work carried out in the same subject area (studies of the directions of development of the fuel and energy complex) at ERI RAS, for example, the STRATEK and MINKOS systems. At ISEM, attempts were made to use the ERI toolkit, but due to the fact that in the studies of ERI RAS the fuel and energy complex is considered more aggregated, this toolkit was not used in the ISEM studies.
Foreign developments in the field of modeling energy systems are grouped into two classes of models: simulation, optimizing the technological structure of energy, and economic, or macroeconomic, in which energy is presented as a sector of the economy as a whole. The representatives of the second class are the developments of the American Department of Energy NEMS, ETA-MACRO. The main representatives of the imitation class models are MARKAL, EFOM, MESSAGE, etc. The use of foreign developments in relation to the research of the Russian fuel and energy complex is impossible, since they are either unavailable (like NEMS) or closed (like EFOM), which makes it difficult to integrate them into software packages. mRhjvt in addition, they do not take into account the specifics of the energy sector in Russia.
Until recently, the ISEM SB RAS used three software packages to study the problem of energy security: INTEC, Oil and Gas of Russia, and CORRECTIVE.
One of the latest developments in the field of software to support research on the directions of development of the fuel and energy complex, taking into account the requirements of energy security -developed under the leadership of L.V. Massel software complex INTEC-M (Fartyshev DA, 2010), which is an improvement and development of the previous version of INTEC [5 -6].
At present, all versions of INTEC are related to legacy software, in connection with which a decision was made to reengineer this software complex.
2 Reengineering a legacy software package 1. Reengineering of the legacy software package The concept of "information systems reengineering" is not well-established. According to [7], reengineering is a systematic transformation of an existing system in order to improve its quality characteristics, the functionality it supports, reduce the cost of its maintenance, the likelihood of significant risks for the customer, and reduce the time it takes to maintain the system.
Legacy systems are systems that, for one reason or another, have ceased to meet the changed needs of applications, which, nevertheless, continue to be used due to the great difficulties that arise when trying to replace them [8].
The reengineering process includes 5 main phases [9]: • Assessment of the possibility of reengineering • Analysis of the solution • Solution development • System implementation • Improvement process 1.1. Reengineering Opportunity Assessment. The goal of reengineering is a software package to support the study of directions for the development of the fuel and energy complex, adapted to the modern information environment. The following set of tasks has been defined for the successful implementation of reengineering: inventory of the legacy system; definition of modern system requirements; architecture formation based on the identified requirements; development of program code; development of a set of tests for approbation of a new version of the software package.
SF INTEC-2002 was developed in the Java programming language. The DISAR system designed to interpret the results of a computational experiment was developed in the Delphi programming language. Both SFs were developed using InterBase DBMS. The multi-agent software package INTEC-M used the following technologies: the JAVA programming language, the FIREBIRD DBMS, the XML data exchange format between agents, and also had a client-server architecture like INTEC-2002 and DISAR.
1.2. Analysis of the solution. In view of the obsolescence of the technologies used in the existing versions of the software complex, the lack of documented program code, the departure from the organization of direct developers, it was decided to develop a new version of SF-INTEC, based on articles and dissertations describing the existing versions of the software complex and the experience of their use.
The list of technologies used for the implementation of the software package includes: programming languages C # and Python; PostgreSQL DBMS; JSON data exchange format between agents. The SF architecture was formed using an agent-service approach. When designing the agent architecture, the MVMM design pattern was chosen.
1.3. Solution development. As a result of the inventory, the following functional requirements were formed for the new version of the software complex, called INTEC-A: formation of technological dictionaries, information models of the fuel and energy complex, research scenarios; presentation of fragments of information models in the form of dynamic cognitive maps; the formation of cognitive maps by transforming fragments of the information model and the results of calculations; optimization of mathematical models; presentation of optimization results in the form of balance tables and cognitive maps.
The following non-functional requirements were also identified: optimization of the model for no more than 5 seconds; separation of the user interface from the logic of the subject area and the computing core.
The following requirements for the user interface are formulated: Russian language support; providing a visual, intuitive presentation of the structure of the posted information, quick and logical transition to the relevant sections of the system; solving user problems in the fastest, simplest and most convenient way possible; targeting users who do not have special technical knowledge and skills in the field of computer technology; ease of development. These requirements are determined on the basis of the joint expert opinion of the Customer and the Contractor for the design of the user interface, must be recorded and confirmed by user testing.
To fulfill the requirement of separating the user interface from the logic of the subject area and the computational core, an agent-service approach was used [10] (Fig. 1).
The agent-service approach is an organic combination of multi-agent and service-oriented approaches. With this approach, the methods are conceptually agents, and from the point of view of implementation, they are software services [10].
In the diagram shown in Fig. The following agents are displayed on the architecture: • Scripting agent. This agent acts as a coordinator agent. It sets various situations and forms individual scenarios by creating and filling technological dictionaries, calls other agents, and provides control over user actions. Dictionaries are used to display models in natural language. The agent partially supports the first stage of preparing the initial data. An agent for forming information models and making adjustments is necessary for convenient work with information models. This agent enables the creation of new models through the use of a graphical user interface. The agent supports the second stage of the computational experiment, that is, the stage of constructing a mathematical model for conducting SE.
• The computing agent supports the third stage of the computational experiment for calculating the mathematical model. The agent's core contains a library for solving a general linear programming problem. The purpose of the agent is to search for the optimal values of the model variables.
• The computation visualization agent is responsible for the visualization of computations. The main task of this agent is the construction of various tabular reports and graphs containing indicators of the results of a computational experiment of interest to the researcher, such as: balances of fuel and energy resources for each district, group of districts and the country as a whole; interdistrict flows of various types of fuel; assessing the efficiency of energy resources and technological methods. The agent supports the fourth stage of the computational experiment, which consists in meaningful interpretation of the computational results.
• Agent -an interpreter of cognitive maps integrates economic, mathematical and cognitive models. The agent will allow the formation and display of economic and mathematical models of the fuel and energy complex in the form of cognitive maps. In [9], an approach to solving the problem of knowledge management is described, which is taken as the basis for the development of an agent.
• Multifunctional PostgreSQL DBMS capable of handling complex queries and supporting massive databases. The DBMS is free and offers many advanced options. Today PostgreSQL is considered the most advanced (free) database management system. When committing a transaction, there is no need to set read locks, which gives better scalability. In fig. 2 shows a fragment of the data model SF «INTEC-A».

Testing of SF "INTEC-A"
In the course of the work, a test model of the Russian fuel and energy complex was used to debug the INTEC-A SF. The application of the SF INTEC-A was considered by the example of imposing disturbances on the basic information model of the fuel and energy complex. For the calculations, scenarios of five critical situations were used. Let's consider one of them. One of the dangerous factors for a reliable fuel and energy supply at the present time is the imbalance of many regional electric power systems. Let us consider a possible Fig. 2 decrease in the capacity of nuclear power plants in the OEES of the Center and the North-West by 80%. Figure 3 shows that in the Northwestern Federal District, there is a need to increase production at IES and reduce the generation of electricity at nuclear power plants. The need for the import of electricity from neighboring federal districts (FD) also increased. Figure 4 shows that in the Central Federal District, there is a need to increase the capacity produced by the IES and to reduce the capacity of the NPP. Also, the flow of electricity with neighboring federal districts will be increased and the export of electricity will be reduced. Figure 5 shows that in the Volga Federal District, the capacities produced by the IES and CHPPs, and the import of electricity will be increased. Figure 6 shows that in the Southern Federal District there will be an increase in the need for electricity generation at the IES, and at the TPP, on the contrary, it will decrease.
In the course of the work, a test model of the Russian fuel and energy complex was used to debug the INTEC-A SF. The application of the SF INTEC-A was considered by the example of imposing disturbances on the basic information model of the fuel and energy complex. To carry out the calculations, scenarios of five critical situations were used, one of which was described in more detail above. For calculations, the following situations were considered: • a decrease in the average outside air temperature during one quarter of the heating season in the European part of Russia by 2 degrees Celsius relative to the longterm average will lead to an increase in the demand for KTP by about 8%; • the possibility of failure of a section of gas trunklines running through the Urals from the West Siberian gas production region (northern line) was considered; • decrease in the supply of heating oil by 10% of its total production during the period under review; • 30% decrease in Ekibastuz coal at power plants in the Ural region by 30% during the quarter; • Decrease in the capacity of nuclear power plants in the OEES of the Center and North-West by 80%.
Here is the interpretation of the results of the calculation on the SF of the first scenario in natural language. In the Northwestern, Central, Volga and Southern Federal Districts, it is necessary to increase the generation of capacities at condensing stations (IES). In the North-West and Central Federal Districts, the import of electricity from neighboring Federal Districts will be increased. In the Central and Southern regions, to increase the export of electricity to the neighboring federal districts. In the Southern Federal District, reduce electricity generation at combined heat and power plants (CHP). In the Siberian Federal District, it is required to reduce the generation of electricity at condensing stations.
According to the obtained balance tables and the description of the result of one of the COPs in natural language, that for clarity of changes in the state of the fuel and energy complex, their graphical presentation is required. In [11], it is proposed to integrate the cognitive map interpreter into INTEC-A to transform the model parameters and calculation results in the form of a set of cognitive maps, in aggregate, which will have quasidynamics.

Conclusion
The paper substantiates the need for reengineering of the software complex for researching the directions of development of the fuel and energy complex, taking into account the requirements of energy security; the results of its execution are shown. The SF allows expanding its functionality without embedding it in the main code by adding new agents.
In the process of reengineering, the following results were obtained: requirements for the new version were formulated; the architecture of the software package is proposed; the composition of technologies for the implementation of SF has been determined; implemented a program code responsible for the functional part of the SF; the user interface is implemented; the SF was tested on a test model of the fuel and energy complex and scenarios of critical situations formed by an expert.
In the future, the development of the user interface and the development of an agent for integrating cognitive and mathematical modeling will be carried out.
This work was executed within the framework of project on state task MESI SB RAS FWEU-2021-0007