Optimal Power Flow Algorithm Based on Second-Order Cone Relaxation Method for Electricity-Gas Integrated Energy Microgrid

Due to the existence of nonlinear constraints, it is diﬃcult to solve the power ﬂow directly. This paper proposes a microgrid optimal scheduling strategy using second-order cone relaxation method to realize linear transformation, so as to minimize the total cost of the microgrid. Firstly, a microgrid system model of electricity-gas integrated energy is established, and the nonlinear constraints of branch power ﬂow are transformed by the second-order cone relaxation method. Then, based on the microgrid model, the application conditions of the second-order cone relaxation transformation method are studied, and the optimal scheduling strategy with the total cost of microgrid as the objective function is proposed. In addition, in the case that the microgrid system does not meet the application conditions of second-order cone programming, the optimization problem is solved by increasing the line loss. Finally, an example is given to verify the eﬀectiveness of the proposed method.


Introduction
In recent years, with the rapid development of the global economy, the energy demand has become larger, which leads to the rapid depletion of fossil fuels and the increasing global environmental pollution [1,2]. As a small system including distributed energy, energy storage system, thermal and electrical load, protection, and monitoring devices, microgrid will play an important role in the future energy network. It can give full play to the economic and environmental benefits of distributed generation and has great social and economic significance. At the same time, it is also of great significance for maintaining system stability, improving the efficiency of energy management and environmental protection [3,4], so the research on microgrid system is increasingly important.
Nowadays, most of the researches focus on the structure and algorithm of microgrid. In the aspect of microgrid structure, it mainly involves the types and coupling relationships of various energy sources in microgrid. Related researches include the establishment of combined cooling heating and power (CCHP) system model based on electricity cooling heating structure [5]. Considering the coupling relationship between wind turbine and photovoltaic, an integrated energy microgrid optimization model is established [6]. In addition, energy storage system plays an important role in energy storage optimization because of its advantages of flexible regulation, so the research on microgrid including energy storage system is also very extensive. In reference [7], an analogue energy storage model is proposed to represent the time-dependency characteristics of energy transfer processes. In reference [8], the microgrid consists a rooftop photovoltaic (PV) system, a battery energy storage system (BESS), an ice-thermal energy storage system (ice-TESS), and loads. On the basis of the above, hydrogen energy, as a clean energy, is more and more widely used in microgrid systems. e integrated energy system dominated by hydrogen energy provides the direction for the future development of integrated energy system [9]. ere are some researches on the optimization algorithm of micro network. e common methods are to minimize the total cost of the system and to solve the problem by using mixed-integer programming method [10]. In order to meet the needs of new energy sources, an approximate dynamic programming algorithm is proposed to better meet the daily scheduling demand of the independent microgrid with the new power generation as the main power source [11]. For specific micro networks, particle swarm optimization and artificial swarm optimization are introduced to solve the problem of optimal scheduling of micro networks [12][13][14]. Nowadays, stochastic optimization technology [15] and bilevel optimization technology [16,17] are more and more common in the selection of optimization algorithm because of their practicability. In addition, the traditional centralized optimization scheduling method is difficult to fully reflect the interest demands of different agents in the integrated energy microgrid, and the application of artificial intelligence technology in integrated energy scheduling needs to be further explored. Artificial intelligence algorithm is becoming a new research direction [18,19]. In the related research, adaptive neural network is introduced in reference [20]. e main contribution of this paper is the design and the validation of an innovative online-trained artificial neural network-based control system for a hybrid microgrid. When modeling microgrid system, because of the existence of nonlinear constrains of microgrid power flow, linear transformation is needed. In the past, the linearization method has been widely used in solving nonlinear optimal scheduling problems due to its advantages of simplicity [21][22][23]. However, these methods still have obvious shortcomings in solving nonlinear models, such as slow solving speed, easy to fall into local optimum, and being unable to guarantee global optimum. ese problems urge researchers to explore more effective solving algorithms to meet the requirements of global optimum and fast solving speed. e second-order cone relaxation method is proposed due to its advantages of high efficiency and comprehensive solution. e second-order cone relaxation method is mostly applied to the linear transformation of power flow constraints in distribution networks [24][25][26]. In order to solve the problem of integrated energy system, an improved second-order cone relaxation method was proposed in reference [27]. A second-order cone programming (SOCP) method is utilized to solve the optimization problem, which is actually a mixedinteger nonconvex and nonlinear programming issue. Reference [28] presents an alternative mixed-integer nonlinear programming formulation of the reactive optimal power flow (ROPF) problem and utilizes a mixed-integer second-order cone programming (MISOCP) based approach to find global optimal solutions of the proposed ROPF problem formulation. e internal grid structure of microgrid is very close to the distribution network in the actual power system, and in the steady-state operation, they are mostly radial network operation [29], so the research results of the second-order cone relaxation method in the distribution network are also applicable to the microgrid system with similar structure. In this paper, the nonlinear power flow constraints in microgrid model are linearly transformed by using the second-order cone relaxation method, and the second-order cone program (SOCP) is obtained. Based on the microgrid model, the application conditions of the second-order cone relaxation method are discussed; at the same time, the problem solving of microgrid model without meeting the application conditions of SOCP is studied, and the method to solve the problem by increasing the line loss is proposed; finally, an example is given to verify the effectiveness and accuracy of the proposed method.

