1. Introduction

The sectors of electricity generation, transmission, and distribution are currently facing a change of paradigm. The introduction of decentralized renewable energy sources and storage systems, the rise of electric vehicles, the multiplication of international high-voltage lines, and the development of smart grids are many reasons to believe that the way our societies produce, transmit, and consume electricity will progressively change in the coming decades [1].

A reliable and economically feasible supply of electricity remains, however, primordial for industrial and residential consumers. In the near future, several countries plan to introduce real-time pricing (RTP) at distribution levels, in order to reflect directly the variability of the electricity price on the consumers [2]. But since the costs of distributed renewable sources and storage systems have been

decreasing, many important consumers see an opportunity to build their own microgrid. Their goal is to reduce their electricity bills by covering partially or totally their electrical loads [3]. Buildings, factories, or even residential neighborhoods are often referred to as the types of consumers that could foresee the creation of a microgrid if it appears to be economically viable [4]. In areas where blackouts and grid outages are frequent, certain microgrids have the interesting capability to isolate themselves from the rest of the grid, and thus act as an uninterrupted power supply (UPS) for the sensitive loads. This islanding mode is also called stand-alone mode of a microgrid, in opposition to the grid-connected mode.

section. The third section enlightens the equations governing the EMS algorithm and outlines their role in the whole control mechanism of the microgrid. The fourth section presents and analyzes the results of the simulations for different scenarios on a test-case microgrid. A conclusion ends this chapter with the reminders on the conceptual approach, the procedure, and the major findings, while pointing the way

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

The term power quality has often been the subject of different interpretations. In [10], e.g., the definition encompasses several aspects without giving defined bounds: "Electric power quality is a term that refers to maintaining the near sinusoidal waveform of power distribution bus voltages and currents at rated magnitude and frequency. Thus, PQ is often used to express voltage quality, current quality,

In this chapter, the attention will be focusing on issues with a large time scale

The voltage magnitude at a bus can deviate from its rated value. These deviations are often tolerated for small percentages, but if they cross certain limits, they are considered as disturbances. Considering a short line model between nodes 1 and 2, the real part of the voltage difference between the two nodes ΔVd is given by the

ffi V<sup>1</sup> � V<sup>2</sup> (1)

(at every hour), such as undervoltage, voltage phase unbalance, and voltage

<sup>Δ</sup>Vd <sup>¼</sup> RP<sup>1</sup> <sup>þ</sup> XQ<sup>1</sup> V<sup>1</sup>

where P<sup>1</sup> and Q<sup>1</sup> are the active and reactive power flowing from node 1 to

Eq. (1) represents the voltage drop across the line. It clearly shows that it is highly dependent on the reactive power flow for inductive lines. However, in distribution lines with lower reactance on resistance ratio (X=R) such as in microgrids, both the active and reactive powers have an impact on the voltage deviation. The IEEE 1547-2003 standard recommends that a microgrid should not make voltage variations greater than �5% around the nominal value [12]. The new norm IEEE 1547.4 also recommends that at least one DER should be responsible for regulating the voltage and the frequency in islanded mode, while staying in coordination with the other loads and DERs. In this chapter, the attention is focused on

In recent years, the rising use of nonlinear power electronic devices along with an increase of the sensitive loads has resulted in various concerns [13]. The continued presence of harmonics can damage or degrade components in the networks such as transformers, electric motors, or electronic appliances. Harmonics also increase the total amount of power losses in the system [13]. High harmonics can normally be easily filtered by passive or active filters or, at least, reduced using

toward further research.

harmonic distortion.

2.1 Voltage deviation

well-known expression [11]:

node 2.

voltage drop.

65

2.2 Harmonic distortion

2. Power quality issues in steady state

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

reliability of service, quality of power supply, etc."

The presence of nonlinear, single-phase, or highly inductive loads in the system can impair the usual three-phase direct symmetric voltage and current waveforms. In general, the parameters concerning reliability and waveform quality of the voltage and current are part of the so-called power quality (PQ), a set of characteristics which define an adequate supply of electricity [5]. According to the performance required and the operative standards, specific bounds should be defined for each PQ index. It is moreover essential for microgrids, as several scientific articles have pointed out that PQ-related issues are more frequent in this type of architecture, especially when they are disconnected from the main grid [6].

