3.4.1 ESS-related parameters and variables

As for the loads, the DGs in the system can either be activated or not, depending on if they produce effectively active power or not. This binary variable is called

QDG, genð Þ r; t , and QDG,absð Þ r; t . The start-up and shutdown of a DG at a specific hour are also binary variables and are denoted STDGð Þ r; t and SDDGð Þ r; t . Finally, the offgrid tð Þ binary variable is equal to 1 if the microgrid operates in stand-alone mode

If the DG is activated (the variable OnDGð Þ r; t is equal to 1), the active power

On the opposite, a DG can produce or absorb reactive power even if the DG

itself does not produce active power, it then behaves like a dynamic VAR

power balance, but the converters of other DERs can take this task.

∀r, ∀t PDG,minð Þ� r; t OnDGð Þ r; t ≤ PDGð Þ r; t ≤ PDG,maxð Þ� r; t OnDGð Þ r; t (9)

In stand-alone mode, the role of certain diesel generators (gensets) is to regulate the frequency. For this reason, they should not directly contribute to the reactive

<sup>∀</sup>rgenset, <sup>∀</sup>t QDG, gen rgenset; <sup>t</sup> � �<sup>≤</sup> QDG,max rgenset; <sup>t</sup> � � � ð Þ <sup>1</sup> � offgrid tð Þ (12)

∀r, t∈f g 2…24 STDGð Þ� r; t SDDGð Þ¼ r; t OnDGð Þ� r; t OnDGð Þ r; t � 1 (14)

Another novel constraint added to this algorithm is the use of diesel generator engines (genset) to smooth the transition between grid-connected and stand-alone modes. Indeed, in grid-connected mode, the stabilization of the frequency is achieved by the main utility grid. But in stand-alone mode, the diesel generators included in rgenset (at least one) will have to take over the task. If the binary variable offgrid tð Þ is equal to 1 at the hour t, the constraint then forces at least one genset to produce active power during each hour of stand-alone operation, and 1 h before and

As it is shown on the right-hand graph in Figure 2, the power converters interfacing the energy storage systems with the microgrid are usually able to work in the four quadrants of the active and reactive power plane. This is explained by the fact that they can manage a bidirectional flow of active and reactive powers.

The start-up and shutdown of a DG at the hour t are defined as follows:

QDG,abs rgenset; <sup>t</sup> � �<sup>≤</sup> QDG,max rgenset; <sup>t</sup> � � � ð Þ <sup>1</sup> � offgrid tð Þ (13)

OnDG rgenset; <sup>t</sup> � <sup>1</sup> � � <sup>þ</sup> OnDG rgenset; <sup>t</sup> � �

!

<sup>þ</sup>OnDG rgenset; <sup>t</sup> <sup>þ</sup> <sup>1</sup> � �

(16)

STDGð Þþ r; t SDDGð Þ r; t ≤ 1 (15)

∀r, ∀t QDG, genð Þ r; t ≤ QDG,maxð Þ r; t (10) QDG,absð Þ r; t ≤ QDG,maxð Þ r; t (11)

OnDGð Þ r; t . The output active and reactive powers are denoted PDGð Þ r; t ,

must be between the allowable minimum and maximum:

Micro-Grids - Applications, Operation, Control and Protection

at the hour t.

compensator:

1 h after as well.

70

∀t, ∀rgenset offgrid tð Þ≤

3.4 Energy storage systems

1 3

3.3.2 DG-related constraints

Every storage system in the microgrid possesses the following parameters: round-trip efficiency eff es ð Þ, maximal useful energy EESSð Þ es , maximal reactive power QESS,max, and maximal power for charging PESS,char,maxð Þ es and discharging PESS,dis,maxð Þ es . Another information needed is the initial state of charge (SoC) of the storage system at the hour preceding the beginning of the simulation, denoted SOCinitð Þ es [18].

The different variables for each ESS are the amount of active power it delivers or it absorbs, PESS,disð Þ es; t and PESS,charð Þ es; t , the amount of reactive power it generates or absorbs, QESS, genð Þ es; t and QESS,absð Þ es; t , and the remaining SoC at every hour SOC es ð Þ ; t . The binary variables ESScharð Þ es; t and ESSdisð Þ es; t are equal to 1 if the ESS charges or discharges active power, respectively.

### 3.4.2 ESS-related constraints

The first constraint forces the SoC of the storage system to be between 0 and 100%:

$$\forall \text{es}, \forall t \; 0 \le SOC(\text{es}, t) \le 1 \tag{17}$$

At hour 1, the ESS needs a special equation because it uses the initial SoC parameter:

$$\forall \mathbf{es}, t = \mathbf{1} \,\mathrm{SOC}(\mathbf{es}, t) = \mathrm{SOC}\_{\mathrm{init}}(\mathbf{es}) + \frac{P\_{\mathrm{ESS,char}}(\mathbf{es}, t) \cdot \sqrt{\mathbf{eff}(\mathbf{es})}}{E\_{\mathrm{ESS}}(\mathbf{es})} - \frac{P\_{\mathrm{ESS,div}}(\mathbf{es}, t)}{\sqrt{\mathbf{eff}(\mathbf{es})} \cdot E\_{\mathrm{ESS}}(\mathbf{es})},\tag{18}$$

