## Abstract

Distributed resource (DR) impacts voltage and frequency, and deviations out of tolerance limits are financial damage to the customers. This chapter presents an energy management system (EMS) with several approaches to overcome intermittency and create a semi-dispatchable generation supply. The EMS will work as a prosumer considering its level of dispatchability, without disturbing the frequency of the network. The power generation model is based on a small wind turbine, solar panels, PEMFC, and a hydrogen storage system. Probabilistic information concerning short-term forecast applied to wind speed and radiation is provided by individual stochastic models. The prosumer is modeled by applying time series analysis through the root mean square algorithm with forgetting factor and by using model predictive control to integrate the system. A case is presented using historic wind speed and radiation data from Mexico City and loads curves based on average households and mini-store on a daily basis.

### Keywords

- distributed generation
- forecast
- energy intermittence
- model predictive control
- energy storage

## 1. Introduction

Renewable energies are increasingly being used to generate electricity. Integration to the network, however, requires adjusting the new technologies in order to meet the established norms. Wind and photovoltaic renewable energy generation technologies are up to now the most developed technologies, and, in both, intermittence is the major issue to attend for connection to the grid.

Studies concerning non-dispatchable generation combined with storage which focus on isolated networks are [1, 2, 3] where a DC configuration is proposed for the renewable energy integration and storage is implemented to increase the use of wind power and reduce the operation of backup systems. For stand-alone systems employing two or more technologies to generate electricity is common. Another way to deal with intermittence is by combining the wind power with forecast, which leads to focusing on ways to accurately plan how to use the generated power and how to participate in market regulation [4, 5]. The wind power uncertainty has been another research topic as in [6] where wind power forecasting uncertainty is investigated in the unit commitment. The study of levelized costs of grid-connected wind turbines with ESD [7, 8] or renewable sources implemented as DG [9], as well as the analysis of the wind energy in Germany [10], is an example of the many studies in the implementation of renewable energies.

The issue with intermittence in wind power can be decreased when a forecast model is implemented. The approach suggested in this study used an energy storage device (ESD) to stabilize the inherent variations and to balance the deviations of the actual wind power to better meet the planned network infeed. The purpose of the ESD is to reduce the intermittence with the implementation of a filter and to be able to meet the short-term planned production of the hybrid system (HS) at the distribution level. To keep a stable frequency in the network, what matters for the operation of the transmission system is not so much the variation in production but the unpredictability of the production which is the study in this work.

The major contribution, as shown in the following sections, is the ability to change the output power of the HS from a non-dispatchable to a semi-dispatchable generation giving the capability to inform the system operator to program the network dispatch. The flexibility of power dispatch depends greatly on the short-term prediction and the storage characteristics to reduce the variations of the power generated by the wind turbine.

Unlike other studies, we propose an energy management system (EMS) to overcome the frequency affectation when the hybrid system is connected as DG, by means of solely clean energies without depending in fossil power plants.

## 2. Implemented model philosophy

The interaction between the HS elements described in Section 4 is done through a developed model predictive control (MPC) algorithm. In consequence, the development of a wind and solar radiation forecast algorithm, alongside the modeling of the different implemented generation devices, is presented.

### 2.1. Forecast model

Energy forecasting is particularly meaningful when considering wind power because of dispatch planning and market operations [11]; the focus in this chapter is dispatch planning.

There are two approaches for wind speed forecasting, namely, weather-based and time series-based approaches. While the former uses hydrodynamic atmospheric models which incorporate physical phenomena such as frictional, thermal, and convective effects, the latter uses only historical wind speed data recorded at the site to build statistical models from which forecasts are derived [12].

The sample data used for the forecast was a 3-month data with a 10-min resolution (12,960 measurements) from a 1-year data recollected from Mexico City; the complete study was made for a whole year. Even though the collected measurement data covers a year, in this study only the first week of results was shown so the reader can truthfully see the behavior of the hybrid system and the output power in a clear way.

#### 2.1.1. Autoregressive (AR) model

A stochastic model that can be extremely useful in the representation of certain practically occurring series is the autoregressive model. In this model, the current value of the process is expressed as a finite, linear aggregate of previous values of the process and a random shock

