Virtual Power Plant Participates in the Two-Level Decision-Making Optimization of Internal Purchase and Sale of Electricity and External Multi-Market

The power industry’s participation in carbon trading and green certificate trading is an effective market-based approach to solve the negative externalities of power production. In this paper, the Virtual power plant (VPP) is taken as the aggregator to coordinate and optimize the carbon trading and green certificate trading between the power purchasing end and the power selling end, so as to achieve the goal of maximizing the comprehensive benefits of the VPP. Firstly, the operation model of VPP aggregating various types of distributed energy and different users participating in green certificate market and carbon trading market is analyzed; Secondly, a two-level collaborative optimization model of VPP participating in power purchase and sale transaction and green certificate transaction is constructed. On the one hand, the cost of power purchase and green certificate acquisition is minimized by combining various types of power generation resources at the power purchase end. On the other hand, the power purchased is distributed among various types of users at the power sale end, so as to maximize the power sale income and green certificate sales income. On this basis, the VPP as a whole participates in the electric energy market, carbon trading market and green certificate trading market to maximize the comprehensive income. Finally, a VPP is taken as an example to verify the economy and effectiveness of the proposed model in this paper.


I. INTRODUCTION A. MOTIVATION
In recent years, environmental problems such as climate change and environmental pollution have become increasingly prominent. As a clean energy source, wind and solar energy can effectively alleviate this problem and have great development potential [1], [2]. However, with the continuous improvement of the scale of wind and solar power integration, problems such as low consumption rate of renewable energy power generation and increasing financial pressure of the government began to appear. In order to pro-mote the sustainable development of wind and solar energy and other new energy industries, the government began to try out the Tradable green certificate (TGC) (hereinafter referred to as ''green certificate'') and carbon emission trading system [3]. Green certificate is a means to monetize the environmental value of renewable energy, and it is a negotiable and tradable securities [4]. Carbon emission rights trading treats The associate editor coordinating the review of this manuscript and approving it for publication was Guijun Li . excess carbon emissions as commodities, and while restricting carbon emissions through the quota system, it also uses market means to improve the competitiveness of low-carbon industries and promote the development of renewable energy power generation [5].

B. LITERATURE REVIEW
Researchers at home and abroad have conducted in-depth research on green certificate trading and carbon emission rights trading. Among them, in the green certificate market transaction, the main focus is on the impact of different influencing factors on the green certificate transaction market and the analysis of the green certificate transaction system. There is less literature to explore in-depth research on the optimal dispatch of the power system considering the green certificate transaction. Dong et al. [6] and Wang et al. [7], [8] discussed the impact of prices, green certificate storage, future development trends of electricity selling companies, and the strategic behavior of participants on the green certificate trading market. Luo et al. [9] analyzed the green certificate transaction circulation mechanism based on the quota system and the feasibility of deploying green certificate transactions VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ on the blockchain, and designed the green certificate crosschain transaction framework and transaction process between different chain domains. Helgesen et al. [10] proved that green certificates can promote the market competitiveness of renewable energy power generation enterprises by constructing a complementary, multi-regional integrated green certificate and power market model. Lazaroiu et al. [11] introduced green certificate trading in VPPs, and compared and analyzed the economic optimization of VPPs under different wind and solar output conditions, but it did not thoroughly explore the impact of green certificate prices on system optimization scheduling.
In terms of carbon emission rights trading, the main research focuses on strategic behaviors such as transaction quotation, initial allowance allocation and carbon emission reduction investment. But there is less research on scheduling optimization in combination with green certificate trading. Peng et al. [12], Dong et al. [13], and Mei et al. [14] respectively studied the allocation methods of green certificate and carbon emission quota in electricity trading market based on two-level allocation, entropy weight method and election mechanism. Ji et al. [15] based on blockchain technology, introduced a ''pan-bilateral'' carbon emission trading mechanism, constructed a ''many-to-many'' multi-round carbon emission trading matching and clearing method, and verified its feasibility. Bu et al. [16] examined the relationship between the stock price of the new and old energy companies and the price of carbon emission rights, which showed that there was a long-term equilibrium relationship between the stock price of energy companies and the price of carbon emission rights, and both were significantly affected by the price of carbon emission rights.
At present, there are still few studies on the joint market of green certificate trading and carbon emission market. VPP as a new type of distributed power coordinated control and energy management technology, can effectively aggregate various power sources to participate in green certificate and carbon emission rights market transactions. At present, researches on VPPs at home and abroad are mostly focused on the optimization of power dispatching in VPP systems, and the conversion and dispatching of multiple energy sources such as electricity, but there are few studies that consider the green certificate trading and carbon emission trading at the same time. Aguilar et al. [17] constructed a stochastic optimization layer, which defines a stochastic model predictive control (SMPC) scheme by combining chance constraints (CC) and machine learning (ML) to process and optimize the generation and load curves. Wang et al. [18] proposed a VPP considering flexible load, established a VPP thermoelectric combined double-layer coordinated optimization operation model, and improved the coordination and optimization effect of multiple flexible loads. Wang et al. [19] analyzed the three-phase scheduling optimization process of VPP participation in the day-ahead, day-mid phase, and realtime phase, and established a three-phase scheduling model of VPP with generalized energy storage.
The key technology comparison between this paper and other researches is as follows:

C. INNOVATION
Based on the above-mentioned research foundation, this paper constructs an optimization model of VPP purchase and sale decision taking into account the coordination of carbon trading and green certificate trading, and has the following innovations: (1) As an aggregator, the VPP's revenue depends on the difference between the purchase and sale end electricity prices, so it is necessary to optimize the purchase and the sale at the same time. However, when the VPP deals with the main body of the buyer and the seller, there are conflicts and mutual influences between the objectives of each main body. In order to solve the problem of decision-making optimization at the purchase and sale end of VPP and the dynamic changes of the each body's objectives, this paper innovatively proposes to construct a controller-agent game model between the VPP and the power generation company on the purchase end, so as to realize the optimization of the purchase end. On the sale end, construct a controller-agent game model between VPP and users to realize the distribution of electricity sales.
(2) Existing research rarely considers the impact of different users' contributions from the perspective of VPP on the VPP's combined power purchase and sales strategy in different markets. It is impossible to accurately describe the reasons for the VPP's selection of target users. This paper innovatively starts from the impact of users on the unit output input of VPP, takes IU, BU, AU, and RU as the main body of electricity sales, considers the contribution of four types of users, sets real-time electricity sales prices, and realizes virtual sales. The power sales distribution plan of the power plant is optimal. This paper innovatively takes the maximization of the income of VPP as the objective function to coordinate and optimize the carbon trading market and green card trading market, so as to promote the realization of the strategic objectives of carbon neutralization and carbon peak.
(3) The current literature mainly focuses on the research on the equilibrium problem of the electricity market under a single carbon trading or green certificate trading system. However, the overall design ideas of the carbon trading and green certificate trading are based on the goal of total amount control. Under the total target, refine the carbon quota or green certificate ratio. Therefore, under the coordination and optimization of the two systems, different types of generating units need to make comprehensive decisions on the specific schemes of carbon market and green certificate market, power generation types of their own units, power generation costs of their own and other generating units, carbon emission intensity and other factors according to the regulatory authority, so as to effectively reduce carbon emissions.

D. THE OTHER PARTS OF THIS PAPER
The other parts of this paper are as follows: in the second part, a double-layer collaborative optimization model of VPP participating in internal power purchase and sale transaction and green certificate transaction is constructed, and the operation model of VPP participating in green certificate market and carbon trading market is analyzed; In the third part, a twolevel collaborative optimization model of VPP participating in internal power purchase and sale transaction and green certificate transaction is constructed, and the model of VPP shop purchase transaction and green certificate acquisition and green certificate allocation are proposed; In the fourth part, on the basis of the above, a decision-making optimization model of VPP participating in the coordination of green certificate trading market and carbon trading market is constructed, and the algorithm for solving the model is proposed; In the fifth part, a VPP is taken as an example to provide reference for the VPP to participate in market transactions. VOLUME 9, 2021 II. NOMENCLATURE

III. VPPs PARTICIPATE IN THE OPERATION MODEL OF GREEN CERTIFICATE MARKET AND CARBON TRADING MARKET
In the context of carbon allowances and green certificate transactions, VPPs aggregate various types of distributed energy and different users to participate in the green certificate market and carbon trading market, as shown in Fig.1: As can be seen from Fig.1, within the VPP, first of all, hydroelectric power generation, wind power generation, photovoltaic power generation and gas turbine submit their declared electricity quantity and price to the operation center of the VPP. At the same time, wind power generation, photovoltaic power generation and other non water renewable energy also need to submit the trading volume of green certificates that can be sold to the operation center of the VPP. The VPP takes the carbon quota and the minimum cost of power purchase into consideration to formulate the strategy of power purchase and green certificate acquisition. Then IU, AU, RU and BU submit their own electricity purchase price and willing electricity purchase price to the VPP operation center. At the same time, all types of users submit green certificate purchase quantity based on their own renewable energy quota requirements. The VPP operation center forms electricity sales strategy and green certificate distribution strategy according to the maximization of electricity sales revenue. Finally, the operation center of the VPP participates in the electric energy market according to the internal deviation of electricity purchase and sale. If the electricity purchase of the VPP is greater than the electricity sale, the surplus electricity purchase will be sold in the electric energy market. Otherwise, the lack of electricity will be purchased in the electric energy market. According to the supply and demand of green certificates, green certificate transactions are carried out on the national green certificate subscription platform. If the purchase amount of green certificates is greater than the allocated amount, green certificates are sold on the green certificate subscription platform, otherwise they are purchased. According to the relationship between the overall carbon emission of VPP and the free carbon emission right, the carbon emission right trading is carried out in the provincial carbon emission market. If the former is greater than the latter, the carbon emission right will be purchased, otherwise it will be sold.

