Bi-level Planning Model for Urban Energy Steady State Optimal Configuration

: Background With the rapid development of social economy, energy consumption has continued to grow, and the contradiction between energy supply and demand has become increasingly tense . Cities account for two-thirds of global primary energy demand that makes urban energy systems become a center of sustainable transitions. Methods This paper builds a bi-level planning model for steady state optimal configuration to realize the reasonable planning of the urban energy structure. The first level mainly analyzes the relationship between coal, petroleum, natural gas, and renewable energy when the energy system is in a stable state. Based on the steady-state relationship of multiple energy sources, the second level is mainly aiming at energy allocation of the city, to achieve the minimization of construction and operating costs of the urban energy system, as well as the pollutant emissions. And nonlinear system dynamics and the non-dominated sorting genetic algorithm II (NSGA-II) algorithm are implemented to solve the model. The model studies the interaction between four energy sources to find out the demand of each energy source when the urban energy system is in a stable state. To illustrate the advantage of the method, the application of the planning model proposed in this paper is discussed in the energy system of city J of China. Under the premise of ensuring the stability of the urban energy system, the city J has two energy planning schemes: mainly coal or mainly high-quality energy. The the perspective of actual the urbanization level of city is relatively high, the coal-based energy structure is and may greater environmental pollution. Under the type of high-quality energy development model, city strengthen the adjustment of the industrial structure and the focus is on strengthening the use of and thereby further reducing the traditional


Introduction
Cities account for two-thirds of global primary energy demand that makes urban energy systems become a center of sustainable transitions [1]. Growing demands and technological shifts are changing global energy systems. For example, innovative technologies such as electric vehicles in the transport sector, and new equipment in the buildings sector, are projected to increase electricity demands in city areas. Cooling demands are the fastest growing in buildings, with subsequent extra load on electricity networks [2]. The Paris Climate Agreement added further traction to the growing international clout of cities as potent actors in both climate change mitigation and adaptation interventions [3]. At present, more than 50% of the world's population lives in city areas, and this number is expected to rise to 70% by 2050 [4].
As is shown in Figure 1, the impact of economic activities on cities could be decomposed into scale effect, structure effect and technology effect [5]. Firstly, the increase of economic aggregate is accompanied by more resource input and energy consumption, which also produces more environmental pollutants and has a negative effect on the environment, which is called scale effect. The change of productivity is often accompanied by the optimization of economic structure, which is reflected in the more reasonable allocation of resources and other factors and has a positive effect on the environment, which is the structural effect. Secondly, with the development of economy, the optimization and upgrading of industrial structure is often reflected in the transformation and upgrading of energy-intensive heavy industry, and the vigorous development of service industry including high-tech industry, to promote the sustainable development of cities. Therefore, city areas have the potential to contribute significantly to global CO 2 emissions reductions through careful urban energy systems planning and community participation.

