Transactive Demand Side Management Programs in Smart Grids with High Penetration of EVs †

: Due to environmental concerns, economic issues, and emerging new loads, such as electrical vehicles (EVs), the importance of demand side management (DSM) programs has increased in recent years. DSM programs using a dynamic real-time pricing (RTP) method can help to adaptively control the electricity consumption. However, the existing RTP methods, particularly when they consider the EVs and the power system constraints, have many limitations, such as computational complexity and the need for centralized control. Therefore, a new transactive DSM program is proposed in this paper using an imperfect competition model with high EV penetration levels. In particular, a heuristic two-stage iterative method, considering the inﬂuence of decisions made independently by customers to minimize their own costs, is developed to ﬁnd the market equilibrium quickly in a distributed manner. Simulations in the IEEE 37-bus system with 1141 customers and 670 EVs are performed to demonstrate the effectiveness of the proposed method. The results show that the proposed method can better manage the EVs and elastic appliances than the existing methods in terms of power constraints and cost. Also, the proposed method can solve the optimization problem quick enough to run in real-time. Choi propose a new transactive DSM program for high penetration levels of EVs using an imperfect competition model. Hao Liang and Lennart Söder check the ability of the method to overcome the limitations and impractical assumptions of existing works, such as high computational complexity due to power system constraints and need for centralized control. of Interest: interest.


Introduction
The conventional transportation system, just like the conventional power system, consumes a massive amount of energy and produces an enormous amount of greenhouse gases [1]. Therefore, electrical vehicles (EVs) interactively working in smart grids (SGs) having renewable energy sources can be an effective and practical solution to reduce the greenhouse gas emissions and the energy cost. However, supplying the energy demand of EVs, while their penetration level is predicted up to 60% by 2040 [2], has a major impact on the power systems [3] and magnifies the importance of demand side management (DSM) programs.
The DSM programs include all activities that alter the demand profile of customers from their normal consumption patterns in response to incentive payments designed to match the supply profile [4]. In particular, customer motivation methods in DSM programs have a major role in the customers' participation. Generally, the motivation methods can be divided into two main categories: incentive-based and time-based. The incentive based methods offer payments to customers who reduce their electricity usage during the times of system need or stress [5]. However, the task of determining the amount of reduction is complex and imprecise [6]. On the other hand, the time-based methods change the price of electricity based on the time of use to encourage customers to consume electricity during off-peak hours [7]. Some popular time-based methods are a flat rate (FR), time of use (TOU), and real-time pricing (RTP). In FR, the energy price, which is fixed during a day, may change for different seasons. In TOU, the energy price is varied during different hours of a day. However, since the price during each time interval is independent of the real-time behavior of customers and each customer can decide individually, it is possible that many customers decide to use electricity during off-peak hours simultaneously. This can cause an undesirable new (rebound) peak [8,9]. In order to prevent this problem, retailers must determine the price of each time interval based on the real-time consumption. However, implementation of RTP methods requires complicated computational process and two-way real-time communication for determining the optimal price due to nonlinear multi-variable equations [10]. We reviewed DSM program in SGs [11] and identified limitations and remaining challenges: (1) The technical constraints of the power system need to be considered. EVs considerably increase the electricity demand and have significant influences on the power system. The adverse effects of high penetration level of EVs on the power grid when they charge themselves in the grid to vehicle (G2V) mode are briefly reviewed in [3]. However, in the vehicle to grid (V2G) mode, active and reactive power injected to the network by EVs, if controlled well, can decrease the peak power [12] and provide ancillary services [13] instead of causing adverse effects. Therefore, although most of existing DSM programs neglect the technical constraints of the power system to simplify mathematical calculations [11], considering the technical constraints is critical for practical deployment of future power systems. (2) Individual benefit of each customer needs to be taken into account. If whole network welfare is selected as a goal function, customers may be discouraged from participating in the DSM program. A multi-agent framework is proposed in [14] to minimize the electricity bill of each household while considering the piecewise linear function for each customer's cost. Still, this method neglects the influence of customers' decision on each other and so it cannot prevent rebounding peaks. (3) Indirect control methods are needed to give decision authorities to the customers. Generally, DSM programs can be categorized into two types based on the control method used: direct and indirect. In direct control methods, elastic loads, including EVs, are directly controlled by a central entity of aggregators or retailers in their region. On the other hand, in indirect control methods, customers make their own decisions on elastic loads. Here, the job of the retailers is to indirectly lead customers to the desirable optimum by changing the price electricity or giving incentives to them. Since direct methods can relatively better handle the uncertainties associated with charging of EVs, e.g., departure or arrival times, most of the researchers prefer direct methods. For example, the demand peak is minimized by directly controlling EVs in [15], the cost of the whole network is decreased using a day-ahead pricing model in the presence of EVs in [16], and the direct charging and discharging method is developed to sell spinning reserve in the wholesale market in [17]. However, the common problem of direct methods is that they take away the decision authority from customers, which may decrease the popularity and security of DSM programs [18]. Therefore, indirect methods are more promising as they are more likely to lead to consumer's acceptance than the direct methods [19]. An indirect scheduling algorithm for EVs having an experimental demonstration at the National Technical University of Athens is presented in [20]. Although in indirect methods implementing, considering the effects of other customers' decision is crucial. For instance, in a real system, since all customers want to optimize their own cost, they may make similar decisions, simultaneously and/or collectively, to produce a major impact on the power system known as an avalanche effect [19] or a rebound peak [8,9].
(4) Imperfect competition model needs to be used to more accurately model the effects of independent customers. There are two models for competitive markets: perfect and imperfect. The perfect competition model assumes that the market price is not dependent on the decision of each participant. This model is relatively simple and many researchers adopt this model. However, an independent price may lead to rebound peaks. On the other hand, an imperfect competition or oligopoly model can be used to consider the effects of all customers' decisions. In particular, Cournot competition model, which is an oligopoly model used to describe a market with multiple players competing for production, can be used to independently maximize their profit given their competitors' decisions [21]. However, since using this model on a system having many participants increases the complexity of the problem, some simplification or approximation is necessary to have a feasible problem. In this direction, the authors of [22] used Cournot competition to model a dynamic price for an intelligent building without EVs and made some simplifying assumptions, such as linear inverse demand curve or having exclusive energy storage device, to solve their problem. This however limits the practicability of their approach.
Learning from the limitations of the existing methods, an indirect RTP based method with two-way communications, called a transactive control method [23], is suggested to be the state of the art approach to manage demand in SG and solve the above mentioned challenges. The proposed method considers the technical constraints of the power system and in the same time by implementing imperfect competition model takes each customer individually decision into account. One of the major challenges of implementing transactive control methods with an imperfect competition model is the complexity of the optimization problem, as will be explained in section II. Therefore, in this paper, we propose a new heuristic two-stage iterative method that can quickly find the optimal power of each customer in a decentralize manner such that the cost of each customer is minimized and the technical constraints of the power system are also satisfied. The main contributions of this paper, in relation to the identified challenges, are summarized as follows: • Solving the first challenge: Technical constraints of the power system are considered to prevent rebound peaks.

