Research on Optimal Scheduling of Multi-Energy Microgrid Based on Stackelberg Game

In recent years, rapid industrialization has driven higher energy demand, depleting fossilfuel reserves and causing excessive emissions. China’s “dual carbon” strategy aims to balance development and sustainability. This study optimizes microgrid efficiency with a tiered carbonpriced economy. A Stackelberg game establishes microgrid-user equilibrium, solved iteratively with a multi-population algorithm (MPGA). Comparative analysis can be obtained without considering demand response scenarios, and the optimization cost of microgrid operation considering price-based demand response scenarios was reduced by 5%; that is 668.95 yuan. In addition, the cost of electricity purchase was decreased by 23.8%, or 778.6 yuan. The model promotes user-driven energy use, elevating economic and system benefits, and therefore, the scheduling expectation of “peak shaving and valley filling” is effectively realized.


Introduction
With the rapid development of modern industry, the contradiction between energy consumption and the environment has become increasingly prominent, and the large emission of greenhouse gases has led to a more severe ecological environment and more serious global warming: according to the BP World Energy Statistical Yearbook 2022 [1], global primary energy consumption in 2021 showed a rebound trend, an increase of nearly 6%. This significantly reversed the sharp decline in energy consumption due to lockdowns in many countries around the world in 2020. Therefore, all countries are seeking energy transformation, and any successful and long-lasting energy transformation cannot be separated from the three elements: safety, burden, and low-carbon. Therefore, countries have formulated corresponding emission reduction targets, focusing on policy incentives and government economic investment as the main body to achieve excessive excess of traditional energy to low-carbon energy. In the daily production and consumption process led by electricity as a high-quality energy source, according to the theoretical guidance of "high energy, high energy, low energy and low-use, temperature-oriented, step use", the three-energy coupling of electricity-heat-gas are explored and improved energy conversion. The new way of rate, especially the utilization of thermal energy, has achieved results in the energy terminal. As a large country of energy use, China strives to achieve carbon peaks by 2030 and achieve carbon neutralization by 2060 [2]. In order to achieve the ambitions and commitments of decarburization and achieve promise, China must establish a relatively sound energy system, with the development of clean energy as the guide, and take the first step in the transformation of China's energy industry structure [3].
In recent years, many scholars have conducted a lot of research on the optimization of the comprehensive energy system. Zhou Nan and others introduced the time-sharing pricing strategy into the optimization scheduling of energy storage to maximize the annual in the scheduling for the goal, and to obtain a balanced solution, micro-network response strategies through price demand can guide users to participate in micro-network scheduling can achieve energy transition. As the main body of energy use, the spontaneous use of the electricity price incentive signal transfer period or cut load based on the spontaneous operator's electricity price incentive signal can be used to achieve the goal of peak-cutting the valley of the load of the microblog. Therefore, this article proposes a multi-energy microfinance low-carbon tone considering the main game, and the establishment of the overall micro-power grid.
This article does the following:

1.
A low-carbon economic optimization model of microgrid with tiered carbon price was constructed. The carbon emissions involved in the operation of each equipment are finally traded through the carbon trading market, and the sensitivity analysis of the system is carried out by adjusting the ladder carbon trading parameters.

2.
A Stackelberg game model with microgrid as the main body of the game and user response as the follower of the game was established, which further improved the level of load participation in the energy system and proved the existence of equilibrium solutions in the game. The model is iteratively solved by a variety of group algorithms, and immigration operators and artificial selection operators are added to the traditional genetic algorithm to prevent all individuals in the population from tending to the same state and stop evolution, and at the same time increase the memory population and improve the model calculation efficiency.

Stepped Carbon Trading Model
Carbon emission quota trading can limit the amount of carbon emissions according to specific emission industries. At the same time, the real-time price of the carbon market is determined by the carbon trading market, and the carbon emission quota is managed in a reasonable and efficient way [13].

Calculation Model of Carbon Emissions
The main carbon sources in microgrid are power consumption process, heat generation and power generation process of cogeneration unit, gas-fired boiler, and coal-fired unit. Because the coal-fired units are equipped with carbon capture power plants, it can help the microgrid consume part of CO 2 . Therefore, when calculating the actual carbon emissions, the CO 2 absorbed by the carbon capture equipment needs to be removed. The total carbon emission model of microgrid is shown in Formula (1), and the total amount of gas purchased is shown in Formula (2).
P g,buy = P g,CHP + P g,GB P e,buy , P g,buy are purchase electricity and gas, λ e , λ g are carbon emission coefficients of electricity-consuming equipment and gas-consuming equipment, Q PGU CO 2 is emissions for coal-fired power plants CO 2 quantity, and Q CCS CO 2 is the amount of carbon capture equipment CO 2 .

Carbon Decentralization Quota Model
The initial allocation of carbon emission rights in this paper mainly includes electricity purchase quota, cogeneration unit quota, gas boiler quota, and coal-fired power plant quota. The carbon emission quota model for power purchase in microgrid is shown in Processes 2023, 11, 2820 4 of 26 Formula (3), and the model synthesis of cogeneration unit, gas boiler, and coal-fired power plant is shown in Formula (4).
ε e , ε x are carbon emission quotas for unit electric power and unit power consumed by different equipment.

Stepped Carbon Trading Model
Based on the above carbon emission model and carbon emission rights allocation model, a ladder carbon trading model is established, and a plurality of carbon emission rights purchase intervals are set in the ladder carbon trading mechanism. The initial carbon emission quota allocated by the system is removed from the total carbon emission, and the mathematical Formula is shown in Formula (5). At the same time, pricing with different gradients is carried out according to the net carbon emission of the system in different charging intervals, when the net carbon emission is less than a given interval length. In the internal time, only the transaction amount at the base price of carbon trading is paid. When the price is higher than a given interval length, the price in each step interval is fixed. Every step increase, the carbon trading price increases exponentially, the carbon emission right purchase ratio increases, and the corresponding price will also increase. According to this trading model, the mathematical model Formula of ladder carbon trading as shown in Formula (6) is obtained.
C CO 2 is carbon transaction costs, E is carbon emission of the system, i is equipment selection, including cogeneration units, gas-fired boilers and coal-fired power plants, N is the total number of device, λ is the price growth rate, l is the interval length, c is the base price of carbon trading.