In this model, the current value of the process was expressed as a finite, linear aggregate of previous values of the process. The AR model is a classic forecast model implemented in time series analysis. An AR(

From Eq. (1),

#### 2.1.2. Recursive least square with forgetting factor

Notice that the k-step AR(

which, by introducing the standard notation using X as the regressor vector, becomes

Recursive least square (RLS) with forgetting factor is based on the AR process and allows the parameter vector

where

This is a recursive implementation of a weighted least squares estimation, where the weights are exponentially decaying over time. With

The parameter

Typical values for

#### 2.1.3. Electrolyzer model

Hydrogen production through water electrolysis is a method of storing wind energy, and it is of great importance to understand that the hydrogen is fundamental to the implementation of this hybrid system, since it is the energy carrier that allows the hybrid system to work autonomously for long periods of time. The hydrogen can be stored and distributed to be used a posteriori to generate electricity via the fuel cell (FC); the only by-product of this combustion is water, so no additional pollution is generated [17].

The hydrogen production by electrolysis of water is reached by the decomposition of water into oxygen and hydrogen gas, thanks to an electric current passed through the water. The reaction has a standard potential of 1.23 V, meaning it ideally requires a potential difference of 1.23 V to split water. The chemical representation is given by

The basic operation of the electrolyzer can be demonstrated by a small experiment, which is shown in Figure 1 [18]. The water is electrolyzed into hydrogen and oxygen by passing an electric current through it.

The electrolysis is fundamental for the production of pure hydrogen, and this must be taken into account in the hybrid system model, by implementing the laws of Faraday electrolysis.

Faraday’s first law of electrolysis. The mass of the substance altered at the electrode during the electrolysis is directly proportional to the amount of electricity transferred to that electrode. The quantity of electricity indicates the amount of electrical charge, typically measured in coulombs [19].

Faraday’s second law of electrolysis. When the same quantity of electricity is passed through several electrolytes, the mass of the substances deposited is proportional to their respective chemical equivalent or equivalent weight [19].

The first law can be used to obtain the amount of hydrogen generated according to a DC current in a certain amount of time, being relevant to the operation of the fuel cell. It can be expressed in mathematical form as follows

The gas volume in liters is represented by

Electrolysis has the advantages of being static, simple, and able to operate for long periods without attention while generating hydrogen to be used in a fuel cell.

Considering Faraday’s law of electrolysis (Eq. (12)) and the fact that the power required by the electrolyzer can be computed by means of the power equation

VH_{2} is the volume of hydrogen produced by the cell. Implementing Eq. (13) the volume of hydrogen produced by the electrolyzer with

where

#### 2.1.4. Fuel cell model

The PEMFC is the type of cell that was used to develop the model and is characterized by an efficient production of energy with high power density represented in Figure 2. Since the cell separator is a polymer tape, the cell operates at a relatively low temperature, which potentially allows quick start-up, and issues such as sealing, assembly, and operation are less complex than in other cell types. The need for handling corrosive acids or bases in this system is removed [20].

The cell has internal electrical losses such as ohmic, activation, and mass transport [20, 21]. The ohmic losses are caused by ionic resistance in the electrolyte and electrodes; electronic resistance in the electrodes, current collectors, and interconnects; and contact resistances. Ohmic losses are proportional to the current density, depending on materials selection and stack geometry and on temperature.

The activation-related losses stems from the activation energy of the electrochemical reactions at the electrodes. These losses depend on the reactions at hand, the electro-catalyst material and microstructure, reactant activities (and hence utilization), and weakly current density.

Mass transport-related losses are a result of finite mass transport limitation rates of the reactants and depend strongly on the current density, reactant activity, and electrode structure.

The cell voltage is calculated based on the reversible open-circuit voltage *E* and the voltage losses, as follows

The internal losses in the fuel cell are neglected in this model, because their values tend to be very small and therefore do not significantly alter the result, as demonstrated in [22]. For the cell voltage, a value between 0.6 and 0.7 V can be assumed [23]. A value of 0.68 is assumed in accordance with the efficiency of the FC.

The operation of the fuel cell can be understood to be essentially the reverse process of electrolysis of water, as this technology recombines the hydrogen with oxygen to generate electrical power and water.

Individual fuel cell units are combined as modules in series or parallel configurations to provide desired voltage and output power. The mechanical arrangement must ensure not only electrical contact among units but also adequate circulation of gases, allowing catalyst reactions to take place at the correct temperatures and humidity levels [21]. The electric power generated by a FC is defined as

in which

To know the amount of hydrogen needed by the fuel cell, one must know the number of fuel cells that make up the stack of the final FC array. By means of Eq. (12) and Eq. (16), the hydrogen used by the stack, in mol/s [21, 24], is deduced as

Another way to calculate the hydrogen used is in kg/s, while considering the molar mass of the hydrogen and the Faraday constant (F), deduced as

In order to design the MPC, the impulse response function for the fuel cell is needed. Taking into account that the FC is an electrochemistry element, its dynamic is very fast as demonstrated in [25, 26]. To compute the impulse response of the FC, the function in Figure 3 is implemented to obtain

## 3. Hybrid system setup and EMS strategy

The proposed HS, according to the historic wind measurements from meteorological stations in Mexico City, is composed by a 5 kW Iskra small wind turbine [27], a 2 kW KC200GT photovoltaic (PV) array [28], a 2.4 kW PEMFC [29], an electrolyzer from the brand Proton OnSite with a net production rate of 18.8 standard liter per minute [30], and a 16,500 l hydrogen storage [31]; the device modeling is subsequently illustrated. In order to achieve the desired output power from the HS, the use of a forecasting method as explained in this section is proposed.

The control is recreated in a computational form, in which the HS output is reflected in the activation, the power regulation, and the interaction between the HS elements as seen in Figure 4, where the continuous, dashed, and pointed arrows represent the electric, control data, and hydrogen flow, respectively. The HS is supposed to connect to the distribution network, taking into account the power level used by normal households in Mexico City at different times of the year [32]. The HS can be adjusted to work as a constant power generator or to meet a signal reference output power, based on the daily historic load of the household(s). This can make the user change the consumption habits in order to have a better response to the system and to decrease the total cost of their electric consumption [33, 34].

Figure 4 shows the flow of the main energies that sustain the HS where the left side is the hydrogen flow and the right side is the electric power flow with the inputs and outputs of the systems. This figure also shows the electric conversion AC/DC and DC/AC taking into account that the FC has a DC output. The power will be controlled, regulated, and distributed to the network and electrolyzer with the purpose of storing energy in the form of hydrogen.

In order to implement a controller, one must understand and describe the models used in the system. Therefore, in the following section, the basic operation of the HS components will be introduced.

Depending on the objective function, various MPC strategies can be implemented. Model predictive control has the inherent advantages like the use for controlling a great variety of processes, including systems with long delay times or of non-minimum phases or unstable ones [35, 36]. In addition, the MPC introduces feedforward control to compensate measurable disturbances, allowing its application to this work to be more satisfactory [37].

Figure 5 shows the basic MPC structure; the future outputs for a horizon N are predicted at each instant t. The predicted outputs for

where

The MPC manages the electric power of the HS and takes into account the output power, the filtered forecast, and the actual wind power, so that the control decides how much power the FC is going to produce and how much power will be directed to the electrolyzer for saving energy for future fluctuations; thus, the output power will be almost without frequency changes and minimizing in a great extent the intermittence and variability of the wind power.

## 4. Forecast and MPC implementation in the hybrid system management

The purpose is to report to the system operator how much power will be delivered to the grid in the next hour. Along the scenarios a priority is given, and a constraint or condition will be added to compute

The reported data will be the trajectory followed by the HS by means of the MPC and will have the principal characteristic of being smooth in time as to avoid any operational instability like voltage or frequency in the grid because of the influence of the wind power. Furthermore, when a trajectory is applied to the control of the HS and successfully reached, it can be demonstrated that wind power as non-dispatchable energy, when implemented in a HS, can be converted to a semi-dispatchable electric source, making the management and distribution of energy more flexible.

Initially, an algorithm to find the optimal forgetting factor (

The aforementioned optimal

The time series models are updated in each iteration of the process as described later in this section, taking into account the new data measured every 10 min. The expressions obtained for each horizon of wind forecast (

The autocorrelation function (ACF) analysis result of the short-term forecast is shown in Figure 8, indicating that the used model is suitable for this study purpose.

Figure 9 shows the RMSE as a function of the horizon k (10-min steps). The black curve is the RMSE for persistence, and the red curve is for RLS. Some improvement of the RLS over the persistence is observed, but it is beyond the scope of the study to investigate the impact of using the forecasts compared to persistence.

The forecast is done using the following steps which are repeated every 10 min:

Update historic data.

Run 1-h-ahead forecast.

Compute the “new trajectory.”

Update the “last trajectory,” adding the last 10 min of the “new trajectory” at the end of the last one, as to always have a 1-h-ahead forecast generation.

Report the new 1-h-ahead updated trajectory to the system operator.

Different EMS scenarios were tested to be applied in the interaction of the inner elements of the hybrid system, with a variety of priorities for the output power, using the proposed developed MPC method.

This section presents and explains the different scenarios of control with the more significant outputs within the ones implemented, and based on these scenarios, a decision about which one is more convenient to implement can be taken, depending on the purpose of the HS, the priorities, and output power needed.

The computational process for all scenarios is shown in Figure 10 in a generalized way, in which constraints change in their decision-making depending on the priority for the HS of the case. The flowchart presents a never-ending iterative process, updating the historical wind measurements and managing the round-the-clock HS energy.

With the computed forecast and the application of the models for the different elements that integrate the HS, the objective function can be deduced and implemented to be minimized in the MPC:

The MPC minimizes an objective function subjected to constraints and manages the power flow of the HS, where

The constraints for the FC and electrolyzer are vectors with the physical nominal values of the elements represented by

## 5. Energy management system scenarios

Two scenarios are implemented to validate the algorithm proposed in this work. The scenarios establish priorities and have the main purpose of zero network frequency disturbance and as a second purpose possession of a more stable and semi-dispatchable power generation.

The purpose of the first scenario MPC as an EMS is smoothing the wind power, employing the power generated by the FC in a prioritized way as an electric generation source. The second scenario focuses on having an as much as possible constant output power, from the HS and the probable “sacrifices” to accomplish it, regarding the wind power surplus.

Figure 12 displays the actual active wind and PV power available, in which the intermittence with abrupt ramps is noticeable, i.e., sudden changes from 20 to 3200 W in the wind power.

### 5.1. Smoothing the wind power

In this scenario, the priority is to smooth the wind power generated by the turbine, managing the output power of the whole HS at every moment. To compute

To calculate the vector

The hydrogen storage will be charged when the tank presents a specified level of hydrogen, represented by the lower threshold (

Storage plays a great role when it comes to maintaining a stable output power of the HS for long periods of time. The activation and deactivation of the electrolyzer are the principal factors for maintaining a desired storage level. As seen in Figure 13, a global flowchart explains how it was applied in the model, giving an idea of how it can be modified depending on the priority of the storage required from the HS.

To ensure constant smooth output power from the HS, constraints were applied on the activation of the FC. As a result the FC generates more frequently and compensates the variability in the wind power, according to the amount of hydrogen stored. When there is no wind, the output power is determined by the nominal FC value. Given the uncertainty in the wind speed, this constraint was necessary to attain the designated power value without having to ask for backup from the grid. Therefore, the nominal value of the FC must be implemented in the MPC and in the activation of the FC. To compute

where the nominal power of the FC is represented by

The maximum power of the HS in this scenario will be determined as the sum of the wind power and the power from the FC given by

The sum of the power generated by the FC and forecast for the wind turbine will be filtered using Eq. (20) which will smooth the flickers, resulting in the reference for the MPC (Eq. (27)); simultaneously, this reference will be the output power of the HS.

### 5.2. Prioritizing the constant output power level of the hybrid system

When the priority is to have an as much as possible constant output power from the HS, the resulting analysis of the previous scenario is of great importance. Because of the intermittence of wind speed, the appearance of many sags in the power forecast and actual power is common. To maintain a linear output power means the need to “sacrifice” other characteristics as, in this case, the magnitude of power supplied from the HS to the distribution network given by

where

In this scenario, the filter at the control part of the model was modified from Eq. (20) as to have more energy stored and to decrease the output magnitude to 60% (

## 6. Results and discussions

Each subsection from Section 5 focuses on the required characteristics needed to smooth and flatten the output power of the HS in order to overcome the intermittence of wind power.

When the HS is connected to the network, it will not destabilize the frequency as demonstrated in this section. The obtained results show the first week behavior of the HS, for the reader to notice in a clear way the dispatchability and reduction of intermittence in comparison to a system without the application of the proposed model as the actual wind power.

### 6.1. Active power delivered from the HS

The designed HS system is to be connected to the distribution network as mentioned before. From results, it can be seen how the unpredictability from the wind power (Figure 12) is solved as shown in the HS active output power obtained with the proposed AEMS model (Figure 14). The network frequency will not be affected considering that the HS output power can be dispatched according to the final user needs and the information can be sent to the system operator with 1 hour prior.

Figure 14 presents the HS output power for both scenarios. Results from the first scenario show that because of the periods of charge, the HS output power has periods of no power delivered to the network and the implementation of the constraints required to activate the electrolyzer is also the moment of no power generated by the HS resulting from the electrolyzer consuming all the power generated by the wind turbine with the purpose of storing energy as hydrogen. Note in Figure 14 that the response obtained from the second scenario, when compared to the first scenario, is flatter, more stable, and more constant as it was expected.

Observing the results of the different scenarios, the HS output power can be adjusted to meet a specific load which modifies the trajectory followed by the MPC and the constraints applied. In addition, because of the flexibility of the MPC, the constraints that rule the charge and discharge of the hydrogen storage can be modified considering the purpose of the HS.

The reduction of volatility of the power delivered to the distribution network is noticeable, comparing the wind power from Figure 12 and the output power of the HS from Figure 14.

### 6.2. Hydrogen storage behavior

The behavior of the hydrogen generated by the electrolyzer and consumed by the FC in the different scenarios can be seen in Figure 15, where it can be noticed that when the electrolyzer works the hydrogen tank is charged and when the FC works the storage level of hydrogen will decrease.

The storage constantly maintains a minimum level of hydrogen as shown in Figure 15; thanks to this, the FC can work longer permitting a smooth or flat output from the HS.

Comparing the production and consumption of hydrogen from both scenarios, results show that there is 16% less production of

The storage from the first scenario always has a good level of hydrogen ready to be used by the FC in a more efficient way as in Figure 15, but clearly because of the charging periods of hydrogen, the output power drops to zero at the output of the HS.

The hydrogen consumption is constant, and, therefore, the tank will not reach a high level of storage, tending instead to maintain a lower mean of hydrogen, as shown in Figure 15.

### 6.3. Findings of the method

Taking into account the importance of charging periods for the storage of hydrogen and of keeping an output power level as linear as possible, decreasing the output power level to generate hydrogen was required for longer periods of time and for the FC to work as backup power to have an almost linearized power level at the output of the HS.

The FC can act as a means of contingency to smooth the output power thanks to the hydrogen stored in the tank, and because of the decision-making based on the forecast that gives information about future possible fast changes in wind power, it is possible the use the FC as a measure for preventing disturbance of the frequency of the network.

The surplus of energy from the high peaks of wind power is saved as hydrogen for future implementation, making smooth wind power and semi-dispatchable HS-generated power possible.

## 7. Conclusions

One of the most important conclusions is the fact that wind power as a non-dispatchable kind of energy, when employed in a hybrid system with implementation of forecast, can be managed as a semi-dispatchable energy. The generation can be modeled based on the needs of the end user or as a base energy for long periods of time, depending on the capacity of the storage and output power required for the system. Consequently, the frequency of the system will not be compromised because of sudden changes in wind power. The proposed HS is meant to work in the distribution level for housing sectors and small stores.

In real life application, this HS model will help to keep the net frequency in the tolerance rate, given the fact that it will not be disturbed by the HS when connected as DG into the network, thanks to the no uncertainty and no intermittence in the HS output power.

When the priority is completely given to the FC generation, there is a high risk of running out of hydrogen and not meeting the full capacity of the HS.

Another finding is the fact that to generate a completely linear power output, there is a need to “sacrifice” other features such as magnitude power, storage limits, and even the times to recharge the hydrogen tank according to the needs of the end user; hence, it is recommended to compromise the involved parties regarding the HS.

The implementation of forecast is demonstrated to be of great importance in planning the dispatch of power, improving and taking contingency measurements as to avoid disturbing the network or even improving the network in the connection point if necessary.

Forecast applied to wind power and used for the MPC allows the manipulation of the elements that make the HS obtain the desired output power while avoiding penalties.

## Acknowledgments

M.F.A.M gratefully acknowledges the support of DTU Compute and appreciates the financial support of the Cities project, supplementary to energy sustainability fund SENER-CONACYT through the CEMIE-OCÉANO project.