2.2.2 Electric vehicle

For simplicity, we assume that EVs have only one round-trip route per day, and the home of each EV owner is the only charging point for each EV.

Denote Ph,EVð Þt the charging/discharging power of the h-th EV during time slot t (Ph,EVð Þt . 0 in charging mode and Ph,EVð Þt , 0 in discharging mode), Ph,EVð Þt need to satisfy the following constraint:

$$P\_{h,EV}^{\min}(t) \le P\_{h,EV}(t) \le P\_{h,EV}^{\max}(t) \tag{13}$$

To reduce computational cost, Ph,EVð Þt between departure and arrival time slots of a route are assumed by zero, without loss of generality, and Ph,EVð Þt at these departure and arrival time slots are assumed to be equal to a half of �<sup>P</sup> drive <sup>h</sup> , where

P drive <sup>h</sup> is the equivalently consumed power of the h-th EV as if the EV route just lasts for one time slot.

$$P\_{h,EV} \left( T\_h^{\
dep} \le t \le T\_h^{arr} \right) = \mathbf{0} \tag{14}$$

The revenue function of EVs is defined in [21], taking into account the battery

The revenue function of the microgrid operator is calculated by

A Distributed Optimization Method for Optimal Energy Management in Smart Grid

Pmin

microgrid has more terms than that in the DSWM problem, as follows:

2.2.4 Power balance constraint in the microgrid

Pi,GðÞþt ∑

demands, and the microgrid operator, as follows:

s.t. (22), (9), (10), (13)–(19), and (21)

P tð Þ<sup>≜</sup> <sup>P</sup>1,Gð Þ<sup>t</sup> ; …; Pn,Gð Þ<sup>t</sup> ; <sup>P</sup>1,EVð Þ<sup>t</sup> ; …; Pv,EVð Þ<sup>t</sup> ; Pg ð Þ<sup>t</sup> � �<sup>T</sup>

Wi,Gð Þ� Pi,Gð Þt ; p tð Þ ∑

<sup>þ</sup> Wmg Pgð Þ<sup>t</sup> ; p tð Þ � �

∑ n i¼1

s.t. (22), (9), (10), (13)–(19), and (21)

q

l¼1

∑ n i¼1

2.2.5 PSwEV optimization problem

where

35

gPt ð Þ ð Þ ≜ ∑<sup>n</sup>

i¼1

min <sup>P</sup> <sup>∑</sup> N t¼1

where Pgð Þt is the power trading between the MG and the microgrid via the microgrid operator. In the case that the microgrid sells power to the MG, Pg ð Þt is negative. Furthermore, Pg ð Þt needs to satisfy upper and low bounds, as follows:

<sup>g</sup> <sup>≤</sup> Pgð Þ<sup>t</sup> <sup>≤</sup> Pmax

With the existence of EVs and the MG, the power balance constraint in the

m j¼1

Pj,Dð Þþt ∑

v h¼1

gPt ð Þ ð Þ (23)

; <sup>P</sup><sup>≜</sup> <sup>P</sup>ð Þ<sup>1</sup> <sup>T</sup>; …; P Nð Þ<sup>T</sup> h i<sup>T</sup>

Wh,EVð Þ Ph,EVð Þt ; p tð Þ

Pl,RðÞþt Pg ðÞ¼ t ∑

The PSwEV problem is to maximize the total revenue of DGs, EVs, load

m j¼1

Substituting (11), (12) and (18)–(20) into (23), the PSwEV maximization

v h¼1

programming in (23) can be rewritten as a minimization problem below:

Cið Þ� Pi,Gð Þt ∑

Wj,Dð Þþ p tð Þ ∑

v h¼1

Lhð Þþ Ph,EVð Þt q tð ÞPgð Þt � � (24)

max <sup>P</sup> <sup>∑</sup> N t¼1

Wh,EVðPh,EVð Þt ; p tð ÞÞ ¼ Lhð Þ� Ph,EVð Þt p tð ÞPh,EVð Þt (19)