A. VPP POWER PURCHASE TRANSACTION AND GREEN CERTIFICATE ACQUISITION MODEL
The power purchase transaction of the VPP is to minimize the power purchase cost and the green certificate purchase cost by combining various types of power generation resources. All types of power generators maximize their comprehensive income by selling electricity or green certificates. Since the VPP simultaneously grasps the information of the generator and the user in the power purchase transaction process, the transaction between the VPP and the generator constitutes a controller-agent game. The specific game framework is shown in Fig.2: As can be seen from Fig.2, the VPP publishes its own power purchases based on the user's historical load data; power generators such as WT, PV, Hy, GT, etc. declare their own power and price based on the power purchases issued by the VPP to maximize the revenue from the sale of electricity. With the goal of minimizing power purchase costs and green certificate acquisition costs, VPPs combine various types of power generation resources to form a power purchase strategy and a green certificate acquisition strategy.

1) VPP POWER PURCHASE TRANSACTION AND GREEN CERTIFICATE ACQUISITION STRATEGY
The VPP takes the minimization of power purchase cost and green certificate purchase cost C vpp t as the objective function, as shown in equation (1), as shown at the bottom of the page, where, ϑ WT t , ϑ is the price of the green certificate at time t. a and b are constants greater than zero, respectively. user is the set of user types, including IU, AU, RU, BU and other users. Q tj is the load demand of the j-th user. λ green j is the proportion of non-aqueous renewable energy quota that the j-th user needs to complete.
Due to the uncertainty of wind power output and photovoltaic output, the VPP cannot accurately predict the specific output of WT and PV when it plays a game with WT generator and PV generator to purchase electricity. Each subject forms a game equilibrium solution according to the predicted value. In real-time dispatching, if the actual output of WT and PV is less than the game equilibrium solution, the VPP faces the risk of power shortage. If the actual output of WT and PV unit is greater than the game equilibrium solution, although the VPP can meet the power demand, it will increase the green card purchase cost and face economic risks. So the conditional value at risk is introduced into the objective function, as shown in equation (2), as shown at the bottom of the next page, where, δ is the risk appetite level of the VPP; C VPP CVaR,t is the risk cost of the VPP at time t; α is the critical value of VPP power purchase risk; β is the confidence level; f (η) is the risk cost function; the proportion of electricity purchased by the VPP from each generator; N is the sample size.
Under the carbon neutrality and carbon peak goals, the VPP is subject to the carbon quota target. That is, the carbon dioxide emissions from the electricity purchased by the VPP shall not exceed the upper limit of the free carbon quota set by the regulatory agency, as shown in equation (3): where, u GT co 2 is the carbon dioxide emitted per unit of GT output; λ co 2 max is the upper limit of free carbon allowance per unit specified by the regulatory agency.

2) GT AND Hy GENERATOR POWER SALES TRADING STRATEGY
Since GT and Hy cannot participate in the green certificate transaction, the electricity sales transaction strategy of GT and Hy is to maximize the income from the sale of electricity, as shown in equations (4)- (5): where, R GT t and R hy t are the income obtained by the GT and Hy generating unit at time t; β hy 1 , β hy 2 and β hy 3 is the composition parameter of the Hy generator; β GT 1 , β GT 2 and β GT 3 is the power generation cost parameter of the GT unit. In order to ensure the sustainable output of GT units and Hy generating units, it is necessary to meet the requirement that the price of electricity sold is higher than the cost of power generation, that is, the income of GT and Hy generating units is greater than zero, as shown in equation (6): For GT units and Hy generating units, they are also subject to up and down climbing constraints and start-stop time constraints, as shown in equation (7)- (8): where, Q hy max down and Q hy max up are the downward climbing limit and the upward climbing limit of the Hy generating unit, respectively; T

3) WT GENERATORS AND PV POWER GENERATORS SELLING ELECTRICITY TRADING STRATEGIES
Since WT generators and PV power generators belong to renewable energy sources and can participate in green power certificate transactions, their electricity sales transaction strategy is to maximize the income from electricity sales and the sales of green certificates, as shown in equation (9): Also in order to ensure the sustainable output of WT and PV generators, it is necessary to meet the requirement that the price of electricity sold is higher than the cost of power generation. That is, the income of WT and PV generators is greater than zero, as shown in equation (11): The electricity sales transaction of the VPP is to realize the maximization of electricity sales income and green certificate sales income by distributing the purchased electricity among various types of users. All types of users maximize their own utility through demand response. A dynamic game is formed between the VPP and various types of users. The dynamic game framework is shown in Fig.3:

1) VPP ELECTRICITY SALES TRANSACTION AND GREEN CERTIFICATE ALLOCATION STRATEGY
After the VPP determines the optimal power purchase strategy, it needs to reasonably allocate the purchased power and the number of green certificates purchased to different types of users according to the four types of user load requirements to maximize revenue. Due to the deviation between the actual load and the predicted load, the user needs to pay the deviation assessment fee when there is a deviation assessment fee. Therefore, when the deviation assessment fee is large, the user will spontaneously transfer part of the load, and use the positive deviation to fill in the negative deviation, so as to reduce the deviation in some periods. Similarly, because the cost of deviation assessment is shared by the user and the electricity seller, in order to reduce the assessment cost and stabilize the deviation, the electricity seller will give the user a certain compensation fee to reduce the power consumption when the positive deviation is large. The DR models include PBDR and IBDR. The power consumption characteristics of different types of users are different, so the ways to participate in the DR are not consistent. Among them, IU have a large demand for electricity, while BU have a fixed period of electricity consumption. Both of them can participate in PBDR and IBDR at the same time. The load of AU can be transferred, but it is difficult to control directly, so they can participate in PBDR. The load of BU can be controlled directly, but it is difficult to respond actively, so they can participate in IBDR. The objective function of VPP is shown in equation (12): where, R Because different users have inconsistent impacts on the profits of VPP, VPP need to set power selling prices for users based on the ability of various types of users to contribute to their own profits. The user contribution is defined as the increase in the VPP unit output input ratio after the VPP selects the user compared with that before the VPP selects VOLUME 9, 2021 the user, as shown in equation (13): where, θ j is the contribution of user j; υ +j and υ −j are respectively the ratio of the unit output input of the VPP to user j after and before the sale of electricity; R j is the income of the VPP from selling electricity to user j; C j is the power purchase cost and DR cost of the VPP to purchase this part of the electricity; Q j is the amount of electricity sold by the VPP to user j. The VPP revises the price of electricity sales according to the user contribution. For users with a user contribution greater than zero, the VPP provides certain price discount packages, as shown in equation (14). On the one hand, it improves user satisfaction and improves user utility. On the other hand, it taps user potential and further enhances user contribution. (14) where, p θ sale tj is the price of electricity sold to user j after considering user contribution; ω j is the electricity price discount coefficient of user j.
According to the revised price of the VPP, the objective function of the VPP can be revised as shown in equation (15) In the process of power sales and green certificate trading, VPP need to meet the constraints of power balance, green certificate purchase and sales balance, as shown in equations (16)- (17). At the same time, in order to maintain the cooperative relationship between the users and VPP's own profits, the selling price of electricity and the selling price of green certificates are subject to upper and lower limits, as shown in equations (18) and (19) respectively:

2) CONSUMER POWER PURCHASE AND DR STRATEGY
Users adjust their own DR volume, thereby affecting the purchase of electricity and achieving the goal of maximizing utility. The user's electricity utility is defined as the weighted sum of the user's electricity purchase cost, the green certificate purchase cost, and user satisfaction, where user satisfaction is characterized by user consumer surplus. The shaded part in Fig.4 is consumer surplus: Based on Fig.4, user consumer surplus can be expressed by equation (20): (20) where, L base tj is the base load of user j at time t; The user's power purchase cost and green certificate purchase cost C total tj are shown in equation (21): Based on equation (20) and equation (21), the user utility maximization is expressed by equation (22): where, ε 1 and ε 2 are the weight coefficients for maximizing user utility and minimizing power purchase cost and green certificate purchase cost.

V. DECISION-MAKING OPTIMIZATION MODEL OF VPP PARTICIPATING IN EXTERNAL MULTI-MARKET COORDINATION
The VPP optimizes the purchase and sale of electricity internally, and requires external participation in the electricity energy market, carbon trading market and green certificate trading market as a whole.

