Optimal Energy Trading for Renewable Energy Integrated Building Microgrids Containing Electric Vehicles and Energy Storage Batteries

The increasing penetration of renewable energy resources and volatility of energy prices cause huge challenges in planning and regulating energy generation, transport, and distribution. A possible solution can be a paradigm change of employing control actions from the demand side in addition to the conventional generation control. To realize such shifts, the primary stage should be a proper and robust analysis of the energy flexibility on the demand side. Recently, demand side control in buildings has become a major research issue because buildings share a substantial portion of the total electricity consumption. The increasing use of controllable devices in buildings combined with the advent of smart metering system has paved the way to exploit the potential flexibility of managing the energy generation and demand of buildings for optimal energy trading. In this paper, we investigate the benefits of demand resources in buildings for optimal energy trading in day-ahead and real-time energy markets. The building flexible demand resources considered are electric vehicles and batteries. The paper examines the combined optimization of EVs and batteries in the day-ahead and regulation electricity markets with the objective of maximizing the total profit of the building microgrid. It takes EVs driving pattern into consideration. The major contribution of the paper is the exploitation of the energy flexibility of buildings using EVs as dynamic energy storage device and batteries as manageable demand facility. The devised optimization problem is formulated as a double-stage mixed-integer linear programming (MILP) problem, and solved using the CPLEX solver. Several numerical results are presented to validate the effectiveness of the devised optimization framework using actual data of building electricity demand and local renewable generation in the Otaniemi area of Espoo, Finland. We demonstrate that the proposed optimization solution can achieve considerable increase in profit, reduce renewable energy curtailment and decrease power demand in peak hours, compared to uncontrolled or non-optimized operation.