Scheduling Model of Integrated
Energy Microgrid e microgrid model established in this paper is an electricity-gas integrated energy microgrid system considering hydrogen energy, natural gas, and hybrid energy storage, and its structure diagram is shown in Figure 1.

Objective Function.
In this paper, the optimization objective of microgrid system operation is the lowest comprehensive operation cost, which includes system operation cost and environmental cost. From the point of view of the whole microgrid system, hydrogen energy is consumed inside the microgrid system and is not exchanged with the outside. Only electricity and natural gas are exchanged with the outside. erefore, the operation cost of the whole microgrid system consists of electricity exchange cost between the microgrid and the main network and energy exchange cost with natural gas. At the same time, we also hope that the energy loss of the system during energy conversion is as small as possible, so the energy loss penalty cost should be added to the system operation cost to control the energy loss. e time step is set to Δt. e scheduling time is T.

System Operation Cost
(1) Cost and benefit of energy exchange between microgrid and main grid.
In (1), f11 is the cost and benefit of energy exchange between microgrid system and main network, expressed as where C e1 is the time of use price of microgrid purchasing electricity through the main grid, while C e2 is the time of use price of electricity from microgrid to main grid, P E in is the active power of microgrid purchasing power through main grid in t period, and P E out is the active power of the microgrid selling electricity to the main grid in t period.
(2) Energy exchange cost and benefit of microgrid and natural gas network.

Complexity
In (1), f12 is the cost and benefit of purchasing and selling natural gas from the microgrid to the natural gas network, expressed as where C g1 is the purchase price of natural gas, C g2 is the selling price of natural gas, P G in represents the CH4 power purchased by the microgrid from the gas network in t period, P G out represents the CH4 power sold by the microgrid in t period, and H is the high calorific value of natural gas.
(3) Penalty cost of energy loss in system operation.
In (1), f13 is the penalty cost of energy loss in microgrid system operation, expressed as where K Loss is the weight coefficient, which indicates the importance of the system for energy loss Loss , and f MT Loss represent the energy loss of electrolyzer, fuel cell, hydrogen to gas device, and micro gas turbine (MT) in energy conversion.

Environmental Cost.
In order to simplify the treatment, the conversion of various forms of energy in this microgrid system is considered not to produce harmful gases, so the environmental cost is mainly composed of CO 2 emissions. e expression of environmental cost is as follows: where ρ G CO 2 is the average CO 2 emission coefficient per unit power supply of the regional power grid, ρ MT CO 2 is the CO 2 emission coefficient of MT power generation, and ρ CH 4 CO 2 is the CO 2 capture coefficient of CH 4 .

Comprehensive Operation Cost.
Combined with the above mathematical expressions, the objective function of comprehensive operation cost considering economy and environmental protection is as follows: where f max 1 and f max 2 are the maximum operating cost and the maximum environmental cost of the micro network system and ω 1 and ω 2 are the respective weight coefficients of the system operation cost and environmental cost. In this paper, the multiobjective optimization problem is transformed into a single-objective optimization problem by giving different weight coefficients to the system operation cost and environmental cost according to the degree of attention.