The equation for the remaining hours has the same form as the previous one, except that SOCinitð Þ es is replaced by SOC es ð Þ ; t � 1 . So, ∀es, t ¼ 2…24:

$$\text{SOC(es,t)} = \text{SOC(es,t-1)} + \frac{P\_{\text{ESS,char}}(\text{es,t}) \cdot \sqrt{\text{eff}(\text{es})}}{E\_{\text{ESS}}(\text{es})} - \frac{P\_{\text{ESS,div}}(\text{es,t})}{\sqrt{\text{eff}(\text{es})} \cdot E\_{\text{ESS}}(\text{es})} \tag{19}$$

The following inequalities restrict the active power of the charge and discharge by their maximal bounds:

$$\forall \text{es, } \forall t \; P\_{\text{ESS}, char}(\text{es}, t) \le P\_{\text{ESS}, char, max}(\text{es}) \cdot E \text{SS}\_{char}(\text{es}, t) \tag{20}$$

$$P\_{\rm ESS,dis}(\mathsf{es},t) \le P\_{\rm ESS,dis,max}(\mathsf{es}) \cdot E \text{SS}\_{\rm dis}(\mathsf{es},t) \tag{21}$$

The same constraints as for the DGs apply concerning the generation and absorption of reactive power:

$$\forall \text{es, } \forall t \ Q\_{\text{ESS},gen}(\text{es}, t) \le Q\_{\text{ESS},max}(\text{es}) \tag{22}$$

$$Q\_{ESS,abs}(\text{es}, t) \le Q\_{ESS,max}(\text{es})\tag{23}$$

Finally, it seems natural that a storage system cannot charge and discharge its active power at the same time:

$$\forall \text{es, } \forall t \text{ ESS}\_{char}(\text{es}, t) + \text{ESS}\_{dii}(\text{es}, t) \le \mathbf{1} \tag{24}$$

3.7 Power quality issue avoidance

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

electrical equipment.

3.7.1 Power-quality-related parameters and variables

the best case, to limit the impacts on the levels of the loads.

<sup>∀</sup>l, <sup>∀</sup><sup>t</sup> αΔVð Þ <sup>l</sup>; <sup>t</sup> it¼<sup>i</sup> <sup>¼</sup> Pload,totð Þ <sup>l</sup>; <sup>t</sup> it¼<sup>i</sup>

its rated value (i.e., ΔV >0.05 pu), at every load bus l and every hour t:

3.7.2 Power-quality-related constraints

case a positive integer).

with:

73

<sup>¼</sup> αΔVð Þ <sup>l</sup>; <sup>t</sup> it¼<sup>i</sup>

The PQ constraints are not directly active at the first dispatch optimization of the MILP algorithm. The results will be first analyzed with a load flow and only then, if some standards are violated, new constraints will be added to address these issues. One difficulty is that the MILP optimization of the EMS only gives active and reactive power results and not voltages. It is therefore not possible to compute the voltage drop, the voltage THD, and the VUF directly. Three new constraints are thus defined to reflect the PQ issues, but with the leverage of active and reactive powers. The aim of this approach is to act on the demand level of problematic types of loads at the different nodes of the microgrid. For instance, if the voltage THD is above the limits at a node with residential loads, then the algorithm will ask the customers to reduce the consumption of their nonlinear loads, within a feasible range, to support the microgrid PQ and help to secure the safety of their own

Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management…

As mentioned previously, multiple iterations are launched between the MILP optimization and harmonic load flows if at least one PQ disturbance exceeds the standards. The goal is to find at the end of the iteration process the right constraints to add in the optimization that will prevent any PQ issue. In this work, sensitivity parameters λΔV, λdist, and λunb are used to strengthen these constraints at every iteration loop. The tuning of these sensitivity parameters essentially results in a trade-off between the accuracy of the final results and the speed of convergence. In practice, the voltage indices (ΔV, THDV, VUF) should be just below the standard in

The variables for the voltage drop, the harmonic distortion, and the phase unbalance in the MILP optimization are denoted αΔV, αdist, αunb,ab, αunb,bc, and αunb,ca. They will be defined in the equality constraints presented below.