For larger networks, PQ issues are normally handled with different techniques at the primary level of control, such as droop control of synchronous machines, active filtering, static VAR compensators (SVC), or other kinds of equipment [7]. But the cost of most of these installations is high for small-scale microgrids. Hence, another less effective but more economical method to tackle long-lasting PQ issues consists in regulating the demand levels of flexible loads to stabilize the microgrid [6]. This modification of the energy used by the consumers is called demand-side management (DSM) and requires an adapted communication system between the consumers and the central controller of the microgrid.

This DSM feature is included inside the energy management system (EMS) algorithm, situated at the tertiary level of control of the microgrid [8]. The EMS is normally only focused on dispatching the active and reactive power fluxes between the distributed energy resources (DERs), the utility grid, and the loads to satisfy the active and reactive power balances while reaching an economic optimum on a daily basis [5]. However, including an appropriate DSM mechanism inside the EMS makes it also a potential solution for the assessment of the PQ in steady state. To our knowledge, very few authors have proposed such an approach based on PQ-related scheduling decisions taken over the multihour horizon. In [6], an energy scheduling algorithm is presented, aiming at mitigating PQ issues through coordinating the operating schedules of sensitive devices in a commercial building microgrid. Yet, most works in literature are based on intelligent control strategies of the DERs interfacing inverters or utilization of dedicated power electronic devices for compensation, all acting on a faster time scale (see, e.g., [9] for a thorough survey of PQ improvement techniques in microgrids).

The main objective of the present chapter is to design and simulate an EMS algorithm for microgrids with specific PQ-related constraints while analyzing its behavior on realistic situations. The resulting algorithm proposed in this work investigates three different PQ issues, namely voltage drop, phase unbalance, and harmonic distortion. It also introduces new considerations regarding the operation of diesel generators during the transitions between grid-connected and stand-alone modes. The main advantage of the proposed algorithm is that it can effectively manage the abovementioned issues, whether the primary control means for PQ enhancements are available or not in the microgrid. The chapter starts with a description of the PQ indices and the common recommendations for their evaluation. Then, the model chosen for the DSM of the loads is presented in the following Power Quality Improvement of a Microgrid with a Demand-Side-Based Energy Management… DOI: http://dx.doi.org/10.5772/intechopen.83604

section. The third section enlightens the equations governing the EMS algorithm and outlines their role in the whole control mechanism of the microgrid. The fourth section presents and analyzes the results of the simulations for different scenarios on a test-case microgrid. A conclusion ends this chapter with the reminders on the conceptual approach, the procedure, and the major findings, while pointing the way toward further research.

### 2. Power quality issues in steady state

The term power quality has often been the subject of different interpretations. In [10], e.g., the definition encompasses several aspects without giving defined bounds: "Electric power quality is a term that refers to maintaining the near sinusoidal waveform of power distribution bus voltages and currents at rated magnitude and frequency. Thus, PQ is often used to express voltage quality, current quality, reliability of service, quality of power supply, etc."

In this chapter, the attention will be focusing on issues with a large time scale (at every hour), such as undervoltage, voltage phase unbalance, and voltage harmonic distortion.

#### 2.1 Voltage deviation

decreasing, many important consumers see an opportunity to build their own microgrid. Their goal is to reduce their electricity bills by covering partially or totally their electrical loads [3]. Buildings, factories, or even residential neighborhoods are often referred to as the types of consumers that could foresee the creation of a microgrid if it appears to be economically viable [4]. In areas where blackouts and grid outages are frequent, certain microgrids have the interesting capability to isolate themselves from the rest of the grid, and thus act as an uninterrupted power supply (UPS) for the sensitive loads. This islanding mode is also called stand-alone

The presence of nonlinear, single-phase, or highly inductive loads in the system can impair the usual three-phase direct symmetric voltage and current waveforms. In general, the parameters concerning reliability and waveform quality of the voltage and current are part of the so-called power quality (PQ), a set of characteristics which define an adequate supply of electricity [5]. According to the performance required and the operative standards, specific bounds should be defined for each PQ index. It is moreover essential for microgrids, as several scientific articles have pointed out that PQ-related issues are more frequent in this type of architecture,

For larger networks, PQ issues are normally handled with different techniques at the primary level of control, such as droop control of synchronous machines, active filtering, static VAR compensators (SVC), or other kinds of equipment [7]. But the cost of most of these installations is high for small-scale microgrids. Hence, another less effective but more economical method to tackle long-lasting PQ issues consists in regulating the demand levels of flexible loads to stabilize the microgrid [6]. This modification of the energy used by the consumers is called demand-side management (DSM) and requires an adapted communication system between the consumers and