•
Solving the second challenge: Customer participation is encouraged by minimizing the cost of each customer instead of the whole network. • Solving the third challenge: Use of indirect method gives decision authorities to customers. • Solving the fourth challenge: Cournot imperfect competition model takes into account the effect of decisions made by individual customers.

•
Solving the implementation difficulties: The proposed heuristic two-stage iterative method solves the non-linear optimization problem quick enough for real-time operations.
The rest of this paper is organized as follows. The mathematical modeling of the transactive DSM program is presented in Section 2. The proposed method is presented in Section 3. The simulation network and results are detailed in Section 4. Finally, the conclusions are presented in Section 5.

Problem Formulation
In our transactive DSM program, the cost of each customer is minimized by scheduling appliances and EVs in such a way that the influence from other customers based on the Cournot oligopoly model is reflected and the system constraints are satisfied. There are two basic types of loads: inelastic loads, which cannot be shifted, such as lightings, and elastic loads, which can be shifted, such as EVs.

Power System Model
The real-time market price (π(t)) is updated based on the total real-time power consumption of all customers based on Cournot model in each time interval as follows: where n is the number of customers; P ie,i , P e,ik , and P EV,i are the active power of inelastic loads, the k-th elastic appliance, and EV load of the i-th customer, respectively; n e,i is the number of the i-th customer's elastic appliances; P loss is the power loss of the system; which can be calculated as [24]: where |V| and δ are the magnitude and phase of the bus voltage; m is the total number of network buses; and |Y| and θ are the magnitude and phase of the admittance matrix, respectively. The voltage of all buses can be calculated from nonlinear power flow equations as described in the literature and the backward/forward sweep method [25] is used. In (1), S is the supply function of the power grid, which gives the cost of the supplied energy for the power grid. It can be calculated from the marginal cost of all generators same as the existing electrical market, e.g., the pool market. Since this paper focuses on the demand side management, the supply management is not the concern of this paper; the supply function, without losing the generality of the method, will model by a given function in simulation section.
The proposed method considers constraints from both the power network and customers. The overload of power lines and voltage regulation constraints are as follows: where I k is the magnitude of the k-th branch current; I k,max is the k-th branch capacity; V min and V max are the minimum and maximum levels of the network voltage, respectively. Each customer also has a specific maximum allowable apparent power (S max,i ). Therefore, the total consumption of the i-th customer in each time interval should satisfy the following constraint: where Q ie,i , Q e,ik , and Q EV,i are the reactive power of inelastic loads, the k-th elastic appliance, and EV load of the i-th customer, respectively.

