A Novel Market Clearing and Safety Checking Method for Multi-Type Units That Considers Flexible Loads

Flexible loads have flexibility and variability in time and space, and they have been widely studied by scholars. However, the research on the participation of flexible loads in market clearing and safety checking is still insufficient. We propose a market clearing and safety checking method for multi-type units that considers flexible loads. First, the flexible load is divided into reducible loads, shiftable loads, and convertible loads, and its mathematical model is established. Then, the convertible loads are considered in the market clearing model, and the power management agency executes the market clearing procedure to obtain the clearing result. When the line power exceeds the limit as a result of clearing, the power flow of the branches and sections is eliminated by adjusting the unit output and reducing the flexible load at the same time, and a safety checking model considering load reduction is established. The marginal electricity price of the nodes is obtained by the interior point method, and we solve the model by calling the CPLEX (v12.7.1) solver in GAMS (General Algebraic Modeling System v24.9.1). We use a regional power grid of 220 kV and above as an example for analysis; the results show that the proposed method can reduce the marginal electricity price of the nodes, reduce the cost of safety checking, and improve the safety of the market clearing.


Introduction
In recent years, flexible loads have become a research hotspot for scholars due to their corresponding speed, low carbon footprint, and low cost [1][2][3]. The continuous development of energy management technology has resulted in an increasing trend in the flexible load participation in demand response (DR) projects [4][5][6]. Many countries are allowing qualified, large consumers, or flexible load aggregators to participate directly in the electricity market [7,8]. In the study [9], authors propose a model for flexible aggregators flexibility provision in distribution networks, the model takes advantage of load flexibility resources allowing the re-schedule of shifting/real-time home-appliances to provision a request from a distribution system operator or a balance responsible party. In the mature stage of the spot market, the transition from the unilateral quotation to bilateral quotation mode will allow the flexible load to directly participate in the power market. In addition, due to the flexible variability in the time and space of the flexible load, the flexible load can also participate in the auxiliary service market [10,11]. Under the bilateral quotation model, how to participate in the market clearing of flexible loads and how to perform a safety checking of the power dispatching agency when the line overrun occurs as a result of the market clearing are issues that need to be resolved for the flexible load participation in the electricity market.
In order to maximize the benefits of integrated energy companies in an increasingly complex multi-participant energy market, some researchers [12] classified loads into three categories based on the elastic characteristics of the loads: reducible loads, convertible loads, and shiftable loads. The three types of loads participate in the demand response project, so that integrated energy companies get more benefits. In the work of [13], the authors proposed an innovative economic and engineering coupled framework to encourage typical flexible loads or load aggregators, such as parking lots with a high penetration of electric vehicles, to participate in the real-time retail electricity market based on an integrated e-voucher program directly. In order to integrate the flexible load in the distribution network, a new pricing mechanism was proposed in the literature [14]. The price can be calculated through the two-tier local distribution network market. Flexible load aggregators act as the price receiver, and the system operator is the manager; the proposed method can save the cost of the flexible load aggregator. Researchers have proposed a market clearing mechanism to minimize the costs (both the day-ahead and real-time adjustments) and maximize the social benefits in terms of the market clearing; this mechanism took into consideration the uncertainty of wind power generation and load forecasting [15]. Another market clearing mechanism was proposed in a different study [16], where the pricing uncertainty and generation reserve were determined by the uncertainty marginal price (UMP). At the same time, energy is priced by locational marginal price (LMP), and the uncertainty of the load is borne by the unit in the day-ahead market. UMP and LMP can be obtained through the robust optimization method. In the work of [17], the researchers adopted a two-stage market clearing method to weaken collusion among the power producers, established a causal relationship and a quantitative relationship between the bidding process of the power producers and the market clearing, and evaluated the effectiveness of the method using system dynamics.
The above-mentioned studies examined the flexible load and market clearing, and the related research is sufficient. However, there is very little research on the flexible load participation in market clearing. In the study [18], researchers assumed that users can participate in market competition (such as on the power generation) directly; they established a market equilibrium model that considered the DR and studied the impact of the DR implementation on the power market. However, in this literature, the classification of flexible loads is not specific, and the impact of flexible loads on the model is not analyzed. In order to ensure the safety of the market clearing results, the dispatching agency needs to perform the safety checking process. During the safety checking process, when the transmission line power exceeds the limit, the output of the line is generally adjusted by adjusting the output of the unit. In the safety checking of the power generation plan, the combined optimization technology is used to solve the power grid safety checking problem and the power generation plan in each time period, and it is widely used in the day-ahead market [19,20].
In this paper, we propose a market clearing and safety checking method for multi-type units that considers the flexible load. First, using the characteristics of the power load, the flexible load was divided into reducible loads, convertible loads and shiftable loads, and we created three mathematical models of the flexible load. In the day-ahead market, generators and demanders submit quotation curves separately, and so we established the market clearing model that considers the convertible loads. The power management agency executed the clearing process to obtain the clearing results; when the line transmission power breaks out as a result of clearing, the flow of the branches and sections can be eliminated by adjusting the output of the generator set and reducing the flexible loads at the same time.
The remainder of this paper is organized as follows: Section 2 discusses the three mathematical models of the flexible load and its mechanism. Section 3 includes the market clearing model that considers the convertible loads. In addition to conventional units, the model also considers the pumped storage and nuclear power units. In this section also discusses a safety checking model that considers the reducible loads. Section 4 introduces the solution method and steps of the model. Section 5 evaluates the effectiveness of the method proposed in this paper through actual cases.