Length of time slot (h) α h,b,t
Incentive for voluntary load curtailment ($kWh) β h,b,t Involuntary load curtailment penalty ($kWh) σ v,h,b,tr Length/duration of trip tr (h) ϕ t Bid mismatch penalty ($kWh) The associate editor coordinating the review of this manuscript and approving it for publication was Bin Zhou.Further enthusiastic involvement of the demand side into the energy management and trading ventures and efficient mixing of flexible loads (FLs), prosumers and renewable energy sources (RESs) into the energy system are major goals in planning the future smart grid.Actually, RESs have numerous benefits over the conventional energy generation sources because they are the clean energy suppliers with zero emission costs.Moreover, RESs are available everywhere, easy to install, require smaller space, noncomplex structures, and contain smaller number of components.Nevertheless, the integration of RESs causes several challenges to grid operators and aggregators primarily due to their uncertain and intermittent behaviors.Predominantly, the stochasticity and instability of RESs can be overwhelmed through accurate forecasting and effective storage and utilization.
A number of solutions for renewable generation forecasting have been proposed in the literature such as the hybrid of wavelet transform, particle swarm optimization and support vector machines [1], integration of particle swarm optimization and neural networks [2], hybrid of genetic algorithm and neuro-fuzzy systems [3] and others.Similarly, several solutions for storing renewable energy generation have been devised in the literature, for example using vanadium redox flow battery (VRB) [4], pumped storage hydro units [5], multiple energy storage units [6], or compressed-air energy storage [7] to smooth the instability of renewable generation.
However, although forecasting tools are performing increasingly better, but robust and solid forecasting techniques that can be used for balancing purposes are yet to be developed.Moreover, the round trip costs and the storage performance deterioration of energy storage devices is still a big a challenge that needs further developments.
Demand response capable load (DRCL) or flexible load (FL) is another important element in the forthcoming smart grid.FL is a load whose consumption can be managed to delay, advance, increase or decrease without sacrificing its basic function or comfort.Generally, FLs are based on customer needs and production capability.FLs can constitute thermostatically controlled appliances (TCAs) comprising refrigerator, electric water heater, and heating, ventilation, and air conditioning (HVAC) devices.They can also include electric vehicles (EVs) and energy storage devices such as batteries.Research and development (R&D) on optimal control of TCAs has been a hot issue in the previous few years.References [8] and [9] devised optimal control configurations to reduce the electricity bills for HVAC systems taking into account customer thermal comfort requirements.Because of the economic and ecological benefits of EVs over the conventional fuel-fired cars, it is estimated that EVs will revolutionize the transportation system we have today.The effect of a high EV penetration on a residential distribution network was examined in [10].Reference [11] investigated a joint optimization of EVs and home energy scheduling taking into account customer thermal comfort needs.However, RESs were not included in this joint optimization problem.The flexibility in the joint operation of EVs and HVACs can be improved to lodge the uncertainties in RES generations.Reference [12] devised an optimization model to exploit the profit of a fleet of EVs in a multi-clearance electricity price market with the help of energy storage devices.Nevertheless, RESs were not included in this model, and the devised model was not stochastic.The flexibility in the EV charging/discharging practice can be enhanced to handle the stochasticity of RESs.References [13], [14] analyzed the influences of EVs on the dispatching and operations of energy systems with RESs and fuel-fired generators.
Beyond those works which intended to reduce the running cost of large-scale energy systems, [15] proposed an optimization framework to exploit the advantages of coordinating EVs and RESs in a building microgrid setup with the target of maximizing the microgrid income in the electricity market while at the same time minimizing the microgrid running cost (fuel cost of fuel-fired generators).Similarly, [16] devised an optimization strategy for optimal bidding of a community-scale microgrid to explore the benefits of coordinating HVACs and RESs with the objective of minimizing the microgrid running costs taking into account customers' thermal comfort preferences while simultaneously maximizing the revenue of the microgrid in the electricity market.However, the operation and maintenance (O& M) costs of operating RESs, energy storage devices, EV charging/discharging stations were not considered in these works.Moreover, the optimization models in these works considered the involuntary load curtailments only.The flexibility potential that can be obtained from flexible loads can be improved further if incentivized voluntary load curtailments are included in the optimization model.
The works in [17] proposed and implemented a dual-step stochastic optimization approach for a wholesale market integration of prosumers.It demonstrates the interactions of peer-to-peer energy exchanges and storages in residential communities.Reference [18] has also devised a two-stage stochastic optimization framework for evaluating the influence of wind power uncertainty on distributed energy storage.
Different from the prior works where the authors focused to formulate the joint optimization of HVACs with EVs, HVACs with RESs or EVs with RESs, this work proposes the joint optimization of batteries and EVs with RESs by considering the O&M costs of energy storage batteries, EV charging/discharging facilities and RESs.Moreover, as far we have investigated this is the first work that formulates the impact of incentivized voluntary customer load curtailment in a joint optimization framework where lower level customers (for example households or homes in a residential community) or electricity end-users can participate in controlling the grid condition or trade in the energy market.We study the benefits of coordinating the major flexible loads, energy storage batteries and EVs, with RESs in a building microgrid.The proposed objective is to maximize the revenue of the building microgrid in the day-ahead and real-time (regulation) electricity market while at the same time minimizing the operation and maintenance costs of the microgrid.
The major contributions of this study are outlined below: • The devised model targets to maximize the profit for the BMG and minimize the demand and renewable energy curtailments as well as bid mismatch penalty while keeping the system constraints.
• The optimization setup includes incentivized voluntary load shedding and penalties for involuntary load shedding, renewable generation curtailment and bid mismatch.
• The devised energy trading optimization model considers EVs driving pattern and exploits the flexibility of EVs as dynamic energy storage device and batteries as manageable demand facility.
• The devised optimization model alleviates the uncertainty of RESs, which can considerably enhance the BMG revenue.
• The devised optimization framework is modeled as a dual-step stochastic programming problem where the uncertainties in the demands, energy prices and renewables are managed by improved forecasts.
The findings of this study demonstrate an optimal and coordinated EV charging/discharging approach enhances the profit a BMG involving in an electricity market.It also shows the optimal EV charging/discharging approach can assist to decrease the renewable generation curtailment that is important to alleviate the bid mismatch penalties.
The remaining sections of the paper are organized as follows.The system model and solution methodology are presented in Section II.
The detail optimization problem description is provided in Section III.The case study and simulation results are given in Section IV and the conclusions are drawn in Section V.

