Holistic data-driven method for optimal sizing and operation of an urban islanded microgrid

This study proposes a holistic data-driven method for the optimal sizing and operation of a building-level islanded microgrid with renewable energy resources in an urban setting. Firstly, various metres are integrated on an energy monitoring platform where ﬁeld data are collected. A randomised learning-based forecasting model is designed for supply/demand prediction in the microgrid. Based on the forecasting results, data-driven uncertainty modelling is used to characterise the uncertainties associated with renewable energy supply and loads. An optimal sizing approach is then proposed to determine the optimal sizes for energy storage systems (ESSs) and distributed generators with the overall aim of minimis-ing the investment and maintenance costs. Based on the optimal sizing and uncertainty scenarios, a two-stage coordinated energy management method is proposed to minimise the operating cost under uncertainties. To validate the proposed method, it is compared with a benchmark method. Simulation results show that the proposed method can reduce the system cost while preserving the ESS lifetime. The developed methods are packaged onto a real-time platform for implementation.


Literature review
In microgrid applications, operational strategies target achieving optimal economic benefits without compromising system stability and reliability caused by intermittent renewable resources and various uncertainties. Research and studies on microgrid optimisation can generally be divided into three categories [4]. The first category focuses on operational strategies with a given or assumed system design for various optimisation objectives [5][6][7]. The second category aims at the optimal design which includes sizing and siting for a project lifetime under various system constraints [8,9]. The third category considers both operational strategies and optimal designs to arrive at global optimal solutions [4]. The primary argument for this type of approach is that sizing and operation strategies need to go hand in hand.
Optimal system sizing paves the foundation for further operational strategy development that guarantee better results and ensure practicability. In the literature, most existing work either focusses on the optimal operation phase or the optimal sizing/siting phase of the microgrid, while being less concerned with a holistic approach that coordinates the two phases [10]. One major challenge for microgrid optimisation is the uncertainty of renewable energy resources such as solar and wind power. Stochastic programming and robust optimisation methods have been reported to address this issue. Specifically, stochastic programming relies on a probability distribution function (PDF) to sample a limited number of random scenarios to approximate the uncertain space of the problem and convert the stochastic model into a deterministic model [7]. However, it is usually difficult to obtain such a PDF in the real world, and most of the existing works are based on the assumed PDF. In contrast, robust optimisation aims to search for the worst case of uncertainty and optimise it to achieve a fully robust solution against uncertainties [11][12][13]. However, robust optimisation tends to be more conservative, which is a major concern for long-term decision making, such as microgrid sizing.

Contribution of the study
This study aims to develop a holistic data-driven approach for the optimal sizing and operation of an islanded microgrid in an urban setting. This study uses a building-level urban islanded microgrid as a testbed for the case studies. The actual building load and photovoltaic irradiance data were first collected. An energy monitoring dashboard was developed to visualise and collect data from various sensors in real time. A randomised learning model was developed for supply and demand forecasting. Using the forecasting results, a data-driven approach was used to generate uncertainty scenarios to characterise the random supply and demand characteristics. Based on the uncertain supply/load model, optimal sizing is performed to determine the sizing of different components, more specifically, the sizes of the energy storage system (ESS) and the distributed generators, with the aim of minimising the capital and operational costs. Based on the optimal sizing results, a two-stage coordinated energy management strategy is proposed to minimise the system operating cost while satisfying various system constraints.
The key contributions of the study can be summarised as below: 1. Data analysis on field-collected historical data is conducted, and data-driven uncertainty modelling is derived. 2. An optimal sizing method considering operational constraints is proposed. 3. A temporal two-stage coordinated energy management strategy is proposed based on optimal sizing and data-driven uncertainty modelling.
The remainder of the paper is organised as follows: Section 2 introduces the islanded microgrid structure, component modelling, forecasting, and data-driven uncertainty modelling. Section 3 presents the optimal sizing methodology and its various considerations. Section 4 focuses on a two-stage coordinated energy-management strategy considering system uncertainties. Section 5 presents the results of the proposed methods. Firstly, the results for the optimal sizing are presented. Subsequently, the results of the proposed energy management strategy are benchmarked against a traditional deterministic approach. A comparison was conducted on various scales for the benchmark and proposed methods. The real-time visualisation of the simulation results is also demonstrated. Finally, Section 6 concludes the paper.

Structure of the islanded microgrid
The work in this paper is based on a practical islanded microgrid demonstration project in Singapore Institute of Technology (SIT) campus, and its schematic structure is shown in Figure 1.
The microgrid consists of a rooftop photovoltaic (PV) panel, an ESS, a diesel generator (DG) and a building load. A set of meters are located at selected locations of the building to measure load consumption of interest, PV irradiance and temperature. A screenshot of the real time energy monitoring dashboard is shown in Figure 2. The data we used in this paper are collected from this monitoring system.