Electrical Vehicle Model
Charging and discharging of an EV is limited by the maximum capacity of the convertor and battery. The input power of an EV should be kept between the maximum charging capacity (p max,ch,i ) and the maximum discharging capacity (p max,dch,i ) as: In addition, the state of charge (SOC) of the battery for each time interval is calculated as: where η ch and η dch are the charger efficiency in G2V and V2G mode, respectively; and S G2V is a binary state variable that equals to 1 in G2V mode and equal to zero otherwise. The SOC should reach the desired value (SOC d,i ) before the EV's departure time (t d,i ) and must be between the minimum value (SOC min,i ) and the maximum value (SOC max,i ) as: Lastly, the degradation cost is another important factor for EVs. In the V2G mode, when EVs inject some active power to the network, batteries are used more than during their normal condition, which reduces the lifetime of the batteries [26]. The degradation cost (C d,i ) is finally added to EVs cost function as: where r b is the degradation coefficient based on $/kW, and Cost EV,i is the cost of the i-th EV.

Elastic Appliances Model
The main difference between elastic appliances and EVs is that the appliances have a continuous operation period. In other words, they continue their operation until their given task is done. Under this condition, each customer needs to determine the optimum starting time of elastic loads (t 0,ik ) that minimizes the cost. As the task should be finished before the desired finishing time (t end,ik ), the starting time should be selected as: where t is the present time; t d,ik is the operation duration of the k-th appliance of the i-th customer.
Since the appliances have a continuous operation period, the cost for the whole periods is considered. Therefore, the elastic loads' cost of i-th customer in time t can be calculated as: More details about elastic appliances model can be found in [27].

Transactive DSM Model
Finally, the optimization problem of the transactive DSM program using the Cournot oligopoly competition model considering the effect of other consumptions in the market price can be formulated as: Power flow equations , where π P (τ) is the predicted energy price for future time intervals. There is two main terms in (13): the first term is the energy cost of i-th customer in the current time interval (t); the second term is the energy cost of the customer in the future time interval for elastic appliances, which start to work in the current time interval but finish their task later. The current price is calculated from Cournot model, while the price of the future time interval should be predicted. It is worth mentioning that since customers cannot change the inelastic loads, the cost of providing energy for inelastic load excluded from the optimization problem. However, the effect of the inelastic consumption in energy price is considered in the supply curve (S). The equilibrium point (i.e., real-time price) of the network can be calculated from solving the above optimization problem (13) by each customer, simultaneously. In order to solve this optimization problem, each customer first needs to predict its own consumption for the future time intervals and estimate other customers' consumptions in the present time interval and for the future time intervals. Note that, this is a nonlinear non-convex multi-objective optimization problem with many variables, and it is complicated to be solved in this form. So, in the next section, a heuristic two-stage iterative method that can quickly calculate the equilibrium point of the network is proposed.

The Heuristic Two-Stage Iterative Method
In order to solve the optimization problem of the transactive DSM program (13) in a distributed approach, a heuristic two-stage iterative method is proposed. In the first stage, each customer solves a modified optimization problem that focuses on quickly finding the optimal power consumption of EVs and elastic loads. Although this modified optimization problem does not consider other constrains, such as the power network constraints and the dependency of price due to other customers, they are later compensated in the second stage. The second stage gathers results from all customers and calculates the whole network states and updates the price and compensates the modifications made in the first stage by an iterative algorithm to approach the equilibrium point. Figure 1 depicts the outline of the proposed heuristic two-stage iterative method. where π P (τ) is the predicted energy price for future time intervals. There is two main terms in (13): the first term is the energy cost of i-th customer in the current time interval (t); the second term is the energy cost of the customer in the future time interval for elastic appliances, which start to work in the current time interval but finish their task later. The current price is calculated from Cournot model, while the price of the future time interval should be predicted. It is worth mentioning that since customers cannot change the inelastic loads, the cost of providing energy for inelastic load excluded from the optimization problem. However, the effect of the inelastic consumption in energy price is considered in the supply curve (S). The equilibrium point (i.e., real-time price) of the network can be calculated from solving the above optimization problem (13) by each customer, simultaneously. In order to solve this optimization problem, each customer first needs to predict its own consumption for the future time intervals and estimate other customers' consumptions in the present time interval and for the future time intervals. Note that, this is a nonlinear non-convex multi-objective optimization problem with many variables, and it is complicated to be solved in this form. So, in the next section, a heuristic two-stage iterative method that can quickly calculate the equilibrium point of the network is proposed.

The Heuristic Two-Stage Iterative Method
In order to solve the optimization problem of the transactive DSM program (13) in a distributed approach, a heuristic two-stage iterative method is proposed. In the first stage, each customer solves a modified optimization problem that focuses on quickly finding the optimal power consumption of EVs and elastic loads. Although this modified optimization problem does not consider other constrains, such as the power network constraints and the dependency of price due to other customers, they are later compensated in the second stage. The second stage gathers results from all customers and calculates the whole network states and updates the price and compensates the modifications made in the first stage by an iterative algorithm to approach the equilibrium point. Figure 1 depicts the outline of the proposed heuristic two-stage iterative method.  Proposed heuristic two-stage iterative method to solve transactive DSM optimization problem.

