Design of an Energy Management System for Secure Integration of Renewable Energy Sources into Microgrids

This chapter presents the design and development of an energy management system (EMS), which guarantees a secure operation of an islanded microgrid under possible imbalances between generation capacity and loads demand. The EMS performs an optimal calculation of low priority loads to be shed, as well as charging and discharging cycles of batteries within the microgrid. A nonlinear model-predictive control (NMPC) algorithm is selected for implementing the EMS, which processes a data set composed of loads measurements, generation capacity, batteries state of charge (SOC), and a set of operation constraints. The EMS is designed under the assumption of having an advanced metering infrastructure (AMI) installed in the microgrid. The EMS is tested in a simulation platform that integrates models of the microgrid components, as well as their distributed controllers (DCs). Simulation results show the effectiveness of the proposed approach, since critical variables as the microgrid’s frequency and voltage magnitude operate within a secured interval even under the presence of faults in one of the DCs.


Introduction
Many inventions have evolved over time from their initial conception, for example, the telephone. The telephone invention triggered a revolution in communications around the world that led to the powerful technology we have today. Alexander Graham Bell would be proud of his invention because of the impact and evolution of telephone, from landlines to satellite undergoes a paradigm shift that will change the industry to the use of DG systems. Figure 1 illustrates the DG concept by showing three different locations with installed DG units.
Small generators, which transform energy from RES, can be incorporated in the electric distribution network, for example, wind turbine generator (WTG) and photovoltaic (PV) arrays. These energy sources present many challenges to researchers and designers regarding power quality and economic issues. Today's power systems rely on spinning reserve and drooping frequency-load characteristics. Future systems, on the other hand, will rely on RES, which operate at peak power in order to displace as much fuel consumption as possible. This peak power constraint imposed by wind and sun complicates the frequency/load control of the entire system [8]. In order to compensate for this intermittent and changing power, short-and long-term storage devices should be deployed. Storage devices can be charged during periods of low-power demand and can supply power during high-power demand. This concept is shown in Figure 2.

Microgrids
Microgrids are small-scale LV/MV power systems with distributed energy resources (DERs), storage devices, and controllable loads, connected to the main power network or islanded, in  Design of an Energy Management System for Secure Integration of Renewable Energy Sources into Microgrids http://dx.doi.org/10.5772/intechopen.69399 a controlled and coordinated way [9]. Microgrids have different operating characteristics than bulk power systems (BPSs). A comparison, between microgrids and BPS, is shown in Table 1. Microgeneration units, typically located at users' sites, have emerged as a promising option to meet growing customer needs for electric power with an emphasis on reliability, power quality, and contribution to different economic, environmental, and technical benefits. However, the impact of microgeneration at LV levels on power balance and grid frequency is still a great challenge.

Advanced metering infrastructure
Smart meters (SMs) are important components of SGs. These devices have the following main features: full-duplex communication, ability to connect or disconnect consumer's loads, and recording capabilities for capturing waveforms for supervising voltage and current. SMs are gradually replacing traditional meters currently in operation and are also being installed in new microgrids. SMs transmit information to different information clients via SCADA systems and other networks.
Among the benefits that SMs offer to consumers, there is the possibility to know in real-time rates and pricing policies, allowing users to decide wisely how to use electric energy. Several research papers are devoted to household scheduling using AMI in order to reduce power consumption during peak consumption hours [10,11]. Figure 3 shows a possible architecture for an AMI. Due to the large number of SMs that will be available in distribution systems, the potential ability of SMs to provide additional information for outage management is also being investigated [12].