II. SYSTEM MODEL A. SYSTEM CONFIGURATION
We consider a BMG operating in grid-connected mode which contains the components below: RES (PV), energy storage batteries, educational (office) buildings with several classrooms, offices or laboratories and their associated loads (flexible and nonflexible), and EV charging/discharging station (EV CDS).The BMG aggregate load demand is modeled using a bottom-up approach where the load demand of each house is formulated first and summed up to form the total load demand of the BMG then.The flexible and nonflexible loads of each house are formulated independently.The optimization horizon is one-day with one-hour resolution.The BMG is supposed to involve in two-settlement energy market where the BMG has to submit its hourly bids to the day-ahead (DA) market a few hours ahead of the realtime (RT) power transfer [5].The bid can be to sell power to the market or to buy power from the market.Any imbalance between the RT power transfer and the DA submitted bid is penalized.The imbalance is corrected by trading power in the RT regulation market.The BMG is a price-taker since it cannot affect the electricity price compared to the main grid [5].The grid operator runs the market and clears the price.The revenue of the BMG is calculated based on the cleared market price.It shall be remarked that the DA electricity price is cleared to the BMG when it submits the day-ahead bids to the energy market [5], [19].
The stochasticities of the renewable generation, load demand and electricity price make the bidding optimization process of the BMG a complex task.To circumvent an excess penalty on bid mismatch, it is occasionally desirable to cut generated power of RESs to maintain the RT power transfer as close as possible to the DA schedule.Nevertheless, curtailment of renewable generation is unnecessary or it is not the better option.Thus, we apply a high penalty charge to limit the quantity of renewable generation curtailment.Load shedding is the other solution to avoid the excess penalty due to the power bid imbalance.However, load shedding is not recommended in microgrids if it is involuntary without the permission of the customer.On the other hand, voluntary load shedding with the consent of the customer is encouraged and incentivized to overcome the bid mismatch penalty charge.Therefore, we impose a high penalty charge payable to the customer to limit the involuntary load curtailment while we apply an incentive charge payable to the customer to encourage voluntary load shedding when needed.Moreover, the operation and maintenance (O&M) costs of the RESs, batteries, and EV charging/discharging stations are considered in the optimization model.The batteries and EVs are the major demand response sources in the proposed optimization framework.
In this study, the flexibility in the battery and EV charging/discharging mechanisms are explored to assist the operation of the renewable generations.
Conventionally, EVs are charged instantaneously with the maximum power when they reach at charging stations/points.We call this as uncontrolled charging approach.Nevertheless, by regulating the charging/discharging plan for EVs smartly taking into both the fluctuation in the energy prices and renewable generations, we can improve the profit of the BMG and decrease the quantity of renewable energy curtailment.
Determining EVs travel plan including their trip distance, arrival and departure times can be difficult and it is generally uncertain.The EVs travel plan assumption in this work is based on practical EV charging services in which EV owners can check the charging facility availability or possibility of EV charging points remotely or online.They can go to charge or discharge if they are acknowledged to come by the charging station operator.Similarly, to simplify our model, we assume that EVs can send to the charging/discharging operator their desired travel plans for the next operating day and then the microgrid aggregator takes this into count in its scheduling and bidding plans.Moreover, in order to ensure that the EV owner drive the EV back home without running out of battery energy, the optimization problem is subjected to constraints that oblige the state of charge of the EV battery to always lay in a specified range considering the trip distance planned by the EV owner.Besides, when the energy price is at its peak and/or when there is shortage of power in the BMG to supply the local load demands, batteries and EVs can be discharged to deliver power to the local demands.The customers in the building microgrid submit their hourly desired EVs travel plans to the building energy aggregator before the operating day.The aggregator, on the other hand, requests the customers to voluntary curtail part of their loads and get incentivized in real-time when needed.Aggregators normally allow voluntary load curtailments when the electricity price is high, the bid mismatch penalty is high and/or there is a shortage of power in the BMG.