First Stage: Customer Side
In the first stage, customers minimize their own cost with a given market price (π d (τ)) considering the local constraints. Therefore, the optimization problem of (13) transforms to (14) as follows: Although the optimization problem of (14) is much easier to solve than (13) and some of the existing optimization methods can be used to solve this problem, a heuristic method can be used to find the optimum solution of (14) quickly, so that it can be implemented on simple computing devices such as smart meters. As the elastic appliances operate until their task completion, each smart meter first finds the optimal starting time of all elastic appliances and then determines the optimal power of EVs. Then, in the second stage, the market price for a given time interval τ is updated considering the network constraints and the effect of each customer to other customers.

Scheduling Start Time of Elastic Appliances
In order to schedule different appliances, a higher priority is given to the appliance that needs to finish its task sooner than others. In other words, the earliest deadline first (EDF) method, which is a traditional real-time scheduling in the field of computing systems [28] is used. For this purpose, the plugged elastic appliances of the i-th customer are ordered from the earliest desired completion time. Then, the starting time of each appliance (t 0,ik ) is selected, sequentially, in such a way that the cost becomes minimum. Here, in order to determine t 0,ik , the electricity cost of the task for different starting times is calculated and the cheapest one that satisfies (5) is selected. Note that if the algorithm decides to turn on an appliance, the active and reactive consumption of the appliance should be taken in to account during the scheduling of other loads. Algorithm 1 details the scheduling of elastic appliances.

Scheduling Charging and Discharging of EVs
Determining the optimal charging and discharging power of EVs has two substages: the first sub-stage only investigates the G2V mode, while the second sub-stage adds the effects of V2G mode.
In the first sub-stage, the net energy that should be charged in the i-th EV's battery (E t,i ), can be obtained as: where SOC 0,i is the initial state of the i-th battery when it connects to the grid. In order to minimize the energy cost, EVs should be charged in the time intervals with low prices as much as possible. Therefore, the algorithm orders the time intervals from the lowest price to the highest price, then assigns E t,i to each time interval in the order of the list. In each time interval, p EV,i (t) is calculated to satisfy all EV's constraints as follows: After assigning some power to the interval with the lowest price, E t,i and p max,ch,i (t) are updated as follows: here, if E t,i new is greater than zero, the interval with the next lowest price is determined and repeated until E t,i new becomes zero. At the end of the first sub-stage, the battery's SOC is calculated from (7).
Hence, the first sub-stage of the proposed algorithm guarantees that each EV minimizes its cost considering all local constraints in G2V mode.
In the V2G mode, EVs can utilize energy stored in their batteries to also sell their stored energy during high price time intervals and replace it during lower price time intervals. This task could be beneficial to the EV owner only when the difference between these prices is larger than the cost of the loss of charging/discharging processes and the cost of battery degradation. The profit gained from this process, by selling some energy in time interval t h and buying the equivalent amount of energy in time interval t l , is calculated as: where p sell hl is the amount of energy that i-th EV sells in interval t h according to all EV's constraints and is calculated as: The maximum and minimum SOC of the battery in all time interval, the maximum charging and discharging power of the battery, and the maximum demand of the customer limit the amount of the energy that an EV can sell [29]. All of these constraints considering the charging and discharging efficiency are considered in (20).
Then, all possible combination of gains (t h − t l ) are ordered from the largest. Then, p EV,i , p max,dch,i (t h ), and p max,ch,i (t l ) are repeatedly updated from the list until Profit V2G,i hl > 0 as: p EV,i (t l ) = p EV,i (t l ) + p sell hl /(η ch .η dch ).
Also, SOC of the battery is updated from (9). Algorithm 2, explains the heuristic method to optimize the EVs power. Calculate P EV,i (t) using (16). 5: Update E t,i and p max,ch,i (t) using (17) and (18). 6: Calculate the SOC for all intervals from (7). 7: Order all possible combinations of (t h − t l ) (in decreasing order). 8: While Profit V2G,i hl > 0 do (sequentially from the list created in line 7) 9: Calculate Profit V2G,i hl using (19) and (20).