Microgrid Low-Carbon Economic Optimization Model with Step Carbon Price
Based on the established carbon trading mechanism, a low-carbon optimization model of microgrid with ladder carbon trading mechanism is proposed. The model considers the lowest comprehensive operating cost of the whole microgrid from the economic level, implements the initial carbon emission quota form from the environmental level, and comprehensively considers the operating cost, system power consumption cost, gas consumption cost, and carbon trading cost of the whole system exceeding the carbon emission quota. The electric balance, thermal balance, gas balance and hydrogen balance in the overall operation of the system are taken as equality constraints, and the climbing constraints and output upper limit constraints of each device are taken as inequality constraints, so as to improve the economy and low carbon of the microgrid [14].

Objective Function
The overall objective function of microgrid not only minimizes the fuel cost and the cost of purchasing electricity and gas, but also supplements the environmental problems according to the carbon trading mechanism. Among them, the carbon transaction cost is the ladder carbon price cost considering exceeding the carbon emission quota. On the premise of ensuring the safety and reliability of the whole microgrid system, the environmental Processes 2023, 11, 2820 5 of 26 factors are quantified, and the output degree of each micro-source is optimized according to the load change, so as to obtain the minimum comprehensive cost of the system. minF = min T ∑ t=1 C PGU + C e, buy + C g, buy + C CO 2 (7) F is the minimum operate cost of the system, C PGU is fuel costs, C e, buy is the cost of electricity purchase, C g, buy is gas purchase cost, and C CO 2 is carbon transaction costs. a.
Fuel cost Energy purchase cost C e, buy + C g, buy = c e∑ T t=1 P e, buy + c g∑ T t=1 P g, buy P e, buy is the total power consumption of the system, P g, buy is the total gas consumption of the system, c e is real-time electricity prices, c g is real-time gas price, and T takes 24 h.

System Operation Constraints
According to the law of conservation of energy, when the microgrid is running as a whole, the output energy of each form should always be equal to the input energy of each form to maintain the system operation. At the same time, the output energy of each equipment is kept within the rated power and cannot exceed the specified maximum output, so the related mathematical Formulas of balance constraint and imbalance constraint in the system are integrated, respectively.
The equality constraints are as follows: a. Electric power balance On the premise of ignoring the network loss, the discharge of wind power, cogeneration units, and power storage equipment, the purchase of electricity from the superior power grid and the overall output of hydrogen fuel cells are equal to the sum of the electric power consumed by the electric load and the charging of power storage equipment, as shown in Formula (10). P WT (t) + P CHP (t) + P SB, dis (t) + P e, buy (t) + P HFC, e (t) = P load (t) + P SB, chr (t) (10) P WT (t) is output power for wind energy, P CHP (t) is output power for electric energy of cogeneration unit, P SB, dis (t) is the discharge power for electric storage device, P HFC, e (t) is electricity production of hydrogen fuel cell, P load (t) is the electrical load, and P SB, chr (t) is charging the power storage equipment.

b.
Thermal power balance The input heat of the system is equal to the output heat; that is, the sum of the exothermic power of cogeneration unit, gas boiler, and heat storage equipment is equal to the thermal power consumed by heat storage equipment and heat load.
H CHP (t) the thermal energy output power of the cogeneration unit, H GB (t) is the heat generation of gas boilers, H TS, dis (t) is released for the heat storage device, H TS, chr (t) is the heat release of heat storage equipment, and H Load (t) is the heat load. c.
Natural gas power balance Similarly, the output of natural gas is equal to the input, that is, the sum of gas purchase, gas storage tank, gas release, and gas conversion technology output is equal to the gas load, gas storage tank, gas storage, cogeneration unit, and gas boiler gas consumption.
G buy (t) is the amount of gas purchased, G ES, dis (t) is the amount of gas vented by the gas receiver, G MR (t) is the amount of CH 4 dioxide produced by methanation of electricityto-gas technology, G load is gas load, G ES, chr (t) is the gas storage capacity of the gas storage equipment, G CHP (t) is the air consumption of the cogeneration unit, and G GB (t) is the amount of natural gas consumed by the gas boiler unit.

d. Hydrogen power balance
Because the two steps of electro-gas conversion technology in microgrid are modeled separately and equipped with hydrogen storage tank and hydrogen fuel cell, hydrogen energy balance is added. P EL, H 2 (t) + P HS, dis (t) = P H 2 , MR (t) + P H 2 , HFC (t) + P HS, chr (t) (13) P EL, H 2 (t) is the hydrogen production capacity of the electrolytic cell in the first step of converting electricity to gas, P HS, dis (t) is the hydrogen storage capacity of the hydrogen storage device, P H 2 , MR is the hydrogen consumption of methanation reaction, P H 2 , HFC is the hydrogen consumption of the hydrogen fuel cell, P HS, chr (t) is amount of hydrogen released for hydrogen storage equipment.
Inequality constraints are as follows: a.

Coal-fired units
During the operation of coal-fired units, it is necessary to ensure that the output is within the allowable range, that is, to ensure the output constraint. P min PGU ≤ P PGU ≤ P max PGU (14) P max PGU and P min PGU are the upper and lower limits of the output of coal-fired units. The output adjustment of coal-fired units should be within the allowable range, that is, climbing constraint.
∆P max PGU is the maximum upward climb power of the coal-fired unit, ∆P min PGU is the maximum downward climb power of the coal-fired unit, ∆P PGU is the amount of power change, P PGU (t) is the power of the coal-fired unit at the time of t, P PGU (t − 1) is the power of the coal-fired unit at the time of t − 1.