This DSM feature is included inside the energy management system (EMS) algorithm, situated at the tertiary level of control of the microgrid [8]. The EMS is normally only focused on dispatching the active and reactive power fluxes between the distributed energy resources (DERs), the utility grid, and the loads to satisfy the active and reactive power balances while reaching an economic optimum on a daily basis [5]. However, including an appropriate DSM mechanism inside the EMS makes it also a potential solution for the assessment of the PQ in steady state. To our knowledge, very few authors have proposed such an approach based on PQ-related scheduling decisions taken over the multihour horizon. In [6], an energy scheduling algorithm is presented, aiming at mitigating PQ issues through coordinating the operating schedules of sensitive devices in a commercial building microgrid. Yet, most works in literature are based on intelligent control strategies of the DERs interfacing inverters or utilization of dedicated power electronic devices for compensation, all acting on a faster time scale (see, e.g., [9] for a thorough survey of PQ

The main objective of the present chapter is to design and simulate an EMS algorithm for microgrids with specific PQ-related constraints while analyzing its behavior on realistic situations. The resulting algorithm proposed in this work investigates three different PQ issues, namely voltage drop, phase unbalance, and harmonic distortion. It also introduces new considerations regarding the operation of diesel generators during the transitions between grid-connected and stand-alone modes. The main advantage of the proposed algorithm is that it can effectively manage the abovementioned issues, whether the primary control means for PQ enhancements are available or not in the microgrid. The chapter starts with a description of the PQ indices and the common recommendations for their evaluation. Then, the model chosen for the DSM of the loads is presented in the following

mode of a microgrid, in opposition to the grid-connected mode.

Micro-Grids - Applications, Operation, Control and Protection

especially when they are disconnected from the main grid [6].

the central controller of the microgrid.

improvement techniques in microgrids).

64

The voltage magnitude at a bus can deviate from its rated value. These deviations are often tolerated for small percentages, but if they cross certain limits, they are considered as disturbances. Considering a short line model between nodes 1 and 2, the real part of the voltage difference between the two nodes ΔVd is given by the well-known expression [11]:

$$
\Delta V\_d = \frac{RP\_1 + XQ\_1}{V\_1} \cong V\_1 - V\_2 \tag{1}
$$

where P<sup>1</sup> and Q<sup>1</sup> are the active and reactive power flowing from node 1 to node 2.

Eq. (1) represents the voltage drop across the line. It clearly shows that it is highly dependent on the reactive power flow for inductive lines. However, in distribution lines with lower reactance on resistance ratio (X=R) such as in microgrids, both the active and reactive powers have an impact on the voltage deviation. The IEEE 1547-2003 standard recommends that a microgrid should not make voltage variations greater than �5% around the nominal value [12]. The new norm IEEE 1547.4 also recommends that at least one DER should be responsible for regulating the voltage and the frequency in islanded mode, while staying in coordination with the other loads and DERs. In this chapter, the attention is focused on voltage drop.

#### 2.2 Harmonic distortion

In recent years, the rising use of nonlinear power electronic devices along with an increase of the sensitive loads has resulted in various concerns [13]. The continued presence of harmonics can damage or degrade components in the networks such as transformers, electric motors, or electronic appliances. Harmonics also increase the total amount of power losses in the system [13]. High harmonics can normally be easily filtered by passive or active filters or, at least, reduced using

appropriate modulation schemes in the control of the power electronic switches. However, low harmonics (3rd, 5th, 7th, 11th, etc.) are difficult to filter without reducing in the same way the signal at the base frequency. Harmonic cancellation techniques exist to tackle this problem, but they are usually expensive and technically difficult to implement [14].

The most used index to evaluate the distortion of a signal is called the total harmonic distortion (THD). The correct definition according to the IEC 61000-2-2 standard states that it is the ratio, in percentage, of the root-sum-square of all the harmonic magnitudes (without including the fundamental) on the magnitude of the fundamental [15]. THDs for voltage and current can thus be written as:

$$THD\_V = \frac{\sqrt{\sum\_{h=2}^{N} V\_h^2}}{V\_1}, THD\_I = \frac{\sqrt{\sum\_{h=2}^{N} I\_h^2}}{I\_1} \tag{2}$$

At low voltages, the limit of 5% voltage THD is commonly used [16]. In this work, the current THD will be considered as a known factor for each load. But the voltage THD, which results from those current harmonics, will be the PQ index measured in each node and the one that will be effectively constrained with the bound of 5%.

