Research on Optimal Energy Flow Calculation of an Electro-Thermal Coupled System via an Interior-Point Approach

With the contradiction between energy consumption and ecological protection becoming increasingly prominent, it has become a serious issue to study an energy system with high efficiency, low pollution, and strong controllability. The application of the backpressure unit and the peak-shaving electric boiler makes the power grid and the heat grid connected and becomes an electro-thermal coupling system, which can be studied as a representative of the integrated energy system. In this study, to make full use of energy, a power system model considering a large number of distributed energy injections and a multi-source thermal system model are constructed. After the energy flow is solved, the optimization method of the electrothermal coupled system is studied to minimize the fuel consumption and obtain the minimum operating cost. In addition, a more comprehensive algorithm is proposed in this study, and the actual model is used in the fourth section of the article to verify that the algorithm can be practically applied.


INTRODUCTION
The development of the integrated energy system (IES) can make the allocation of resources more rational and optimal, which is a good way to deal with the huge energy consumption and resource depletion in the current era, and it is also a foundation for the complete transformation of the country's energy structure in the future (Moeini-aghtaie et al., 2014). In the traditional energy systems such as power grids and thermal networks, each energy system has an independent operating system, the coupling between them is not tight, and the energy efficiency is low. The coupling between integrated energy systems is tight, the energy utilization rate is high, and the ability to absorb renewable energy is greatly improved (Liu et al., 2016;Sun et al., 2020;Zhang et al., 2022). When the power grid is actually running to calculate the power flow, the forward-backward method and the Newton-Raphson method are mostly used . These two methods have a strong theoretical system in the power grid, and their ideas are also relatively mature. However, when it is applied to an electro-thermal combined system, the solution program becomes complicated, the number of iterations is large, and it is difficult to realize the combination between the various systems. At present, many scholars at home and abroad have proposed energy flow solving methods for integrated energy systems (Jia et al., 2014;Xia et al., 2017;Yu et al., 2021). Liu et al. (2021) have refined the heat network and considered the method of solving the energy flow in the case of heat loss. Guo et al. (2019) constructed a unified energy flow solution method based on energy hubs. Li et al. (2015) have considered the effect of adding energy storage elements to the whole system.
The modeling of each part of the network and the energy flow solution of the electro-thermal coupled system are the basis of the optimal energy flow research. As the most important part of this study, the control variables are not given as the general energy flow calculation but need to be determined through optimization, thus forming a nonlinear programming problem with multiple constraints, and the solution methods are also diverse to simplify the nonlinear programming method represented by the gradient method, and the interior point method is used more. The research on the optimal power flow has been very extensive. Zhang et al. (2019) considered the construction of the heat network model more comprehensively and built a refined energy flow solution model on the basis of the heating system. Jiang and Liang. (2015) considered the characteristics of poor performance in traditional AC-DC hybrid power flow calculation and uses the Gaussian method for an iterative solution to improve the applicability of the entire system. To realize the optimal allocation of energy and reduce energy consumption, this study constructs a simplified integrated energy system model and uses a unified solution method to achieve a fast and accurate solution, simple solution process, high calculation accuracy, and simple programming and does not require too many iterations (Krause et al., 2011;Malley and Kroposki, 2013;Chen et al., 2020). When a large number of PV nodes are injected into the system, the PV nodes can be equivalent to improve the traditional forward and backward generation method. In addition, the interior point method chosen in this study in the process of solving the optimal energy flow does not need to find the initial value in the feasible region, and it will adapt quickly when the system scale increases Wang et al., 2021a;Wang et al., 2021b). In the fourth section of the study, an optimal energy flow calculation model including a distributed power grid and a multi-heat source radiant heat grid is established, and two examples are used to analyze the characteristics of the two solutions proposed.

Power System Model
The running state of the power system is not constant, and a power flow equation can be listed in each state. If the column is written as the node voltage, it can be expressed as follows: ( 1 ) The node power equation of power flow calculation can be expressed as follows: where P G,i and Q G,i are the active and reactive power delivered by the generator into the network; P Load,i and Q Load,i are the load active and reactive power corresponding to the node.