The index it represents the iteration number. It is initialized at zero and then incremented each time it goes through a harmonic load flow (the variable i is in this

As reminded within the Section 2.1, the voltage drop between two nodes is linked with the active and reactive power flows (see (1)). If the X/R ratio of the line that connects each aggregated load is known, then the variable αΔ<sup>V</sup> is defined as:

The following equation is applied at every iteration if the voltage is below 95% of

If j j <sup>Δ</sup>V lð Þ . <sup>0</sup>:<sup>05</sup> pu and it . <sup>0</sup>: αΔV,limð Þ <sup>l</sup>; <sup>t</sup> it¼iþ<sup>1</sup>

<sup>∀</sup>l, <sup>∀</sup><sup>t</sup> αΔVð Þ <sup>l</sup>; <sup>t</sup> it¼iþ<sup>1</sup> <sup>≤</sup> αΔV,limð Þ <sup>l</sup>; <sup>t</sup> it¼iþ<sup>1</sup> (32)

� <sup>1</sup> � λΔ<sup>V</sup> � <sup>Δ</sup>V tð Þit¼<sup>i</sup> Otherwise: αΔV,limð Þ <sup>l</sup>; <sup>t</sup> it <sup>¼</sup> <sup>∞</sup> (33)

<sup>þ</sup> <sup>x</sup>=r lðÞ� Qloadð Þ <sup>l</sup>; <sup>t</sup> it¼<sup>i</sup> (31)

#### 3.5 Power exchange with the utility grid

As long as it is not in stand-alone mode, the microgrid is physically connected to a larger traditional utility grid at the point of common coupling (PCC).

#### 3.5.1 Grid-related parameters and variables

The maximal power that can be drawn from the grid is denoted Pgrid,in,max. If the microgrid produces a surplus of energy, it can inject it into the grid. The maximum power that can be injected is called Pgrid, out,max. In grid-connected mode, the microgrid can also help the utility grid to achieve its own voltage stability by providing the reactive power it needs, which is denoted Qgrid,reqð Þt .

The variables concerning the connection with the utility grid are the active power drawn from it, Pgrid,inð Þt , and rejected to it, Pgrid, outð Þt , and the reactive power absorbed from it, Qgrid,inð Þt , or supplied to it, Qgrid, outð Þt .

#### 3.5.2 Grid-related constraints

The active and reactive power can, of course, only be exchanged if the switch at the PCC is closed, and so if the binary variable offgrid tð Þ is equal to zero:

$$\forall t \ P\_{grid,in}(t) \le P\_{grid,in,max} \cdot (1 - \alpha \text{ffgrid}(t)) \tag{25}$$

$$P\_{grid,out}(t) \le P\_{grid,out,max} \cdot (1 - \text{offgrrid}(t)) \tag{26}$$

$$Q\_{grid,in}(t) \le Q\_{grid,in,max} \cdot (1 - \text{offgrid}(t)) \tag{27}$$

$$Q\_{grid,out}(t) \le Q\_{grid,out,max} \cdot (1 - offgrid(t))\tag{28}$$

#### 3.6 Power balance

Some of the most essential equations in the algorithm are the balance equations that will equilibrate load and generation. Here are the equations for the active and reactive power balances:

$$\begin{aligned} \text{At } \sum\_{l} (P\_{load}(l, t) \cdot (\mathbf{1} + l \text{os}\_{P})) + \sum\_{\mathbf{c}} P\_{\text{ESS}, char}(\mathbf{c}, t) \\ + P\_{grid, out}(t) = \sum\_{\mathbf{c}} P\_{\text{ESS}, di}(\mathbf{c}, t) + \sum\_{r} P\_{DG}(r, t) + P\_{grid, in}(t) \end{aligned} \tag{29}$$

$$\begin{aligned} \forall t \ \sum\_{l} \left( Q\_{load}(l,t) \cdot \left( 1 + \text{loss}\_{Q} \right) \right) &+ \sum\_{\text{ex}} Q\_{\text{ESS},abs}(\text{es},t) + \sum\_{r} Q\_{\text{DG},abs}(r,t) \\ &+ Q\_{\text{grid},out}(t) + Q\_{\text{grid},eq}(t) \cdot \left( 1 - \text{off}\_{\text{grid}}(t) \right) = \sum\_{\text{ex}} Q\_{\text{ESS},gen}(\text{es},t) \\ &+ \sum\_{r} Q\_{\text{DG},gen}(r,t) + Q\_{\text{grid},in}(t) \end{aligned} \tag{30}$$

In this work, predetermined hourly values are used for lossP and lossQ that represent the upper bounds of losses in the system, as a ratio to the total active or reactive power demand. These values are calculated by the load flow studies and represent a very small percentage of the total hourly loads.

Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management… DOI: http://dx.doi.org/10.5772/intechopen.83604

### 3.7 Power quality issue avoidance

Finally, it seems natural that a storage system cannot charge and discharge its

As long as it is not in stand-alone mode, the microgrid is physically connected to

The maximal power that can be drawn from the grid is denoted Pgrid,in,max. If the microgrid produces a surplus of energy, it can inject it into the grid. The maximum power that can be injected is called Pgrid, out,max. In grid-connected mode, the microgrid can also help the utility grid to achieve its own voltage stability by

The variables concerning the connection with the utility grid are the active power drawn from it, Pgrid,inð Þt , and rejected to it, Pgrid, outð Þt , and the reactive power

The active and reactive power can, of course, only be exchanged if the switch at

Some of the most essential equations in the algorithm are the balance equations that will equilibrate load and generation. Here are the equations for the active and

<sup>þ</sup> Pgrid, outð Þ<sup>t</sup> <sup>=</sup> <sup>∑</sup>esPESS,disð Þþ es; <sup>t</sup> <sup>∑</sup>rPDGð Þþ <sup>r</sup>; <sup>t</sup> Pgrid,inð Þ<sup>t</sup> (29)

(30)

þ Qgrid, outð Þþt Qgrid,reqðÞ� t ð Þ 1 � offgrid tð Þ = ∑esQESS, genð Þ es; t

In this work, predetermined hourly values are used for lossP and lossQ that represent the upper bounds of losses in the system, as a ratio to the total active or reactive power demand. These values are calculated by the load flow studies and

∀t Pgrid,inð Þt ≤ Pgrid,in,max � ð Þ 1 � offgrid tð Þ (25) Pgrid, outð Þt ≤ Pgrid, out,max � ð Þ 1 � offgrid tð Þ (26) Qgrid,inð Þt ≤ Qgrid,in,max � ð Þ 1 � offgrid tð Þ (27) Qgrid, outð Þt ≤ Qgrid, out,max � ð Þ 1 � offgrid tð Þ (28)

a larger traditional utility grid at the point of common coupling (PCC).

providing the reactive power it needs, which is denoted Qgrid,reqð Þt .

the PCC is closed, and so if the binary variable offgrid tð Þ is equal to zero:

<sup>þ</sup> <sup>∑</sup>esQESS,absð Þþ es; <sup>t</sup> <sup>∑</sup>rQDG,absð Þ <sup>r</sup>; <sup>t</sup>

absorbed from it, Qgrid,inð Þt , or supplied to it, Qgrid, outð Þt .

ðPloadð Þ� l; t ð Þ 1 þ lossP Þ þ ∑esPESS,charð Þ es; t

þ∑rQDG, genð Þþ r; t Qgrid,inð Þt

represent a very small percentage of the total hourly loads.

∀es, ∀t ESScharð Þþ es; t ESSdisð Þ es; t ≤ 1 (24)

active power at the same time:

3.5.2 Grid-related constraints

3.6 Power balance

∀t ∑<sup>l</sup>

72

reactive power balances:

∀t ∑<sup>l</sup> Qloadð Þ� l; t 1 þ lossQ

3.5 Power exchange with the utility grid

Micro-Grids - Applications, Operation, Control and Protection

3.5.1 Grid-related parameters and variables

The PQ constraints are not directly active at the first dispatch optimization of the MILP algorithm. The results will be first analyzed with a load flow and only then, if some standards are violated, new constraints will be added to address these issues. One difficulty is that the MILP optimization of the EMS only gives active and reactive power results and not voltages. It is therefore not possible to compute the voltage drop, the voltage THD, and the VUF directly. Three new constraints are thus defined to reflect the PQ issues, but with the leverage of active and reactive powers. The aim of this approach is to act on the demand level of problematic types of loads at the different nodes of the microgrid. For instance, if the voltage THD is above the limits at a node with residential loads, then the algorithm will ask the customers to reduce the consumption of their nonlinear loads, within a feasible range, to support the microgrid PQ and help to secure the safety of their own electrical equipment.

#### 3.7.1 Power-quality-related parameters and variables

As mentioned previously, multiple iterations are launched between the MILP optimization and harmonic load flows if at least one PQ disturbance exceeds the standards. The goal is to find at the end of the iteration process the right constraints to add in the optimization that will prevent any PQ issue. In this work, sensitivity parameters λΔV, λdist, and λunb are used to strengthen these constraints at every iteration loop. The tuning of these sensitivity parameters essentially results in a trade-off between the accuracy of the final results and the speed of convergence. In practice, the voltage indices (ΔV, THDV, VUF) should be just below the standard in the best case, to limit the impacts on the levels of the loads.

The variables for the voltage drop, the harmonic distortion, and the phase unbalance in the MILP optimization are denoted αΔV, αdist, αunb,ab, αunb,bc, and αunb,ca. They will be defined in the equality constraints presented below.

#### 3.7.2 Power-quality-related constraints

The index it represents the iteration number. It is initialized at zero and then incremented each time it goes through a harmonic load flow (the variable i is in this case a positive integer).

As reminded within the Section 2.1, the voltage drop between two nodes is linked with the active and reactive power flows (see (1)). If the X/R ratio of the line that connects each aggregated load is known, then the variable αΔ<sup>V</sup> is defined as:

$$\forall l, \forall t \; a\_{\Delta V}(l, t)^{it=i} = P\_{load, tot}(l, t)^{it=i} + \varkappa / r(l) \cdot Q\_{load}(l, t)^{it=i} \tag{31}$$

The following equation is applied at every iteration if the voltage is below 95% of its rated value (i.e., ΔV >0.05 pu), at every load bus l and every hour t:

$$\forall l, \forall t \; a\_{\Delta V}(l, t)^{it = i + 1} \le a\_{\Delta V, \lim}(l, t)^{it = i + 1} \tag{32}$$

with:

$$\begin{array}{c} \text{If } |\Delta V(l)| > 0.05 \, pu \text{ and } it > 0 \text{: } a\_{\Delta V, \lim}(l, t)^{\text{if } i = i + 1} \\ = a\_{\Delta V}(l, t)^{\text{if } i = i} \cdot \left(1 - \lambda\_{\Delta V} \cdot \Delta V(t)^{\text{if } i = i}\right) \text{Otherwise: } a\_{\Delta V, \lim}(l, t)^{\text{if }} = \infty \end{array} \tag{33}$$

For the harmonic distortion, Eq. (2) shows that nonlinear loads with a rich harmonic content will have a higher current THD and should therefore be limited when the distortion is too high with respect to the norms. One should notice that in this work, the current THD is a parameter fixed for every type of load ty, while the voltage THD is a PQ index computed with harmonic load flows. The variable αdist represents the total amount of distortion in the network and is defined as:

$$\forall t \; a\_{dilt}(t)^{it=i} = \sum\_{l} \sum\_{\text{ty}} \left( P\_{load}(l, \text{ty}, t)^{it=i} \cdot THD\_{l}(\text{ty}) \right) \tag{34}$$

The following equation is applied at every iteration, if the voltage THD is over 5% at least at one load bus l, and at every hour t:

$$\forall t \ a\_{dist}(t)^{it=i+1} \le a\_{dist, \lim}(t)^{it=i+1} \tag{35}$$

back to the utility grid. The gain from selling energy at an hour t is called Cgrid,sellð Þt . For each type of load, a parameter called value of lost load (VoLL) and denoted Cloadð Þ ty represents the lost gain from diminishing the use of this kind of load by 1 kW for 1 h. This parameter really depicts how valuable is each type of load. The type of load with the lowest VoLL will be the first one that the microgrid will reduce, drop out, or shift by some hours in case of emergency or high cost of electricity. On the other hand, critical loads which are important for the consumer should never be disconnected and a very high VoLL is attributed to them (e.g.,

Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management…

For the DGs, a fixed cost CDG, onð Þr represents the cost of maintaining and operating a DG when this one is running. An additional variable cost CDG,varð Þr represents the marginal cost of producing an additional kilowatt. This last parameter is often correlated with the price of the fuel for fossil-fueled engines. The cost related to the start-up of a synchronous fossil-fueled generator is denoted CDG,STð Þr . For the storage systems, a small cost CESS,dis is also attributed for discharging electricity from the storage equipment. This is done to prioritize the power production from renewable sources directly, rather than discharging the energy stored in the ESSs. Since the reactive power is usually free of charges, any power electronic converter can produce or consume it. A side effect can happen in which a converter from a DER supplies reactive power to the converter of another DER. Yet, reactive power flows must be minimized to prevent voltage drops. The exchange of reactive power should indeed only be done to compensate the low power factor of certain loads or to participate actively in voltage support of the utility grid. So, to restrict the reactive power flows, a small fictive cost CDER,react is assigned to any kVAR exchanged. Furthermore, the microgrid should also prioritize its own reactive power at low voltages rather than requesting it to the utility grid at a higher voltage. The reactive power exchanged with the utility grid has been assigned with a cost

Now, the MILP objective function can be stated gathering linear and binary decision variables with their respective cost coefficients. The total cost of operation for 24 h, Ctot, should be minimized by tuning the various decision variables cor-

Pgrid,inðtÞCgrid,buyðtÞ � Pgrid, outðtÞCgrid,sellðtÞ

PDGðr, tÞCDG, varðrÞ þ OnDGðr, tÞCDG, onðrÞ þ STDGðr, tÞCDG,STðrÞ

Cgrid,react

As it can be seen in Figure 3, the user of the algorithm can first insert the values of different parameters in an Excel spreadsheet to create a specific scenario. Then,

CDER,react

CDER,react

(42)

important motor drives in a factory).

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

Cgrid,react, which should be higher than CDER,react.

ESSdisðes, tÞCESS,disðesÞ

Ploadðl, ty, tÞCloadðtyÞ

QESS,absðes, tÞ þ QESS, genðes, tÞ

QDG,absðr, tÞ þ QDG, genðr, tÞ

Qgrid, outðtÞ þ Qgrid,inðtÞ

rectly and satisfying the constraints:

r ∑ t 

þ ∑ es ∑ t

þ ∑ t 

� ∑ l ∑ ty ∑ t

þ ∑ es ∑ t 

þ ∑ r ∑ t 

þ ∑ t 

Min Ctot ¼ ∑

4. Methodology

75

with:

$$\begin{split} & \text{If } \mathsf{THD}\_{V} > \mathsf{596} \text{ and } it > 0 \colon a\_{\text{dist,lim}}(t)^{\text{it} = i + 1} \\ & = a\_{\text{dist}}(t)^{\text{it} = i} \cdot \left( \mathbbm{1} - \lambda\_{\text{dist}} \cdot \max\nolimits \left( \mathsf{THD}\_{V}(l, t)^{\text{it} = i} \right) \right) \text{Otherwise: } a\_{\text{dist,lim}}(t)^{\text{it}} = \infty \end{split} \tag{36}$$

If several buses have an irregular voltage THD at a certain hour, the load bus that has the highest distortion is selected to create αdist,limð Þ<sup>t</sup> in (36). The constraints on the voltage distortion are global, for the whole microgrid, and only depend on the hour of the day t.

Regarding the phase unbalance, the following set of variables is adopted between each phase:

$$\forall t \; a\_{\text{unb},\text{ab}}(t)^{\text{it}=i} = \left| \sum\_{l} P\_{\text{load},\text{tot}}(l,t) \cdot (phase\_{\text{distrib}}(l,a) - phase\_{\text{distrib}}(l,b)) \right| \tag{37}$$

$$a\_{\rm unb,bc}(t)^{\rm it=i} = \left| \sum\_{l} P\_{\rm load,tot}(l,t) \cdot (phase\_{\rm distribution}(l,b) - phase\_{\rm distribution}(l,c)) \right| \tag{38}$$

$$a\_{\rm unb,cu}(t)^{\rm it=i} = \left| \sum\_{l} P\_{\rm load,tot}(l,t) \cdot (phase\_{\rm distribution}(l,c) - phase\_{\rm distribution}(l,a)) \right| \tag{39}$$

The following equation is applied at every iteration if the VUF is over 3% at least at one load bus, and at every hour t. The index ph<sup>0</sup> represents here the different phase to phase combinations.

$$\forall t, ph' \in \{ab, bc, ca\} \; a\_{unb, ph'}(t)^{it=i+1} \le a\_{unb, \lim}(t)^{it=i+1} \tag{40}$$