#### 2.3 Phase unbalance

According to the theory of the Fortescue decomposition, any three-phase system can be decoupled into direct, inverse, and zero-sequence components. The voltage unbalance is generally evaluated with an index called voltage unbalance factor (VUF), which corresponds to the ratio between the inverse ð Þ Vi (or zero ð Þ Vh ) and direct-sequence ð Þ Vd components of the Fortescue decomposition of the voltage:

$$VUF = \max\left(\frac{V\_i}{V\_d}, \frac{V\_h}{V\_d}\right) \tag{3}$$

optimization for 24 h, with specific decisions at each hour, thanks to a mixedinteger linear programming (MILP) algorithm. The algorithm will set the operating point of the production, storage systems, and load levels at every hour and assumes inherently that the frequency remains constant at 60 Hz. Steady-state PQ issues are addressed as well under the form of constraints, namely voltage drop, phase unbalance, and harmonic distortion. As already mentioned, it is interesting to notice that in traditional distribution grids, those PQ issues would normally be treated at the primary or secondary level of control, often with static compensator or dynamic power-electronics-based devices. But those installations are often too expensive for

Hierarchical control structure in microgrids (dashed lines represent feedback signals and solid lines represent

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

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

The constraints of the EMS algorithm can be divided into different sections, depending on the asset they concern: loads, grid connection, DGs, ESSs, etc. They

are presented below using the following indices notations:

• The harmonic order index is called h (1, 3, 5, …, 11).

• The DG index is called r (genset1, genset2, PV, WT, etc.).

• The genset index is called rgenset (genset1, genset2, etc.).

• The load type index is called ty (HVAC, appliances, motors, etc.).

• The iteration index of the PQ regulation loop is denoted it (0, 1, 2, etc.).

• The time index in hours is called t (1, …, 24).

• The load index is called l (Load1, Load2, etc.).

• The ESS index is called es (es1, es2, etc.).

• The phase index is called ph (a, b, c).

small-scale microgrids.

Figure 1.

67

guideline information).

The IEEE 1547.4-2011 standard warns the owner of the microgrid that large voltage unbalances can cause problems to the three-phase inverter-based DERs, by placing high ripple currents on the DC bus. These ripple currents may also have an adverse effect on the synchronous generators and energy sources (like batteries and fuel cells). The norm recommends the objective of keeping a VUF lower than 3% at every node [12].

#### 3. Building the energy management system

#### 3.1 Control structure of an AC microgrid

One can easily understand that communication between all the actors of the microgrid is essential, in order to maintain satisfying performance and to minimize the operating costs in both grid-connected and stand-alone modes. The control of AC microgrids is generally divided into a hierarchical three-level structure. In a similar way to traditional networks, the levels are differentiated by their usual time response. As shown in Figure 1, the entity that will supervise the communication between the different layers is called microgrid central controller (MGCC) [17].

The EMS algorithm supporting PQ that this work aims to develop is part of the tertiary control scheme. The algorithm will essentially compute cost minimizing

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

#### Figure 1.

appropriate modulation schemes in the control of the power electronic switches. However, low harmonics (3rd, 5th, 7th, 11th, etc.) are difficult to filter without reducing in the same way the signal at the base frequency. Harmonic cancellation techniques exist to tackle this problem, but they are usually expensive and techni-

The most used index to evaluate the distortion of a signal is called the total harmonic distortion (THD). The correct definition according to the IEC 61000-2-2 standard states that it is the ratio, in percentage, of the root-sum-square of all the harmonic magnitudes (without including the fundamental) on the magnitude of the

fundamental [15]. THDs for voltage and current can thus be written as:

q

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ∑<sup>N</sup> <sup>h</sup>¼2V<sup>2</sup> h

At low voltages, the limit of 5% voltage THD is commonly used [16]. In this work, the current THD will be considered as a known factor for each load. But the voltage THD, which results from those current harmonics, will be the PQ index measured in each node and the one that will be effectively constrained with the

According to the theory of the Fortescue decomposition, any three-phase system can be decoupled into direct, inverse, and zero-sequence components. The voltage unbalance is generally evaluated with an index called voltage unbalance factor (VUF), which corresponds to the ratio between the inverse ð Þ Vi (or zero ð Þ Vh ) and direct-sequence ð Þ Vd components of the Fortescue decomposition of the voltage:

> Vi Vd ; Vh Vd � �

, THDI ¼

ffiffiffiffiffiffiffiffiffiffiffiffiffiffi ∑<sup>N</sup> <sup>h</sup>¼2<sup>I</sup> 2 h

(2)

(3)

I1

q

V<sup>1</sup>

VUF ¼ max

The IEEE 1547.4-2011 standard warns the owner of the microgrid that large voltage unbalances can cause problems to the three-phase inverter-based DERs, by placing high ripple currents on the DC bus. These ripple currents may also have an adverse effect on the synchronous generators and energy sources (like batteries and fuel cells). The norm recommends the objective of keeping a VUF lower than

One can easily understand that communication between all the actors of the microgrid is essential, in order to maintain satisfying performance and to minimize the operating costs in both grid-connected and stand-alone modes. The control of AC microgrids is generally divided into a hierarchical three-level structure. In a similar way to traditional networks, the levels are differentiated by their usual time response. As shown in Figure 1, the entity that will supervise the communication between the different layers is called microgrid central controller (MGCC) [17].

The EMS algorithm supporting PQ that this work aims to develop is part of the tertiary control scheme. The algorithm will essentially compute cost minimizing

THDV ¼

Micro-Grids - Applications, Operation, Control and Protection

cally difficult to implement [14].

bound of 5%.

2.3 Phase unbalance

3% at every node [12].

66

3. Building the energy management system

3.1 Control structure of an AC microgrid

Hierarchical control structure in microgrids (dashed lines represent feedback signals and solid lines represent guideline information).

optimization for 24 h, with specific decisions at each hour, thanks to a mixedinteger linear programming (MILP) algorithm. The algorithm will set the operating point of the production, storage systems, and load levels at every hour and assumes inherently that the frequency remains constant at 60 Hz. Steady-state PQ issues are addressed as well under the form of constraints, namely voltage drop, phase unbalance, and harmonic distortion. As already mentioned, it is interesting to notice that in traditional distribution grids, those PQ issues would normally be treated at the primary or secondary level of control, often with static compensator or dynamic power-electronics-based devices. But those installations are often too expensive for small-scale microgrids.

The constraints of the EMS algorithm can be divided into different sections, depending on the asset they concern: loads, grid connection, DGs, ESSs, etc. They are presented below using the following indices notations:


It should be noted that the rgenset index gathers the different diesel generators that will have the task to maintain the frequency during stand-alone mode. Practically, only one diesel generator is enough if its capacity is sufficient.

The reactive power consumption is calculated using the active power and the

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

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi <sup>1</sup> � pf <sup>2</sup> ð Þ ty <sup>q</sup>

∀l, ∀t Pload,totð Þ¼ l; t ∑tyPloadð Þ l; ty; t (7) Qload,totð Þ¼ l; t ∑tyQloadð Þ l; ty; t (8)

pf ty ð Þ (6)

∀l, ∀ty, ∀t Qloadð Þ¼ l; ty; t Ploadð Þ l; ty; t

Finally, the aggregated load can be calculated for every node as follows:

The DGs are generally interfaced with the grid by a fully controllable converter. These converters have the ability to absorb or generate reactive power in addition to the active power generation. Since the converter is independent from the DG, it can absorb or generate reactive power, even if the DG is turned off. The left-hand graph in Figure 2 shows the capability curve of the DG converter with active and reactive power axes. Normally, the rating of power electronic converters is

expressed in VA, which means that the feasible zone should be a circle on an active and reactive power axis diagram. However, linear programming does not allow quadratic equations and the capability zone of the converter is then approximated by a rectangle. The absolute reactive power remains anyway small in general and

If the DG is on, it will be able to regulate its output useful power between a maximum and a minimum. Of course, renewable and intermittent sources are less flexible concerning this last feature because they often depend on meteorological conditions. The minimal and maximal active power outputs if the DG is running are denoted PDG,minð Þ r; t and PDG,maxð Þ r; t . The absolute reactive power generated or absorbed by the converter must also be enclosed by a maximum QDG,maxð Þ r; t ,

Capability zone of a DG and an ESS converter, with active and reactive power feasible ranges (in blue for discharging and green for charging). The real power rating (in VA) of the power electronic converter is

this simplification would normally not affect significantly the results.

fundamental-frequency power factor (pf ¼ cosð Þ ϕ ):

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

3.3 Distributed generators

3.3.1 DG-related parameters and variables

depending on its rating.