Thermal System Model
The thermodynamic system model is composed of a hydraulic model and a thermodynamic model. According to the hydraulic model of the heat network, the amount of water flowing through the pipeline and the injected water flow at the heat load node can be obtained. The following flow continuity equation is used to express as follows: where A l is the network correlation matrix of the heat load node relative to each pipeline, and m is the water flow vector through the pipe. A thermal model can be used to determine the temperature of each node of the thermal network, including the following equations. Eq. 4 is the equation of node injection heat power, mass flow, and node temperature. Eq. 5 is the relationship between the temperature of the head and tail of the pipeline. Eq. 6 is the equation for the outflow of hot water from the heat source through different heat networks and finally mixed at heat loads.
where ϕ is the node injection heat power vector, ϕ i is the node heat load power vector, ϕ Ei is the node electric boiler injection heat power vector, T il is the temperature of hot water provided by each node, T ol is the temperature of hot water flowing back, T end is the temperature of the hot water as it leaves the pipe, T start is the temperature at which the hot water enters the pipe, T e is the ambient temperature, λ is the coefficient of heat conduction per unit length of the pipeline, d is the transmission distance of the pipeline, μ is the temperature compensation parameter, m out,a is the branch flow of the branch out of the pipeline for the branch a, and T out is the temperature of hot water flowing back to the pipeline at different locations. There is often more than one heat source in a thermal system. Figure 1A is the schematic diagram of the radiant heat system model with multiple heat sources. In this model, two heat sources are used to heat the heat load at the same time. Then, the two heat sources are transformed into two equivalent heat sources shown in Figure 1B to heat the heat load. Therefore, the multi-heat source radiation type heat network is converted into multiple single heat source radiation-type heat networks. The transformation is as follows: m kij m H1 m H1 + . . . + m Hi m ki .
This is rewritten in the matrix form as where, m kij (i = 1, . . . , n, n represents the number of pipes branching from the node, j = 1, . . . , m, m represents the number of heat sources in the heat network) is the corresponding single heat source radiation heat network after conversion. m H i (i = 1, ..., n) is the pipe flow input by the corresponding heat source to the node, and m k i (i = 1, ..., n) is the branch flow before conversion, that is, the multi-heat source radiation type heat network corresponds to the pipeline flow.
where, ϕ l i (i = 1, ..., m, m is the number of heat sources in the heat network) is the equivalent heat load power after the multi-heat source radiation heat network is equivalent to multiple single heat source radiation heat networks, and ϕ l is the equivalent heat before the node thermal load power.

Thermal-Electro Coupled Model
Coupling elements of power systems and thermal systems such as thermoelectric units and heat pumps have the property of generating heat while supplying power. A backpressure unit is a widely used thermoelectric unit, which does not contain a condenser. The exhaust heat in the back pressure unit will be fully utilized, and the thermal efficiency is high. The disadvantage is that the generating capacity of the backpressure unit should be based on heat production, and the regulation sensitivity is not strong. Therefore, the backpressure unit is generally selected as the heat source to play a central role in the thermal system, and the electric boiler is selected to meet the demand for peak shaving. The thermal power and electrical power emitted by the backpressure unit satisfy the following equation: where ζ is the ratio of heat production to electricity production, which is generally a constant value, ϕ BY is the heat power produced by the backpressure unit, and P BY is the electricity generated by the backpressure unit. The equation of thermal power and electrical power emitted by a peak-shaving electric boiler is as follows: where δ is the heat-to-electricity ratio, which is generally a constant value, ϕ EB is the thermal power emitted by the peakshaving electric boiler, and P EB is the electric power generated by the peak-shaving electric boiler.