b. Cogeneration unit
Because the cogeneration unit meets both the electric load and the heat load, it needs to meet both the electric output constraint and the heat output constraint.  Climbing constraints are shown in Formulas (19) and (20).
∆P convert, e = P convert, e (t) − P convert, e (t − 1) ∆P max convert, e is the maximum upward climb power of that cogeneration unit, ∆P min convert, e is the maximum downward climb power of the cogeneration unit, ∆P convert, e is the amount of power change under the pure condensation condition, P convert, e (t) is the electrical power of the cogeneration unit after the t time conversion, P convert, e (t − 1) is the electrical power of the cogeneration unit after the t − 1 time conversion. c.

Electro-gas conversion technology
The electrolyzer and methanation reaction should meet the hydrogen production output constraint and the CH 4 output constraint, respectively.
P max EL, H 2 and P min EL, H 2 are the upper and lower limits of hydrogen production by the electrolyzer, G max MR and G min MR are the upper and lower limits of the CH 4 quantity obtained by the reaction.
∆P max EL, H 2 and ∆G max MR is the maximum upward climb power of that electrolytic cell and methanation reaction, ∆P min EL, H 2 and ∆G min MR are the electrolyzer and methanation reaction large downward climb power, ∆P EL, H 2 and ∆G MR are the amount of power change, P EL, H 2 (t) and G MR (t) are the power of the electrolyzer and methanation reaction at the time of t, P EL, H 2 (t − 1) and G MR (t − 1) are the power of the electrolyzer and methanation reaction at the time of t − 1.

d. Gas-fired boiler unit
The output constraint and climbing constraint of gas-fired boilers are similar to those of coal-fired units, as shown in Formulas (27)- (29).
H max GB and H min GB are the upper and lower limits of gas boiler output, ∆H min GB is the maximum upward climbing power of the gas boiler, ∆H min GB is the maximum downward climbing power of the gas boiler, ∆H GB is the amount of power change, H GB (t) is the gas boiler power at the time of t, H GB (t − 1) is the gas boiler power at the time of t.

e.
Hydrogen fuel cell ∆P HFC, e = P HFC, e (t) − P HFC, e (t − 1) (32) P max HFC, e and P min HFC, e are the upper and lower limits of hydrogen fuel cell output, ∆P max HFC, e is the maximum upward climb power of the hydrogen fuel cell, ∆P min HFC, e is the minimum upward climb power of the hydrogen fuel cell, ∆P HFC, e is the amount of power change, P HFC, e (t) is the hydrogen fuel cell power at the time of t, P HFC, e (t − 1) is the hydrogen fuel cell power at the time of t − 1.

Game Theory Basis
Gaming theory refers to the influence of the individual income of each participant in the case of the interdependence and interdependence of the participants. Therefore, because the income of all parties in the game receives the influence of multiple parties, each participant is considered to make rational judgments. Through the information obtained by themselves, they will give their strategies in real time to the overall feedback. The complete game consists of three basic elements:

Participants
Participants refer to the subjects that can Formulate strategies and make rational judgments in the overall game. Among them, the collection mathematics represents the participants (33).

Strategy Set
Strategy is an important factor in the overall game. Participants have changed different strategies by collecting information, that is, the methods and means of maximizing their own interests to achieve their own interests. The number of strategies can be selected by themselves. Because the game is the mutual impact of the main body Formulation strategy, the sequence of the strategy Formulation has a huge impact on the results of the game. Among them, all participants Formulated the strategy collection mathematics indication (34).

Effectiveness
The effect refers to the benefits that the participating entities of each game are after the game. Among them, benefits can be positive income or negative benefits, that is, the maximum benefits to obtain. The goal of the participants is to maximize the benefit by adjusting the strategy, and the benefit collection mathematical representation of the participants is shown in the math indication (35).
After determining the basic three elements of the game, the establishment of a complete game is completed.

Stackelberg Game
Because the microgrid and the user side consider the price-based demand response, that is, there is no relevant agreement between the participants, users spontaneously change Processes 2023, 11, 2820 9 of 26 their energy consumption habits. Participants constantly adjust their own strategies to maximize their own interests during the scheduling process. There is still an obvious decision-making sequence between the microgrid and the client, with the microgrid acting first as the leader and the client following up as the follower. Among them, the leader first makes the appropriate decision, occupying the position of priority decision, and the follower makes the decision after receiving the signal from the leader. That is, microgrid is the leader to adjust the real-time price of distribution network, and the client is the follower to respond to the real-time price proposed by microgrid. This game type is called Stackelberg game. Stackelberg game is divided into dynamic non-cooperative game, also known as Stackelberg game. The model problems solved by the Stackelberg game mainly have the following characteristics [15]: (1) There is no agreement among the participants, and they make their own decisions. The mathematical definition model of Stackelberg game is as follows: Let the leader's strategy set is X, the follower's strategy set is Y, the leader's utility function is f : X × Y → R , the utility function of the follower is g : As a dynamic game, leaders send out decision signals x n ∈ X, followers make decisions according to the leader's strategy, and the set of followers' balance points is A(x). Therefore, the mechanism mapping is generated: X → A(Y) . When the next leader makes a decision, in order to maximize their own interests at all times, they will consider the follower scheme, and the overall game optimization goal is max f (x, y). Let (x * , y * ) be the equilibrium point of the game, then the equilibrium condition is shown in Formula (4) [16].