B. SOLUTION APPROACH
In this study, we take into account the stochasticities of renewables, load demands and electricity prices.Improved forecasts can be used to manage these uncertainties.We employ the approach we used in our previous work [1] to model and forecast the PV power generation.We use the method we employed in our present work [20] to model and forecast the BMG aggregate local load demand.Similarly, the technique in [21] can be utilized to model and predict the real-time electricity prices.Normally, day-ahead electricity prices are cleared before several hours of the operating day [22] (i.e., before we run the optimization and submit the day-ahead bids) and thus no forecast is used for day-ahead prices.
The devised optimization problem is described as a dualstep stochastic program.The first-step decisions are performed before any stochastic values (i.e., forecasted values) are disclosed.The realization (regulating compensation) of the stochasticities is made in the second-step decisions after the disclosure of the stochasticities.The second-step decisions rely on the outcome of the first-step decisions [5].

III. OPTIMIZATION PROBLEM FORMULATION
The proposed dual-step stochastic optimization problem is described here.The first-step decision consists of the hourly power bids submitted to the day-ahead electricity market.The second-step decisions contain the curtailment of voluntary/involuntary demands and renewable generation, the battery charging/discharging decisions, the EV charging/discharging decisions, and the real-time power transfer between the BMG and the main utility grid.
As described above, the energy market is a two-settlement market (day-ahead and real-time/regulation markets).In the first-stage, the decision is the determination of the amount of day-ahead bid in the day-ahead market for the 24 hours of next operating day.This decision is the amount of power the building microgrid schedules (submits to the market operator) to buy or sell at each hour of the coming day.The building microgrid aggregator makes this decision based on the forecast information of the renewable energy generation, load demand and electricity price for each hour of the coming day.It is known that no forecast is absolute or perfect, and  thus the submitted day-ahead bids in the first-stage optimization decisions may not actually be the same with the realtime power transfer to/from the market.This is mismatch between the predicted and real-time values of the renewable energy generation, load demand and electricity price is the major source of uncertainty in the proposed optimization framework.This uncertainty is accounted for and managed by second-stage decisions through the determination of the amount of the power transfer at the each hour of the real-time operation.This real-time power transfer decision is based on the first-stage decision and its main purpose is to manage the uncertainties or balance the first-stage decisions with realtime power requirement.
Figure 1 illustrates how the double-stage optimization operates and the inputs to and output from each optimization step.We present the objective function, and all the capacity and technical constraints in the next subsequent subsections.

A. OBJECTIVE FUNCTION
We devise to maximize the objective function formulated in (1).The sign agreement here is that if the power is exported to the utility grid, it will assign a positive value, and vice versa.The proposed objective function (1) aims to maximize the building microgrid profit in a two-settlement (day-ahead and real-time) electricity market.The profit is formulated by subtracting the power imbalance penalty (ϕ t P RT t − P DA t ), the O&M cost of PV systems The objective function therefore apprehends the costs of energy trading in the day-ahead and real-time markets, the penalty costs for bid mismatch, renewable generation curtailment, and involuntary load shedding.
The objective problem also captures the incentives for voluntary curtailment.Moreover, it considers the O&M costs of the RESs, batteries and EV charging/discharging station, and the degradation cost of the batteries.
It has to be noted that a positive value of P ) of its day-ahead and real-time decisions.Besides, the other second-stage decisions such as the voluntary/involuntary load shedding, RES curtailment, the battery charging/discharging decisions, and the EV charging/ discharging decisions, assist to manage the stochasticities of RESs, load demands and electricity prices.