Calculation Method of the Energy Flow in the Electro-Thermal Coupled System
At present, Newton-Raphson's energy flow solution method is the most widely used. However, the Newton-Raphson method has the shortcomings of strict requirements on the initial value and more iterations. Therefore, this study proposes an improved forward-backward generation method, which improves the drawbacks that the traditional forward-backward generation method cannot deal with PV nodes, and is extended to the radiant thermal system with multiple heat sources, which reduces the number of iterations and the requirement for initial values. The improvement of the thermal system simplifies the model and improves the calculation speed. When distributed energy is added to the grid, PV nodes will become more. But the traditional push-back method cannot handle this. Therefore, it can be improved to allow power flow calculations to continue. Figure 2 shows the flow solution diagram of the improved forward-backward substitution method.
The power loss formula is as follows: where ΔS is power loss, I is the line current, R i , X i are line parameters, and U N is the rated voltage of the line. Next, the voltage drop formula of each line is calculated as follows, where ΔU is the longitudinal component of the voltage drop, Z i , R i , X i are line parameters, ΔP is the active loss, and ΔQ is the reactive loss.
For the PV nodes, if ΔP 0, the following equation is satisfied: where ΔQ is the reactive power loss, and X i is the line parameter.
Since the injection of distributed generation into the distribution network will increase the number of PV nodes in the power system, a large number of PV nodes cannot be calculated by using the forward-backward substitution method. If the initial reactive power value at the power source is set to 0, the PV node can be equivalent to a PQ node first to facilitate subsequent solutions, and the reactive power at the power source is corrected at each iteration to ensure the real-time data. The correction equation is as follows: where γ ∈ (−1, 1) is the calculation step length. Generally γ 0.1, Q i is the reactive power calculated by the PV node, Q ij is the reactive power of all branches and nodes connected to the PV node, P i is the power of the PV node, and X a are line parameters. The fact that whether the voltage of each node satisfies the convergence condition of the following equation is judged. If not, the voltage value is updated before the power flow calculation, and the equation is corrected until the voltage satisfies the convergence condition.
The convergence condition is as follows: where ε is the convergence accuracy, U (k) i is the voltage value obtained by the kth iteration, and U 0 is the initial voltage value.
The aforementioned idea can be extended to the thermal system to be equivalent to the power system. The temperature of the heat network is analogous to the voltage of the power grid, the heat flow is analogous to the current, the heat load node is equivalent to the load, the heat source node is equivalent to the power supply, and the node with known heating temperature is an analogy to the balance node in the power system. Then, according to the coupled part modeling mentioned in 2.3, the sum of thermal power of all equilibrium nodes in the thermal system is transformed into the power of electric load to realize the transformation process of the power flow solution.

Problem Description
One of the main research problems in this study is the construction of the optimal energy flow model for the entire system and the solution method. The purpose of solving the optimal energy flow is to make the entire system run efficiently and to obtain security guarantees at the same time. Adjustment through certain algorithms of the output of each energy unit can achieve the optimal distribution of energy among various systems. When the model is built, the grid is used as the basis. The thermal grid and the grid are connected together through coupling elements at a certain node, and the thermal power of the thermal grid is converted into electrical power and introduced into the grid. To calculate the optimal energy flow, the objective function must be selected first. In this study, the goal is to minimize the operating cost of the entire system. This is a nonlinear programming problem that considers multiple constraints of independent networks and coupled parts. The following assumptions should be made before modeling: 1) The operating conditions of each power source and a heat source are known (if there is a parallel connection between power sources or heat sources, it will not be considered); 2) The output of each power source and heat source are known; 3) The topologies of the heat grid and the grid are known; 4) The node load size is known; 5) The parameters of the overall network are known.
The mathematical model of the optimal energy flow can be expressed as where u is generally an independent variable that can adjust the active and reactive power output of each power supply and the temperature and flow of hot water flowing out of the heat source, and x is generally a variable that follows u, such as the voltage of each node in the power grid and the branch power, the heat network. The temperature of the water flow at each node and the flow of the pipeline at other places are determined; min f(u, x) is the minimum system operating cost in this study, g(u, x) 0 is the power balance equation of the power grid and the heat network, and h(u, x) ≤ 0 is the inequality constraint.

Objective Function
If the objective function is to minimize the operating cost, the corresponding coal consumption should be minimized. The heat source selected in this study is a backpressure unit, and a peakshaving electric boiler is used to assist it, so it can be considered that the objective function established in this study is based on heat production and production. Electricity is a quadratic fitting function of the variable, and the objective function is as follows: where i is the backpressure unit from 1 to n, c 0(i)~c5(i) is the fitting constant, P BY(i) is the electrical power generated by the backpressure unit, and D BY(i) is the thermal power generated by the backpressure unit.

Grid Active and Reactive Power Balance Constraints
The equation constraints of the power grid can be considered as the active and reactive power equations of the power flow calculation, and the balance condition is that the inflow power of each node in the power grid is equal to the sum of the outflow and losses: where N a 1 P BY(a) and N a 1 Q BY(a) are the sum of the active power and reactive power of the backpressure units connected to 1 to N unit, and P a and Q a are the active and reactive power of the node.