The Demand Response Type
For the classification of electric energy demand response, the response method is mainly used as a differentiation method, both of which require a contract with the energy supply company, one is the price-based demand response, including time-of-use electricity price, real-time electricity price and peak electricity price. Compared with the incentive type, the price type has a lower degree of change in the user's energy habits, and only needs to make voluntary adjustments to the price signal. The incentive-type response is to adjust the energy-using behavior strictly according to the load reduction calculation method and response time signed in the contract, and carry out the corresponding compensation mechanism for the adjusted energy-using behavior or impose corresponding fines for the part that does not meet the response requirements. Compared with the two corresponding methods, the current user acceptance of price-based demand response is higher, and the project implementation scope is wider, and this paper mainly studies price-based electricity price in the subsequent microgrid-user game stage.
The relationship model between electricity and electricity price is mainly divided into: electricity price elasticity matrix, user psychology model, exponential function fitting model, and statistical principle model [17]. Among them, the elasticity matrix of electricity and electricity prices is described as the change in electricity demand caused by the change in electricity price, and the elastic coefficient of electricity price is defined, and the calculation Formula is shown in Formula (37).
In the Formula, ∆P e is the amount of electricity increase, and ∆C e is the increase in electricity price.
The electricity price response mechanism is divided into single period and multiperiod, that is, fixed ladder electricity price and real-time electricity price, due to the peak and valley hours and price of the ladder electricity price is fixed, users will only change energy demand in a certain period, and real-time electricity price will prompt users to change energy consumption behavior according to different time periods. Therefore, a multi-period response mechanism is introduced, in which the multi-period elasticity coefficient is divided into the self-elasticity coefficient of the user response in the current period and the cross-elasticity coefficient of the user response behavior in other periods, and the mathematical model of the self-elasticity coefficient and cross-elasticity coefficient obtained according to the above definition is shown in Formulas (38) and (39).
In the Formula, ε ii is the self-elastic coefficient and ε ij is the cross-elastic coefficient. i is the ith dispatch period and j is the jth dispatch period.
According to the definition of the above elasticity coefficient and the mathematical model, the user price response model of the overall period is obtained as shown in Formula (40) and the electricity price elasticity matrix as shown in Formula (41) ∆C n is the change in electricity price at n moments after the demand response, ∆P n is the load change at n times after the demand response, P n is the load before the n time response.

Microgrid-User Stackelberg Game Structure
As the leader in the Stackelberg game, microgrids generate revenue by developing pricing strategies different from those of distribution networks, selling electricity to users at different energy purchase prices [18,19]. Users, as followers in the Stackelberg game relationship, formulate a decision plan to reduce the cost of electricity purchase, that is, increase the amount of load transfer to reduce the cost of electricity purchase, and achieve the maximization of the follower's benefits, that is, the maximum value of the follower's objective function, as shown in Formula (51). Then, the scheme obtained by changing the load transfer amount is transmitted to the microgrid, which makes the next optimal decision based on the user's response results. At this point, the output plan of the microgrid may not match the user's demand, thereby reducing the maximum profit of the microgrid. Therefore, at this point, the microgrid will redesign its output plan and energy prices to achieve the highest return on the microgrid, which is the maximum value of the leader's objective function, as shown in Formula (42). The Stackelberg game structure of microgrids is shown in Figure 1. that is, increase the amount of load transfer to reduce the cost of electricity purchase, and achieve the maximization of the follower's benefits, that is, the maximum value of the follower's objective function, as shown in Formula (51). Then, the scheme obtained by changing the load transfer amount is transmitted to the microgrid, which makes the next optimal decision based on the user's response results. At this point, the output plan of the microgrid may not match the user's demand, thereby reducing the maximum profit of the microgrid. Therefore, at this point, the microgrid will redesign its output plan and energy prices to achieve the highest return on the microgrid, which is the maximum value of the leader's objective function, as shown in Formula (42). The Stackelberg game structure of microgrids is shown in Figure 1.

Microgrid Revenue Model
As the leader in the game, microgrid should achieve the optimal scheduling strategy of microgrid operation as a whole [20,21], set the price of electricity sales within 24 h in combination with the load change given by the user, realize the highest income, and construct the optimal operation income scheduling model of components of microgrid as a whole.

Objective Function
S is the minimum operating cost of the system in the game model,

Microgrid Revenue Model
As the leader in the game, microgrid should achieve the optimal scheduling strategy of microgrid operation as a whole [20,21], set the price of electricity sales within 24 h in combination with the load change given by the user, realize the highest income, and construct the optimal operation income scheduling model of components of microgrid as a whole.

Objective Function
S is the minimum operating cost of the system in the game model, C es, buy is the cost of purchasing electricity from the superior power grid in the game model, C eu, sell is the electricity price income sold by microgrid to users, C gs, buy is the cost of buying gas, C CO 2 , s is that transaction cost of carbon in the game model, e es, buy is the unit price of selling electricity for the distribution network, e eu, sell is the amount of electricity purchased for the microgrid, P es, buy is the electricity purchased by the user sold by the microgrid, P user is the amount of power after the user responds.
C es, buy = e es, buy P es, buy C eu, sell = e eu, sell P user (44)

Constraints
Due to the introduction of the demand response mechanism, the upper and lower limits of the microgrid's power purchase from the distribution network and the upper and lower limits of the microgrid's selling price to users are increased, in which the power balance is shown in Formula (47). Thermal power balance, natural gas power balance, and hydrogen power balance are shown in the Formulas (12)- (14). The operating models, contribution models, and climbing models of thermoelectric units are as follows (17)- (20). The two-stage operation model, the power model, and the climbing model of the electrical rotation technology are as follows (21)- (26). The power boiler crew and the climbing models are shown in the Formulas (27)-(29), respectively. Hydrogen fuel cell operation models, contribution models, and climbing models are shown in the Formulas (30) P min es, buy and P max es, buy are the upper and lower limits of the amount of electricity that the microgrid purchases from the distribution network, e max eu, sell and e min eu, sell are the upper and lower limits of electricity price sold by microgrid to users. P WT (t) + P CHP (t) + P SB, dis (t) + P e, buy (t) + P HFC, e = P user (t) + P SB, chr (t) P WT (t) is output power for wind energy, P CHP (t) is output power for electric energy of cogeneration unit, P SB, dis (t) is discharge power for that electric storage device, P HFC, e (t) is electricity production of hydrogen fuel cell, P SB, chr (t) is charging the power storage equipment.
Due to the introduction of price-based demand response, the relevant constraints of demand response should be increased. First, it is required that the total amount of load in the whole dispatching period remains unchanged, as shown in Formulas (48) and (49). At the same time, in order to achieve the ultimate goal of demand response, it is necessary to control the load of each step in the scheduling between the upper and lower limits of the load value before response, as shown in Formula (50).
P max user,t ≤ P 0,max user,t P min user,t ≥ P 0,min ∆P user, t is the change in user electricity consumption before and after demand response, P 0 user, t is the electricity consumption of users before demand response, P 0, max user, t and P 0, min user, t are the upper and lower limits of the demand response preload value, P max user, t and P min user, t are the upper and lower limits of the demand response afterload value.