Figure 2.

69

represented with a dashed green line.

#### 3.2 Loads

#### 3.2.1 Load-related parameters and variables

To represent the diversity of loads present in the system, each aggregated load l at a node of a microgrid is disaggregated into several subloads depending on the end use, called types of load and denoted ty. These types of loads gather common devices that have similar power factor, harmonic content, and flexibility, namely HVAC, domestic hot water (DHW), lights, appliances, and motor drives. The purpose of this distinction is to get a better knowledge of the types of equipment that are causing PQ issues within the aggregated loads. It could be, for example, foreseeable that the MGCC asks a consumer at a certain point of the network to reduce slightly the temperature of its building to avoid the purchase of power on the utility grid when this one is expensive.

The parameter typeratioð Þ l; ty tells us the usual proportion of a load type ty in the consumption of an aggregated load l. For example, the typeratioð Þ l; ty of motors inside an industrial load is usually higher than 0.5. Each type of load also has the following parameters: fundamental-frequency power factor (pf ty ð Þ), harmonic content (harm ty ð Þ ; h ), current THD (THDIð Þ ty ), and flexibility (flex ty ð Þ), i.e., the percentage of the power consumption that a device can reduce without overly affecting its users. Those parameters are considered to be constant for every load type, whatever the active power they consume.

At an aggregate level, the total demand curve of a load at a specific node of the microgrid is supposed to be known and is referenced as Pload,curveð Þ l; t . Note that it is evaluated at the normal consumption usage, without the possible reduction linked with DSM. The aggregated loads could also be unbalanced between their phases. The phase distribution index phasedistribð Þ l; ph represents the ratio between the power that is actually required by a phase (a, b, or c) of an aggregated load and the power that would normally be consumed by this phase if the load was balanced. Thus, if these indices are unitary for all the phases of a load, this load is perfectly balanced. Finally, another parameter that will be useful for PQ matters is x=r lð Þ, the ratio between reactance and resistance of the line to which the load is connected.

At each hour, each load type can be either active or not, this binary variable is called Onloadð Þ l; ty; t and is equal to 1 if the load is active. If it is the case, the active and reactive powers that the type of load effectively consumes are called Ploadð Þ l; ty; t and Qloadð Þ l; ty; t . The total active and reactive powers for the aggregated loads at each node of the microgrid are called Pload,totð Þ l; t and Qload,totð Þ l; t .

#### 3.2.2 Load-related constraints

The active power must be between the allowable minimum and maximum if a load type of an aggregated load is activated (i.e., Onloadð Þ l; ty; t is equal to 1):

$$\begin{aligned} \forall l, \forall t \boldsymbol{y}, \forall t \ P\_{load}(l, t \boldsymbol{y}, \boldsymbol{t}) & \geq (\mathbf{1} - f \text{lex}(\mathbf{t} \boldsymbol{y})) \cdot \mathbf{t} \mathbf{y} p\_{ratio}(l, \mathbf{t} \boldsymbol{y}) \\ & \quad \cdot P\_{load, curve}(l, \mathbf{t}) \cdot \mathbf{On}\_{load}(l, \mathbf{t} \boldsymbol{y}, \boldsymbol{t}) \end{aligned} \tag{4}$$

$$P\_{load}(l, \text{ty}, \text{t}) \le \text{type}\_{ratio}(l, \text{ty}) \cdot P\_{load, curve}(l, \text{t}) \cdot On\_{load}(l, \text{ty}, \text{t}) \tag{5}$$

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

The reactive power consumption is calculated using the active power and the fundamental-frequency power factor (pf ¼ cosð Þ ϕ ):

$$\text{V}, \forall l, \forall y, \forall t \ Q\_{load}(l, ty, t) = P\_{load}(l, ty, t) \frac{\sqrt{1 - pf^2(ty)}}{pf(ty)}\tag{6}$$

Finally, the aggregated load can be calculated for every node as follows:

$$\forall l, \forall t \; P\_{load, tot}(l, t) = \sum\_{ty} P\_{load}(l, ty, t) \tag{7}$$

$$Q\_{load,tot}(l,t) = \sum\_{\text{ty}} Q\_{load}(l,t\text{y},t) \tag{8}$$

### 3.3 Distributed generators

It should be noted that the rgenset index gathers the different diesel generators that will have the task to maintain the frequency during stand-alone mode. Practically,