Fault-tolerant control
Critical-safety and operability issues with a defined performance in technological systems, such as electrical, industrial, aircraft control, nuclear generation, and so on, cause them to rely on complex control systems. Classic control schemes are suitable for guaranteeing a desired system performance in a specific operating range. However, these control strategies are unable to maintain the system performance under faulty scenarios. Therefore, there is a necessity of fault-tolerant control (FTC) strategies to improve the reliability and availability of critical-safe systems.
Quick detection of faults avoids serious damages to machines and humans, while allowing online reconfiguration of fault-tolerant controllers. Many books and research papers related to the field of FTC coincide on a two-step methodology for making a system fault-tolerant [13,14]: 1. Fault diagnosis: Whenever a fault is present in the system, it has to be detected and identified.
2. Control reconfiguration: The controller has to be designed with the ability to accommodate faults on components automatically.
This methodology is an active research field, mainly due to the variety of possibilities for executing the abovementioned steps. Fault diagnosis is performed by a fault detection and diagnosis (FDD) module, while control reconfiguration could be done by many different control approaches, such as model-based, intelligent, gain scheduling, and so on. Such an FTC system, which relies on the fault information obtained from the FDD module, is called an active faulttolerant control system (AFTCS). Figure 4 shows an architecture of an AFTCS [14].

Microgrid modeling
Control engineering most of the times is model dependent. Understanding the process, system, or plant to be controlled is fundamental for proposing proper control strategies. This section presents modeling procedures of the microgrid components used throughout this research: diesel engine generator (DEG), WTG, PV array, battery storage system (BSS), and power converters. At the end of this section, a microgrid benchmark model is presented, which integrates the microgrid components in one single simulation environment. Figure 5 shows the aforementioned elements in a microgrid configuration.
The rationale for the SGs lies in the integrative analysis of DERs, many of which will be intermittently operating, with the deployment of short-term and long-term storage systems. Current strategies on load sharing will not work to integrate RES due to its peak-power and intermittent operation. Therefore, new control strategies for voltage/reactive-power and loadsharing/frequency need to be developed; microgrid modeling is the first step prior to advanced controllers design.

DG units modeling
A DG unit is conformed mainly of three components: 1. Microgeneration unit. Typical choices are batteries, PV, WTG, flywheels, fuel cells, and so on.
2. Power conditioning system (PCS). PCS is related with power conversion, AC/DC or DC/ AC, and its control techniques.
3. Coupling circuit. Interface elements, most of the times a filter, for coupling the DG unit with the network.

Power electronic converters
Proper integration technology has to be developed for using DG units in a microgrid configuration. The majority of DG units is integrated to the grid through the use of power electronicsbased interfaces, which convert the power, firstly, to DC and then puts the energy into the grid by using an inverter. Adequate control strategies of the PCS allow maximum extraction of the energy from RES.
Power electronic converters performing conditioning have to be highly efficient, flexible, and reliable. It is well known that improving the performance of power converters increases system's efficiency. According to Figure 5, there are mainly three power electronic circuits that need to be implemented to control voltage, power, and frequency of a DG unit: AC/DC converter, DC/DC converter, and voltage source inverter (VSI).

Diesel engine generator
Diesel generating sets are typically used in power systems without connection to the power grid, as emergency power supply if the grid fails, as well as for more complex applications such as peak-shaving, grid support, and energy export to the power grid. This section presents models for the diesel engine (DE) components: synchronous generator and diesel engine. Design of an Energy Management System for Secure Integration of Renewable Energy Sources into Microgrids http://dx.doi.org/10.5772/intechopen.69399

Synchronous machine model
The synchronous generator has two circuits magnetically coupled: the first one is static and has the shape of a hollow cylinder with longitudinal slots and an armature winding; the second component is the rotor whose winding is supplied with DC current. The DC current is supplied to the field winding by an exciter, which may be a generator mounted on the same shaft or a separate DC source connected to the field winding through brushes bearing on slip rings [15].
As a prime mover drives the machine shaft, the magnetic field generated by the field winding links the stator coils to induce voltage in the armature windings.
As presented in Ref. [16], a state-space model, which uses the dq dynamic equations of the electrical circuit of a synchronous generator with a pure resistive load (RL) connected to its terminals, can be represented as follows: where ½i d i q i F T are the dq stator and field currents, respectively; R s and R F are the stator and field resistances; L s , L m , and L F are the stator, magnetizing, and field inductances; ω is the electrical speed; v d and v q are the dq stator voltages; and v F is the field voltage which will be used as a control input.