User Benefit Model
User benefit refers to the reasonable adjustment of required energy according to its own demand for electricity and energy price in the process of demand response [22]. In this paper, the user satisfaction model is introduced to constrain the load variation. While considering the microgrid to guide users to adjust their own energy consumption period, the satisfaction of power consumption mode and expenditure satisfaction are used as constraints to participate in dispatching.

Objective Function
As a follower of the game, the user responds after the price signal is given by the microgrid. Considering the user's power consumption income and cost, the goal is to maximize the user's benefit, and the objective function is shown in Formula (51).
Processes 2023, 11, 2820 13 of 26 U is that maximum benefit of user in the game model, C UE is the benefit of users, α is energy preference coefficient for users.

Constraints a.
Satisfaction with electricity consumption mode Before the introduction of electricity price demand response, users' electricity consumption periods were mainly selected according to their own preferences, and at this time, users' satisfaction with electricity consumption methods was the highest [23]. However, after the introduction of electricity price demand response, the user changes his own electricity preference to reduce electricity expenditure by responding to the price signal given by the microgrid. The mathematical model is shown in Formula (53) and the satisfaction constraint is shown in Formula (54).
M min is the lower limit of user's satisfaction with electricity consumption. b.

Expenditure satisfaction
After the price-based demand response is implemented in the microgrid, users will adjust according to the real-time electricity price to ensure that the electricity expenditure will not have a great impact [24]. Therefore, expenditure satisfaction is usually used to measure the change in user expenditure. The mathematical model is shown in Formula (55), and the satisfaction constraint is shown in Formula (56).
eu,sell P 0 user,t −e eu,sell P user,t ) e eu,sell P user,t (55) In the Formula, e 0 eu, sell is the unit price of electricity sales for microgrid before demand response, P 0 user is power consumption of users before demand response. N min is the lower limit of user spend satisfaction.

Establishment and Proof of Microgrid-Client Stackelberg Game
As shown in Figure 2, the microgrid and the user constitute a dynamic non-cooperative game, and the game relationship constitutes a Stackelberg game Formula as shown in Formula (57).
Formula (52) contains three elements of the game: participants, strategy sets, and utility.

1.
Game participants: participants in the game of microgrid and users as the main slave, expressed in the form of set as follows (MGO ∪ USER).

2.
Strategy set: The microgrid is the leader in the Stackelberg game and the optimization strategy is Formulated first, and the electricity price strategy proposed by the microgrid to the user is represented by the set Φ MGO . The set of load adjustment strategies made by the user is represented by set Ψ USER .

3.
Utility: The cost set of the microgrid is represented by set S MGO , and the benefit set of users is represented by U USER . the cost collection of microgrid.

The solution Method of Game Model Based on Multi-Population Genetic Algorithm
The previous chapter analyzed the energy flow relationship between devices in the microgrid and the optimization functions of various game entities, and established a Stackelberg game model for the microgrid user. As the function to be solved is a largescale linear programming problem, compared to other algorithms, using multiple population genetic algorithms can effectively reduce the complexity of the solution and improve the efficiency of the solution.
Genetic Algorithm (GA) is an adaptive global optimization probability search algorithm proposed by Professor Holland in the United States in 1975 that simulates the genetic evolution of biological organisms in nature. Organisms evolve through heredity, variation, and natural selection, and genetic algorithms are inspired by Darwin's theory of natural selection. The solution of the example corresponds to the chromosomes in the genetic process, and the set of all chromosomes is a population, and the individuals are eliminated between the populations according to the principle of "natural selection, survival of the fittest", and the selection between individuals in the corresponding population is in programming. Starting from the initialization of the population, the interval judgment of the fitness function is carried out for each generation of the population, and according to the designed fitness ratio, the appropriate strategy is selected to select the excellent individuals of the current population, and the selected excellent individuals are crossed and mutated to form a new population. Analogous to the evolution process of When the follower in the game responds to the leader's strategy, and the leader accepts the response, it shows that the upper and lower game as a whole has reached the equilibrium condition [24]. That is, when the user responds to the electricity price strategy proposed by the microgrid according to the optimized operation scheme, and the microgrid accepts the response strategy, the microgrid-user reaches the equilibrium condition. Make Φ * MGO a vector set representing all optimal strategies of a microgrid, and Ψ * USER a vector set representing all the response strategies of the client. To reach the Stackelberg equilibrium condition, Formula (58) must be satisfied.
Φ x is the optimal operation scheme of the microgrid, Ψ y is the optimal response scheme of the user terminal, Φ * n−x is yeah, except Φ x other strategies than, Ψ * n−y yeah, and except Ψ y other strategies outside.
In the equilibrium state of Stackelberg game, neither party can obtain greater benefits by unilaterally proposing new strategies, and it is necessary to verify the existence and uniqueness of the equilibrium solution before solving it. The theorems for verifying the existence of the equilibrium solution are as follows: 1.
The decision schemes of leaders and followers are all non-empty bounded convex sets; 2.
After the top leaders make decisions, the followers have corresponding unique solutions; 3.
After the lower followers respond, the leader has a unique solution.
Compared with the above definitions, the existence and uniqueness of Stackelberg equilibrium solution of microgrid-user Stackelberg game model established in this chapter are proved:
As shown in Formulas (52)-(54), each term in S MGO is a linear or constant function with respect to P es, buy or P user , then S MGO is a concave function with respect to P es, buy and P user .