To represent the diversity of loads present in the system, each aggregated load l at a node of a microgrid is disaggregated into several subloads depending on the end use, called types of load and denoted ty. These types of loads gather common devices that have similar power factor, harmonic content, and flexibility, namely HVAC, domestic hot water (DHW), lights, appliances, and motor drives. The purpose of this distinction is to get a better knowledge of the types of equipment that are causing PQ issues within the aggregated loads. It could be, for example, foreseeable that the MGCC asks a consumer at a certain point of the network to reduce slightly the temperature of its building to avoid the purchase of power on the

The parameter typeratioð Þ l; ty tells us the usual proportion of a load type ty in the consumption of an aggregated load l. For example, the typeratioð Þ l; ty of motors inside an industrial load is usually higher than 0.5. Each type of load also has the following parameters: fundamental-frequency power factor (pf ty ð Þ), harmonic content (harm ty ð Þ ; h ), current THD (THDIð Þ ty ), and flexibility (flex ty ð Þ), i.e., the percentage of the power consumption that a device can reduce without overly affecting its users. Those parameters are considered to be constant for every load type, whatever

At an aggregate level, the total demand curve of a load at a specific node of the microgrid is supposed to be known and is referenced as Pload,curveð Þ l; t . Note that it is evaluated at the normal consumption usage, without the possible reduction linked with DSM. The aggregated loads could also be unbalanced between their phases. The phase distribution index phasedistribð Þ l; ph represents the ratio between the power that is actually required by a phase (a, b, or c) of an aggregated load and the power that would normally be consumed by this phase if the load was balanced. Thus, if these indices are unitary for all the phases of a load, this load is perfectly balanced. Finally, another parameter that will be useful for PQ matters is x=r lð Þ, the ratio between reactance and resistance of the line to which the load is

At each hour, each load type can be either active or not, this binary variable is called Onloadð Þ l; ty; t and is equal to 1 if the load is active. If it is the case, the active

Ploadð Þ l; ty; t and Qloadð Þ l; ty; t . The total active and reactive powers for the aggregated

The active power must be between the allowable minimum and maximum if a

∀l, ∀ty, ∀t Ploadð Þ l; ty; t ≥ð Þ� 1 � flex ty ð Þ typeratioð Þ l; ty

Ploadð Þ l; ty; t ≤ typeratioð Þ� l; ty Pload,curveð Þ� l; t Onloadð Þ l; ty; t (5)

� Pload,curveð Þ� l; t Onloadð Þ l; ty; t

(4)

and reactive powers that the type of load effectively consumes are called

loads at each node of the microgrid are called Pload,totð Þ l; t and Qload,totð Þ l; t .

load type of an aggregated load is activated (i.e., Onloadð Þ l; ty; t is equal to 1):

only one diesel generator is enough if its capacity is sufficient.

Micro-Grids - Applications, Operation, Control and Protection

3.2.1 Load-related parameters and variables

utility grid when this one is expensive.

the active power they consume.

3.2.2 Load-related constraints

connected.

68

3.2 Loads

The DGs are generally interfaced with the grid by a fully controllable converter. These converters have the ability to absorb or generate reactive power in addition to the active power generation. Since the converter is independent from the DG, it can absorb or generate reactive power, even if the DG is turned off. The left-hand graph in Figure 2 shows the capability curve of the DG converter with active and reactive power axes. Normally, the rating of power electronic converters is expressed in VA, which means that the feasible zone should be a circle on an active and reactive power axis diagram. However, linear programming does not allow quadratic equations and the capability zone of the converter is then approximated by a rectangle. The absolute reactive power remains anyway small in general and this simplification would normally not affect significantly the results.

#### 3.3.1 DG-related parameters and variables

If the DG is on, it will be able to regulate its output useful power between a maximum and a minimum. Of course, renewable and intermittent sources are less flexible concerning this last feature because they often depend on meteorological conditions. The minimal and maximal active power outputs if the DG is running are denoted PDG,minð Þ r; t and PDG,maxð Þ r; t . The absolute reactive power generated or absorbed by the converter must also be enclosed by a maximum QDG,maxð Þ r; t , depending on its rating.

#### Figure 2.

Capability zone of a DG and an ESS converter, with active and reactive power feasible ranges (in blue for discharging and green for charging). The real power rating (in VA) of the power electronic converter is represented with a dashed green line.

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 OnDGð Þ r; t . The output active and reactive powers are denoted PDGð Þ r; t , 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 at the hour t.

#### 3.3.2 DG-related constraints