Flexible Load Modeling
In this paper, the flexible load is divided into reducible loads, convertible loads, and shiftable loads. The power consumption law of the flexible load can be accurately sensed by a real-time monitoring device, and the load control technology can be used to realize the interruption and translation of the load in a specific time period. From the perspective of the demand response, the flexible load can participate in the demand side management (DSM) and DR projects of the grid by adjusting its own power demand, and it can be dynamically adjusted with the balance of the supply and demand [21][22][23][24]. When the flexible loads participate in the control and responds to the demand, the load model can be expressed as: P LD = (t, P re , P convert , P shift ) = P s (t) + P fl (t, P re , P convert , P shift ) (1) where P LD is the total load demand, P s (t) is the normal load demand, P fl is the flexible load, P re is the load demand reduction, P convert is the convertible load demand, and P shift is the translatable load demand.

Reducible Loads
The meaning of reducible loads is that the power dispatch center can interrupt the load without affecting user comfort. Typical load reductions include air conditioning loads and lighting. Its mathematical model can be expressed as follows: where ∆P re (t) is the response of the load during the t period; ∆p re is the change of the electricity price in the t period; k re (t) is the self-elastic coefficient of the load in the t period; and v re (t) is the rate of the load reduction.

Convertible Loads
Convertible loads mean that within a dispatch period, power demand can be transferred to any time, but the total amount of electricity used within one day remains unchanged. Typical convertible loads include energy storage and electric vehicle charging stations. Its mathematical model can be expressed as follows: where ∆P convert (t) is the response of the transferable load during the t period; P 0 (t) is the base load of the t period; ∆p convert (t) is the electric-difference vector between this period and other time periods; and ∆k convert (t) is the mutual elastic vector of the t period relative to other periods. The load transfer rate T is the duty cycle of the load.

Shiftable Loads
The shiftable loads refer to the loads which power supply time can be changed according to the dispatching demand, and the entire period of time is shifted within a one-day scheduling period, such as when users are utilizing a washing machine or a water heater, or some large industrial users that are producing. The shiftable loads can be divided into multiple categories, according to the amount of electricity consumption and the duration of electricity consumption. Figure 1 shows the schematic diagram before and after the transfer of three different shiftable loads. During the transfer process, the power supply duration and power supply of the same shiftable load remain unchanged. Compared with the convertible loads, the power supply duration of the shiftable load is continuous, and the power supply within this period remain unchanged. Its mathematical model can be expressed as follows: where ∆P shift (t) is the response of the shiftable loads during this period; f 3 (t) is its initial power consumption curve; and ∆t(∆p) is the duration time.

General Framework
The flexible load aggregator is an organic combination of multiple types of flexible loads. Through the energy management center, it participates in power grid operations and market transactions as a stakeholder. Flexible load aggregators determine the optimal bidding curve by maximizing their own interests. Figure 2 shows a schematic diagram of flexible load aggregators participating in the market composed of electric vehicles, temperature-controlled loads and distributed energy storage as typical flexible loads. The classification of flexible loads is conducive to the precise control of the power management department and to the flexible role of flexible loads. The framework of the market clearing and safety checking method in this paper is shown in Figure 3.