Components modelling
In this section, various components in the islanded microgrid are mathematically modelled.

Rooftop PV panel model
PV panels convert irradiance into power. The conversion from irradiance to power is shown in where P PV , Y PV , G , G STC , p , T and T STC are the PV output power, total rated capacity of the PV array, current irradiance, irradiance at standard test conditions, temperature coefficient of power, PV cell temperature and PV cell temperature at standard test conditions.

Energy storage modelling
Energy storage can be modelled by characterizing it in terms of power, energy ratings and efficiencies. The power limits are be expressed as follows.
where P c and P d are the maximum charging and discharging rate of the ESS. The energy limits of an ESS can be expressed as state-ofcharge (SoC).
where P ESS (t ), t and E max are the power, time interval and maximum capacity of the ESS.
where p, and P are DC power, efficiency and AC power, respectively. Subscripts c and d denotes charging and discharging. The energy losses during conversion between DC/AC and AC/DC are considered. The output power of the diesel generator can be characterized by the output power, output power limits and ramp rate.
where p DG and DG are the output power and efficiency of the diesel generator.
where P DG and P DG are the lower and upper output power limits of the diesel generator.
where R down DG and R up DG are the ramp down and ramp up limits of the diesel generator; R up DG is a positive value and R down DG is a negative value.

Data-driven uncertainty modelling
The power output of renewable energy resources such as solar PV can be highly intermittent and random. Such uncertainty would significantly challenge the robustness of the operation and planning solutions. In this paper, extreme learning machine (ELM) [14], which is a type of artificial neural network is used for the PV irradiance and load forecasting. The structure of the ELM is shown in Figure 3.
Based on the basic ELM structure, the output function is formulated as follows:

FIGURE 4 Equidistant bins of PV irradiance forecast
where N is the number of hidden layer nodes, g is the activation function, w i ∈ R N represents the input weight vectors which connect input layer and hidden layer, β i ∈ R N represents the output weights connecting hidden layer and output layer, and b i is the input bias at the hidden layer nodes. At the training stage of the ELM, the input weights and biases are selected randomly, which leaves the output weights β to be analytically obtained by a direct matrix calculation. The output weight vector β* can be estimated by using the minimal norm least square method as follows: * = H † T (12) where H † represents the Moor-Penrose generalized inverse of H, and H is called the hidden layer output matrix, For PV irradiance forecasting model, the inputs are PV irradiance, temperature and hour of the day, the output is the PV irradiance. For the load forecasting model, the inputs are load power, hour of the day and day of the week, the output is the load power.
In this paper, a data-driven method that relies on historical data distribution is applied to model the uncertainties of the PV irradiance and load. Forecast bins are used to approximate uncertainty levels associated with forecasting values [15]. Firstly, a data pool of point forecasting values is formed using the proposed forecasting model for a substantial number of days. Every point forecast value corresponds to a set of actual measurement values. We use one selected day to illustrate how it works. Figure 4 shows a day-ahead forecast of PV irradiance and the actual values for one selected day.  Figure 5 shows uncertainty distributions for all of the forecast bins using data from 08 Oct 2020 to 04 Feb 2020.
The forecast bins in Figure 5 are stored and used to generate different scenarios based on the day-ahead forecasts. After a point forecast value is generated from the day-ahead forecasting model, we will sample randomly from the corresponding forecast bin distributions to get various possible actual values. This process is repeated until the desired number of uncertainty scenarios are generated. Figure 6 shows three PV scenarios generated from the forecast bin approach. The proposed method can generate any number of scenarios based on a single day-ahead forecast.
A similar approach is adopted to generate uncertainty scenarios for the load distributions. The combined uncertainty scenarios can then be generated by combining the two.

OPTIMAL SIZING FOR THE ISLANDED MICROGRID
The sizing of the islanded microgrid is formulated as optimization model that minimizes the capital cost (CC), maintenance cost (MC) and operation cost (OC) subject to operational constraints.
The capital cost is a one-time investment in the first year, assuming a fixed interest rate of r and number of years being l, the annualized one time cost (AOTC) in $/year can be calculated using [9]: Assuming the maintenance cost is recurring yearly, the total cost per day (TCPD) in $/day can be calculated as