with:

$$\begin{aligned} \text{If } \Vdash \mathbf{U} \mathbf{U} \mathbf{F} \succeq \mathbf{\color{red}{90a}} \text{ and } \textit{it} \succeq \mathbf{0};\\ \alpha\_{\textit{unub}, \textit{lim}(t)^{\dot{\alpha} = i + 1} = \max\_{pl'} \left( a\_{\textit{unb}, pl'} (t)^{\dot{\alpha} = i} \right) \cdot \left( 1 - \lambda\_{\textit{unb}} \cdot \max\_{l} \left( VUF(l, t)^{\dot{\alpha} = i} \right) \right) \\ \text{Otherwise: } \alpha\_{\textit{unb}, \textit{lim}} \left( t \right)^{\dot{\alpha}} = \infty \end{aligned} \tag{41}$$

In these constraints, αunb,limð Þ<sup>t</sup> is also a global limitation for the whole microgrid that only depends on the time t. Hence, Eq. (41) selects at each hour the largest previous phase-to-phase αunb,ph<sup>0</sup> and the load bus with the largest VUF.

#### 3.8 Objective function

The cost curve Cgrid,buyð Þt tells how much it costs to buy 1 kWh from the utility grid at each hour. If the microgrid has enough resources to produce more power than its own loads require, it can either store energy in the storage system or sell it Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management… DOI: http://dx.doi.org/10.5772/intechopen.83604