Second Stage: Grid Side
The aim of the second stage is to find the equilibrium point. For this purpose, our algorithm first calculates the supply price (π s ) for the total power from the supply curve. If π s matches the demand price (π d ), then the equilibrium point (π*) is reached. Otherwise, the algorithm updates the new price to be used in the next iteration to approach the equilibrium point.
Generally, in a rational power market, a supply curve is a non-decreasing function and a demand curve is a non-increasing function. The intersection of these two curves is the equilibrium point as illustrated in Figure 2a. Therefore, if π s is greater than π d , the price of the equilibrium point is also greater than π d , and vice versa. The proposed algorithm uses this idea and bisects the difference between these two prices (i.e., π s − π d ) to find the equilibrium point. Algorithm 3 details the procedure of updating the new price (π new ) for the next iteration. In this algorithm, π min and π max are the upper and lower limit of the equilibrium price, respectively. The convergence of this algorithm is proved in appendix.
Also, SOC of the battery is updated from (9). Algorithm 2, explains the heuristic method to optimize the EVs power. Calculate PEV,i(t) using (16).

Second Stage: Grid Side
The aim of the second stage is to find the equilibrium point. For this purpose, our algorithm first calculates the supply price (πs) for the total power from the supply curve. If πs matches the demand price (πd), then the equilibrium point (π*) is reached. Otherwise, the algorithm updates the new price to be used in the next iteration to approach the equilibrium point.
Generally, in a rational power market, a supply curve is a non-decreasing function and a demand curve is a non-increasing function. The intersection of these two curves is the equilibrium point as illustrated in Figure 2a. Therefore, if πs is greater than πd, the price of the equilibrium point is also greater than πd, and vice versa. The proposed algorithm uses this idea and bisects the difference between these two prices (i.e., πs − πd) to find the equilibrium point. Algorithm 3 details the procedure of updating the new price (π new ) for the next iteration. In this algorithm, πmin and πmax are the upper and lower limit of the equilibrium price, respectively. The convergence of this algorithm is proved in appendix.   If π i < π i+1 then π min = min(π min , π i ) 3: If π i > π i+1 then π max = max(π max , π i ) 4: π new = (π min + π max )/2 Since in the proposed method, the price of energy for each customer can change their consumption, the price of different nodes can be altered to have more control over the power system constraints [30]. For this purpose, a different controlling price can be added to π new for each bus to satisfy the system constraints. However, in our simulation, same price for all buses keeps the system in defined constrained; therefore, we did not change price for different node in this implementation.
Since all customers in indirect methods try to minimize their own cost, they may make similar decisions and cause a sudden change in the demand curve as was shown in Figure 2b. In these circumstances, the consumption power corresponding to π min and π max are not similar. Therefore, the consumption power of equilibrium point (P*) must be calculated from the supply curve, and the difference between P* and P (π max ), called the residual power, needs be assigned to some customers. For this purpose, the price of some customers is changed from π max to π min . Although π max and π min are almost same, this method changes the power consumption of the system and solves the convergence issue. Algorithm 4 details the proposed method to handle this problem. 1: Select π max as π*. 2: Calculate P (π max ) from Algorithm 1 and 2. 3: Calculate P* from supply curve. 4: P res = P* − P (π max ) 3: While P res > 0 do 4: Select an EV randomly, change its price to π min , and calculate P i (π max ). 5: P res = P res − (P i (π min ) − P i (π max )) Figure 3, shows the single line diagram of the IEEE-37 bus test system used for our simulation. The line data and the maximum power of buses are taken from [31]. We generate the system load profiles based on residential loads modeled in [32]. Here, a group of different home profiles is created by the simulator given in [33]. Then, an adequate number of them is randomly assigned to each bus to match the maximum power consumption reported in [31]. This procedure results in 1141 customers connected consuming about 11.2 MWh in a day. If π i < π i+1 then πmin = min(πmin, π i ) 3:

Simulation Setup
If π i > π i+1 then πmax = max(πmax, π i ) 4: π new = (πmin + πmax)/2 Since in the proposed method, the price of energy for each customer can change their consumption, the price of different nodes can be altered to have more control over the power system constraints [30]. For this purpose, a different controlling price can be added to π new for each bus to satisfy the system constraints. However, in our simulation, same price for all buses keeps the system in defined constrained; therefore, we did not change price for different node in this implementation.
Since all customers in indirect methods try to minimize their own cost, they may make similar decisions and cause a sudden change in the demand curve as was shown in Figure 2b. In these circumstances, the consumption power corresponding to πmin and πmax are not similar. Therefore, the consumption power of equilibrium point (P*) must be calculated from the supply curve, and the difference between P* and P (πmax), called the residual power, needs be assigned to some customers. For this purpose, the price of some customers is changed from πmax to πmin. Although πmax and πmin are almost same, this method changes the power consumption of the system and solves the convergence issue. Algorithm 4 details the proposed method to handle this problem. Select an EV randomly, change its price to πmin, and calculate Pi (πmax).