Literature review
The sustainable development of cities faces the triple dilemma of economic growth, energy sustainability and environmental protection. A stable and reliable urban energy supply is essential to support economic growth and environmental protection. Therefore, many scholars have carried out extensive research on urban energy system planning, mainly focusing on three aspects: urban energy demand forecasting, urban energy system evaluation results, and related urban energy system planning technologies. In terms of urban energy forecasting, Yeo I A et al. [9] categorized urban facilities according to energy use characteristics and were modeled to make forecasts of energy demand. Mouzourides P et al. [10] investigated the link between urban form characteristics with the associated urban energy demands for heating and cooling. Rok Hribar et al. [11] implemented and compared different forecast models for residential natural gas demand of an urban area. The model forecasts are based on past temperatures, forecasted temperatures and time variables, which include markers for holidays and other occasional events. In order to improve the accuracy of short-term power load forecasting. Chen Li [12] used a denoising method based on decomposition and reconstruction, and used the multi-objective optimization algorithm (MOGOA) to optimize the parameters of the artificial neural network. Sybil Sharvelle et al. [13] developed and demonstrated the Integrated Urban Water Model (IUWM) for forecasting urban water demand with options to assess effects of water conservation and reuse, and the capacity of IUWM for the assessment of the spatiotemporal variability of water consumption. Regarding the evaluation of the urban energy system, most scholars analyzed from the aspects of reliability, sustainability, and stability. Rui Jing et al. [14] introduced the ecological network analysis (ENA) as a general systematic analysis tool to simulate and assess urban energy supply security. The evaluation included overall sustainability assessment, system property analysis, and structure analysis of energy supply systems. Rui Jing et al.
[15] introduced a generalized system value approach to quantify the contribution of an individual design decision towards improving the system design. It measured the contribution of an individual technology to the whole system in the range between two benchmarks that respectively represent complete exclusion of the technology and the optimal penetration level.
Based on the research results of urban energy demand and urban energy system evaluation, some scholars have also carried out widely research on urban energy system planning technology. Su M et al. [16] proposed a multi-objective optimization model at urban sector scale to achieve sustainable development of energy, economic, and environmental systems, by integrating objectives of minimal energy consumption, energy cost, and environmental impact. To comprehensively measure the environmental objective, the life cycle assessment method was used to calculate the environmental impact caused by various pollutants in the chain of energy production, transportation, and consumption. Xuyue Zheng et al. [17] presented an approach for modeling and optimizing decisions for retrofitting urban energy systems, with a focus on the optimal configuration and operation to satisfy the energy requirements, which was required by supply side and demand side technologies. A mixed integer nonlinear programming model was formulated in GAMS and solved using Lindo optimizer. Chiara Delmastro et al. [18] presented a spatial and temporally resolved urban energy system optimization model with specific features in order to describe the interactions between energy efficiency in buildings and heat supply strategies. Yongli Wang et al [19] established a novel multi-objective optimization model for the design of integrated energy system with electric, thermal and cooling subsystem to simultaneously minimize the economic, technical and environmental objectives. Aiming at the integrated energy system formed by multi-energy coupling, Yongli Wang et al. [20] adopted three investment restraint schemes, simulated the economic operation of the system based on typical daily load characteristic curves in different seasons, and established an optimal capacity allocation model of the integrated energy system, which took into account the investment cost restraint and minimizing the total annual cost and carbon dioxide emissions. L. Yu et al. [21] developed an interval possibilistic-stochastic programming (IPSP) method that can deal with multiple uncertainties existed in the real-world mixed energy system (MES). Then, the IPSP method was applied to planning MES in the City of Qingdao (China) that aims to encourage developing renewable energies based on subsidy policy. Mashael Yazdanie et al. [22] aimed to understand the impacts of different national energy strategies on long-term urban energy systems planning through a case study for the city of Basel in Switzerland. A cost optimization modeling approach was employed 5 and heat and electricity demand sectors were considered.
Due to the lack of a scientific urban energy system planning method, there are still many problems in the planning process. For example, the management of system is fragmented, whose information between energy subsystems is not shared, and the different energy systems focus on solving their own problems, which are lack of integrated optimization solutions for urban energy systems, etc. Therefore, there is an urgent need to carry out related research on the theory and technology of urban energy system and multi-energy comprehensive planning, and establish a method for the steady state optimization of urban energy system. Nonlinear system dynamics is a discipline that studies the variation of state variables of a nonlinear system with time. In 1892, Russian scholar Lyapunov published the paper "General Problems of Motion Stability", giving two methods to analyze the stability of ordinary differential equations. Among them, the first method of Lyapunov analyzes the local stability of the corresponding equilibrium point of the nonlinear system [28]. In Ref [29], the Lyapunov optimization was used to design the general energy management algorithm Energy Hub base station under the condition of unknown Energy Hub process, energy In the urban energy system planning, in order to clarify the advantages and disadvantages of the proposed model, this paper compares the existing typical research results from the aspects of research object, goal, solving algorithm, whether it is bi-level, qualitative analysis or quantitative analysis. The comparison results are shown in Table 1 below. It can be found that there are a lot of studies on urban energy systems and their planning, but there are still some unresolved problems: 1) the existing planning models mostly aim at the lowest system cost, but have less environmental considerations, which is not conducive to urban sustainable development. 2) under the existing urban energy system planning, less consideration is given to the substitution relationship between different forms of energy, which may cause duplication of planning.
Based on these unresolved problems, this article established a Bi-level planning model for urban energy steady state optimal configuration. The main contributions of the paper may be summarized as follows: 1) The concept and structure of urban energy system are put forward, and the bi-level optimization problem of multi-energy comprehensive planning and steady-state configuration of the urban energy system is proposed.
2) A bi-level model was established. The first level is the analysis model of the steady-state relationship of multiple energy sources, and the second level is the steady-state configuration optimization model.
3) The first level mainly analyzes the relationship between coal, petroleum, natural gas, and 6 renewable energy when the energy system is in a stable state. 4) Based on the steady-state relationship of multiple energy sources, the second level mainly focuses on the energy allocation of the urban energy system in a steady state, to achieve the minimization of construction and operating costs of the urban energy system, as well as the pollutant emissions.