3.
As shown in Formulas (51) and (52), U USER is a continuous function with respect to P es, buy and P user .

The Solution Method of Game Model Based on Multi-Population Genetic Algorithm
The previous chapter analyzed the energy flow relationship between devices in the microgrid and the optimization functions of various game entities, and established a Stackelberg game model for the microgrid user. As the function to be solved is a large-scale linear programming problem, compared to other algorithms, using multiple population genetic algorithms can effectively reduce the complexity of the solution and improve the efficiency of the solution.
Genetic Algorithm (GA) is an adaptive global optimization probability search algorithm proposed by Professor Holland in the United States in 1975 that simulates the genetic evolution of biological organisms in nature. Organisms evolve through heredity, variation, and natural selection, and genetic algorithms are inspired by Darwin's theory of natural selection. The solution of the example corresponds to the chromosomes in the genetic process, and the set of all chromosomes is a population, and the individuals are eliminated between the populations according to the principle of "natural selection, survival of the fittest", and the selection between individuals in the corresponding population is in programming. Starting from the initialization of the population, the interval judgment of the fitness function is carried out for each generation of the population, and according to the designed fitness ratio, the appropriate strategy is selected to select the excellent individuals of the current population, and the selected excellent individuals are crossed and mutated to form a new population. Analogous to the evolution process of species, generation-by-generation, continuously enhancing the fitness of the population until the optimal solution is output after the desired conditions are completed. Since the genetic algorithm does not rely on gradient calculation, it has strong robustness and global optimization ability [24,25].
Multi-population genetic algorithm divides a single population into multi-threaded populations and adds immigration operators. In the evolution process of different populations, the migration operator introduces the optimal individuals to other populations every certain number of iterations, which realizes the information exchange between different populations and the balance of global and local search performance. Secondly, the elite population is established, and each generation of evolution selects the best individuals of other populations to join the elite population and save them through artificial selection operators, and no genetic operation is carried out to ensure that the best individuals are not destroyed, so all the optimal solutions produced by each evolution can be completely preserved [26][27][28][29]. The simplified process of improvement is shown in Figure 3.
The solution process for the whole game system is as follows: (1) Initializing the operation parameters of the microgrid and the load data of the user terminal, and sending the electricity price strategy drawn up by the microgrid to the lower layer; (2) Converting the maximum energy consumption benefit of the user terminal into a negative cost, feeding back according to the pricing signal of the microgrid, and feeding back the load signal to the upper-level dispatching; (3) The microgrid solves the objective function through the feedback signal; (4) Judging whether the game equilibrium solution is reached, and if so, outputting the result; otherwise, return to (2) to continue scheduling.
The solution process for the whole game system is as follows: (1) Initializing the operation parameters of the microgrid and the load data of the user terminal, and sending the electricity price strategy drawn up by the microgrid to the lower layer; (2) Converting the maximum energy consumption benefit of the user terminal into a negative cost, feeding back according to the pricing signal of the microgrid, and feeding back the load signal to the upper-level dispatching; (3) The microgrid solves the objective function through the feedback signal; (4) Judging whether the game equilibrium solution is reached, and if so, outputting the result; otherwise, return to (2) to continue scheduling.

Basic Data
The reaction parameters of each equipment are shown in Table 1. The electricity price and natural gas price are shown in Figure 3, but considering the price-based user demand response, the initial tiered price is adopted as shown in Figure 4, and the new demand response parameter data are shown in Table 2 [30]. The typical electricity load,

Basic Data
The reaction parameters of each equipment are shown in Table 1. The electricity price and natural gas price are shown in Figure 3, but considering the price-based user demand response, the initial tiered price is adopted as shown in Figure 4, and the new demand response parameter data are shown in Table 2 [30]. The typical electricity load, heat load, and gas load curves of the multi energy microgrid, as well as the predicted output power of wind power generation, are shown in Figure 5. Peak and valley time of use electricity prices are used for billing, with low peak periods ranging from 23.00 to 7.00, flat peak periods ranging from 8.00 to 11.00 and 15.00 to 18.00. Daytime peak periods are reached from 12.00 to 14.00, and nighttime peak periods are reached from 19.00 to 22.00.

Game Equilibrium Results
The lowest comprehensive cost of the microgrid is 11,667.044709 yuan, which takes 692.513986 s. Comparing Figure 6a with Figure 6b, the game process between the microgrid and the user terminal can be analyzed. When the number of iterations is 1-8 times, the results of the game between microgrid and user do not change, and the microgrid has the lowest return and the highest user benefit. When the number of iterations is between 8 and 14, the revenue of microgrid gradually increases, and the corresponding user income gradually decreases. At a time of 15-20 iterations, both microgrid and user benefits remain the same. When the number of iterations is between 21 and 24, the revenue of microgrid increases significantly, and the corresponding user revenue decreases sharply. When the number of iterations is between 25 and 30, the microgrid revenue and user revenue once again enter a stable state.