5:
Pres = Pres − (Pi (πmin) − Pi (πmax)) Figure 3, shows the single line diagram of the IEEE-37 bus test system used for our simulation. The line data and the maximum power of buses are taken from [31]. We generate the system load profiles based on residential loads modeled in [32]. Here, a group of different home profiles is created by the simulator given in [33]. Then, an adequate number of them is randomly assigned to each bus to match the maximum power consumption reported in [31]. This procedure results in 1141 customers connected consuming about 11.2 MWh in a day.  We consider EVs, dish washers (wet1), and washing machines with dryers (wet2) as elastic loads. The average consumption profiles of the dish and clothes washers are shown in Figure 4. Both profiles have a long operation period and the second type consumes high power near the end. When these appliances start, they should operate until the task is completed. The electricity price may change during the operation and handling of these dynamic profiles for DSM programs consequently becomes very difficult. However, the simulation results in the next subsection show that the proposed method can manage this problem as well. We consider EVs, dish washers (wet1), and washing machines with dryers (wet2) as elastic loads. The average consumption profiles of the dish and clothes washers are shown in Figure 4. Both profiles have a long operation period and the second type consumes high power near the end. When these appliances start, they should operate until the task is completed. The electricity price may change during the operation and handling of these dynamic profiles for DSM programs consequently becomes very difficult. However, the simulation results in the next subsection show that the proposed method can manage this problem as well. Based on the reference from [32], we assume that the dish washers are turned on between 6 and 8 p.m. with a probability of 23% and the task needs to be done before 6 to 9 a.m. the next day, with the uniform distribution. Also, the washing machines with dryers are turned on between 8 and 10 a.m. with a probability of 28% [32] and the task needs to be done before 2 to 5 p.m., with the uniform distribution. These wet appliances consume about 2 MWh each day.

Simulation Setup
The departure and the arrival times of EVs are selected based on a normal distribution [11] with the standard deviation of one hour and the mean values of 7 a.m. and 7 p.m., respectively. The desired SOC is selected based on the uniform distribution between 60% and 100% of the maximum SOC. The initial SOC is set to a value less than the desired SOC generated by a normal distribution with the standard deviation of 2 kWh and the mean value of 10 kWh, which translates into about 28 miles of travel by a typical EV with an energy consumption rate of 0.36 kW/mile [34]. The penetration level of EVs is assumed to be 50% (670 EVs), which consumes about 5.46 MWh each day.
In the simulation, three different types of EVs are used. The type one uses the charger level one having pmax = 2 kW, Smax = 5 kVA, and the battery size of 10 kWh. The type two and three use the charger level two having pmax = 9 kW [35], Smax = 10 kVA, and the battery size of 20 and 30 kWh, respectively. The charging and discharging efficiencies are assumed to be 95% and the minimum and maximum SOC are selected to be 0 and 100%, respectively. The degradation coefficient is set to be 0.05 $/kW [26].
The supply function is formulated so that the average energy price bought from the upper network without EVs for off-peak and peak time will be about 17 and 4 ¢/kW, respectively, according to [36] as: where Ptotal is the total input power of the network including the power loss, and S is the cost in $/kW. The error of the inelastic power prediction and the price forecasting is modeled by a normal distribution with a standard deviation of 3%. Figure 5 compares the results of the FR method and the TOU method, two most well-known and widely used DSM programs, in the abovementioned grid, when there is no EV. As it is shown in Based on the reference from [32], we assume that the dish washers are turned on between 6 and 8 p.m. with a probability of 23% and the task needs to be done before 6 to 9 a.m. the next day, with the uniform distribution. Also, the washing machines with dryers are turned on between 8 and 10 a.m. with a probability of 28% [32] and the task needs to be done before 2 to 5 p.m., with the uniform distribution. These wet appliances consume about 2 MWh each day.

Simulation Result
The departure and the arrival times of EVs are selected based on a normal distribution [11] with the standard deviation of one hour and the mean values of 7 a.m. and 7 p.m., respectively. The desired SOC is selected based on the uniform distribution between 60% and 100% of the maximum SOC. The initial SOC is set to a value less than the desired SOC generated by a normal distribution with the standard deviation of 2 kWh and the mean value of 10 kWh, which translates into about 28 miles of travel by a typical EV with an energy consumption rate of 0.36 kW/mile [34]. The penetration level of EVs is assumed to be 50% (670 EVs), which consumes about 5.46 MWh each day.
In the simulation, three different types of EVs are used. The type one uses the charger level one having p max = 2 kW, S max = 5 kVA, and the battery size of 10 kWh. The type two and three use the charger level two having p max = 9 kW [35], S max = 10 kVA, and the battery size of 20 and 30 kWh, respectively. The charging and discharging efficiencies are assumed to be 95% and the minimum and maximum SOC are selected to be 0 and 100%, respectively. The degradation coefficient is set to be 0.05 $/kW [26].
The supply function is formulated so that the average energy price bought from the upper network without EVs for off-peak and peak time will be about 17 and 4 ¢/kW, respectively, according to [36] as: S(P total ) = 1.88 * 10 −7 P total 2 + 3.67 * 10 −5 P total + 4.12 * 10 −2 , where P total is the total input power of the network including the power loss, and S is the cost in $/kW. The error of the inelastic power prediction and the price forecasting is modeled by a normal distribution with a standard deviation of 3%. Figure 5 compares the results of the FR method and the TOU method, two most well-known and widely used DSM programs, in the abovementioned grid, when there is no EV. As it is shown in this figure, TOU can decrease the power peak and the cost of the production in compare to the FR method, when there is no EV in the power system.  However, when there is high penetration of EVs and elastic loads in the power system, the TOU method face with new challenges, as shown in Figure 6. In the FR method, since the utility does not apply any incentive, each appliance starts to consume power as soon as it connects to the network. Consequently, between around 18:00 and 19:30, EVs' load increases the peak power of the system from 941 kW to more than 2.6 MW and the maximum marginal cost (MC) from 17 cents to 1.3 dollars. The TOU method can neither help to manage a lot of sudden additional loads of EVs. Since the EVs and dish washers need to complete their tasks by the next morning, they wait for the low tariff and start to consume power simultaneously from the beginning of the off-peak interval (e.g., 01:00). Therefore, a rebound peak is formed. Although the TOU method can reduce the power peak to 886 kW without EVs, it cannot manage the peak of the network with EVs and it consumes 4.65 MW with the maximum MC of 3.94 dollars.