Power Flow Constraints of Microgrid.
Because this paper focuses on the application of second-order cone relaxation method in solving microgrid power flow, only the microgrid power flow constraints are listed here, and the constraints in other microgrid systems, such as gas grid power flow constraints, output constraints of various energy conversion devices, and energy storage device constraints, are not discussed here. e basic model of microgrid power flow is as follows: In (7)- (12), branch impedance r ij , x ij , node admittance g j , and b j are constant. Because the internal voltage level of microgrid system is 400 V (as shown in Figure 2), the influence of admittance g j and b j on microgrid power flow is very small. For simple calculation, g j V 2 j and b j V 2 j in (7) can be ignored. Node voltage V, branch current I, branch power flow P-Q, and node injection power p-q are optimization variables, which are obviously nonlinear.
is nonlinear constraint condition will be transformed by the secondorder cone relaxation method in Section 3. Equations (7)-(11) are the common constraint equation of general power flow; equation (12) is the unique constraint condition of each microgrid system, which is determined by its own power load, micro source, and other internal structures of the microgrid.

Second-Order Cone Relaxation Transformation.
In this paper, the nonlinear constraints in this model are linearized by the second-order cone relaxation method, and the nonlinear programming problem of the system is transformed into SOCP. For conversion of equation (9), first define I ij � I 2 ij , V j � V 2 j , and then the secondorder cone relaxation transformation is carried out to obtain and equation (13) can be equivalent to the standard form of second-order cone relaxation expressed by type 2 norm. en, by substituting I ij � I 2 ij and V j � V 2 j into equations (7)-(8), the optimal power flow constraint equation after second-order cone relaxation can be obtained:

Analysis of Second-Order Cone Relaxation
Model. e nonconvex feasible region C original of the original problem is transformed into a convex feasible region C SOC by SOC relaxation. If the optimal solution S obtained by the secondorder cone relaxation transformation model is still a point in C original , then the second-order cone relaxation transformation is strictly effective; that is, the optimal solution S is also the optimal solution of the original problem. e second-order cone in this paper is actually a rotating secondorder cone; the standard form is as follows: Because I ij � I 2 ij , V j � V 2 j , it is obvious that equation (13) satisfies the condition of x 1 , x 2 ≥ 0 in equation (20), and the form is exactly the same. Figure 2 is the structure diagram of microgrid system, which is obviously a radial power network. For the radial power network, the second-order cone relaxation model established is strictly accurate; that is, the optimal solution calculated by the second-order cone relaxation model is also the optimal solution of the original problem. At the same time, if the optimal scheduling objective function of microgrid operation is convex and is a strictly increasing function of branch current, then the second-order cone relaxation transformed model is accurate convergence.
For the microgrid system in this paper, the objective of system optimization cost is the strict increasing function of branch current. e analysis is as follows: under the condition of (13), the node voltage V j in microgrid is basically unchanged due to the constraints of upper and lower limits of voltage (voltage loss is ±5%). e branch current I ij (actually the square of the branch current) can have a wide range of values under the constraints of the upper and lower limits of the current. However, the greater the difference between I ij and the actual value of the branch current, the greater the loss I ij r ij on the branch of the microgrid, so that the power supply needs to provide more active power to meet the active power balance constraints in (15), which leads to the increase of the system cost target. erefore, the cost objective of microgrid system is a strictly increasing function of branch current I ij . In the process of seeking the lowest cost objective of the system, I ij converges to the equal sign of (13) and finally makes I ij equal to the actual value of branch current. erefore, the system model obtained by secondorder cone relaxation for power flow constraints is effective and accurate.

Simulation Analysis
In order to verify the validity and accuracy of the model, a simulation example of the microgrid system is analyzed, and the time step Δt is taken as 1 h, and the scheduling time T is 24 h. e simulation results are based on MATLAB programming. For convenience, Gurobi solver is used to solve the optimization problem. Figure 3. e forecast output of the wind turbine in one day is shown in Figure 4, the TOU price is shown in Figure 5, and the natural gas price is given as 2.5 yuan/m 3 .

Second-Order Cone Transformation Model for Microgrid without Abandoned
Wind. When the wind turbine output is normal, the wind power of microgrid system and the loss of microgrid branch are shown in Figure 6, while the current of microgrid branches L23 and L36 is shown in Figure 7.
It can be seen from Figures 6 and 7 that, in the case without abandoned wind in the microgrid, the microgrid power flow obtained by the model after the second-order cone transformation is completely consistent with the actual value. At this time, the second-order cone transformation method is effective and accurate, and the above conclusion    Complexity that the objective function is the strictly increasing function of branch current I ij is also completely correct. e actual value of branch current in Figure 7 is obtained by equation (21) according to node voltage V and line power flow P-Q checking calculation.