Business Process
Flexible loads participate in grid interaction through demand response, which can generally be divided into two basic modes: price-based demand response and incentive-based demand response. Price-based demand response refers to the behavior of users voluntarily avoiding high electricity prices to low electricity prices under the stimulation of electricity price signals; incentive-based demand response refers to users signing agreements with the grid side in advance in order to obtain economic compensation by accepting the direct control or interference control of electricity consumption from the grid side. The above operation requires the user to negotiate with the grid side in advance in the interactive contract to obtain appropriate data. The process is shown in Figure 4. The implementation of flexible load response projects should follow the principles of "safety, reliability, fairness, equality, openness, and transparency". Safety and reliability are the primary principles to be followed in the construction and implementation of demand response capabilities. It is necessary to ensure the stable and reliable operation of the power grid and the safe operation of enterprises; the principle of fairness and equality guarantees the effective development of demand response work, in strict accordance with relevant laws during the implementation process. The policies and agreed rules are implemented fairly and fair to all participating users; the principle of openness and transparency guarantees the continuous advancement of demand response work, the rules of participation are simple and clear, open to the society, and the majority of users are encouraged to participate voluntarily. During the implementation of demand response organization, choose a reasonable response range and capacity to ensure a basic balance between the peak electricity price increase fund and the power demand response subsidy expenditure. The process of flexible load participation in demand response is shown in Figure 5.

Market Clearing Model that Considers the Convertible Load
In the traditional power-dispatching model, the power producers need to fully generate power according to the dispatching instructions [25]. However, in the power market environment, the dispatching instructions must meet the needs of the power producers and the demand of the power load [26]. The electric load can be divided into the conventional load and the flexible load, and the conventional load can participate in the market bidding. The flexible load can increase the flexibility of the load by changing the demand for electric power. However, the flexible load cannot fully participate in the power adjustment, and the most basic power demands must be meet. The proportion of the flexible load participating in the market can be calculated by the following formula: where P fl and P s represent the flexible load and the normal load, respectively. Due to the limited share of flexible load in the market, the scale factor x ranges from [0, θ] and the value of θ does not exceed 0.3.

Generator Bidding
In a period T, the cost of the generator i ∈ S G is assumed to be a quadratic curve [27]: where P Gi,t is the actual output of the generator, a i and b i are the quadratic coefficient and the primary coefficient of the cost curve of the generator, respectively. The power producer quotes according to the marginal cost, and uses the quotation strategy coefficient k Gi,t to affine the marginal cost function, and the quotation curve can be expressed as: 3.

Demand Side Bidding
In a period T, the benefit function of the demand side j ∈ S L can be expressed as: where α j and β j are the quadratic coefficient and the primary coefficient of the benefit function, P L j,t is the power demand of the load node. In the same way as the power producer, the demand side participates in the market bidding by adjusting the quotation strategy coefficient k Li,t , and the submitted quotation curve is:

Market Clearing Model
In this paper, the demand side is divided into the normal load and flexible load. The corresponding benefit functions are B(P L ) and B(P FL ), respectively. The difference between the demand side benefit and the generator cost C(P G ) is the social welfare. From the perspective of the power market clearing, the purpose of electricity trading center is to maximize the social welfare. Therefore, the objective function is the maximization of the social welfare, and it can be expressed as: max P G ,P L ,P FL where P G , P L , and P FL are respectively the power generation output power, the conventional load demand, and the flexible load demand. Moreover, α FL j and β FL j are the quadratic coefficients and the primary coefficients of the flexible load benefit function, respectively. The clearing model that considers the convertible load needs to consider the transferable load constraint in addition to the conventional power balance constraints, network security constraints, and related constraints of the generator set. The transferable load does not change the total amount of electricity used in 1 power cycle, but the power consumption in each period can be flexibly adjusted.
(1) System power balance constraint − i∈S G, j∈S L B ij θ ij = P Gi,t + P Ci,t + P Hi,t − P L j,t − P FLj,t where P Gi,t is the output of the conventional generator set, P Ci,t is the output of the pumped storage unit, P Hi,t is the output of the nuclear power unit, P Lj,t is the load of the conventional user, and P FL j,t is the load of the flexible load. When the power system is running, the power system power balance must be guaranteed. The pumped-storage generator set generates electricity when the electricity price is high during peak hours and transmits power to the grid; it draws water during the low-voltage period and consumes electricity. In one day, the sum of the power generation and electricity consumption is zero. The output of the nuclear power unit is stable, and its output in each period is considered constant, P H0 .
(2) Upper and lower limits of the unit where, P i,t is the output of the unit in this period, which satisfies the upper and lower limits of the unit output. P min i and P max i are the minimum and maximum output of the unit, respectively.
(3) Climbing constraint of the unit where ∆P Gi,t,up and ∆P Gi,t,dw are the maximum up/down climbing power of unit. In two adjacent time periods, the climb rate of the unit must meet the minimum and maximum climb constraints.
(4) Convertible load constraint In a period T, the total electricity consumption of the convertible load remains the same, satisfying the convertible load total constraint and the transferable load transfer interval constraint: P con, j,t = TP con,j −τ%P con,j ≤ ∆P con,j,t ≤ −τ%P con, j t ∈ T con,j (14) where ∆P con,j,t is the transfer amount of the convertible load at the time T of the node j. If it is positive, the load is transferred to time T, and if it is negative, the load is transferred from time T. The first equation is the transferable load total constraint, the second inequality is the upper and lower bounds of the transfer amount, and T con, j is the convertible interval.

Safety Checking Model That Considers the Reducible Loads
The market clearing model aims to maximize the social welfare, but in the pursuit of maximizing profits, it will inevitably lead to a reduction in the system's security. To ensure that the power flow of the line does not exceed the limit, it is usually directly in the clearing model that considers the line safety constraint, to ensure the security of the line transmission. However, this method makes the clearing model very complicated and it is difficult to ensure the efficiency of solving the model [15,28,29]. In this paper, the market clearing process of this article actually includes two stages, the first stage does not consider the line safety constraints, and the second stage is the safety checking process considering safety constraints. In both stages, flexible loads are considered. Moreover, in the safety checking process, by simultaneously adjusting the output of the unit and reducing the load, the problem of power overrun is eliminated. This method divides the complex market clearing into two simple steps and uses the optimization algorithm to adjust the power generation output and the load reduction to eliminate the trend limit of the branch and section.
When using the mathematical optimized method to conduct the safety checking on the clearing result, it is necessary to establish an optimization model, and the unit adjustment amount and the load reduction amount can be used as the decision variables. The goal is to minimize the sum of the unit adjustment cost and the flexible load reduction cost. The objective function is: where C(∆P G ) and C(P F ) are the generator set adjustment cost and the flexible load reduction cost, respectively. The unit adjustment cost can be expressed as: The flexible load reduction costs can be expressed as: where δ i and γ i express the cost factor of the unit adjusting and load reducing, respectively; here δ i = 10γ i . The constraint conditions consider the adjustment amount and the reduction amount of the balance constraint, the unit adjustment upper and lower limit constraints, the load reduction constraint, the line upper and lower limit constraints and the power distribution factor constraint.
(1) Balance between the adjustment and reduction where ∆P Gi is the adjustment amount of the unit output, and P F j is the flexible load reduction amount; in an ideal case, the flexible load reduction amount is equal to the unit output adjustment amount.
(2) Upper and lower limit constraints before and after the unit adjustment. (19) where P 0 Gi is the original output of the unit, and the sum of the output before the adjustment and after the adjustment must meet the upper and lower limits of the unit.
(3) Upper and lower limit constraint of the line transmission power.. (20) where P max l is the maximum value of the line transmission power, P l0 is the transmission power of the line before the safety checking, and ∆P l is the adjustment amount of the line transmission power after the safety checking.
(4) Reduce load constraints. P Fi,min ≤ P Fi ≤ P 0 Fi (21) where P Fi,min is the minimum power demand for the flexible load and P 0 Fi is the original fixed power demand for the flexible load user.

(5) Power distribution factor constraints
where p l,i is the power distribution factor of line l with respect to ∆P G,i , q l,i is the power distribution factor of line l with respect to the flexible load reduction amount P Fi0 − P Fi , and ∆P l is the adjustment amount of the line transmission power after the safety checking.
In the process of safety checking, the power dispatch center implements the load reduction plan and needs to provide compensation fees F to the load reduction users. The compensation fee F = C(P F ) in this paper is shown in (17).