Power Balance Constraints of the Heating Network
The power balance constraints of the heating network include the electric power balance of backpressure unit nodes, the thermal power of heat source nodes, the thermal power used by users and the thermal power supplied by electric boilers, and the temperature balance of hot water flowing into pipes.
where ϕ i is the node heat load power vector, ϕ Ei is the node electric boiler injection heat power vector, T il is the temperature of hot water provided by each node, T ol is the temperature of hot water flowing back, T end is the temperature of the hot water as it leaves the pipe, T start is the temperature at which the hot water enters the pipe, T e is the ambient temperature, λ is the coefficient of heat conduction per unit length of the pipeline, d is the transmission distance of the pipeline, and μ is the temperature compensation parameter.

Constraint Conditions of Power Grid Inequality
For all backpressure units, the upper and lower power limits of active and reactive power are met: where P min BY(i) and P max BY(i) are the minimum and maximum active power output of the back pressure unit, and Q min BY(i) and Q max BY(i) are the limit values of the reactive power output of the back pressure unit.
Similarly, all peak-shaving electric boilers also meet the upper and lower power limits of active and reactive power: where P min BE(i) and P max BE(i) are the minimum and maximum active power output of the peak-shaving electric boiler, and Q min BE(i) and Q max BE(i) are the limit values of the reactive power output of the peak-shaving electric boiler.
To meet the stability of power grid operation, it is necessary to restrict the amplitude of the voltage and the phase angle difference of the voltage: where U min a(i) and U max a(i) are the upper and lower limits of the voltage amplitude of the i node, and |θ a(i) − θ a(j) | min and |θ a(i) − θ a(j) | max are the limits of the voltage phase angle difference between the two nodes.

Inequality Constraint Conditions of the Heating Network
If the variables m, T il ,T ol , T end , T start , T e , and D BY(i) of the heating network exceed a certain range, the operation of the whole combined system will become unstable, so the upper and lower limits of these variables should be constrained:

Power Balance Constraint of the Electrothermal Coupling Node
When the backpressure unit is used as the hub of the power grid and the heating network and when the peak-shaving electric boiler assists in regulation, there is the following power balance equation at the junction of the two networks: The aforementioned formula is the conversion relationship between thermal power and electric power of the backpressure unit and electric boiler.

Calculation Method of the Optimal Energy Flow in the Electrothermal Coupling System.
Among many methods for solving optimal energy flow, the nonlinear programming method and interior point method are widely used. Compared with the former, the interior point method has the advantages of fast calculation speed and better convergence. When the system is huge, the calculation amount is not as complex as other methods, and the initial value is not particularly strict. Therefore, the interior point method is selected to solve the optimal energy flow of the whole joint system in this study. The traditional interior point method is always in the feasible region in the iterative process. Therefore, it is often difficult to choose the initial value. However, with the emergence of the central trajectory method, it is not necessary to find the initial value in the feasible region of the established model, and the range has changed greatly than the previous one. It only needs to meet the conditions of relaxation variables and disturbance factors, and the requirements for the initial value are no longer so strict.
At first, the interior point method appeared to calculate the optimal power flow in the power grid. When constructing the objective function, it is not necessary to list the state variables and control variables separately like other power flow models. In the interior point method, these two variables are not distinguished, and they are uniformly represented by x. In addition to the active power, reactive power, voltage amplitude, and phase angle of each node, x in this study also includes the thermal power generated by the heat source in the heating network, the temperature and flow rate of water flowing out to the pipeline, the temperature information of the outlet and inlet of each pipeline, and the water flow rate in the pipeline.
After the aforementioned analysis, the optimal power flow model is simplified as the following formula: where f(x) is the minimum operating cost function described in 3.2, p(x) 0 is the equality constraint, q min ≤ q(x) ≤ q max is the inequality constraint, and x is the set composed of variables P BY , Q BY , P BE , Q BE , U a , θ a , D BY , D BE , m, T il , T ol , T end , and T start . For Equation 28, it is difficult to solve the model. Two relaxation variables m and n can be introduced to transform it into the same equality constraint as p(x) 0: where m and n are relaxation variables, both of which are positive numbers.  If the solution directly according to the aforementioned formula may make the result beyond the feasible range, Eq. 29 can be combined with the objective function to limit the solution result within the determined range, and once it approaches the boundary, the result increases rapidly and returns to the region again.
log m a n a , where υ is the perturbation factor; the perturbation factor is used to eliminate inequality constraints and transform them into equality constraints for subsequent solutions.  For equality constraints, Lagrange functions can be constructed to find the extremum of each variable: where r T [r 1 , r 2 , /, r n ] T , s T [s 1 , s 2 , /, s n ] T , and t T [t 1 , t 2 , /, t n ] T are multipliers introduced in the constructor. The partial derivatives of x, m, n, r, s, and t are obtained by using the Lagrange function, and the nonlinear equations are constructed when the derivative value is zero: where M, N, S, and T are diagonal matrices with a elements, and E is an identity matrix with a elements. Newton's method is used to solve the aforementioned differential equation and simplify it, and the simplified modified equation matrix form is as follows: where the matrices A, B, and C are expressed by the following equations: B According to Eq. 33, a group of solutions closest to the optimal solution can be solved.