Wmg Pgð Þ<sup>t</sup> ; p tð Þ � � <sup>¼</sup> ð Þ p tðÞ� q tð Þ Pg ð Þ<sup>t</sup> (20)

<sup>g</sup> (21)

Ph,EVð Þt (22)

life cost:

2.2.3 Microgrid operator

DOI: http://dx.doi.org/10.5772/intechopen.84136

$$P\_{h,EV} \left( T\_h^{dep} \right) = P\_{h,EV} \left( T\_h^{arr} \right) = -0.5 P\_h^{drive} \tag{15}$$

The state of charge (SOC) of EV battery at the starting point of a next time slot depends on the SOC at the starting point of current time slot and a charging/ discharging efficiency φh, as shown in (4).

$$\text{SOC}\_{h}(t+1) = \begin{cases} \text{SOC}\_{h}(t) + \rho\_{h} P\_{h,EV}(t) \Delta t & : P\_{h,EV}(t) \ge 0 \\\\ \text{SOC}\_{h}(t) + \frac{P\_{h,EV}(t) \Delta t}{\rho\_{h}} & : P\_{h,EV}(t) < 0 \end{cases} \tag{16}$$

SOC constraint is as follows:

$$\text{SOC}\_{h}^{\text{min}} \le \text{SOC}\_{h}(t) \le \text{SOC}\_{h}^{\text{max}} \tag{17}$$

When EVs are at home (from the arrival time to the next departure time), their charging/discharging scheduling can be utilized for DR actions. The variable Ph,EVð Þt during EV plugged-in time is the decision variable and will be solved by the proposed algorithm. However, it is necessary to ensure that EVs have enough energy (SOC) for their routes before their departure times. To satisfy this requirement, we consider a simple EV charging strategy based on [21]–[22] in which Pmin h,EV and Pmax h,EV in (13) are specified during the EV plugged-in time. The EV charging strategy is presented below.

Algorithm 1: EV charging strategy (from Tarr <sup>h</sup> to the next day <sup>T</sup>dep <sup>h</sup> )

```
1: Input: Departure time Tdep
                         h , and the required state-of-charge SOCreq
                                                                h
2: t0 ¼ round Tdep
              h � SOCreq
                       h
                    Pmax
                    EV Δt
            � �
3: If Tarr
     h ≤ t , t0
4: Pmax
     h,EVðÞ¼� t Pmin
                 h,EVðÞ¼ t Pmax
                            EV ¼ �Pmin
                                    EV ¼ const
5: t ¼ t þ 1
6: Return to 3
7: Else t0 ≤ t , Tdep
               h
8: Pmin
     h,EVðÞ¼ t max Pmin
                    EV , Pmax
                         EV ð Þ� t � t0 SOChð Þ� t SOCmin
                                                     h
                  � �=Δt � �
9: Pmax
     h,EVðÞ¼ t min Pmax
                    EV , SOCmax
                  h � SOChð Þt � �=Δt � �
10: t ¼ t þ 1
11: Return to 3
12: Else t ¼ Tdep
            h
13: End
```
The battery life function of EVs depends on EVs charging/discharging power [23], as follows:

$$L\_h(P\_{h,EV}(\mathbf{t})) = -\mu\_h \, P\_{h,EV}^2(\mathbf{t}) + \pi\_h P\_{h,EV}(\mathbf{t}) P\_{h,EV}(\mathbf{t} - \mathbf{1}) \tag{18}$$

where μ<sup>h</sup> and π<sup>h</sup> are constant coefficients, h ¼ 1, …, v.

A Distributed Optimization Method for Optimal Energy Management in Smart Grid DOI: http://dx.doi.org/10.5772/intechopen.84136

The revenue function of EVs is defined in [21], taking into account the battery life cost:

$$W\_{h,EV}(P\_{h,EV}(t), p(t)) = L\_h(P\_{h,EV}(t)) - p(t)P\_{h,EV}(t) \tag{19}$$