Diesel engine model
The DE contains the combustion system and is responsible for the movement of the pistons, consequently the movement of the crankshaft that generates the output torque T(s). Figure 6 shows a block diagram of a DE. A first-order system models the actuator dynamics of the DE. The time delay e -τ s and a torque constant K b model the combustion system. The flywheel block Figure 6. DE block diagram [6]. models the inertia generated inside the machine, η represents the flywheel acceleration constant, and the coefficient δ represents friction. The fuel injected to the DE is represented by x 1 (t), whereas x 2 (t) represents the angular velocity of the engine's shaft. d(s) models load changes in the rotor's shaft.
-ð2Þ Table 2 shows the characteristic values of the DE constants of model (2).

Wind-driven generation system
This section presents details on the modeling of a wind-driven electricity generation system (WEGS). A horizontal axis wind turbine (WT) is chosen as prime mover, while an induction generator performs the energy conversion. The wind turbine induction generator is an attractive DG unit in a deregulated electric energy market since wind energy is a non-polluting source.
Wind energy is air in motion whose energy is derived from sun, because about 2% of the solar flux falling on earth's surface is transformed into wind due to uneven heating of the atmosphere. Wind energy has some limiting characteristics such as non-schedulability, uncontrollable, and so on.

Wind turbine model
The WT model used throughout this chapter is a lumped mass model. The WT is pitch controlled through the blade pitch angle, β. The power coefficient, C p as shown in Eq. (3), characterizes the WT and depends on the tip speed ratio, λ ¼ ΩR/V w , and β, where R is the WT rotor radius, Ω is the mechanical angular velocity of the WT rotor, and V w is the wind velocity. The pitch angle β is only varied to limit the over-speed of the generator The dynamic output mechanical torque of the WT, T m, is expressed as where ρ is the air density and A represents the swept area of the blades.

Induction generator model
The electrical equations of the induction generator model in the dq reference frame can be expressed in pu as - where v s , v r , i s , i r , Ψ s , and Ψ r represent the voltage, current, and flux (subscript s stands for stator and subscript r for rotor); r s and r r are stator and rotor resistance, respectively; ω r is the rotor angular speed; ω b is the base electrical angular velocity; H represents inertia moment, T 0 is load torque, and p denotes a time derivative operation.

Photovoltaic generation system
A PV cell is represented as a single-diode mathematic model, which is composed of a current source I ph , a nonlinear diode, and internal resistances, R s and R sh . Figure 7 shows the PV cell model.
A PV array is composed of the combination of N p parallel and N s serial PV cells. The total current produced by a PV array is expressed as follows: References [18,19] present a simple nonlinear Thevenin model for the lead-acid battery. This model considers the dynamic response of the battery, which is influenced by the capacitive effects of the battery plates and also by the charge-transfer resistance. Figure 8 shows the equivalent circuit of a lead-acid battery ð7Þ Figure 7. Single diode PV model.