B. POWER BALANCE CONSTRAINT
The sum of available local generation (RESs), the quantities of voluntary and involuntary load curtailments, and the discharging powers from the batteries and EVs should be equal to the sum of the real-time power transfer, the BMG aggregate nonflexible local load and the charging powers of batteries and EVs, at each operating time slot of the optimization horizon.

D. EV CONSTRAINTS
The EV behaviors and the traveling patterns shall also be precisely modeled.The important parameters while modeling the EV charging/discharging characteristics are the EV battery capacity (kWh), the travel efficiency (kWh/km) and the charging type (fast, slow, DC or AC).These characteristics can be obtained from the manufacturer's datasheet or website.
The traveling pattern of the EVs can be formulated by the quantity of travels per day, the departure and returning times, and the trip distance of each travel.A trip is described as the period between the times when the EV departs from and returns back to the charging/discharging station of the BMG.This is associated with the customer travel plan, which can be sent by the customer to the BMG aggregator a few hours ahead of the operating day.

1) POWER CONSTRAINTS
We suppose the EVs are only charged/discharged when they are parked at the BMG CDS.Furthermore, EVs are plugged to the piles immediately they reach at the CDS.Thus, the charging/discharging power constraints are used only during the times when the EV is parked at the CDS as: where, b EV ,c v,h,b,t denotes the availability of EV v of house h of building b at the CDS for charging at time t, b EV ,d  v,h,b,t denotes the availability of EV v of house h of building b at the CDS for discharging at time t, P EV ,c,max v,h,b,t and P EV ,d,max v,h,b,t represent the peak charging/discharging bounds, respectively.The EV charging/discharging powers are zero if the EV is not at the CDS (i.e., since b EV ,c v,h,b,t = b EV ,d v,h,b,t = 0).Moreover, (6) ensures that an EV cannot charge and discharge at the same time.

2) SOC DYNAMICS AND CONSTRAINTS
We suppose the EVs can make a number of travels during the optimization horizon (for example, one day).Let t dep v,h,b,tr and t arr v,h,b,tr be the time slots when EV v of house h in building b departs and arrives the BMG CDS or home for trip tr, respectively.Then, the objective function must abide the constraints below: VOLUME 7, 2019 The SOC of EV v of house h in building b varies based on the charging/discharging powers when the EV parks at the CDS (7) and the deviation of the SOCs at departing and arriving times corresponds to the energy consumption while driving the EV (8).Equation ( 9) guarantees that the SOC decreases when the EV travels.Equation ( 10) ensures the EV battery can keep long lifetime, following the SOC range recommended by the manufacturer [23].

E. ENERGY STORAGE SYSTEM CONSTRAINTS
The constraints below denote the charging/discharging bounds for battery u (11 and 12), SOC bounds (13), and charging/discharging status restrictions where battery u is not permitted to charge and discharge at the same time (14).The battery SOC dynamics is formulated in (15).

F. RENEWABLE ENERGY CURTAILMENT
The quantity of renewable generation curtailment is restricted by the peak available renewable generation:

G. INCENTIVIZED VOLUNTARY LOAD CURTAILMENT
The voluntary load shedding is less than the maximum nonflexible demand:

H. INVOLUNTARY LOAD CURTAILMENT
The involuntary load shedding should be less than the peak permissible involuntary shedding and the maximum nonflexible demand: To summarize, we have described the proposed optimization problem as a mixed integer linear program (MILP) which can be solved by the CPLEX solver of the GAMS software environment [24].