Game Equilibrium Results
The lowest comprehensive cost of the microgrid is 11,667.044709 yuan, which takes 692.513986 s. Comparing Figure 6a with Figure 6b, the game process between the microgrid and the user terminal can be analyzed. When the number of iterations is 1-8 times, the results of the game between microgrid and user do not change, and the microgrid has the lowest return and the highest user benefit. When the number of iterations is between 8 and 14, the revenue of microgrid gradually increases, and the corresponding user income gradually decreases. At a time of 15-20 iterations, both microgrid and user benefits remain the same. When the number of iterations is between 21 and 24, the revenue of microgrid increases significantly, and the corresponding user revenue decreases sharply. When the number of iterations is between 25 and 30, the microgrid revenue and user revenue once again enter a stable state.
tions is between 8 and 14, the revenue of microgrid gradually increases, and the corre-sponding user income gradually decreases. At a time of 15-20 iterations, both microgrid and user benefits remain the same. When the number of iterations is between 21 and 24, the revenue of microgrid increases significantly, and the corresponding user revenue decreases sharply. When the number of iterations is between 25 and 30, the microgrid revenue and user revenue once again enter a stable state.  The electricity sales plan of microgrid to users obtained by game solution is shown in Figure 7, and the load after the price-based demand response of the user is shown in Figure 8. According to Figure 7, it can be seen that the purchase price of microgrid is lower than the transaction price between microgrid and users at any time, which is the result of microgrid's game in order to encourage users to respond and achieve the optimal overall economic dispatching level. The price signal sent by the microgrid between 12:30-18:00 and 0:00-1:00 and 2:00-5:00 at the peak time of electricity prices continues to be low, encouraging users to adjust the load during this period. According to Figure 8, it can be seen that after the introduction of price-based demand response, the user's load curve has changed greatly, and the load has been transferred according to the real-time price adjustment given by the microgrid.
In order to verify the optimization effect of the proposed multi-group optimization method on the model, the multi-group optimization algorithm (MPGA) is compared with particle swarm optimization (PSO) and standard genetic algorithm (GA), and the results are shown in Figure 9. The electricity sales plan of microgrid to users obtained by game solution is shown in Figure 7, and the load after the price-based demand response of the user is shown in Figure 8. According to Figure 7, it can be seen that the purchase price of microgrid is lower than the transaction price between microgrid and users at any time, which is the result of microgrid's game in order to encourage users to respond and achieve the optimal overall economic dispatching level. The price signal sent by the microgrid between 12:30-18:00 and 0:00-1:00 and 2:00-5:00 at the peak time of electricity prices continues to be low, encouraging users to adjust the load during this period. According to Figure 8, it can be seen that after the introduction of price-based demand response, the user's load curve has changed greatly, and the load has been transferred according to the real-time price adjustment given by the microgrid.    In order to verify the optimization effect of the proposed multi-group optimization method on the model, the multi-group optimization algorithm (MPGA) is compared with particle swarm optimization (PSO) and standard genetic algorithm (GA), and the results are shown in Figure 9. As shown in Table 3, the total cost of microgrid obtained by MPGA algorithm is 11 667.04 yuan, which reaches convergence in 31 times. The total cost of PSO algorithm is 12, 306.7 yuan, which reaches convergence in 74 times. The total cost of GA algorithm is 13, 368.8 yuan, which reaches convergence in 87 times. It is proved that the convergence speed and one-day expenditure cost of MPGA algorithm are the best, and the optima solution is due to other algorithms.

Optimization of Operation Results
In order to further analyze the impact of price-based demand response on the sys As shown in Table 3, the total cost of microgrid obtained by MPGA algorithm is 11, 667.04 yuan, which reaches convergence in 31 times. The total cost of PSO algorithm is 12, 306.7 yuan, which reaches convergence in 74 times. The total cost of GA algorithm is 13, 368.8 yuan, which reaches convergence in 87 times. It is proved that the convergence speed and one-day expenditure cost of MPGA algorithm are the best, and the optimal solution is due to other algorithms.

Optimization of Operation Results
In order to further analyze the impact of price-based demand response on the system, two comparison scenarios are set up. The carbon transaction cost, carbon emission, electricity purchase cost, gas purchase cost, and total cost of microgrid in different scenarios are shown in Table 4. As shown in Table 3, compared with not considering demand response, in the scenario of considering demand response, the gas purchase cost has slightly increased, while the initial carbon emissions of natural gas related equipment are low, so the carbon emissions and carbon transaction costs have increased. However, based on a low-carbon model with a tiered carbon trading mechanism, the cost of electricity and total costs significantly decrease, but the increase in environmental costs is relatively small and within a reasonable range. Moreover, considering demand response can enable users to participate in the response, which is conducive to the consumption of renewable energy. The price is based on demand response and leads the user to transfer the load, so the power purchase cost is reduced. Through comprehensive calculation, the total cost of the scenario considering demand response is reduced, and the goal of economic optimal scheduling of the microgrid system is achieved.
The equipment scheduling level of the microgrid after considering the demand response is shown in Figures 10 and 11, and the equipment scheduling level of the microgrid without considering the demand response is shown in Figures 12 and 13. rocesses 2023, 11, x FOR PEER REVIEW 21 of 27 ers to participate in the response, which is conducive to the consumption of renewable energy. The price is based on demand response and leads the user to transfer the load so the power purchase cost is reduced. Through comprehensive calculation, the tota cost of the scenario considering demand response is reduced, and the goal of economic optimal scheduling of the microgrid system is achieved. The equipment scheduling level of the microgrid after considering the demand re sponse is shown in Figures 10 and 11, and the equipment scheduling level of the mi crogrid without considering the demand response is shown in Figures 12 and 13.      By comparing Figures 10a and 11a, it can be seen that the energy purchase period, without considering demand response, is mainly in the peak time of energy consumption, and the power purchase period in the micro grid scenario after considering demand response is mainly distributed in the peak and valley time of electricity price. By comparing the gas consumption of methanation reactions in Figures 10b, 11, 12b, and 13, it can be seen that, considering demand response scenarios, it is 26.4% and 16.7% of the gas consumption without considering demand response scenarios, respectively. Without  By comparing Figures 10a and 11a, it can be seen that the energy purchase period, without considering demand response, is mainly in the peak time of energy consumption, and the power purchase period in the micro grid scenario after considering demand response is mainly distributed in the peak and valley time of electricity price. By comparing the gas consumption of methanation reactions in Figures 10b, 11, 12b, and 13, it can be seen that, considering demand response scenarios, it is 26.4% and 16.7% of the gas consumption without considering demand response scenarios, respectively. Without considering demand response, methanation reactions account for a larger proportion of By comparing Figures 10a and 11a, it can be seen that the energy purchase period, without considering demand response, is mainly in the peak time of energy consumption, and the power purchase period in the micro grid scenario after considering demand response is mainly distributed in the peak and valley time of electricity price. By comparing the gas consumption of methanation reactions in Figures 10b, 11, 12b, and 13, it can be seen that, considering demand response scenarios, it is 26.4% and 16.7% of the gas consumption without considering demand response scenarios, respectively. Without considering demand response, methanation reactions account for a larger proportion of the gas consumption. This is because in this scenario, the microgrid does not consider user load transfer, and purchases during the low electricity price period for the first step of hydrogen production from electricity to gas. Therefore, the hydrogen production is more than considering demand response scenarios, and as a raw material for methanation reactions and hydrogen fuel cells, it relatively reduces the purchase of natural gas during this scheduling period.