back to the utility grid. The gain from selling energy at an hour t is called Cgrid,sellð Þt . For each type of load, a parameter called value of lost load (VoLL) and denoted Cloadð Þ ty represents the lost gain from diminishing the use of this kind of load by 1 kW for 1 h. This parameter really depicts how valuable is each type of load. The type of load with the lowest VoLL will be the first one that the microgrid will reduce, drop out, or shift by some hours in case of emergency or high cost of electricity. On the other hand, critical loads which are important for the consumer should never be disconnected and a very high VoLL is attributed to them (e.g., important motor drives in a factory).

For the DGs, a fixed cost CDG, onð Þr represents the cost of maintaining and operating a DG when this one is running. An additional variable cost CDG,varð Þr represents the marginal cost of producing an additional kilowatt. This last parameter is often correlated with the price of the fuel for fossil-fueled engines. The cost related to the start-up of a synchronous fossil-fueled generator is denoted CDG,STð Þr .

For the storage systems, a small cost CESS,dis is also attributed for discharging electricity from the storage equipment. This is done to prioritize the power production from renewable sources directly, rather than discharging the energy stored in the ESSs.

Since the reactive power is usually free of charges, any power electronic converter can produce or consume it. A side effect can happen in which a converter from a DER supplies reactive power to the converter of another DER. Yet, reactive power flows must be minimized to prevent voltage drops. The exchange of reactive power should indeed only be done to compensate the low power factor of certain loads or to participate actively in voltage support of the utility grid. So, to restrict the reactive power flows, a small fictive cost CDER,react is assigned to any kVAR exchanged. Furthermore, the microgrid should also prioritize its own reactive power at low voltages rather than requesting it to the utility grid at a higher voltage. The reactive power exchanged with the utility grid has been assigned with a cost Cgrid,react, which should be higher than CDER,react.