Linearization of the Cost Function
In GAMS, nonlinear functions can be linearized by defining the SOS2 variables. The SOS2 variables consist of λ i (i = 1, 2, · · ·, n + 1) elements, with up to two non-zero elements in λ i , and satisfies λ 1 + λ 2 + · · · + λ n+1 = 1. Suppose the fractional linear function f (x) can be equally divided into linearized n segments on [a,b], and a = x 1 < x 2 < · · · < x n+1 = b are n + 1 segmentation points [30,31]. The starting point of the paragraph i can be expressed as: Assuming ( x, y) is a point in the segment i, and x = λ i x i + λ i+1 x i+1 , λ i , λ i+1 satisfies λ i + λ i+1 = 1, then the linear approximation of y can be written as: Using the above method, the quadratic cost function in the objective function is linearized.

Market Clearing and Safety Checking Process
The method proposed in this paper can be divided into two stages. The first stage is the market clearing, which considers the convertible load during the market clearing; when the line transmission power is overrun in the clearing result, the second stage of the process is performed. By adjusting the output of the unit and reducing the flexible load at the same time, the purpose of eliminating the out-of-limit line flow is achieved. The safety checking can further ensure the safety of the market clearance. The specific process is shown in Figure 6.
The solution steps are as follows: Step 1: Input unit data, line parameters, and other data. The generator and the demand side submit the quotation curve, and dispatch department execute the market clearing process. Then, initial power generation plan is formulated.
Step 2: Start the power flow calculation program to determine whether the power flow exceeds the limit. If it does not exceed the limit, end the calculation and output the power generator output; otherwise, proceed to the next step.
Step 3: Output the over-limit line number and over-limit power.
Step 4: Start the safety checking module, execute the safety checking procedure, calculate the generator adjustment of the generator, and reduce the load to reduce the power.
Step 5: Output the power of the generator and reduce the power by reducing the load. The market clearing model discussed in this paper is a nonlinear programming model. After linearizing it, it is solved by calling the CPLEX solver in GAMS.

Basic Date
Here, we use a 220 kV and above line of a regional power grid as an example. There are 73 nodes and 93 lines in the regional power grid, including 5 thermal power plants, 1 pumped storage power plant, and 1 nuclear power plant. In addition, the external electricity is injected into the 1st node and 68th node, and these two nodes are regarded as units with adjustable output. The relevant parameters of the power plant are shown in Table 1. The network diagram is shown in Figure 7. Taking the typical daily load curve of summer in 2018, as an example, 85% of them are fixed loads to ensure basic electricity demand, 11.03% of the electricity demand is determined by participating in the market, and another 4.97% of the transferable load, the load curve, and the proportion of flexible load are shown in Figure 8.   The spot market is based on the trading days, and each trading day can be divided into 24 or 48 time periods. Taking 24 time periods as an example, each trading time period is one hour. The market organizer is responsible for organizing the bidding and trading of the spot market, collecting the quotation information of both parties, and determining the transaction result. This example uses a bilateral quotation as an example. The bidding parties submit their quotation curves separately, as shown in Tables 2 and 3. The quote parameters in Tables 2 and 3 are randomly selected.