Model of bi-level programming
The urban energy system is an integrated system of energy production, processing conversion and transmission allocation, which can realize the coordination and optimization of different energy sources in urban planning, construction, and operation. It mainly consists of three subsystems: energy supply system, energy conversion system and energy consumption system. Figure 2 is a typical structural diagram of an urban energy system.

Fig.2 Typical structure of Urban Energy System
Urban energy system is an important concern for future energy development. The planning and allocation of urban energy is the key to urban economic operation. Aiming at the problem of urban energy steady state optimal configuration, this paper establishes a bi-level programming optimization model with bi-level hierarchical structure. The first level is a four-dimensional urban energy system model based on nonlinear system dynamics, which is used to find the demand for each energy source when the system is in a steady state. The optimization goal of the second level can be described as 8 minimizing the economic cost and the environmental cost of the energy system under various constraints. The bi-level optimization consists of two levels. The output results of the first level model are the input parameters of the second level model, which will affect the optimization results of second level model. Figure 3 is a bi-level optimization logic diagram.

Urban energy system steady state coefficient
Parameter Input Four-dimensional urban energy system model Method

Four-dimensional the urban energy system model of first level
In order to reduce consumption and optimize urban energy structure, based on the competition system, we established a nonlinear model that is dominated by coal and diversifies the development of natural gas, petroleum, and renewable energy (mainly including wind and photovoltaic). The model studies the interaction between the four to find out the demand for each energy source when the urban energy system is in a stable state. The objective function is: under the constraints of each target when the urban energy system is in a stable state. In order to solve the consumption of energy in the urban energy system under steady state, a four-dimensional nonlinear urban energy system model X-Y-Z-R is established as shown in equation (2): The model idea is as follows: indicates that the coal consumption rate in the urban energy system is proportional to the energy gap and the potential gap share 1/ XM  in the current energy system; the input of petroleum and natural gas reduces the demand gap of coal; the utilization of renewable energy will reduce the demand for coal.
indicates that the consumption rate of natural gas to its own gap; 10 the ultimate return from coal can introduce more natural gas or vigorously develop coal-to-gas technology, thereby increasing the consumption of natural gas, so the rate of natural gas consumption is directly proportional to the final return from coal; indicates that when the amount of environmental pollution generated by coal and petroleum in the urban energy system is less than the threshold ( ( ( ) ( )) x t z t N  ), the consumption rate of natural gas decreases with increasing () xt and () zt , but when the amount of environmental pollution generated is greater than the threshold at time ( ( ( ) ( )) x t z t N  ), since the amount of environmental pollution is controlled within the specified range, the consumption rate of natural gas increases with () xt and () zt .
indicates that the consumption rate of petroleum is proportional to its own gap; at the same time, due to the final income generated by coal, more petroleum can be introduced or the coal-to-petroleum technology can be developed to increase the consumption of petroleum. Therefore, the rate of petroleum consumption is directly proportional to the final return from coal.
12 d x d r  indicates that the consumption rate of renewable energy decreases with the increase of () xt , and the consumption rate of renewable energy is proportional to its own gap.

Objective function
The goal of steady-state optimal allocation of urban energy systems is to minimize the economic cost of the energy system and minimize the amount of environmental pollution emissions during the planning period. Therefore, the optimal planning model is proposed to include the economic scheduling model and the environmental scheduling model. 1. Economic model Economic costs consider energy supply costs (energy production, supply, imports) and energy conversion costs (only power generation is considered). The cost of power generation technology is divided into two categories: fuel cost and operation and investment cost. The cost of fuel is mainly the cost of coal, petroleum, and natural gas, which is included in the energy supply cost. The operating investment cost is included in the energy conversion cost. The energy conversion technology mainly refers to the power generation technology. The cost includes the operating costs of the newly built units or equipment, the newly-built units or the equipment investment costs.
Where cost C is the total cost of the urban energy system; s C is the energy supply cost; c C is the energy conversion cost, t is the different period of the planning period; Where e C is the environmental cost; r K is the environmental value of the pollutant; r V is the pollutant discharge; and Z is the penalty cost due to excessive emissions.

Constraint conditions
Considering the factors affecting the urban energy system structure, the constraints of the second phase of the urban energy system include energy supply and demand balance constraints, energy exploitation capacity constraints, technical capacity constraints, energy planning policy constraints, and environmental constraints.
(1) Energy supply and demand balance constraints Consider coal, petroleum, natural gas supply and demand balance constraints and converted energy supply and demand balance constraints: ( , ) ( , ) ( , ) , S n t SM n t XS n t n t is the local production of energy n during the period t; Where , nt  is the upper limit of the production capacity of energy n during the period t.
Where m ax r K is the maximum allowable emissions specified by environmental policy.