Conclusions
This article further rationalizes the configuration of microgrids and analyzes the respective needs of the two stakeholders, microgrids, and users. Therefore, a low-carbon economic optimization model for microgrids with a tiered carbon trading mechanism is constructed to ensure system economy while reducing carbon emissions. In addition, on this basis, a Stackelberg game model with price-based demand response, led by microgrids and followed by users, was introduced. The microgrid benefits are determined as the optimal scheduling of device operation, while the user side benefits are determined as having the highest energy efficiency, with the lowest cost. Firstly, the three elements and types of game are proposed, and the applicable game type in this chapter is Stackelberg game. Secondly, a microgrid user Stackelberg game structure was established, and the goal of the micro grid game was to achieve optimal operational economy, as well as constraints due to the consideration of increased demand response. The game goal of the user end was proposed to maximize revenue, and a satisfaction model including user electricity consumption and electricity expenditure was analyzed as a constraint to participate in the game. Once again, a Stackelberg game model was established between the microgrid and users, and it was proven that there exists an equilibrium solution to the game. Finally, an example analysis was conducted to verify the feasibility of the model. The specific conclusions are as follows: (1) Comparative analysis without considering demand response scenarios shows that the optimization cost of microgrid operation considering price-based demand response scenarios has decreased by 5%, which is 668.95 yuan. Among them, the power purchase cost has decreased by 23.8%, which is 778.6 yuan, the carbon emissions have increased by 17%, which is 83.96 kg, and the carbon trading cost has increased by 1.8%, which is 41.98 yuan. This proves that the introduction of demand response can improve the overall economic benefits of microgrids while slightly increasing environmental costs. (2) After considering demand response, the selling price of microgrids is always lower than the purchase price from the distribution network, and the price reduction rate is relatively high during the initial load valley, encouraging users to adjust their load during the time period. After the demand response, the user's load curve underwent significant adjustments and transformations, and the corresponding load transfer was carried out according to the price signal of the microgrid, achieving the expected "peak shaving and valley filling" effect of microgrid scheduling. (3) In the microgrid scheduling scenario considering price-based demand response, the electricity purchase period is mainly distributed during the low and flat peak periods of tiered electricity prices. Due to the transfer of user load, the energy pressure caused by user load is reduced. Funding: This article is supported by the Liaoning Provincial Scientific Research Funding Project, the comprehensive load modeling and electric heating control mechanism of the village-level traffic DC micro-network comprehensive load modeling (LJKMZ20221032).

Data Availability Statement:
Data are availability on request from the authors.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results. Electricity purchase costs C g, buy

Glossary
The cost of purchasing gas P g, buy Overall system air consumption c e Real-time electricity prices c g Real-time gas prices T Take 24 h P WT (t) Wind energy output power P CHP (t) The power output of the cogeneration unit P SB, dis (t) Discharge power of power storage equipment P HS, dis (t) Hydrogen storage equipment storage capacity P H 2 , MR Hydrogen consumption in methanation reactions P H 2 , HFC Hydrogen fuel cell hydrogen consumption P HS, chr (t) The amount of hydrogen released by hydrogen storage equipment P max PGU Upper limit of coal-fired unit output Maximum downhill climb power of cogeneration units P convert, e (t) The electrical power of the cogeneration unit after conversion at time t P convert, e (t − 1) The electrical power of the cogeneration unit after conversion at time t − 1 P max EL, H 2 The upper limit of hydrogen production capacity of the electrolyzer P min EL, H 2 The lower limit of hydrogen production by the electrolyzer G max

MR
The upper limit of the amount of CH 4 resulting from the reaction The amount of change in power P HFC, e (t) The power of the gas boiler at the time t P HFC, e (t − 1) The power of the gas boiler at the time t − 1 C es, buy The cost of purchasing electricity to the upper grid in the game model C eu, sell The electricity price revenue sold by the microgrid to the user C gs, buy The cost of purchasing gas C CO 2 , s Carbon trading costs in game models e es, buy The unit price of electricity sold in the distribution network e eu, sell Electricity purchased by the microgrid P es, buy The electricity purchased by the user is sold by the microgrid P user The amount of power after the user responds P min es, buy The lower limit of the amount of electricity that the microgrid purchases from the distribution grid P max es, buy The upper limit of the amount of electricity that microgrids can purchase from the distribution grid e max eu, sell The upper limit of the electricity price that microgrid can sell to users e min eu, sell The lower limit of the electricity price sold by the microgrid to the user P CHP (t) The output power of the electrical energy of the cogeneration unit P SB, dis (t) The discharge power of the power storage device P HFC, e (t) The power generation of hydrogen fuel cells P SB, chr (t) The power to charge the storage device ∆P user, t Changes in user electricity consumption before and after demand response P 0 user, t The user's electricity consumption before the demand responds P 0, max user, t The upper limit of the demand response preload value P 0, min user, t The lower bound of the demand response preload value P max user, t The upper limit of the demand response afterload value P min user, t The lower bound of the demand response afterload value C UE User's interests α User energy preference coefficient M min The lower limit of user satisfaction with electricity consumption P 0 user Electricity consumption by users before demand response N min Minimum consumer spend satisfaction Other strategies except Ψ y