Now, the MILP objective function can be stated gathering linear and binary decision variables with their respective cost coefficients. The total cost of operation for 24 h, Ctot, should be minimized by tuning the various decision variables correctly and satisfying the constraints:

$$\begin{aligned} \textit{Min } \textit{C\_{\text{out}}} &= \sum\_{r} \sum\_{t} \left( P\_{\text{DG}}(r,t) \mathbf{C\_{DG,ur}}(r) + \textit{On\_{DG}}(r,t) \mathbf{C\_{DG,un}}(r) + \mathbf{ST\_{DG}}(r,t) \mathbf{C\_{DG,ST}}(r) \right) \\ &+ \sum\_{\alpha} \sum\_{t} \textit{ESS\_{di}}(\mathbf{s}(\mathbf{s},t) \mathbf{C\_{ESS,di}}(\mathbf{s})) \\ &+ \sum\_{t} \left( P\_{\text{grid},in}(t) \mathbf{C\_{grid,up}}(t) - P\_{\text{grid,out}}(t) \mathbf{C\_{grid,ul}}(t) \right) \\ &- \sum\_{l} \sum\_{t} \sum\_{t} P\_{\text{load}}(l,t;y,t) \mathbf{C\_{load}}(t) \\ &+ \sum\_{\alpha} \sum\_{t} \left( Q\_{\text{ESS},abv}(\mathbf{s},t) + Q\_{\text{ESS},\text{gen}}(\mathbf{c},t) \right) \mathbf{C\_{DER,\text{max}}} \\ &+ \sum\_{r} \sum\_{t} \left( Q\_{\text{DG},abv}(r,t) + Q\_{\text{DG},\text{gen}}(r,t) \right) \mathbf{C\_{DER,\text{max}}} \\ &+ \sum\_{l} \left( Q\_{\text{grid},\text{on}}(t) + Q\_{\text{grid},in}(t) \right) \mathbf{C\_{grid,\text{max}}} \end{aligned}$$