Example Verification of the Energy Flow Calculation of the Electrothermal Coupling System
To prove that the aforementioned method can be practically applied, an actual model is used in Figure 3 as an example to conduct experiments.  In this example, the heat grid and the power grid are coupled through the cogeneration unit. The heat network part includes two heat source nodes source 1 and source 2 using a backpressure unit, a peak-shaving electric boiler located at node 5, and 14 heat load nodes. The peak modulation ratio is 0.45, the thermoelectric ratio is 1.4, and the heat load is 0.5 MW. The length of each pipeline is set to 1.58 km, λ is set to 0.289, and the diameter of the pipeline is set to 100 mm. According to the transformation method of the multi-source radiant heat network in Section 2.2, the multi-source radiant heat network is transformed into several single-source radiant heat networks and then the energy flow solution is performed. Table 1 is the heating system pipeline flow, and Table 2 is the temperature at each node in the heat network.
The thermal system and power system are coupled through node 6. The thermal power of node 6 is 1.7347 MW, which is converted to 2.2551 MW. The power grid part selects 14 node distribution networks, node 1 is set to 1.00 pu, node 2 and node 6 are PV nodes, the voltage amplitudes are 0.993 pu and 0.964 pu, and its node is PQ node. According to the flow chart in Figure 2, the 1st and 2nd are set to PQ nodes for the first iterative, and then, the program is returned to calculate the reactive power correction. The reactive power correction is substituted for the next iterative calculation. After three iterations, the convergence criteria are met, and the result is output. The power flow calculation results obtained by this method are compared with those obtained by the traditional Newton-Raphson method of power flow calculation, as shown in Figure 4 which verifies the accuracy of this method.

Example Verification of the Optimal Energy Flow Calculation of the Electrothermal Coupling System
In this chapter, the model of the 14-node grid and 14-node heating network shown in Figure 5 is selected for example verification. Two heat sources S1 and S2 in the heating network are connected with 6 and 11 nodes in the grid, respectively. The parameters of the two heat source nodes of the back pressure unit and heat load nodes in the combined system are set as shown in Table 3.
When setting the objective function, the minimum operating cost is selected as the objective function, and the fitting constant in the objective function is selected in Table 4. After setting the initial values and upper and lower limits of each parameter, the simulation is carried out according to the optimal energy flow calculation method described in Section 3.4, and the running cost of the system is minimized by adjusting the thermal power and electric power of the power supply and heat source. The comparison diagram of pipeline flow calculation results of optimal power flow and general power flow is shown in Figure 6 and Table 5. The comparison diagram of the supply and return temperature of each node is shown in Figure 7 and Table 6.
The node temperature obtained from the optimal power flow calculation is determined by optimizing the control variables, while the control variables in the ordinary power flow are initially given. Therefore, it is more economical to introduce the results of the optimal power flow into the actual operation, and the coal consumption will be lower, thus achieving the purpose of the optimal energy flow calculation.

CONCLUSION
In this study, an improved forward push-back substitution method is proposed for the combined electric and heat system. First, models of individual systems and coupled parts are built, and the calculation model of the electro-thermal combined system is constructed. The improved forward-backward substitution method is used for energy flow calculation to realize the analysis and calculation of the energy flow of the whole combined system. Finally, through the calculation and analysis of the example of the comprehensive energy test system, it is proved that the idea proposed in this study can be practically used. In the part of the study of the optimal energy flow calculation method, the interior point method is used to find the parameters that meet the optimal operation conditions of the system. By comparing the simulation results of energy flow calculation and optimal energy flow calculation, it can be obtained that the interior point method is feasible and economical to calculate the optimal energy flow of the electrothermal combined system.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/supplementary material, further inquiries can be directed to the corresponding author.

AUTHOR CONTRIBUTIONS
ZL was responsible for the main idea, simulation part, and writing work of this study. YZ and JX were responsible for the mathematical derivation. QS participated in the coordination of the study and reviewed the manuscript.