IV. CASE STUDY AND NUMERICAL RESULTS
We consider a building microgrid (BMG) that contains one PV solar system, one energy storage battery and one educational building with several classrooms, laboratories and offices with their associated loads.The BMG also contains one large EV charging/discharging station with several charging/discharging piles to accommodate many EVs at a time.For the purpose of computational simplicity and clarity of illustrations, we consider the aggregate nonflexible load of the building.The aggregate electricity demand is the sum of the individual demands of all the classrooms, laboratories and offices in the building.That means, the total building demand measured at the building electricity gateway is used to demonstrate the obtained results in the study.Thus, to achieve numerical results for the aggregate building scenario, we simply set B = H = 1 in all the associated objective function, constraints and values.We consider ten EVs (V = 10) in the BMG.
The electricity demand data is collected from an actual building in Otaniemi area of Espoo, Finland with a suitable scaling factor.Data for the PV system is collected from real (operational) rooftop PV plant located in Otaniemi area of Espoo, Finland with a suitable scaling factor.The PV is indeed located on the rooftop of the case study building.Improved forecasts for the PV power production and nonflexible aggregate load are obtained using the approaches in [1] and [20], respectively.We take the historical data for the energy prices [22] as their predicted values.The forecasts for the aggregate nonflexible base load and PV power are shown in Figure 2. The historical day-ahead and real-time electricity prices are also shown in Figure 3.
We suppose all the EVs are Nissan Leaf ('Acenta' model) with a battery storage capacity of 40kWh [25] and maximum charging/discharging power of 6kW [26].In fact, this Nissan Leaf model can be charged/discharged at a maximum power of 50kW but with a fast charging mode which is not considered in this work.We also suppose the BMG charging/discharging station is furnished with Level 2 EV charging/discharging piles with a power ratings of 7.2kW.The EVs are assumed to make a single trip in the optimization period (one-day).The minimum and maximum SOCs of the EVs are  0.2 and 0.9, respectively.A charging/discharging efficiency of 90% is assumed for the EVs.The initial SOCs of the EVs are supposed to be evenly distributed in the range [0.2, 0.9].The returning and leaving times of the EVs are represented by normal distributions with the averages of 8:00 and 17:00, respectively, and standard deviations of 2 hours for both.The expected SOCs of the EVs when they depart the CDS is supposed to be the maximum SOC.The travel efficiencies of the EVs are taken as 16.5kWh/100km [27].The driving distance of the EVs is assumed to be 50km, which is the average daily travel distance in Finland [28].This is a typical driving pattern in Finland, which is employed to achieve the numerical results in the various scenarios in this study.
We illustrate a summer scenario in this paper; but, results for scenarios from the other seasons (winter, spring and autumn) can be demonstrated likewise.We assume a 24h optimization horizon with one-hour time resolution/slot.
Penalty fees for involuntary load shedding (β h,b,t = β, ∀t, b, h), PV power curtailment (c PV curt,t = c PV curt,∀t ) and bid mismatch (ϕ t = ϕ, ∀t) are 1 $/kWh, 0.02 $/kWh and 0.08 $/kWh, respectively.Incentive for voluntary load shedding (α h,b,t = β, ∀t, b, h) is assumed to be 0.25 $/kWh [29].The maximum aggregate voluntary load shedding (LS vol,max h,b = LS vol,max ) at each time slot is assumed to be the aggregate nonflexible load of the BMG at the same time slot.The peak aggregate involuntary load shedding (LS invol,max h,b = LS invol,max ) at each time slot is set as 10% of the aggregate nonflexible load of the BMG at the same time slot.The energy storage battery capacity is 100kWh.Its minimum and maximum SOCs are 0.2 and 0.9, respectively.The peak charging/discharging power is 25kW and the charging/discharging efficiency is assumed to be 90%.The utility grid, constraint (3), is not considered.However, when the maximum power trading in the day-ahead market is not limited, we have to assign ϕ t a suitably large value to guarantee the bid mismatch is not very big and the real-time power transfer is near to the submitted day-ahead bid.Besides, we neglect the battery degradation cost, the operation and maintenance costs of the PV system, battery and EV CDS (c Bat deg,u,t = c PV om,t = c Bat om,u,t = c EVCDS om,t = 0, ∀t, u).We describe a Load Scaling Factor (LSF) as the ratio of the aggregate nonflexible load forecast to the aggregate renewable generation forecast over the optimization horizon.For instance, the LSF in Figure 2 is 0.6, which is selected as the benchmark or base scenario.For all the results shown in this section, only the system data clearly shown in the results are varied, the other data remain similar as in the benchmark scenario.
Figures 4(a), 4(b) show the benefits of the devised optimal EV charging/discharging strategy over the uncontrolled (nonoptimized) one.
In the uncontrolled EV charging/discharging strategy, EVs are charged instantly with the maximum power when they reach at the BMG CDS, and the charging terminates when the EVs reach their desired SOCs.As shown in Figure 4, the proposed optimal EV charging/discharging strategy provides a higher profit (optimal objective value) and a smaller PV power curtailment compared to the uncontrolled strategy.In addition, the BMG profit and the amount of PV power curtailment decrease as the penalty for renewable energy curtailment (c PV curt ) increases, and they finally become saturated since c PV curt is suitably high.Figures 5(a), 5(b) compare the advantages of the two strategies by varying the bid mismatch penalty (ϕ) for two cases, namely with and without an energy storage battery in the BMG.We can see that the BMG profit decreases and the amount of PV power curtailment increases as ϕ increases.This is due the fact that when ϕ increases, we must keep a stricter condition where the real-time power transfer should be much closer to the day-ahead submitted bid.In addition, it is obvious that the optimal EV charging/discharging strategy achieves a higher profit and smaller PV power curtailment than the uncontrolled strategy.The optimal hourly bids that BMG can submit to the day-ahead market with various values of LSF are shown in Figure 6.As shown in Figure 6, the amount of the day-ahead bid submission decreases as the LSF value increases.This is because higher LSF indicates the availability of more load demand in the microgrid than the renewable power generation.Thus, the microgrid supplies its local demands rather exporting or bidding its power to the main grid.That means the power export (bid) to the main grid decreases.