(42)

### 4. Methodology

As it can be seen in Figure 3, the user of the algorithm can first insert the values of different parameters in an Excel spreadsheet to create a specific scenario. Then,

For the harmonic distortion, Eq. (2) shows that nonlinear loads with a rich harmonic content will have a higher current THD and should therefore be limited when the distortion is too high with respect to the norms. One should notice that in this work, the current THD is a parameter fixed for every type of load ty, while the voltage THD is a PQ index computed with harmonic load flows. The variable αdist represents the total amount of distortion in the network and is defined as:

<sup>∑</sup>ty Ploadð Þ <sup>l</sup>; ty; <sup>t</sup> it¼<sup>i</sup>

The following equation is applied at every iteration, if the voltage THD is over

If several buses have an irregular voltage THD at a certain hour, the load bus that has the highest distortion is selected to create αdist,limð Þ<sup>t</sup> in (36). The constraints on the voltage distortion are global, for the whole microgrid, and only depend on the

> Pload,totð Þ� <sup>l</sup>; <sup>t</sup> ð Þ phasedistribð Þ� <sup>l</sup>; <sup>a</sup> phasedistribð Þ <sup>l</sup>; <sup>b</sup>

Pload,totð Þ� <sup>l</sup>; <sup>t</sup> ð Þ phasedistribð Þ� <sup>l</sup>; <sup>b</sup> phasedistribð Þ <sup>l</sup>;<sup>c</sup> 

Pload,totð Þ� <sup>l</sup>; <sup>t</sup> ð Þ phasedistribð Þ� <sup>l</sup>;<sup>c</sup> phasedistribð Þ <sup>l</sup>; <sup>a</sup> 

<sup>∈</sup>f g ab; bc;ca <sup>α</sup>unb,ph0ð Þ<sup>t</sup> it¼iþ<sup>1</sup> <sup>≤</sup> <sup>α</sup>unb,limð Þ<sup>t</sup> it¼iþ<sup>1</sup> (40)

The following equation is applied at every iteration if the VUF is over 3% at least

at one load bus, and at every hour t. The index ph<sup>0</sup> represents here the different

If VUF . 3% and it . 0:

Otherwise: <sup>α</sup>unb,limð Þ<sup>t</sup> it <sup>¼</sup> <sup>∞</sup>

previous phase-to-phase αunb,ph<sup>0</sup> and the load bus with the largest VUF.

In these constraints, αunb,limð Þ<sup>t</sup> is also a global limitation for the whole microgrid that only depends on the time t. Hence, Eq. (41) selects at each hour the largest

The cost curve Cgrid,buyð Þt tells how much it costs to buy 1 kWh from the utility grid at each hour. If the microgrid has enough resources to produce more power than its own loads require, it can either store energy in the storage system or sell it

<sup>¼</sup>maxph<sup>0</sup> <sup>α</sup>unb,ph0ð Þ<sup>t</sup> it¼<sup>i</sup> ð Þ� <sup>1</sup>�λunb�maxl VUF lð Þ ;<sup>t</sup> it¼<sup>i</sup> ð Þ ð Þ

Regarding the phase unbalance, the following set of variables is adopted

� THDIð Þ ty