Simulation Result
The proposed transactive method can indirectly manage EVs' loads same as the other elastic loads, even in the presence of high penetration level of EVs (50%). The proposed transactive method is changing the RTP to encourage customers to shift the elastic loads to time intervals with the lowest price. As a result, the proposed method reduces the power peak to 870 kW and the maximum MC to 14.9 cents. Figure 7 shows the original (FR) and the shifted elastic loads, by implementing the proposed RTP method. This new load profile minimizes the cost for each customer and also satisfies the constraints of both the network and customers. However, when there is high penetration of EVs and elastic loads in the power system, the TOU method face with new challenges, as shown in Figure 6. In the FR method, since the utility does not apply any incentive, each appliance starts to consume power as soon as it connects to the network. Consequently, between around 18:00 and 19:30, EVs' load increases the peak power of the system from 941 kW to more than 2.6 MW and the maximum marginal cost (MC) from 17 cents to 1.3 dollars. The TOU method can neither help to manage a lot of sudden additional loads of EVs. Since the EVs and dish washers need to complete their tasks by the next morning, they wait for the low tariff and start to consume power simultaneously from the beginning of the off-peak interval (e.g., 01:00). Therefore, a rebound peak is formed. Although the TOU method can reduce the power peak to 886 kW without EVs, it cannot manage the peak of the network with EVs and it consumes 4.65 MW with the maximum MC of 3.94 dollars.
The proposed transactive method can indirectly manage EVs' loads same as the other elastic loads, even in the presence of high penetration level of EVs (50%). The proposed transactive method is changing the RTP to encourage customers to shift the elastic loads to time intervals with the lowest price. As a result, the proposed method reduces the power peak to 870 kW and the maximum MC to 14.9 cents. Figure 7 shows the original (FR) and the shifted elastic loads, by implementing the proposed RTP method. This new load profile minimizes the cost for each customer and also satisfies the constraints of both the network and customers.      Figure 8 shows the voltage of the bus #26 that experiences the lowest voltage. The minimum voltage of the network with EVs in the FR and TOU methods are 0.88 pu and 0.81 pu, respectively. However, the proposed method can maintain a voltage above 0.95 pu, which is even better than the base load (FR without EVs).
Energies 2017, 10,1640 14 of 18 Figure 8 shows the voltage of the bus #26 that experiences the lowest voltage. The minimum voltage of the network with EVs in the FR and TOU methods are 0.88 pu and 0.81 pu, respectively. However, the proposed method can maintain a voltage above 0.95 pu, which is even better than the base load (FR without EVs). The reactive power of the network is shown in Figure 9. Although the EV chargers have unit power factor, the reactance of power lines increases the total reactive power consumption of the network.
The maximum active and reactive power (Pmax and Qmax), the maximum MC (MCmax), the percentage of energy loss (Eloss/∑P), and the energy cost of all loads in different cases are listed in Table 1. The results show that the TOU method can reduce energy cost and improve some technical issues, such as peak power and voltage regulation, but is not so effective in scenarios with a high penetration level of EVs as it can create rebound peaks. On the other hand, the proposed transactive method can well manage the EVs' loads and other elastic appliances, such that the peak power and the maximum MC are kept even less than the base load (FR without EVs). The case 9 in Table 1, shows the effect of V2G mode. As expected, because of the flat MC of the proposed method, the V2G mode can slightly improve the performance even with the low degradation coefficient. The reactive power of the network is shown in Figure 9. Although the EV chargers have unit power factor, the reactance of power lines increases the total reactive power consumption of the network.
The maximum active and reactive power (P max and Q max ), the maximum MC (MC max ), the percentage of energy loss (E loss /∑P), and the energy cost of all loads in different cases are listed in Table 1. The results show that the TOU method can reduce energy cost and improve some technical issues, such as peak power and voltage regulation, but is not so effective in scenarios with a high penetration level of EVs as it can create rebound peaks. On the other hand, the proposed transactive method can well manage the EVs' loads and other elastic appliances, such that the peak power and the maximum MC are kept even less than the base load (FR without EVs). The case 9 in Table 1, shows the effect of V2G mode. As expected, because of the flat MC of the proposed method, the V2G mode can slightly improve the performance even with the low degradation coefficient.  One of the important challenges of implementing the RTP method is the calculation time. The calculation time has to be short enough to cope with the dynamic changes in the system. In order to test the calculation time, we implemented the proposed method using MATLAB on a workstation with an 8-core 2.3 GHz CPU and 8 GB RAM. In this implementation, each time interval is assumed to be 10 min long, which is a practical assumption in SGs. The number of iterations and the calculation time for each time interval are shown in Figure 10. The results show that the calculation time of the proposed heuristic two-stage iterative method is less than 4 s. Note that the first stage of the proposed method is done by the customers and can be executed simultaneously by smart meters in parallel. In detail, the average execution times of the customer side (First Stage) and the grid side (Second Stage) are measured 0.0023 s and 0.0031 s, respectively.  One of the important challenges of implementing the RTP method is the calculation time. The calculation time has to be short enough to cope with the dynamic changes in the system. In order to test the calculation time, we implemented the proposed method using MATLAB on a workstation with an 8-core 2.3 GHz CPU and 8 GB RAM. In this implementation, each time interval is assumed to be 10 min long, which is a practical assumption in SGs. The number of iterations and the calculation time for each time interval are shown in Figure 10. The results show that the calculation time of the proposed heuristic two-stage iterative method is less than 4 s. Note that the first stage of the proposed method is done by the customers and can be executed simultaneously by smart meters in parallel. In detail, the average execution times of the customer side (First Stage) and the grid side (Second Stage) are measured 0.0023 s and 0.0031 s, respectively.