Microgrid model
Operating a microgrid within the limits of the established operation standards requires the development of novel control strategies. According to the standard ANSI C84.1, utilities are required to maintain voltage at the customer's service panel between 114 and 126 V (AE5%) Figure 9. Microgrid MV benchmark model CIGRE TF C6.04.02.
based on a 120-V nominal secondary voltage. Standard IEEE 1547-2-2011 [20] recommends that for interconnecting DERs with electric power systems, the total time should be less than 0.15 s when the magnitude of the frequency variation exceeds 0.5 Hz and the magnitude of the voltage variation exceeds 5%. Figure 9 shows the microgrid benchmark model configuration, consisting of two feeders supplied by a distribution substation. A grid of DG units is connected to the left-side feeder, including four PV array units, one WTG, two BSS, and one DEG. Every DG unit has a DC. The rated voltage level of the network is 20 KV, which is supplied from a 110 KV transformer station. The parameters of the network, the load and the DG units (in pu), were taken from Ref. [21] and are summarized in Tables 3 and 4.
Although maximum values for active and reactive power loads are considered in the network parameters shown in Table 3, variable load profiles have been generated for loads L 1 , L 2 , L 6 , L 7, and L 9 .
The features of DG units are as follows generator field current sets the voltage magnitude. The rated output power of the DEG is 0.3125 pu over a P base of 5 MW.
• WTG: The characteristics of WTG are assumed in Section 3.1.3. The maximum output power of the WTG is 0.2 pu.
• PV array: The features of the PV modules 330 SunPower (SPR-305) are used. PV 1 array consists of 66 strings of five series-connected modules connected in parallel, providing 0.02 pu. PV 2 , PV 3 , and PV 4 have 0.02, 4 Â 10 -3 , and 5 Â 10 -3 pu of power generation capacity, respectively. The PCS of every PV array is composed of a boost converter and a VSC.
• BSS: The lead-acid batteries are combined with bidirectional DC/AC converters with a maximum output power of 0.02 pu for BSS1 and 0.015 pu for BSS2. The charging power for every BSS is 0.01 pu.
DERs do not provide system frequency regulation. Therefore, for power flow calculations, the DG units (except for the DEG) are considered as load nodes with negative power consumption. During grid-connected operation, the main grid controls voltage and frequency. Islanded operation demands that local microgrid generation controls voltage and frequency.