Cost per day for ESS photovoltaic system and diesel generator
The ESS is made up of two main components, the array of batteries and the power converter system. The batteries and installation cost are proportional to the size of the system, $/kWh. The power converter system (PCS) to connect the ESS to the islanded microgrid, $/kW. The cost of batteries denoted as SC is: where ESS bat is the cost of batteries and E max is the maximum capacity of the battery in kWh and $/kWh, respectively. The cost of the power converter system denoted as PCS ess is: where ESS pcs and P c is the maximum power output of the ESS is the cost of the PCS in kW and $/kW, respectively. The maintenance cost of the ESS denoted as MC ess is considered in this project as shown in Equation (17): where MC EC and MC PCS are the maintenance cost of the batteries and PCS in $/kWh and $/kW, respectively. The AOTC of ESS can be calculated as The TCPD of the ESS in $/day can be calculated as The PV system is also made up of two components, the PV array and the power converter system. Similarly, the installation cost is proportional to the size of the system in $/kWp. The PV array cost is where PAC is the PV array cost; PV max and PV cost are the maximum PV output power and the cost in kWp and $/kWp, respectively.
The cost of the power converter system for PV is where PCS PV is the cost of the power converter system and PV pcs is the cost of the PCS in $/kWp. The maintenance cost of the PV system is where MC PV is the maintenance of the PV system; MC pac and MC pcs are the maintenance cost of the PV and PCS in $/kWp. The AOTC of the PV in $/year can be calculated as: The TCPD of the ESS in $/day can be calculated as: The capital cost of the diesel generator denoted as DG is where DG P and P DG is the cost and peak power output of the diesel generator in $/kW and kW, respectively. The maintenance cost of the DG is calculated as: where UMC DG is the maintenance cost of the DG in $/kW. The capital cost of the DG is also annualized.
The TCPD of the DG can be calculated as: The total TCPD of the ESS, PV and DG can be calculated as: TCPD = TCPD ESS + TCPD PV + TCPD DG (29)

Operating cost (OC) for ESS, photovoltaic system and diesel generator
The operating cost of the islanded microgrid is calculated as below: The operating cost of the diesel generator in $/kWh is where C DG and F DG are the total operating and fuel cost of the DG. The operating cost of the ESS is where C ESS and F ESS are the total operating and unit operating of the ESS.
For an islanded microgrid, once the power supply is deficient, the load needs to be curtailed, and the cost of power curtailment is: where P curtail and F curtail are the curtailed power and cost coefficient of curtailment, respectively. The total operating cost of the islanded microgrid can be calculated as:

Optimal sizing of islanded microgrid
The optimal sizing is formulated to minimize the total cost of the microgrid comprising of TCPD (Equation (29)) and OC (Equation (33)).
min TCPD + OC subject to the following constraints, Power balance: Power limit of ESS: Power limit of the diesel generator: Ramping rate limit of the diesel generator: Figure 7 shows the proposed two-stage coordinated energy management strategy taking into account supply and demand uncertainties.

TWO-STAGE COORDINATED ENERGY MANAGEMENT UNDER OPERATIONAL UNCERTAINTIES
In the two-stage coordinate optimization, the day-ahead ESS power outputs are optimized in the first stage and will be fixed for the next day operation (second stage), while the DG and curtailment power are re-dispatched in real time to compensate for inaccuracies in the forecast. The first stage decision is the ESS power output and the second stage decisions are the real time DG dispatch and power curtailment. The first stage decision, namely the ESS power output, are optimized based on the day-ahead forecast considering the scenarios generated from the day-ahead forecasts. The DG dispatch and power curtailment are discarded in the first stage. The problem can be formulated to be a two-stage stochastic programming model as follows: where y is the second stage decision variables, i.e. the DG output and power curtailment; the uncertain variable, i.e. the electrical load demands and PV power outputs. ξ is the uncertain variable, i.e. the electrical load demands and PV power outputs. ξ has a finite number of possible scenarios 1 , 2 , … n with respective probability of 1, 2 , … n. The scenarios are built according to Section 2.3. More specifically, the first stage optimisation considering uncertainties can be written as: (41) subject to Equations (35)-(39).
In the second stage real-time operation, the ESS follows the day-ahead decisions from the first stage while the DG power output and power curtailment are re-dispatched when the uncertainties are realised.

Forecasting results
In this paper, normalized root mean square error (NRMSE) are used to measure the accuracy of the forecasting results: The PV irradiance data are collected from our installed sensor during the period of 08 Oct 2019 to 04 Feb 2020. The load data are collected from our building load system from 27 Nov 2019 to 04 Feb 2020. The data are divided into training and testing set with a ratio of 7:3. The performance of the ELM models is shown in Tables 1 and 2. Illustrations of the forecasting results are shown in Figures 8  and 9.