Conclusions
In the modern power grid, DSM program is imperative to cope with the dynamic nature of output power produced by renewable energy source and extra demand of EVs. In this paper, a transactive DSM program under an imperfect competition market model in the presence of high penetration level of EVs is proposed. The transactive DSM program gives the decision authority to customers and can attract more customers to participate in the program, while the imperfect competition market model prevents the rebounding peaks and satisfies the power system constraints. Although the indirect demand control in an imperfect competition market leads to a complicated nonlinear non-convex multi-objective optimization problem, a heuristic two-stage iterative method is proposed to quickly solve the problem. The method is simulated in MATLAB on the IEEE 37-bus test system having 1141 customers with actual load profiles and different elastic appliances and EVs. The results show that the proposed method not only decreases energy cost of individual customers and power loss and maintains power system constraints within their limits, but also solves the problem quickly enough to be feasible in real-time operations.
Proof. In a rational market the following assumption are always true: (1) Supply curve (S) is a non-decreasing function; (2) Demand curve (D) is a non-increasing function; (3) The initial cost of production (S(0)) is less than the price that customers would be willing to pay for the first unit of production (D(0)); and (4) demand curve always has positive value, so D(∞) ≥ 0 and S(∞)→∞. In these circumstances, the function (F), which is defined as F = D − S is a non-increasing function whose root is the market equilibrium (RTP). Since F(0) > 0 and F(∞) < 0, the bisecting method can

Conclusions
In the modern power grid, DSM program is imperative to cope with the dynamic nature of output power produced by renewable energy source and extra demand of EVs. In this paper, a transactive DSM program under an imperfect competition market model in the presence of high penetration level of EVs is proposed. The transactive DSM program gives the decision authority to customers and can attract more customers to participate in the program, while the imperfect competition market model prevents the rebounding peaks and satisfies the power system constraints. Although the indirect demand control in an imperfect competition market leads to a complicated nonlinear non-convex multi-objective optimization problem, a heuristic two-stage iterative method is proposed to quickly solve the problem. The method is simulated in MATLAB on the IEEE 37-bus test system having 1141 customers with actual load profiles and different elastic appliances and EVs. The results show that the proposed method not only decreases energy cost of individual customers and power loss and maintains power system constraints within their limits, but also solves the problem quickly enough to be feasible in real-time operations. production (S(0)) is less than the price that customers would be willing to pay for the first unit of production (D(0)); and (4) demand curve always has positive value, so D(∞) ≥ 0 and S(∞)→∞. In these circumstances, the function (F), which is defined as F = D − S is a non-increasing function whose root is the market equilibrium (RTP). Since F(0) > 0 and F(∞) < 0, the bisecting method can find the root of F. Therefore, Algorithm 3, which is bisecting the difference of supply and demand curve, converges to the market equilibrium.