A. CARBON TRADING MARKET
At this stage, China adopts a free allocation method for the allocation of carbon allowances, including the baseline method and the historical method. Among them, the baseline method is the main method for the allocation of carbon allowances for Chinese power generation companies. This paper uses this method to determine the amount of carbon allowances for VPP, as shown in equation (23): where, E co 2 t is the amount of carbon allowance allocated to the VPP at time t; λ t is the distribution coefficient of carbon emissions per unit of electricity; device is the VPP generator set collection, device = {WT , pv, GT , hy}.
Since wind power generation, photovoltaic power generation, and hydropower generation are all renewable energy power generation, no carbon emissions are generated. The carbon emissions in the VPP all come from GT power generation. The carbon emissions generated by GT power generation are as shown in equation (24): where, E dis t is the carbon emissions produced by the GT at time t; a 1 , a 2 and a 3 are the carbon emission coefficient of the GT.
The VPP participates in the carbon trading market as a whole. If the overall carbon allowance of the VPP is less than the carbon emissions, the VPP participates in the carbon trading market as the purchaser of carbon emission rights. At this time, the benefits of the VPP are shown in equation (25), as shown at the bottom of the page. Otherwise, it participates in the carbon trading market as the seller of carbon emission rights. At this time, the cost of purchasing carbon emission rights by the VPP is shown in equation (26), as shown at the bottom of the page, where, p co 2 t is the basic price of carbon trading at time t; δ is the growth coefficient of carbon trading price; D is the length of the carbon emission interval of carbon trading.

B. GREEN CERTIFICATE TRADING MARKET
Due to the poor ability of voluntary subscription of green certificates at this stage, the implementation of a mandatory trading quota system for green certificates can promote the participation of various transaction entities in transactions and ease energy tension. Under the constraints of renewable energy power quota assessment indicators, VPP participate in the green certificate trading market and make green certificate decisions that maximize revenue. However, the implementation of the green certificate mandatory trading quota system makes the green certificate transaction price uncertain. This paper combines the market transaction clearing mechanism and considers the upper and lower price constraints to construct a dynamic pricing function for green certificates. The price of green certificates is closely related to the supply and demand of green certificates. The supply and demand curve of green certificates is shown in Fig. 5: are the upper and lower limits of the green certificate price, respectively. It can be seen from the price mechanism that when the demand for green certificates is greater than the supply, the demand curve is the horizontal line where the price is p mar_green max . When the demand for the green certificate is less than the supply, the demand curve is the horizontal line with price p mar_green min , so the blue curve in Fig. 5 is the demand curve for the · · · · · · (26) VOLUME 9, 2021 green certificate. The equilibrium price p mar_green t of green certificates is determined by the supply and demand of green certificates.
According to the equilibrium price, the VPP determines the number of green certificates that need to be purchased or can be sold by combining the user's quota and the number of green certificates provided by clean energy generators. If the user's quota is greater than the number of green certificates that the clean energy power generation company can provide, the VPP will participate in the green certificate trading market as the purchaser, and the cost of the VPP to purchase green certificates is shown in equation (27). Otherwise, the VPP participates in the green certificate trading market as the seller, and the revenue of the VPP selling green certificates is shown in equation (28).
where, R green t is the income obtained by the VPP in the green certificate trading market at time t.

C. MODEL SOLVING 1) CONTROLLER-AGENT GAME OF POWER PURCHASE AND SALE TRANSACTION IN VPP
The controller-agent game was proposed by Stackelberg. In the game process, the leader takes the first opportunity and advantage, and develops his own strategy. The follower needs to make an optimal response to the leader's decision. The leader updates its own decision after receiving the follower's response. The two parties continue to interact with each other to pursue their respective goals, and finally reach the Nash equilibrium of the Stackelberg game [20].
In the VPP power purchase transaction and green certificate acquisition process, the VPP has certain advantages in grasping the information of generators and users at the same time. The VPP makes power purchase strategies and green certificate acquisition strategies by combining various types of power generation resources with the goal of minimizing power purchase costs and green certificate purchase costs. With the goal of maximizing revenue from electricity sales and green certificates, various power generation companies formulate their own energy output plans and electricity sales/green certificate strategies. Among them, the conditions that the VPP and various power producers need to meet in the Nash equilibrium solution are as follows: where, F VPPS and F ES respectively represent the interests of the two subjects of the game under the optimal strategy; S VPPS and S ES respectively represent the VPP and the strategy set of various power producers; S * VPPS and S * ES respectively represent the optimal strategy set of the two players in the game. Equation (29) shows that in the above-mentioned equilibrium solution between the VPP and the power supplier, neither of the parties can unilaterally adjust the decision to obtain greater benefits.
The specific solution process of the controller-agent game is as follows: 1) Enter the initial data, including the energy demand curve of the VPP, the output parameters of each equipment of various power generators, and the initial electricity and green certificate transaction prices.
2) The VPP announces its own power demand and green certificate purchases according to the energy demand on the user side, and calculates the lowest purchase cost C VPP x after the combination of power generators selected at this time.
3) According to the demand curve of the VPP, various power generation companies update the x-th equipment output, electricity price, and green certificate price, optimizing their own interests as the goal. The final strategy is fed back to the virtual power plant. 4) After the VPP gets feedback, it formulates the electricity generation and green certificate transaction combination of the power generation company selected for the x + 1-th time, and calculates the purchase cost C VPP x+1 at this time. At the same time, judge whether the following constraint conditions are met, if not, then skip to step 2, otherwise, proceed to the next step.
5) Output the transaction combination of the VPP's purchase of electricity and the green certificate, the purchase cost at this time, the equipment output of various generators, and the price of electricity and green certificate.