Market Clearing
Based on the above data, we used two schemes to verify the impact of the flexible load on market clearing.
Case One: The market clearing model does not consider the flexible load, and the power consumption behavior of the flexible load does not change.
Case Two: 4.97% of the transferable load participates in the market clearing, and the transferable load can change the power usage behavior according to the cost of the electricity.
The marginal electricity price of a node is defined as the increase of the 1 MW load at the node. Under the premise of ensuring safety, the minimum production cost of the system can be obtained through the optimization model of market bidding [32]. The node's marginal price can be obtained by solving the Lagrange function, and the definition of the node's marginal electricity price can be applied in the market clearing model [33,34].
By comparing the two schemes, the impact of the flexible load on the market clearing model can be analyzed.
From Figures 9 and 10, we can know the marginal node electricity price of the market clearing. The difference is that Figure 9 does not consider flexible loads, and Figure 10 considers flexible loads. The results show that the node electricity price can be obtained successfully, and it is very close to the actual electricity price, which has great engineering application value.  When the convertible load is not considered, the highest price of the node is 0.832 yuan/kWh, and the lowest price is 0.704 yuan/kWh. Considering the participation of the convertible loads, the highest electricity price in all aspects is 0.813 yuan/kWh, and the lowest electricity price is 0.712 yuan/kWh. Therefore, the participation of the convertible loads in the market can clearly reduce the electricity price and reduce the peak-to-valley electricity price difference in the market. This result is in line with expectations, because the flexible load itself is economical.
During the market clearing process, the users of convertible loads are shifted and allocated to the time when the cost of electricity is lower. Because of this, the load curve will change, and the convertible load during the peak period of power consumption will shift to the lower period.
The load curve after the market clearing is shown in Figure 11. The peak-to-valley difference of the initial load is 33.71%. Compared with the initial load, the peak-to-valley difference of the load curve is reduced by 11.40%. This article is aimed at a specific urban power grid, which has a high proportion of load density. In other high-density load cities, the load characteristics have similar properties to the urban power grid. The research in this paper can be extended to similar urban power grids, which can effectively alleviate the challenges to the supply of electricity and improve the load curve. Figure 11. Load curve after the market clearing.

Safety Checking
In the safety checking of the power grid, the participation of the load reduction should be considered, and the maximum reduction is 20% [14]. As shown in Figure 12, the 76th line exceeds the limit, and the limit is 196 MW. In order to ensure the safety of the line flow, two cases were adopted. The cases are described below. The first case does not consider the participation of flexible loads and directly performs safety checking and correction through unit adjustment.
The second case considers that the load can be reduced to participate in the safety checking and correction. The load that can be reduced accounts for 10.09% of the total load.
The safety checking operation of the 76th line was carried out in the above two cases. We now analyze the differences between the two cases.
Based on the above data, the safety checking line power flow results obtained in Cases 1 and 2 are shown in Figure 13. The diagram shows that both cases can ensure that the line flow does not exceed the limit and can ensure the safe operation of the network; the transmission power of the line does not exceed its upper and lower limits. The output adjustment results of the two cases are shown in Table 4. Table 4 shows that power plant 52 in Case Two emits 5.61 MW more power than Case One, and power plant 63 in Case One emits 137.89 MW more power than Case Two. The reason is that the reducible loads can participate in the safety checking in Case Two, and balance the power plant output by reducing the flexible load. The adjustable amount of the reducible load results in Case Two are shown in Figure 14. The total amount of the reducible load after the reduction can be seen, where the total reduction in the flexible loads is 132.28 MW, which makes up for the power shortage of Unit 2 in Case Two.
From the above analysis, we know that the reducible load has a rapid response. By reducing the load and participating in the safety checking, the adjustment amount of the generator set can be reduced. In this way, the role of load reduction can be brought into full play, and the number of start-stops of the unit can also be reduced.

Economic Analysis
In order to reflect the impact of the flexible load on the safety checking, the safety checking costs of the two cases are compared in Table 5. The unit adjustment cost of the second case is less than that of the first case, mainly because it can reduce the load and make up the adjustment task of the unit, reducing the unit adjustment cost, and the load loss of the second option is lower than the unit output adjustment cost.  Table 5 shows that the total cost of the safety checking for the second case is smaller than the first case, and the cost savings are about 11,200 yuan. Table 6 reflects the impact of the load reduction on the safety checking. It can be seen from the table that the reducible load participates in the increased capacity that can increase the safety checking power adjustment.

Conclusions
The paper proposed a market clearance and safety checking method for multi-type units that considers flexible loads. A market clearance model that considers the convertible loads and a safety checking model that considers the reducible loads were established. The safety checking can further eliminate the out-of-limit flow of the branches and sections and ensure the safety of the market clearing. A case study of a 220 kV and above power grid was used to analyze the results. The results show that the convertible loads participating in the market clearing can reduce the node's marginal electricity price and reduce the peak and valley electricity price. Reducible loads participate in the safety checking, compared with the single adjustment of the power of the generator set, the power adjustment amount of the generator set is reduced; at the same time, the cost of safety checking is reduced. However, in engineering applications, the establishment of a reasonable incentive/price mechanism is the prerequisite for guiding flexible loads to participate in market clearing and safety checking. In the next study, in-depth research will be conducted on this issue.