Otherwise: <sup>α</sup>dist,limð Þ<sup>t</sup> it <sup>¼</sup> <sup>∞</sup> (36)

(34)

(37)

(38)

(39)

(41)

<sup>∀</sup><sup>t</sup> <sup>α</sup>distð Þ<sup>t</sup> it¼iþ<sup>1</sup> <sup>≤</sup> <sup>α</sup>dist,limð Þ<sup>t</sup> it¼iþ<sup>1</sup> (35)

<sup>∀</sup><sup>t</sup> <sup>α</sup>distð Þ<sup>t</sup> it¼<sup>i</sup> <sup>¼</sup> <sup>∑</sup><sup>l</sup>

Micro-Grids - Applications, Operation, Control and Protection

5% at least at one load bus l, and at every hour t:

If THDV . 5% and it . <sup>0</sup>: <sup>α</sup>dist,limð Þ<sup>t</sup> it¼iþ<sup>1</sup>

� <sup>1</sup> � <sup>λ</sup>dist � maxl THDVð Þ <sup>l</sup>; <sup>t</sup> it¼<sup>i</sup>

with:

<sup>¼</sup> <sup>α</sup>distð Þ<sup>t</sup> it¼<sup>i</sup>

hour of the day t.

between each phase:

<sup>∀</sup><sup>t</sup> <sup>α</sup>unb,abð Þ<sup>t</sup> it¼<sup>i</sup> <sup>¼</sup> <sup>∑</sup><sup>l</sup>

<sup>α</sup>unb,bcð Þ<sup>t</sup> it¼<sup>i</sup> <sup>¼</sup> <sup>∑</sup><sup>l</sup>

<sup>α</sup>unb,cað Þ<sup>t</sup> it¼<sup>i</sup> <sup>¼</sup> <sup>∑</sup><sup>l</sup>

phase to phase combinations.

3.8 Objective function

74

with:

∀t, ph<sup>0</sup>

<sup>α</sup>unb,limð Þ<sup>t</sup> it¼iþ<sup>1</sup>

the algorithm first runs an initial optimization, under the form of an MILP that minimizes the daily costs, while respecting a set of constraints. The main linear variables for this optimization are either active or reactive powers. In order to quantify the impact of the PQ issues in terms of active and reactive powers, new PQ indices have been created for the purpose of this work (αΔV, αdist, αunb,ab, αunb,bc, and αunb,ca). These new indices have the advantage to be directly computed in the MILP and do not require any load flow (see Section 3.7.2). The MILP optimizations are solved with the software GAMS. The solver typically converges in around 90 iterations within a relative error of 2 <sup>10</sup>6.

least one of the PQ constraints shown in (32), (35), and (40) is truly restrictive for

Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management…

The conceptual microgrid that has been used in this chapter is shown in Figure 4. It is an alteration of the one presented in [6]. While the properties of the lines, the American voltage levels, and the characteristics of the transformers and the DERs have been kept identical, this microgrid has different kinds of loads and a smaller number of branches. In order to show the diversity of power consumers in a microgrid, three main different loads have been introduced: a residential load, an

The test microgrid has three different levels of voltage, at 11.2 kV, 408, and 207 V. They are interfaced by transformers but do not include any DC bus. The architecture is radial, as usual in distribution systems, and divided into four different branches. The first branch contains two diesel generators genset<sup>1</sup> and genset2. These diesel generators are essentially a backup power supply in stand-alone operations. The second branch has a first bus at 408 V (node 3), which is connected to a small 60 kWp wind turbine and a battery storage system of 80 kWh useful energy. This branch continues to the 207 V voltage to feed a residential load of 48 dwellings, called Load1. The third branch supplies an important industrial load named Load2. Finally, the fourth branch is a bidirectional line that reaches a small office building load, Load3, with a 40 kWp PV installation. The power demands of the different

The utility grid seen from the PCC at node 4 has been replaced by its Thevenin equivalent. It has a short-circuit power of 1000 MVA and a X/R ratio of 22. All

the next MILP optimization.

5. Simulation for different case studies

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

industrial load, and a commercial load.

aggregated loads are represented in Figure 5.

Figure 4.

77

Architecture of the test microgrid.

During this first optimization, the parameters αlim,ΔV, αlim,dist, and αlim,unb have been initialized to a very large value, high enough so that the inequalities (32), (35), and (40) do not restrict the value of αΔV, αdist, αunb,ab, αunb,bc, and αunb,ca.

Using the results of the MILP, the program OpenDSS [19] will launch a set of harmonic load flows. These load-flows will give all the information about the voltage on the different nodes of the microgrid that is needed to compute the PQ indices, i.e., the voltage deviation in per unit, the voltage THD, and the VUF. If any of these indices does not respect the standards that have been presented in the Section 2, a noninfinite value will be attributed to the corresponding αlim, so that at

#### Figure 3.

Flow chart of the decision process. Green processes are performed by Excel, orange by GAMS, gray by OpenDSS, and blue by MATLAB.

least one of the PQ constraints shown in (32), (35), and (40) is truly restrictive for the next MILP optimization.