2) SOLUTION PROCESS
This paper takes into account the coordination of carbon trading and green certificate trading for the VPP purchase and sale decision is a non-linear, multi-constrained mixed integer optimization problem. The non-linear constraints are transformed into linear constraints by introducing intermediate variables, and the YALMIP toolbox is called in MATLAB. Using CPLEX solver to solve. The specific solution process is shown in Fig.6: Step 1: First of all, the VPP combines historical load data, and the VPP releases its own power purchase, and each unit declares its own output and price based on the power purchase of the VPP; Step 2: Calculate the number of green certificates that can be sold by WT and PV panels. The VPP combines the power generation of each unit with the goal of minimizing the purchase cost of electricity and green certificate purchases. Output the optimal power purchase strategy and green certificate purchase strategy of VPP; Step 3: The VPP issues a DR plan based on the power purchase and load demand. Each type of user determines whether to participate in the DR based on their own conditions. If they participate in the DR, they declare the corresponding DR volume and adjust the electricity price; if not participating directly calculate the user's contribution; Step 4: The VPP aims at maximizing the income from electricity sales and green certificate sales. Output the optimal electricity sales strategy and green certificate sales strategy; Step 5: VPP participates in external market optimization. On the one hand, judge the carbon quota and the actual carbon emissions. If the carbon quota is greater than the actual carbon emissions, sell the carbon emission rights, otherwise buy the carbon emission rights; On the other hand, judge the demand and supply of green certificates. If the demand of green certificates is greater than the supply of green certificates, buy green certificates, otherwise sell green certificates; Step 6: Optimize the carbon trading market and green certificate trading market.

VI. EXAMPLE ANALYSIS A. BASIC DATA
In this paper, a 3MW WT, 2MW PV panels and 3MW GT are configured. The climbing power of the GT is 0.18mw/h and the starting and stopping time is 0.12h. The basic parameters of WT, PV panel and GT are detailed in reference [21], and the output of each unit is shown in Fig. 7 [22].  The VPP aggregates four types of users: IU, BU, AU, and RU. The expected load of each user is shown in Fig. 8 [23]. Among them, IU and BU refer to all enterprises engaged in industrial production and business operations in the region; RU refer to the sum of all residents in the region, including all residential buildings; AU specifically refer to the electricity load of agricultural irrigation in the region.

1) ANALYSIS OF THE UTILITY OF GREEN CERTIFICATE TRADING AND CARBON TRADING COORDINATION
After taking the above parameters, in order to analyze the coordination effect of green certificate trading and carbon trading, four scenarios are set as follows: Scenario 1: In the VPP purchase and sale process, the green certificate trading market and carbon trading market are not considered; Scenario 2: In the process of purchasing and selling electricity for VPP, only the green certificate trading market is considered, and the carbon trading market is not considered; Scenario 3: In the VPP purchase and sale of electricity, only the carbon trading market is considered, and the green certificate trading market is not considered; Scenario 4: In the VPP purchase and sale of electricity, the carbon trading market and the green certificate trading market are considered at the same time.
From this, under the four scenarios, the output of each unit and the load demand of each user are shown in Fig. 9-16:   At the same time, considering carbon trading and green certificate trading scenario 4, the output of WT, PV, Hy and other renewable energy is higher than the other three scenarios, while the output of GT is the lowest compared to the other three scenarios, indicating that both carbon trading and the green certificate trading market can make the power purchase plan of the VPP cleaner and lower-carbon.   In terms of load demand, the maximum loads of IU, BU, AU, and RU users in scenario 1 are 2.51MW, 2.54MW, 1.72MW, and 1.27MW respectively, which are higher than the maximum loads of various users in the other three scenario. This is because considering carbon trading and green certificate trading, by invoking the DR of the four types of users, the load during the trough period at night is significantly increased, and the load during the peak period during the day is significantly reduced, which enhances the effect of ''peak shaving and valley filling''. Table 3 shows the purchasing and selling strategies of VPP: It can be seen from Table 3 and 4 that the share of WT generation and PV power generation in scenario 4 considering    carbon trading and green certificate trading is as high as 90.14%, much higher than 76.15% in scenario 1, 86.26% in scenario 2 and 88.01% in scenario 3. This is because considering green certificate trading and carbon trading, VPP can make profits in the carbon trading market and green certificate trading market by purchasing WT generation and PV power generation. In addition, compared with the other three scenarios, scenario 4 has the highest electricity sales income and net income, which are 14535.43$ and 6873.63$ respectively, while the lowest electricity purchase cost, which is 7661.80 $ respectively. This shows that VPP should actively use green certificate market and carbon trading market to promote clean energy consumption and increase net income.