V. CONCLUSION
Optimal energy trading problem for a BMG with battery, EVs and RES in day-ahead and real-time energy markets is considered in this study.The battery and EVs are the major demand response resources of the BMG.We formulate the problem as a dual-step optimization process considering uncertainties of RES, electricity demand and electricity prices.The batteries as static energy storage and the EVs as dynamic energy storage capabilities are used to balance the variability of the demands, prices and RESs.The proposed optimization model aimed to maximize the profit for the BMG and minimize the demand and renewable energy curtailments as well as bid mismatch penalty while keeping the system capacity and technical constraints.Incentivized voluntary load shedding and penalties for involuntary load shedding, renewable generation curtailment and bid imbalance have also been considered in the devised model.Simulation findings demonstrate that the optimal coordination of energy storage batteries and EVs with renewable generation can improve significantly the profit of the BMG in the energy market, decrease the BMG operating cost and reduce the quantity of renewable energy curtailment.

u
Battery discharging efficiency (%) η EV ,c u EV charging efficiency (%) η EV ,d b EV ,d v,h,b,t Binary variable for EV discharging c Bat deg,u,t Battery degradation cost ($kWh) c Bat om,u,t Battery O&M cost ($kWh) C EV v,h,b

FIGURE 2 .
FIGURE 2. Forecasted base load and PV power production.

FIGURE 3 .
FIGURE 3. Day-ahead and real-time electricity prices.

FIGURE 4 .
FIGURE 4. Comparison between optimally controlled and uncontrolled EV charging/discharging strategies with various PV power curtailment penalties.

FIGURE 5 .
FIGURE 5. Comparison between optimally controlled uncontrolled EV charging/discharging strategies various power imbalance penalties.

FIGURE 6 .
FIGURE 6. Optimal day-ahead bids for various LSF values.