Second-Order Cone Transformation Model for Microgrid with Abandoned
Wind. When the wind turbine output is 1.5 times the normal condition, the wind abandonment appears in the microgrid system. At this time, the power of the abandoned wind and the loss of the branch of the microgrid are shown in Figure 8, while the current of branches L23 and L36 is shown in Figure 9.
When the wind abandonment occurs in the microgrid, the current of each branch calculated by the transformation model is different from the actual value, and the wind abandonment is also different from the actual value. It can be seen from Figure 8 that the abandoned wind volume of microgrid calculated by the second-order cone relaxation transformation model is less than the actual abandoned wind volume, and the difference is large, while it can be seen from Figure 9 that the branch current of microgrid calculated by the second-order cone relaxation transformation  Complexity model is greater than the actual branch current, and the difference is also large. At the same time, the results obtained by the second-order cone relaxation transformation model are very different from the actual value in the periods of 0: 00-7:00 and 23:00-24:00, that is, the period when the microgrid has abandoned wind at night, while in the daytime, when there is no abandoned wind in the microgrid, there is no difference with the actual value, so it is accurate. For this problem, the explanation can be given by analyzing equations (13) and (14).
In the case of no wind abandonment in microgrid, the above conclusion that the objective function is the strictly increasing function of branch current I ij is correct.
However, in the case of wind abandonment in microgrid system, when I ij is greater than the actual value, the loss I ij r ij on the branch of microgrid "increases," and the power output further increases, but at this time, the wind turbine is used as the power supply, e increased branch loss power is compensated by the abandoned wind power. erefore, in the process of solving the optimal cost objective function, this part of "increased" loss power will not increase the system cost, but cause a false appearance of reducing the abandoned wind volume of microgrid system. e final results are shown in Figures 7 and 8; by solving the second-order cone relaxation transformation model, the abandoned wind power of microgrid system  Complexity decreases and the branch current increases. erefore, it can be seen from the above analysis that when the microgrid system has abandoned wind, the system cost target is no longer a strictly increasing function of branch current I ij .

Solving the Deviation Problem of Second-Order Cone
Transformation Model. It can be seen from the above analysis that when the microgrid system abandons the wind, the constraints of equations (13) and (15) are insufficient to make the branch current I ij converge to the actual value, because at this time the objective cost function is no longer a strictly increasing function of I ij .
In the night time with wind abandonment, there is a large deviation between the second-order cone conversion value and the actual value at 0 : 00-7:00 and 23 : 00-24 : 00. e maximum deviation of total line loss is 34.5 kW, the maximum deviation of wind abandonment power is 43 kW, the maximum deviation of branch L12 current is 430 A, and the maximum deviation of branch L36 current is 135 A. ese deviations are obviously not allowed in practical application. In order to solve the above problem, it is necessary to add a strictly increasing function of I ij in the objective cost function, Obviously, the active power loss of microgrid branch is the strict increasing function of I ij , and it is also practical to add the branch loss cost to the objective function. Equation (22) is  the increased cost function of active power loss of microgrid branch: where K Line is the branch loss cost coefficient, which is very small. Its function is to ensure that the objective cost function is a strictly increasing function of the branch current I ij of the microgrid at any time, and it almost does not affect the optimal scheduling of the microgrid system. After adding the branch loss cost function of microgrid into the objective cost function, the optimal scheduling problem of microgrid system is solved again, as shown in Figures 10 and 11. e results show that when the microgrid system has abandoned wind, the solution result of the second-order cone relaxation transformation model is still the actual effective value, which verifies the effectiveness of the method.

Conclusion
is paper mainly studies the application of the secondorder cone relaxation method in solving the optimal power flow of microgrid. rough the second-order cone relaxation method, the nonlinear constraints in microgrid power flow are transformed into the second-order cone programming problem (SOCP), and the application conditions of the second-order cone relaxation method are further discussed. In the microgrid operation optimization scheduling problem, if the microgrid structure is a radial power network and the system cost objective is a strictly increasing function of the branch current of the microgrid, then the microgrid model after second-order cone transformation is accurate and effective. When there is no abandoned wind in the microgrid system, the branch current is a strict increasing function of the system cost objective, and the second-order cone relaxation method is accurate. However, when the microgrid system has abandoned wind, the branch current is no longer the strict increasing function of the optimization objective, and the second-order cone relaxation method is biased. is problem can be solved by increasing the line loss cost function. Simulation results show the effectiveness of this method. Although this method can effectively improve the application scope of second-order cone programming, there are still some problems, such as slow solution speed and complex operation. e next research direction should be to study the improved secondorder cone relaxation method which can solve the problem quickly.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare no conflicts of interest.