2) USER CONTRIBUTION UTILITY ANALYSIS
According to the power purchase and sale strategy of the VPP in the above scenario 4, the contribution of each user to the VPP is calculated as shown in Table 5: It can be seen from Table 4 that IU have the highest contribution to the VPP, which is 0.4789, while RU have the lowest contribution, which is 0.1126. This is because the peak energy consumption period of RU coincides with the VPP's high power purchase cost period. After the combination of the two, the power purchase cost of the VPP is increased. On the one hand, IU have the highest load base and have higher potential for DR than RU. Therefore, DR reduces power consumption during peak hours and reduces the power purchase cost of VPP; On the other hand, the peak power consumption of industrial loads matches the low power purchase cost period of the VPP, which further reduces the power purchase cost of the VPP, so IU have the highest contribution.
According to the contribution of different users, the differentiated electricity selling prices set by the VPP for different users are shown in Fig.17:   FIGURE 17. Differentiated electricity price for each user. VOLUME 9, 2021 It can be seen from Fig. 17 that, on the one hand, from the comparison of the electricity prices of users, taking peak hours as an example, the peak electricity prices of IU, BU, AU, and RU users are respectively 13.78$/MWh, 13.97$/MWh, 18.89$/MWh, 20.17$/MWh, among which the price of electricity sold by IU is the lowest in each period, and the price of electricity sold by RU in each period is the highest. As can be seen from Table 2, the highest contribution of IU is 0.4789 and the lowest contribution of RU is 0.1126. Therefore, it shows that the user's power sales price is inversely proportional to the user's contribution, that is, the higher the user's contribution to the VPP, the lower the real-time power sales price set by the VPP for users.
On the other hand, from the perspective of electricity selling price of a user, the real-time electricity selling price set by the VPP for users is consistent with the change trend of load demand curve. The high electricity price period is concentrated in 10:00-14:00 and 18:00-21:00, the medium electricity price period is concentrated in 7:00-9:00 and 15:00-17:00, and the valley electricity price period is concentrated in 22:00-6:00. This is completely matched with the peak and trough periods of users' power consumption. At the same time, it can be seen that in the peak period of power consumption, the power sales price is higher, and in the trough period of power consumption, the power sales price is lower.
According to the electricity sales price set by the VPP for IU, BU, AU and RU, the power purchase cost of each user under the two scenarios of considering and not considering the contribution is calculated, as shown in Table 6: It can be seen from Table 6 that after the VPP sets the realtime electricity selling price, it has the greatest effect on the improvement of IU, reducing the power purchase cost of IU by 16.04%, followed by BU, reducing the power purchase cost by 9.08%, and improving the effect of RU. The smallest value is only 1.61%, indicating that for VPP, IU should be focused on. It shows that for the VPP, since the IU contribute the most to the VPP, the electricity price formulated by the VPP also plays the most obvious role in improving the IU. Therefore, when selling power, the VPP should focus on the change of load demand of IU, so that IU can further improve their contribution to the VPP.

3) THE UTILITY ANALYSIS OF CONDITIONAL VALUE-AT-RISK
According to the above analysis results, the VPP faces the dual problems of low cost of wind and solar power generation and high risk of power shortage on the power purchase side. Therefore, how to balance the lowest power purchase cost and the lowest risk cost objective is a key issue for VPPs to participate in power purchase and sale transactions. At the same time, this paper uses the CVaR method to describe the uncertainty in the objective function and constraint conditions, and the different parameter settings will also have an impact on the power purchase plan. Therefore, this paper conducts a sensitivity analysis on the risk cost weight coefficient.
The setting of risk cost weight coefficient directly reflects the risk attitude of the VPP. When the risk cost coefficient is high, the VPP is more sensitive to the uncertainty of the wind and solar power output, and is unwilling to bear the risk of default in the sales of electricity caused by the actual output of the wind and solar power being lower than the expected output. When the risk cost coefficient is low, the VPP is more willing to pursue the low price of wind and solar power generation output to obtain the transaction income of over purchase and sale of electricity. Fig.18 shows the total power purchase cost of VPP under different risk cost coefficients. According to Fig.18, with the increase of risk cost coefficient, the power purchase cost and total cost of VPP gradually increase, while the risk cost gradually decreases. That is because with the increase of risk cost coefficient, the VPP will gradually increase the power purchase share of GT power generation, so the power purchase cost will also gradually increase. Due to the high cost coefficient, the same power purchase scheme, the risk cost of VPP power purchase is also higher, and the total cost of VPP power purchase is gradually increasing. From the total cost curve, when the risk cost coefficient is higher than 0.75, the increase of the total cost curve slows down, indicating that the power purchase scheme of the VPP is basically close to the most conservative value. In general, the VPP can reasonably select the risk cost coefficient between 0.25 and 0.75 according to its own risk attitude.