Solution of the first level based on nonlinear system dynamics
Nonlinear dynamic equations must express progressive laws. These nonlinear dynamic equations generally use ordinary differentials containing time parameters. Nonlinear dynamic equations typically generally use regular differentials containing time parameters. The comparison or partial differential equation, i.e. the evolution equation, is defined, and the solution of the equation represents the motion of the system (how the state changes with time). The stability of the solution indicates whether the motion of the system is stable or not. Therefore, this article uses the stability of the nonlinear system solution and the Lyapunov theorem to study how urban energy changes over time.
1. Dissipative analysis gets three balance point: And at this time The characteristic equation is 1 3 The characteristic root of 0 J is: can be obtained from its Jacobian matrix.
The characteristic equation is The characteristic roots are 1 1 3 cc The characteristic equation can be obtained as The original formula becomes 32 (

Solution of the second level based on NSGA-II
Multi-objective optimization is usually used as an effective method to find the optimal solution among different objectives. Because these objectives may be nonlinear, contradictory, or unmeasured, the global optimal solution of multiple objectives is usually obtained by the Pareto optimal solution set. Pareto is a compromise solution of different objectives, and decisions can be made according to the Pareto front and requirements of different objectives. It avoids the introduction of transforming the multi-objective problem into a single-objective problem. In this paper, in the second level NSGA-II algorithm is used to solve multi-objective system planning problems in MATLAB 2016b toolbox. In the NSGA-II algorithm, the population number is 800, the iteration number t is 500, the crossover rate is 0.85, and the variation rate is 0.2. As shown in Figure 4, the flow of solving the second level optimization problem based on the NSGA-II multi-objective genetic algorithm can be described as follows.

Parameters
A city in China was selected as the research object in this paper. At the end of 2019, city J had a permanent population of 21.53 million, an urban population of 18.65 million, an urbanization rate of 86.6%, and a permanent migrant population of 7.94 million. In 2019, city J achieved a regional GDP of 353.713 billion yuan, an increase of 6.1% over the previous year at comparable prices. The total retail sales of consumer goods were 1227.01 billion yuan. The urban energy sources are mainly coal, petroleum, natural gas, and renewable energy.
(1) Input parameters of the first level Figure 5 shows the consumption of coal, petroleum, natural gas, and renewable energy in city J during 2003-2019. (2) Input parameters of the second level In addition to the parameters mentioned above, Table 2 shows the forecast value of energy price in urban energy system and Table 3 is the pollutant emissions and environmental cost factors. And estimates that the energy demand of city J in 2020 is 14,400 tons of standard coal.

The first level simulation
(1) Determination of parameters of the nonlinear system 1 a and M (2) Identification and determination of other nonlinear system parameters The other parameters in the four-dimensional nonlinear urban energy system are identified by the Forcal program. After the debugging error reaches 10 -4 , the results of the parameters obtained are as shown in Table 5. As can be seen from Table 4, when 1.8 M  , the fitting coefficient R 2 has the highest degree of fit, so it can be determined that 1 a is 0.0466. And the three-dimensional view of the urban energy system is shown in Figure 6.
a Three-dimensional view of x-y-z b Three-dimensional view of x-y-r c Three-dimensional view of x-z-r d Three-dimensional view of y-z-r Fig. 6 Three-dimensional view of the city energy system It can be seen from Figure 7 that in a short period, the elastic relationship of the energy sources ( ), ( ), ( ), ( ) x t y t z t r t in the urban energy system is relatively stable. As time goes by, the stable state of the system will be destroyed, but the fluctuation range will continue to decrease over time. small.
Over a long period, the elastic inertia of each energy source in the urban energy system shows a relatively stable state: regular fluctuations within a specific range. Figure 7 shows that when 3 0.13 d  , the urban energy system ( ), ( ), ( ), ( ) x t y t z t r t will stabilize after a period.

The second level simulation
The nonlinear system dynamic parameters calculated in the first level are used as the input parameters of the second level of urban energy planning. Since the two objectives of the lowest economic cost and the lowest environmental cost are mutually exclusive, 20 sets of feasible solutions can be obtained. Therefore, when analyzing the relationship between different energy sources and objective values, it is necessary to analyze both economic and environmental costs. The Pareto results is shown in Figure 8.

Fig.8 Pareto results of economic goals and environmental objectives
According to the simulation results of the first level, a feasible solution for the stability of multiple sets of energy combinations is obtained. Still, the difference between the advantages and disadvantages of different feasible solutions is obvious. In the second level the NSGA-II algorithm is used for simulation. The result of the first level is used as the input value of the second level. Under the objective function conditions and various constraints that satisfy the minimum economic cost and environmental cost, the target value is better. The 20 sets of feasible solutions are analyzed for operational conclusions. The specific results are shown in Table 6.

Tab. 6 Second level simulation results
No. Since the optimization variables and the target dimensions are inconsistent, the above feasible solutions are normalized, and the processing results are shown in Figure 9. According to the proportion of coal in the energy structure, the 20 groups of planning results are divided into two categories, as shown in Figure 10. The first category is the energy planning model based on coal. Under this type of development model, coal accounts for more than 50%; the second category It is an energy planning model based on high-quality energy. Under such development models, oil, natural gas, and renewable energy account for more than 50%.

The first type of planning schemes
Under the first planning scheme, the urban energy system mainly uses coal as the primary energy source, with petroleum, natural gas, and renewable energy sources as auxiliary energy sources.
The feasible solution under the first planning scheme is shown in Figure 11.
Although the urban energy system can still maintain a stable state under this planning scheme, if city J chooses this development model, it should try to use clean coal technology and coal to oil to make coal a clean energy source. Simultaneously, city J must make efforts to reduce the proportion of coal in the energy consumption structure through industrial structure transformation and other measures, and continuously reduce the proportion of direct coal consumption in final energy consumption.
For city J, the coal-based energy structure can save economic costs. However, from the perspective of actual demand or ecological environment, the urbanization level of city J is relatively high, and the coal-based energy structure is unreasonable and may cause greater environmental pollution.

The second type of planning schemes
Under the second type of planning schemes, the urban energy system mainly uses natural gas and renewable energy as the main energy supply, and coal and petroleum are the auxiliary supply energy, which are environment-friendly planning schemes. Although the amount of coal planning for the second type of program has increased, at the same time, the amount of planning for oil has been drastically reduced, effectively reducing the level of pollutant emissions, thereby reducing environmental costs. The feasible solution under the second type of planning scheme is shown in Figure 12.
With the development of urbanization, the society's extensive attention to environmental protection, the improvement of people's living standards, and the continuous improvement of the market economy system, the growth momentum of social development for high-quality energy such as natural gas and oil is gradually growing.
Under this type of energy development model, city J should continue to strengthen the adjustment of the industrial structure and optimize and upgrade the urban development path. The focus is on strengthening the use of clean energy and improving energy efficiency, thereby further reducing the demand for traditional fossil energy in the process of economic development.
Secondly, place the construction of urban energy infrastructure in an important position in urban planning and construction. Judging from the development experience of urbanization abroad, the construction of urban energy systems is as important as the construction of roads, transportation, communications, and drainage systems. The urban energy system includes electricity, heat, gas pipe network, transmission and distribution system and management system. The unified planning and construction of the urban energy system must appropriately advance the development of the city.
While avoiding "urban diseases", will further improve the level of urbanization and realize the sustainable development of the city and the energy system. Thirdly, the strategy of "self-production and self-sale of regional energy" can be implemented to transform the efficiency of energy production, transmission, and conversion processes. For example, through the implementation of combined cooling, heating and power, the thermal energy associated with thermal power generation can be directly supplied to users with the shortest flow line, which significantly improves the efficiency of primary energy conversion. In short, urban energy system planning is an important part of the top-level design of urban development, which is closely related to the sustainable development of cities. However, no matter what development mode is adopted, the ultimate goals are to ensure the stability of urban economic development and reduce the emission of pollutants based on the meeting the energy demand. The construction of smart cities not only forms the basis for scientific development but also guides the optimized development of urban energy structure. Through municipal energy assessment and planning, it is essential to consider the development of the urban energy system from the city's overall perspective. Then expect and carefully consider the city's development strategy and development needs.

Conclusion
In order to realize the economic and environmental benefits of the urban energy system, a bi-level planning model for the steady optimal allocation of urban energy is established in this paper. The conclusions are as follows: (1) In order to reduce consumption and optimize urban energy structure, based on the competitive system, a nonlinear model dominated by coal was established to diversify the development of natural gas, petroleum, and renewable energy (mainly including wind energy and solar energy).The model studies the interaction between four energy sources to find out the demand of each energy source when the urban energy system is in a stable state.
(2) An optimal planning model is proposed. The objectives of steady-state optimal allocation of the urban energy system are to minimize the economic cost of the energy system and environmental pollution emissions during the planned period.
(3) Based on the bi-level planning model of the steady-state optimal allocation of urban energy, the energy system of city J is planned and simulated, and corresponding suggestions for the construction of the urban energy system are put forward respectively for the coal-based development schemes and the high-quality energy development schemes.