If the DG is activated (the variable OnDGð Þ r; t is equal to 1), the active power must be between the allowable minimum and maximum:

$$\forall r, \forall t \; P\_{DG, min}(r, t) \cdot On\_{DG}(r, t) \le P\_{DG}(r, t) \le P\_{DG, max}(r, t) \cdot On\_{DG}(r, t) \tag{9}$$

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 compensator:

$$\forall r, \forall t \ Q\_{DG,gen}(r, t) \le Q\_{DG,max}(r, t) \tag{10}$$

$$Q\_{DG,abs}(r,t) \le Q\_{DG,max}(r,t) \tag{11}$$

Note that the generator convention is adopted, so, e.g., the active power is positive when discharging. As it was already explained in the previous section, the capability zone of these converters is approximated by a rectangle instead of a circle, due to

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

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

The different variables for each ESS are the amount of active power it delivers

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

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

The equation for the remaining hours has the same form as the previous one,

PESS,charð Þ� es; <sup>t</sup> ffiffiffiffiffiffiffiffiffiffiffiffiffi

The following inequalities restrict the active power of the charge and discharge

The same constraints as for the DGs apply concerning the generation and

except that SOCinitð Þ es is replaced by SOC es ð Þ ; t � 1 . So, ∀es, t ¼ 2…24:

∀es, ∀t 0≤ SOC es ð Þ ; t ≤ 1 (17)

eff es ð Þ <sup>p</sup>

EESSð Þ es � PESS,disð Þ es; <sup>t</sup> ffiffiffiffiffiffiffiffiffiffiffiffiffi

EESSð Þ es � PESS,disð Þ es; <sup>t</sup> ffiffiffiffiffiffiffiffiffiffiffiffiffi

eff es ð Þ <sup>p</sup> � EESSð Þ es

eff es ð Þ <sup>p</sup> � EESSð Þ es

(18)

(19)

PESS,charð Þ� es; <sup>t</sup> ffiffiffiffiffiffiffiffiffiffiffiffiffi

eff es ð Þ <sup>p</sup>

∀es, ∀t PESS,charð Þ es; t ≤ PESS,char,maxð Þ� es ESScharð Þ es; t (20)

PESS,disð Þ es; t ≤ PESS,dis,maxð Þ� es ESSdisð Þ es; t (21)

∀es, ∀t QESS, genð Þ es; t ≤ QESS,maxð Þ es (22) QESS,absð Þ es; t ≤ QESS,maxð Þ es (23)

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.

the limitations of linear programming.

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

3.4.1 ESS-related parameters and variables

SOCinitð Þ es [18].

100%:

parameter:

3.4.2 ESS-related constraints

∀es, t ¼ 1 SOC es ð Þ¼ ; t SOCinitð Þþ es

SOC es ð Þ¼ ; t SOC es ð Þþ ; t � 1

by their maximal bounds:

absorption of reactive power:

71

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 power balance, but the converters of other DERs can take this task.

$$\forall r\_{\text{genest}} \,\forall t \,\, Q\_{DG,gen}(r\_{\text{genest}}, t) \le Q\_{DG,max}(r\_{\text{genest}}, t) \cdot (1 - qffgrid(t))\tag{12}$$

$$Q\_{DG,abs}(r\_{\text{genset}}, t) \le Q\_{DG,max}(r\_{\text{genset}}, t) \cdot (1 - \text{offgrid}(t)) \tag{13}$$

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

$$\forall r, t \in \{2...24\} \text{ ST}\_{DG}(r, t) - \text{SD}\_{DG}(r, t) = \text{On}\_{DG}(r, t) - \text{On}\_{DG}(r, t - 1) \tag{14}$$

$$\text{ST}\_{DG}(r, t) + \text{SD}\_{DG}(r, t) \le 1 \tag{15}$$

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 1 h after as well.

$$\forall t, \forall r\_{\text{genet}} \; offgrid(t) \le \frac{1}{3} \begin{pmatrix} On\_{DG}(r\_{\text{genet}}, t - 1) + On\_{DG}(r\_{\text{genet}}, t) \\ & + On\_{DG}(r\_{\text{genet}}, t + 1) \end{pmatrix} \tag{16}$$

#### 3.4 Energy storage systems

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.

Note that the generator convention is adopted, so, e.g., the active power is positive when discharging. As it was already explained in the previous section, the capability zone of these converters is approximated by a rectangle instead of a circle, due to the limitations of linear programming.