4) ANALYSIS ON THE EFFECTIVENESS OF THE CONTROLLER-AGENT GAME FOR GREEN CARD DISTRIBUTION
In order to further analyze the effectiveness of the controlleragent game for green certificate allocation in this paper, the quota system in literature [9] and the historical demand method in literature [10] are used to compare and analyze the distribution method of the controller-agent game in this paper. Three scenarios are as follows: Scenario 1: The quota system is used to allocate green certificates, that is, green certificates are allocated according to the electricity demand of users; Scenario 2: Use the historical demand method to allocate green certificates, that is, allocate according to the user's historical demand for green certificates; Scenario 3: The controller-agent game of this paper is used for distribution, that is, the VPP and the user start a dynamic game to realize the distribution of green certificates.
According to the above scenario, the number of green certificates allocated to different users and the net income of the VPP are shown in Table 7: It can be seen from Table 7 that when the quota system is used for green certificate distribution, IU obtains the most green certificate and AU obtains the least green certificates. This is because from the load demand of each user, IU has the largest power consumption demand. According to the quota system method, the power consumption demand is directly proportional to the green certificate distribution result, so IU obtains the most green certificates. However, because the allocation method of quota system only focuses on power consumption and ignores other factors affecting green certificate allocation, such as the impact of green certificate allocation on the income of each subject, the controlleragent game can comprehensively consider multiple factors and realize the maximum income of each subject by dynamically adjusting the strategies of each subject. Using the historical demand method for green certificate distribution, it can be seen that the number of green certificates in BU is the largest and the number of green certificates in AU is still the smallest. Although the historical demand method is highly operable, there is a certain error in replacing the future distribution results with historical data, which has an impact on the income of the VPP. Therefore, compared with the existing green certificate allocation methods, the green certificate allocation method proposed in this paper has the characteristics of dynamic, small error and large income.

5) APPLICABILITY ANALYSIS OF OTHER CASES
In order to verify the scope of application of this study, the park in literature [17] is used as the analysis object, and the basic parameters are consistent with literature [18]. At the same time, two indexes of smoothness and economy are selected to evaluate the applicability of this paper to other cases. The smoothness index is the standard deviation of Park load before and after using this model, and the economic index is the comprehensive cost of the park before and after using this model. The index results are shown in Table 8: It can be seen from Table 8 that after using this model, the load standard deviation of the park decreased from 24.88 to 20.21, with a decrease rate of 18.77%, and the comprehensive cost of the park also decreased from 53.10 dollars to 39.57 dollars, with a decrease rate of 25.48%, indicating that the model proposed in this paper can be effectively applied to other cases.

VII. RESULTS AND CONCLUSION
Based on the VPP's operation model of participating in the green certificate market and carbon trading market, this paper proposes a collaborative optimization model for VPP to participate in internal power purchase and sale transactions, green certificate transactions, and a decision-making optimization model for external multi-market coordination. The VPP is taken as an example to analyze the calculation example and get the following conclusions: (1) By coordinating and considering the decision-making optimization of VPP participating in green certificate market and carbon trading market, on the one hand, it can increase the output proportion of WT and PV generators, making the power purchase scheme of VPP cleaner and low-carbon. On the other hand, by invoking the DR of four users, the load in the low period at night is significantly increased and the load in the peak period during the day is significantly reduced, which enhances the ''peak cutting and valley filling'' effect. Therefore, the coordination and optimization of green certificate market and carbon trading market should be carried out when VPP participate in market decision-making.
(2) Since the contribution of users is inversely proportional to the real-time electricity selling price, considering the contribution of users to formulate the real-time electricity selling price can reduce the power purchase cost of users and improve the utility of users. Therefore, for different users, we should formulate differentiated power sales prices to improve the incentive of power sales prices to users.
(3) With the increase of the risk cost coefficient, the risk cost decreases, and the power purchase cost and total cost of the VPP increase. At the same time, the VPP can improve the income by reasonably selecting the risk cost coefficient between 0.25 and 0.75 according to its own risk attitude. Therefore, the VPP should select the appropriate risk cost coefficient in combination with the actual situation.
(4) Compared with the historical demand method and quota system, the controller-agent game can comprehensively consider various factors and dynamically adjust the strategies of each subject. It has the characteristics of dynamics, small error and large income. Therefore, the green certificate distribution method with comprehensive and small error should be adopted for green certificate distribution.
(5) The model proposed in this paper has strong adaptability in other cases, which can reduce the cost and smooth the load curve.