Optimal sizing results
The typical load and PV irradiance profile from the historical data are used in the optimal sizing of the islanded microgrid as shown in Figure 10. The cost used for the components are shown in Table 3. The annual interest rate, life expectancy for ESS, PV and DG are assumed to be 6%, 3 and 10 years, respectively. The power curtailment cost if the summation of ESS and DG operating cost.  We assume power curtailment is a waste of energy therefore assign a high cost to it. The power generated from PV is assumed to be free, as such the optimization would aim to charge the ESS when there is an excess in PV generation and avoid dispatching DG and power curtailment for PV and ESS. The islanded microgrid has a strict power balance equation as it is not connected to the main grid. The sizing of each component is critical. The PV must be sufficiently large to have excess power for charging the ESS opportunistically. The ESS should be large enough to store the excess PV power so as to be used when needed. The DG must be sized to meet the load demand when PV and ESS are not available. Based on Section 3.3, the optimal sizing results are shown in Table 4.
The power generated from PV is assumed to be free, as such the optimization would aim to charge the ESS when there is an excess in PV generation and avoid dispatching DG and power curtailment for both PV generation and ESS. The islanded

Energy management results
The proposed two-stage coordinated energy management strategy aims to minimize the daily operating cost considering uncertainties. In the first stage, the ESS outputs are optimized using In order to demonstrate the advantages of the proposed method, we compare the proposed method with a two-stage deterministic energy management approach. In the first stage of the benchmark method, the ESS schedule is determined based on the day-ahead forecast to minimize the daily operating cost without considering uncertainties. In the second stage, DG and power curtailment are re-dispatched when the uncertainties are realised. Figure 11 shows a comparison of the day-ahead ESS schedule between the two methods on 05 Feb 2020. The red line shows the power output of the ESS, where negative power refers to ESS discharging while positive power refers to ESS being charged, referring to the vertical axis on the left. The orange shade stands for the SOC changes of the ESS. The green shade stands for the difference between the actual load demand and the PV generation, where positive power means load demand being bigger than the PV generation; while negative power means load demand being smaller than the PV In the benchmark method shown in Figure 11b, the ESS discharges between 11:00 AM to 12:00 PM when there is excess PV generation. The benchmark method does not make full use of the excess PV generation and potentially causes unnecessary power curtailment. This is caused by lack of consideration of forecasting uncertainties. However, using our proposed method in Figure 11a, the ESS is charged between 10:00 AM to 03:00 PM to capitalize on the excess PV generation. From 07:00 PM to 09:00 PM, the ESS discharges to meet the load when there is no PV generation. The proposed method is able to make proper decisions taking into account forecasting uncertainties. Figure 12 shows the DG power output and power curtailment under 10 selected uncertainty scenarios out of the total 100 scenarios. These decisions will be discarded. The second stage online optimisation will re-dispatch the DG output and power curtailment when uncertainties are realised. Figure 13 shows comparison for the second stage real time dispatch for DG and power curtailment, where the blue shade stands for the DG dispatch while the red shade stands for the power curtailment. The proposed method incurs much lesser power curtailment due to the consideration of uncertainties in the first stage. As such, more excess PV generation is utilized as compared to the benchmark method. Figure 13b also shows that there is a power curtailment after 09:00 PM. This part of the energy is curtailed because at night the load turns out to be lesser than the scheduled ESS output, part of the scheduled ESS output is curtailed in real time. In out proposed method, such cases do not occur, which is attributed to the consideration of the uncertainty scenarios. Figure 14 gives a comparison for the benchmark and proposed method. Figure 14a shows that the proposed method consumes lesser ESS and DG energy and also incurs lesser power curtailment due to the consideration of uncertainties. Figure 14b shows that the proposed method gives smoother ESS and DG operating profiles, which potentially contributes to better ESS lifetime preservation. Figure 14c shows that the total operating cost using our proposed method is 14.7% lower than the benchmark method.
Another case study was conducted using data from 07 Feb 2020. The comparison results are shown in Figure 15. The  Figure 15b. An overall 18% cost reduction is achieved using the proposed method.
The real time collected data from the energy monitoring system in Figure 2 is fed into the forecasting, scenario generation and optimisation engine with the proposed energy management strategies, decisions are then obtained and displayed on the dashboard shown in Figure 16. The data extraction, forecasting, scenarios generation and optimisation are carried out at the end of each day, from which the day ahead schedules of ESS are updated and displayed. The second stage decisions are also optimized in real time and displayed when the real time collected data becomes available.

CONCLUSION
This study develops a holistic approach for energy forecasting and uncertainty level analysis, optimal sizing, and coordinated energy management strategies for an islanded microgrid within an urban setting. The study begins with an online energy monitoring system where various data sources are field-collected for analysis and forecasting. A data-driven approach is adopted to model the uncertainties associated with forecasting and generate uncertainty scenarios. Using the field collected data, optimal sizing is conducted to determine the proper sizing for the islanded microgrid, which minimises the investment and operational costs while maintaining system stability. A two-stage coordinated energy management method that considers uncertainties is proposed to minimise the operational cost. The comparison results with a benchmark deterministic approach show that our proposed method can achieve a lower operating cost and better preserve the ESS lifetime.
A software platform is also built to aggregate the collected data, demonstrate forecasting results, and visualise operating recommendations.