Energy management system
The system states for the islanded section (left-side feeder) of the distribution system in Figure 9 are defined as where V i and δ i are node's voltage and angle of the bus i.
Additionally, more variables and vectors are needed for the controller formulation, such as power at the nodes S i ¼ P i þ jQ i , admittance matrix Y, and power generated by the DG units, P DGi : Equation (11) is solved iteratively through the Newton-Raphson (NR) power flow algorithm, with prior knowledge of P DGi , and current load consumption of every power system node. P DE is estimated in a prediction horizon of length N. An important modification of Eq. (11) is the inclusion of the reactive power consumed by the WTG at bus 7, which is calculated as follows [22]: where the negative sign of Eq. (12) represents reactive power consumption of the WTG induction generator from the network; z m , z c , z 1 , and z 2 represent the excitation reactance, reactance of a capacitor bank installed at the terminal of the induction generator, and the stator and rotor reactance, respectively.
The control objectives of the proposed strategy are as follows: • To manage the connection and disconnection events of batteries; • To shed low priority loads every time the load demand is greater than the generation capacity. This control action anticipates any harmful operation of the system through the predicting model, which predicts potential load imbalances; • To keep the voltage magnitude with a maximum variation of AE5%.
A microgrid-centralized controller (MGCC) implements an NMPC algorithm. Loads management as well as batteries connecting and disconnecting events are performed by a control vector, u, defined by Eq. (13). The control vector is calculated in real time by the MGCC, and transmitted to the DCs in the microgrid. Table 5 presents the relationship between each bit of u and its corresponding load controller for switching purposes, that is, for u i ¼ 1 ! L i load is connected, and for An important requirement in the design of NMPC is the availability of a model for predicting the output variables. The NMPC algorithm requires predicted values of the power generated by the DEG to optimally decide which load has to be shed. Trip commands are sent from the MGCC to proper loads. Figure 10 shows the EMS architecture. This control architecture is deeply analyzed in Ref. [23]. The NR power flow algorithm is used to predict the microgrid's system states, and consequently the P DE in a specific prediction horizon N. To find the optimal steady-state operation of the microgrid, the connection and disconnection commands of the control vector u are accounted within the NR algorithm. An initial data set Z k composed of the batteries' SOC, load demand, and the active power generated by every DER is required prior to the execution of the NR calculation. The data set Z k does not consider load variations within the prediction horizon. This fact is considered, and two approaches were tested for the initial iterative load values of the NR algorithm in order to predict P DE : Figure 10. NMPC architecture for a centralized load shedding strategy.
Design of an Energy Management System for Secure Integration of Renewable Energy Sources into Microgrids http://dx.doi.org/10.5772/intechopen.69399 1. Consider the load measurements as constants during the entire prediction horizon N; 2. Use a load predictor based on an artificial neural network (ANN). For this purpose, 20 load profiles from different days of the week for every variable loads in the microgrid were used as training set for configuring a three-layer ANN.
Another approach for predicting the P DE was developed with an autoregressive model with external input (ARX) through a data-based modeling using an adaptive neuro-fuzzy inference system (ANFIS). As in the case of the ANN training algorithm, 20 different generation profiles of the DEG for different days of the week were used as training set for the ANFIS. The ARX configuration developed is the one detailed in Ref. [24]. This modeling procedure does not imply an NR calculation, therefore reducing the computing time of the control algorithm.
Since the voltage magnitude of the microgrid is to be kept within a AE5% range of variation, a static voltage stability index, presented in Ref. [22], is used for defining a secure range of operation of the The control vector u calculated by the NMPC algorithm is restricted to be binary. Optimization problems of this type are called mixed-integer nonlinear programming (MINLP) problems. The MINLP package of TOMLAB for MATLAB was used for solving this optimal control problem.   [25] for further details). A simple MPC has also been tested, which causes microgrid instability due to its lack of adaptability to faulty situations. Figure 12 provides additional information on the NMPC performance by showing the voltage and frequency of the microgrid, and the loads and batteries switching due to the NMPC calculation. Voltage magnitude maintains within the AE5% band (in the weaker bus/node 1) when the microgrid operates in islanded mode. In this operation mode, when no control action is performed, the voltage magnitude constraint is violated. On the other hand, constraints included in the NMPC algorithm are not violated. From Figure 12, it is seen that high priority loads L 1 , L 7, and L 8 were not disconnected, and at least one load of the low priority loads group kept connected, as it was programmed in the NMPC algorithm. Batteries charge at off-peak times, when there is availability of power from the generation units (P gen > P load ). Batteries deliver power to the grid when there is a power deficit due to peak consumption. The inclusion of load shedding and battery management in the NMPC algorithm improves the microgrid's overall performance by guaranteeing a reliable and secure operation. In addition to the previous results, Figure 13 shows the operation of the microgrid under similar conditions of Figures 11 and 12. The islanding event occurs at 12h00, and as expected the voltage magnitude variation does not overpass the AE5% variation when the EMS takes decisions on the batteries energy management, and low priority loads to be shed. A similar situation is observed with the frequency deviation from 1 pu, which remains in an acceptable range of variation of maximum 0.05%. By contrast, the simulation of the microgrid operating without the EMS shows an unsecure behavior of the system, violating the |ΔV| < AE5% operation constraint, and also presenting a much larger frequency variation, as also shown in Figure 13.

Conclusions
A predictive control scheme that prevents from unbalances between the load demand and the capacity of generation installed in an islanded microgrid is analyzed in this chapter. The NMPC calculates, within an optimization framework, load shedding when necessary as well as the energy management from the batteries in the microgrid. Therefore, an optimal control problem is established, where all the operating conditions of the microgrid are integrated, that is, load priorities for disconnection and batteries charging and discharging cycles. A comparison of some simulation results of the microgrid working with and without the MGCC shows improvements in the reliability of the microgrid when it operates in islanded mode, since simulation results showed the capability of the control strategy of maintaining within safe limits voltage and frequency of the microgrid, as well as a correct balance of generated power and load demand.