A Novel Holistic Energy Management System Incorporating PV Generation and Battery Storage for Commercial Customers

The increasing electricity costs and the decarbonization targets are driving consumers to seek alternative energy supply and energy management tools to decrease their energy costs. In this context, aggregators, and Energy Service Companies (ESCOs) are developing financing and energy management solutions to offer holistic solutions that may facilitate a seamless integration of PV, batteries and electromobility into customer premises. Such solutions require novel but robust methodologies and algorithms that can increase customer benefits. In this work, a holistic energy management methodology comprising forecasting and scheduling algorithms was developed. The algorithms aim at maximizing the customer benefits during normal operation as well as supplying critical infrastructure during grid events. Four separate real-world trials were conducted over a period of three months in the context of a demonstration in a Medium Voltage (MV) customer with results showing that energy costs may be reduced to up to 27.3% while also dropping the system's peak load demand by up to 16.7%. In terms of islanding capabilities, the trials demonstrate the system's ability to support the local network during blackouts and suggested the need for a formalization and standardization of the sizing process of any equipment with blackout capabilities within the planning of Low/Medium Voltage (LV/MV) systems. Additional use cases that aim at unveiling the flexibility offered to aggregators were examined and results showed that the proposed scheme can support flexibility services during Demand Response (DR) events.


A Novel Holistic Energy Management System
Incorporating PV Generation and Battery Storage for Commercial Customers Maria-Aliki Efstratiadi , Sotiris Tsakanikas , Panagiotis Papadopoulos , Senior Member, IEEE, and Diego R. Salinas Abstract-The increasing electricity costs and the decarbonization targets are driving consumers to seek alternative energy supply and energy management tools to decrease their energy costs.In this context, aggregators, and Energy Service Companies (ESCOs) are developing financing and energy management solutions to offer holistic solutions that may facilitate a seamless integration of PV, batteries and electromobility into customer premises.Such solutions require novel but robust methodologies and algorithms that can increase customer benefits.In this work, a holistic energy management methodology comprising forecasting and scheduling algorithms was developed.The algorithms aim at maximizing the customer benefits during normal operation as well as supplying critical infrastructure during grid events.Four separate real-world trials were conducted over a period of three months in the context of a demonstration in a Medium Voltage (MV) customer with results showing that energy costs may be reduced to up to 27.3% while also dropping the system's peak load demand by up to 16.7%.In terms of islanding capabilities, the trials demonstrate the system's ability to support the local network during blackouts and suggested the need for a formalization and standardization of the sizing process of any equipment with blackout capabilities within the planning of Low/Medium Voltage (LV/MV) systems.Additional use cases that aim at unveiling the flexibility offered to aggregators were examined and results showed that the proposed scheme can support flexibility services during Demand Response (DR) events.Index Terms-Energy, scheduling, energy storage, batteries, demand response, power supplies, islanding.Maria-Aliki Efstratiadi, Sotiris Tsakanikas, and Panagiotis Papadopoulos are with Motor Oil Hellas, 15124 Marousi, Greece (e-mail: mefstratiadi@moh.gr;stsakanikas@moh.gr;ppapadopoulos@moh.gr).
Digital Object Identifier S OCIO-ECONOMIC and political challenges are driving an energy transition from a fully centralized based generation network to a distributed, RES based system.Customers are incentivized to seek alternative supply options, either directly by net metering schemes or indirectly by experiencing an increase in overall electricity costs.
In addition, the increase of electromobility and the complexity of renewables and battery systems' integration in MV and LV networks, and specifically for customers which are not acquainted with local energy management processes, requires development of plug and play energy management systems.Such systems require capturing multiple benefits that aggregate indirect revenue streams through the achievement of operational cost reduction while providing increased reliability and potential additional services, like demand response through flexibility exploitation.
This study focuses on the design and deployment of a holistic energy management system that on the one hand integrates field assets like PV, batteries, and load premises, and on the other hand delivers four case studies that include, energy cost reduction, Demand Response (DR) functionality and black-out support, extending the work conducted in [1].

II. LITERATURE REVIEW
Optimal integration of Distributed Generation (DG) resources can be challenging since there are many different elements, variables and constraints that need to be considered.Such elements include DG integration network status, load dynamics, fault events, protection plans, environmental factors, and consumer behavior.Operational problems need to be reduced to a minimum for optimal integration which could only be accomplished in large part by coordinating various Distributed Energy Resources (DERs) [2].
Several strategies have been proposed to define the optimum sizing and operation of renewable energy systems (stand-alone or hybrid) with single objective optimization (typically aiming at minimizing the systems' costs) or multi-objective optimization where the variable of reliability and/or other constraints are added as separate functions.The most recent optimization functions have been developed using multiple techniques such as heuristic [3] or rule-based algorithms [4] and machine learning techniques [5].Ant colony optimization algorithms are also quite common for standalone hybrid renewable generation systems which are based on integer programming [6], [7].In terms of real-life applications, optimization algorithms when applied in hybrid DER systems (such as PV systems coupled with energy storage units) can be used to resolve a variety of issues either from the network's perspective or from the customer's side.
Looking into the different types of Energy Management Systems (EMS) developed over the years, they typically aim at achieving reliable, efficient, and cost-effective use of renewable energy resources in the premises of commercial energy users.Koukaras et.al [8] proposed a framework for a multi-objective analysis considering both consumers and aggregators aiming at cost minimization and discomfort reduction from the consumer's side and at cost minimization from the aggregators' side.For the customers' side, the study resulted in different levels of cost reduction depending on the level of discomfort of the energy user, without modelling though in detail all the energy charges applied to the customer's bill.
A widely acknowledged benefit of energy storage units is their potential contribution to the reduction of electrical power consumption during high demand periods (peak shaving) [9].Studies suggest that a battery management algorithm can reduce the peak energy consumption of an energy user by up to 35% while increasing the PV self-consumption rate by 47% [10].This result, however, strongly depends on the robustness of the load forecasting method used to predict the peak load incidents.Peak load reduction algorithms that utilize battery storage are typically based on load forecasts to schedule active power discharge by battery systems during peak load periods.The contribution of reactive power offered by power electronics converters of storage systems towards reducing the peak, has been analyzed in HV [11] however there is no EMS demonstrated in the state of the art that applies such schemes in real-world applications.
With regards to grid services, demand response has also been identified as an important source of flexibility that complements more conventional supply-side flexibility resources with results suggesting a reduction in production costs primarily by facilitating the substitution of high-cost thermal generators with low-cost renewables [12].Short-term flexibility at lower costs can also be provided by flexible demand from temporarily shifting electricity demand in industrial and commercial customers in response to financial incentives [13], but there is not much content in the literature on the actual responses from the assets of an MV customer with PV and batteries.
Lastly, attention has been given lately to the evaluation of the back-up power supply functionality of hybrid PV and BESS systems which seems to attract the interest of commercial energy users [14].Multiple case studies have been conducted focusing on the limits of hybrid PV and storage systems to support a blackout [15] or on the optimal sizing of those systems [16], [17], [18].While many of these studies consider the effect of degradation factors of both the solar and the storage systems, there is lack of actual testing of the blackout functionality of commercial inverters.The impact of the type of critical loads that need to be served during a blackout on BESS sizing exercises, also has limited references in literature.
Within this work, a holistic energy management system for LV/MV energy users was developed and tested to analyse and capture the value of four different potential revenue streams and services, namely energy cost reduction, peak shaving, demand response services and black-out support.The contribution of this work can be summarized as follows: r A detailed model was designed to reflect the complete customer charges along with a rule-based algorithm that optimizes total energy costs irrespectively of the sizing of the customer and its associated assets, in an effort to model in detail all the energy charges of a customer's bill extending [8]; r Reactive power management from the inverters was used to minimize load peaks and reduce network charges following up on studies such as [11] and demonstrating the effect of such Energy Management Systems in real-life applications; r The real time response of battery storage in terms of its ability to provide demand response in customer premises was evaluated offering a demonstration of the actual DR of an MV customer with RES onsite, taking studies like [13] one step further into understanding the actual performance and efficiency of physical assets involved in the process; r An electrical island was artificially created to evaluate the blackout support capabilities of a hybrid PV and BESS system and validate a battery sizing exercise with real-life data offering a unique testing of the impact of the type of critical loads that need to be served during a blackout on such exercises.

A. System Architecture
The developed architecture of the holistic energy management system comprises the following elements and is visualized in Fig. 1.
r A multi-purpose concentrator (gateway) developed for the operation of various scenarios DER and smart grids, which contains an embedded computer that provides processing Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.capacity to capture and store information, execute algorithms and control the setpoints of the field assets; r A software module which consists of a set of forecasting algorithms to predict energy generation and demand, taking data from registered measurements by sensors and other Intelligent Electronic Devices (IEDs) installed along the MV network; r A software module which leverages on the forecasting re- sults and optimizes BESS dispatch scheduling.The module includes mechanisms to recognize congestion situations and manage them from a commercial flexibility perspective.These algorithms enable peak shaving processes to maximize the value for the customer through demand aggregation and using market information in evolving tariff environments.It also includes several measures to reduce the amount of energy purchased from the utility company during peak demand hours, thus reducing grid congestion; r A web-based platform enables the integration of devices and software modules, serving as the common point of reference for data aggregation and control signals' dispatching.Using open standards/APIs, this platform is a solution that has been developed to help integrate all data generated in a common database, where it can be easily accessed and queried.Thus, specific modules deployed in this platform include a unified API that provides endpoints for ingestion of all the data required for the calculation of KPIs (i.e., PV and Load forecasting, batteries, energy consumption etc.) and a visualization tool that allows users to inspect the information stored in the database.This study focuses on the use of the described system and the benefits it can bring when deployed in an MV network and is tested in the premises of a resort in the island of Thasos in Greece with the aim to optimize the operation of the assets and reduce energy costs.The EMS was initially commissioned in September 2021 and is since actively optimizing the operation of the energy system in the customer premises.
The hotel is connected to the main grid of Thasos which is supplied by an MV substation of 250 MVA at 20 kV.The hotel is supplied by a an MV/LV substation of 400 kVA 20 kV/0.4 kV.The test environment comprises: r Residential loads (corresponding to 3 buildings with 6 dis- tinct apartments each) with total peak load of 158.52 kVA (as recorded in August 2022), supplied by the 400 kVA substation.Each building is connected to a sub-board via 5 × 16 mm 2 cables (L1-L3, Neutral, Ground) and each sub-board to the main substation board via 70 mm 2 cables; r Total rooftop PV generation of 50 kWp; r An energy storage system composed of 3 Li-ion batteries with a combined total nominal capacity of 24.9 kWh a 95% depth of discharge and a 96% round-trip efficiency; r Each of the three buildings comprises one hybrid and one non-hybrid inverter of 5 kVA and 12.5 kVA maximum output power respectively; r Energy analysers [19] connected to the substation that measure the total substation load; r Individual smart meters connected to the inverters of the buildings measuring imported-exported energy flows; The PV and battery assets on site are connected under a "net-metering" agreement, an electricity billing mechanism that allows users to generate energy locally and cover in total or partially their energy needs, utilizing the grid as a buffer to account for potentially unsynchronized local supply and demand for the prosumer.A representation of the physical architecture of the pilot is depicted in Fig. 2.

B. Algorithm's Description 1) Energy Cost Reduction:
The total energy cost model for an MV connected customer was analysed.This comprises the competitive (commodity) charges, the network related charges and any other charges related to CO 2 , taxes and common charges as shown in Table I.
Equations ( 1) and ( 2), were used to calculate the forecasted PV generation and the forecasted load profile of the site, where L t=n and G t=n are the load and PV generation forecasts for the n th hour of the day respectively.As detailed in [1] the forecast module was designed and developed as a hybrid forecast method by the integration of a baseline regressive model to generate a forecast with long horizon H and big granularity, e.g., 48 h and 30 min, respectively, and a recurrent model, for smaller time horizon and steps, e.g., 5 min ahead and 10 s steps, which gets activated upon errors between observed values and long-term forecast model.
The decision variable used to evaluate the charging/discharging profile of the battery is the Energy Cost Baseline (ECB) calculated as shown in (5).
Energy price = [p t=1 , p t=2 , p t=3 , . . ., p t=24 ] (4) The algorithm chooses the setpoint according to (6), where the threshold values C_th EC trial and D_th EC trial are chosen daily using an iterative approach where all combinations within the range c min < c < c max are tested as charging and discharging threshold values to ensure the maximum cost reduction.The validity of the algorithm has been tested through the analysis of the results of an entire year of operation where all potential load variations have been considered (different days with different Net-Load and energy-prices).
The setpoint enumeration values correspond to discharging (1), charging (2) and idle operation (0) of the battery, a simplified logic which was adopted due to hardware limitations from the utilisation of the Sunspec standard [20] to the specific onsite equipment.The implementation of the standard did not allow the batteries to discharge at power rates different than the nominal rating and resulted in some further limitations of the algorithm.If the highest values of the decision variable are all close to each other (shaded parts a and c on Fig. 3), it may happen that at the highest value, the battery has already been fully discharged, thus resulting in non-optimal scheduling.
To overcome this limitation and improve the results of the algorithm, a "Charging/Discharging sub-priority routine" was created.
The aim of this routine is to ensure a solid prioritization of the operations (discharge commands to the hour slots with the Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.highest values of ECB first).If the energy contained in the battery is not enough to satisfy the discharging requests, the setpoints will be recalculated to ensure that the "highest price moments" are satisfied, thus the "less expensive moments" in the time window are changed in idle mode.A similar logic ensures a dual behavior in case of charging.
Regarding the modelling parameters of the battery, the following equations describe the evolution of the SOC of the battery during the day (7), the formalisation of the energy to or from the battery in period t (8), and the constraints applied to the value of the battery power P batt in relation to the setpoints and SOC t values (9).
• 100 (7) 2) Peak Load Management: The peak load management algorithm was designed to minimize the load peaks as defined in (3).In particular, the algorithm first assigns to each of the forecasted hourly Net Load values a priority index for discharge and a priority index for charge according to the range values of the decision variable (e.g., the highest value of the decision variable presents the highest discharging priority and lowest charging priority and vice versa).Secondly, the algorithm chooses the charging/discharging behavior according to (10).
Thresholds C_th P S trial and D_th P S trial , are calculated starting from the charging/discharging priority indexes in a manner to ensure the maximum flattening of the curve according to the battery capacity.Their setting is chosen daily using an iterative approach where all combinations within the range N min < N < N max are tested as charging and discharging threshold values.The validity of the algorithm is tested through the analysis of the results of an entire year of operation.
Finally, the Charging/Discharging routine has also been applied here.The developed algorithm with both the energy cost reduction and the peak load management module, is shown in Fig. 4.

C. Case Studies
The designed system and respective algorithms were deployed in the facilities of the MV resort depicted in Fig. 1 and were tested using a set of case studies summarized below: r Energy cost reduction: Reduce the overall energy con- sumption of the customer's facilities and/or shift the demand from a high-cost time to a low-cost one when dual or more dynamic tariffs are applied.
r Peak shaving: Utilize the energy storage assets to shift the peak load of the site towards a low energy rate period and/or the absolute reduction of the peak load (by shifting demand and "flattening" the demand profile).
r Demand/Generation Response: Simulation of the provi- sion of DR services to the grid.DR involves shifting or shedding electricity demand to provide flexibility in wholesale and ancillary power markets to help balance the grid.
r Black-out support: Investigate how blackout support needs to be considered by commercial customers and identify the benefits, utilizing existing PV and battery systems, while evaluating the capabilities of the installed systems.

A. Energy Cost Reduction
The performance of the module under energy cost reduction operation was tested for a period of one month.The operation of the batteries was scheduled based on the forecasted load, forecasted PV generation and energy prices during a day to achieve the maximum financial savings.The results of the algorithm's deployment can be seen in Fig. 5 and Table II.The error of each forecast has a different impact on the results of the use case: r The PV forecasting error seems to have a higher impact on the total savings of the site since it also affects the final amount of consumed energy on top of the savings due to the operation of the algorithm.Our analysis shows that a 10%-15% error (daily MAPE) in PV forecasting could Fig. 6.Apparent power demand before (black line) and after applying the peak load management algorithm (peak shaving operation) with (light grey line) and without (dark grey line) reactive power support from the inverters.
have an impact of 20%-35% on the estimation of savings.The daily MAPE of the PV generation algorithm within our trial period varies from 8.5% to 26.7% r The load forecasting error seems to have a less straightfor- ward effect on the estimation of the total savings for this specific system.Our analysis shows that a 10%-15% error (daily MAPE) in load forecasting could have an impact of 12%-17% on the estimation of savings in the competitive charges, whilst when the error reaches 20%, this deviation can rise disproportionally higher.However, since a large percentage of the energy savings could come from the reduction of network charges via the reduction of the peak load over a period of one month, it appears that the most important element of the load forecasting algorithm is the ability to capture the peak load hours of the day.In the examined use case, the daily MAPE of the load varies from 12.3% to 28.6% but the estimation of the total monthly savings is only 2% lower than the actual

B. Peak Shaving
The performance of the module under peak shaving operation was tested for a period of a month, using only active power support in the first 15 days and both active and reactive power support for another 15 days.Fig. 6 depicts two indicative days of the operation of the algorithm with and without reactive power support.
The daily peaks are calculated as the highest value of the apparent power drawn from the substation on one day, before and after deploying the peak load management algorithm.The difference between the two values has been calculated for each day of the trial, and the range of these differences is shown as "Daily peak load reduction range" in Table III, along with the rest of the results of the peak shaving case study with and without reactive power support.For the duration of the trial, the highest apparent power before deploying the algorithm was measured at 45.2 kVA while the highest one measured after deploying the algorithm solution was 31.1 kVA.
The active energy required to achieve the same reduction in the customer's peak load reduces by 5.7% when utilizing the  maximum reactive power potential of the asset, thus reducing the amount of chargeable energy without affecting the delivery of the service.The hourly distribution of the daily peaks within the trial period can be seen in Fig. 7.The hours are depicted in local time (UTC+2).
However, the distribution of the peaks (Fig. 7) shows that after the implementation of the peak shaving module, the peak load appears in different times within the day (also avoiding the high price times in most cases), while previously the peak load appeared mostly between 9-12 (UTC+2) which resulted in increased overall network charges for the customer.
An analysis has been performed to investigate the sensitivity of the control performance with respect to the charging and discharging thresholds of the algorithm.The analysis has been performed looking into the correlation between the daily peak load reduction and the variability of the thresholds and showed that the peak shaving output varies significantly, depending on the accuracy of the forecasting modules.The combined MAPE for load and generation forecasting, i.e., their multiplication, was used to perform a sensitivity analysis on the control performance with the following results: r On a day with low combined MAPE the daily peak load reduction percentage changes up to −5% if the deviation of the discharging threshold remains above −1.2kVA (−6.7%) of the defined "optimum" and the deviation from the defined "optimum" charging threshold remains between −1.3 kVA (−11%) and 0.30 kVA (+1.9%).The deviation from the calculated PLRed is always negative which indicates that the selection of the thresholds within this day is optimum.
r On a day with an average combined MAPE the daily peak load reduction percentage remains unchanged if the discharging threshold remains between −1.2 (−8.3%) and −0.1 kVA (−0.7%) of the defined "optimum" and the deviation from the defined "optimum" charging threshold remains between −0.7 (−36.9%) and 1.7 kVA (+89.5%).Outside these tolerance limits, the deviation of the PLRed increases significantly and is always on the negative side indicating that in this case as well the selection of the thresholds for the day was optimum.
r On a day with a high combined MAPE the daily peak load reduction percentage remains unchanged within a very narrow window of 0.05 to 0.15 kVA (both less than <1%) of the defined "optimum" charging threshold and the deviation from the defined "optimum" discharging threshold remains between −1.3 (−14%) and 0.5 kVA (+4%) and then changes radically as the deviation increases.Unlike the two cases above, the PLRed also moves to the positive side of the graph which shows that for this day, the selection of the charging/discharging thresholds is not optimum.This has been attributed to the high forecasting error on that "edge-case" day which leads to a sub-optimal detection of the timepoints with peak load, hence a sub-optimal selection of charging/discharging thresholds.The above are reflected in Fig. 8(a) to (c) where the x axis is the deviation from the defined discharging threshold, the y axis is the deviation from the defined charging threshold and the z axis the deviation of the peak load reduction from the optimum on the day the sensitivity analysis has been performed.The figures represent a day with the best (a), an average (b) and the worst (c) combined forecasting MAPE, during the 1-month trial period.Overall, our analysis has shown that the sensitivity of the algorithm's performance is very low when the deviation of the charging/discharging thresholds remain between ∼±1.3 kVA of their defined optimum daily values, which is 7.8% of the average apparent load of the site for the duration of the trial period but represents a different percentage of deviation from the threshold depending on the day.In addition to the above, our analysis has shown that when the combined daily MAPE is lower than 4%, the algorithm succeeds in choosing the optimum charging and discharging thresholds for the day.

C. Demand/Generation Response
The potential of the energy cost reduction algorithm to respond to requests either from a network operator, the system operator or a supplier/aggregator with internal portfolio balancing processes, was evaluated.Representative results that reflect the response of the controlled batteries to an explicit demand response trigger are shown in Fig. 9.
The tests were conducted for a period of 10 days.Two scenarios were demonstrated to evaluate the algorithm's efficiency during: r Demand response: In this scenario the batteries were in- structed to discharge to relieve the network from load burden.The requests were emulated by applying a very high cost-rate for the energy purchased during the time of the request, forcing the batteries to discharge.r Generation response: In this scenario the batteries were instructed to charge so to absorb locally generated PV energy.These requests were simulated by applying a zero cost to the energy purchased from the grid, thus forcing the battery to charge.The method of virtually applying the very high or zero energy cost is practically a means to emulate downwards, or upwards flexibility DR signals communicated by a DSO or an aggregator during high or low contingency conditions respectively, under a hypothetical flexibility provision contract which was an alternative to an actual response since a flexibility market doesn't currently exist in Greece.The extreme costs of energy (very high or zero cost) ensure that the charging/discharging request would be the first priority of the battery within the specific day, hence the battery will always be in a state to support the DR request.We were hence able to capture the potential of utilizing commercially available equipment for the provision of DR services not necessarily designed for this scope and quantify the associated risks that would need to be considered for the participation in an actual DR market.
The average deviation between the requested energy and the energy delivered during the time of the events was calculated at −2.3% with the maximum not exceeding 8.8% in absolute value.The impact of this deviation should be further examined in the context of a specific flexibility framework since such results could offer valuable insights for the baselining of any DR services' provision.

D. Black-Out Support
During this trial, an electrical island configuration was manually created to assess whether critical loads can be supplied by the existing battery systems on site.The test was performed at one of the buildings which is connected to a set of two inverters, one hybrid and one non-hybrid.The setup of those inverters is such that cascading functionality (a feature that allows the inverters to operate in coordination when more than Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.one (inverters) are apparent in an installation) is not present.As a result, the non-hybrid inverter is considered "off" during the trial thus leaving half of the installed PV capacity onsite unavailable during the black-out simulation.

TABLE IV DEFINED CRITICAL LOADS FOR BLACK-OUT SUPPORT TRIAL
The trial preparatory activities included the definition of the critical electrical loads in the premises presented in Table IV.The timeline of actions and the power flows on site are described in Fig. 10.
The trial has been split in 7 phases.
r Phase 1: Charging of the battery to 100% r Phase 2: Trial's initiation with dehydrators "on" r Phase 3: Addition of TV units' loads r Phase 4: Addition of refrigerators' load r Phase 5: Addition of lighting loads r Phase 6: Addition of extra loads to bring progressively the total load closer to the inverter's limits r Phase 7: Reinstation to grid operation Before initiating the trial (Phase 1), the battery was charged from its current SOC at that time to 100%.As Fig. 8 presents, the total consumption stemming from the first set of critical loads, namely the dehydrators, is in the range of 285-415 W, considerably lower than the expected nominal output of the devices.This deviation can be attributed to the fluctuating nature of the device's consumption, which varies based on the humidity levels in the rooms.The rest of the critical loads were progressively switched on triggering the battery to further discharge until the total load was equal to 1629 W at which point the load was stabilized and the SOC of the battery reached a level of 91.1%.The maximum capacity of the hybrid inverter was identified as 1.7 kVA per phase adding up to a total of 5 kVA for all phases.In addition to that, the batteries have a 2.56 KW charging and discharging power limit.Phase 6 of this trial was designed to evaluate the above-mentioned limits by progressively increasing the building's load until the total reached ∼2500 W using additional small loads (lights, hair dryer units and domestic appliances) to increase the site's consumption in a controlled way.After operating for about 15 mins, the inverter was shut down (error indication on inverter's display).
The error was attributed to the dehydrator, which increases its consumption when the ambient humidity level drops below a predefined threshold, causing one of the three phases of the inverter to reach its upper limit of operation (∼1.7 kW).In less than 3 mins after removing the additional loads to reduce the total load of the building to around 1300 W, the inverter started an auto-islanding reforming operation and returned online, still supporting the remaining loads in the building by continuing to discharge the battery.
The outputs of this trial were used to validate a battery sizing exercise aiming at identifying differences between the theoretical approach towards sizing a storage asset for blackout support and the actual duration of the battery.When comparing the expected load profile during the trial to the actual one, it was identified that due to the nature of the dehumidifiers operating in fluctuating load, the actual discharging profile of the batteries during the blackout was different than expected as per Fig. 11.
The residual load is defined as the expected consumption from the grid after subtracting the expected generated energy from the PVs.The type of load and its operation circles are shown to be significant when planning the sizing of a battery system.According to the literature, a degradation of 2% per year is expected for a Li-ion battery but this number strongly depends on the operating conditions of the battery (mostly temperature) [21].Manufacturers often offer warranties for 60% retained capacity after 10 years of operation, or 6000 cycles.indicates that under the worst-case scenario of degradation, the duration of the battery of interest would be able to support the critical loads for one hour less in 10 years' time than it does today.
The difference between the theoretical approach and the actual results indicates that during a battery sizing exercise, consideration should be given to the load profile expected to be served during a blackout as well as to the expected lifetime of the battery.A cost-benefit analysis should also be part of the feasibility study conducted prior to the investment to ensure that the cost of the battery would be paid off.

V. CONCLUSION
Energy management systems that incorporate functionalities which may capture a variety of benefits for customers interested in decarbonizing their energy consumption with local resources are emerging.Within this study an energy management system which can be applied to any LV/MV customer has been designed, modelled, and implemented.Its functionalities, performance and effectiveness were demonstrated through real world trials in an MV resort equipped with PV generation, battery storage systems and smart metering devices.A set of services offered were evaluated; these included minimization of energy costs, peak shaving support, demand response operation and black-out support.Similar results are expected if the energy management system is applied to different types of customers and locations, but further training would be required to the forecasting algorithm along with modifications to the cost structure of the energy price also taking into account the regulatory framework of the energy market in the specific location of the customer.Our results indicate that the forecasting accuracy of PV generation and load is of paramount importance.The fact that the forecasting algorithms are based on a day-ahead horizon imposes inherent constraints to the forecasting accuracy which could be significantly enhanced by a more close-to-real time rolling forecast on generation and demand perhaps fed also with actual data stemming from the field.
Our key learning points are summarized as follows: 1) Total energy cost reduction: the cost structure of MV and LV customers is complex and is characterized by fixed and variable costs with different timeframes and conflicting weighting.Accurate cost structure modelling is required to perform detailed optimization taking into account the hourly rates of the retail energy price as well as the additional network charges as applied to a specific type of customer and load profile.A dynamic update of the charging/discharging thresholds specified in this study according to periodic retraining of the algorithm on new consumption and generation data for shorter periods could be considered for future work.2) Peak shaving: reactive power management capabilities from power electronics interfaces included in commercial inverters may contribute to the peak reduction of a customer load and in effect reduce the upstream network burdening as well as the network related charges passed to the customer.However, the Sunspec standard utilized in most commercial inverters requires further controllability extension to enable reaching optimal decisions.3) Demand response potential for LV customers: there is currently limited application of demand response schemes for LV customers in Europe.The results of the present work showed that there is potential to be exploited when battery storage systems are deployed in customer premises, however careful considerations are required in baselining DR potential as well as standardization in inverter controllability.4) Blackout support: battery storage system sizing requires detailed modelling of the load cycling of the critical loads designed to be supported during grid events.There is currently limited literature related to the diversity factors of LV loads considering their cycling.The results from the present work suggest that further work linked to the planning of MV assets is needed to accurately model battery systems sizing for blackout support functionalities with minimum cost.Attention could also be given to the potential of an additional functionality that would allow the deployed algorithm to drop or bring back loads in case of an island situation depending on the available energy from the onsite generation systems.This would probably require additional IoT hardware to be deployed to dispatch the algorithms results to the respective loads or an inverter selection that would support multiple controllable load circuits.As summarized, the scope of the presented work has been to design and operate an EMS with quantifiable and practical applications for MV connected customers.The current work could be extended by applying an optimization function to the developed algorithms to produce optimal results.Further consideration could also be given to the quantification of the system's nonidealities, the savings achieved in the framework of self-consumption optimization and on the deviation between the requested energy and the energy delivered during the time of the DR events.
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.
API Application programming interface BESS Battery energy storage systems c t = n Energy cost baseline on the n th hour of the day C_th Charging threshold D_th Discharging threshold DR Demand response DER Distributed energy resources Manuscript received 5 July 2023; revised 28 September 2023 and 1 December 2023; accepted 4 January 2024.Date of publication 12 January 2024; date of current version 21 June 2024.This work was supported by the European Commission's Horizon 2020 Research and Innovation Program in the project FLEXIGRID under Grant 864579.Paper no. TSTE-00705-2023.(Corresponding author: Maria-Aliki Efstratiadi.)

Fig. 3 .
Fig. 3. Example of the logic of the energy cost reduction algorithm.

Fig. 4 .
Fig. 4. Flowchart of the developed algorithms for energy cost reduction and peak load management.

Fig. 5 .
Fig. 5. Indicative profiles of load and generation forecasts in comparison to battery operation and energy prices.

Fig. 7 .
Fig. 7. Hourly distribution of peak load before (left) and after (right) applying the peak load management algorithm (peak shaving operation).

Fig. 8 .
Fig. 8. Deviation of daily peak load reduction VS deviation from charging/discharging thresholds for a day with (a) the best combined forecasting MAPE, (b) an average combined forecasting MAPE and (c) the worst combined forecasting MAPE.

Fig. 10 .
Fig. 10.Power flows and SOC during phases of the blackout support trial.

Fig. 11 .
Fig. 11.Expected VS actual residual load and discharging profile of the battery onsite.

Fig. 12 .
Fig. 12. Theoretical duration of battery during a blackout in Year 1 and Year 10 of operation compared to the trial's data.
10.1109/TSTE.2024.3353224Load forecast for the n th hour of the day HV High Voltage IED Intelligent electronic device L t = n PV generation forecast for the n th hour of the day LV Low Voltage MV Medium Voltage N t = n Net load forecast for the n th hour of the day p t = n Energy price on the n th hour of the day P batt

TABLE I COMPONENTS
OF THE TOTAL ENERGY COST MODEL

TABLE II COST
AND ENERGY CONSUMPTION INDICATORS BEFORE AND AFTER THE DEPLOYMENT OF THE ALGORITHM (APRIL 2023)

TABLE III RESULTS
OF PEAK SHAVING CASE STUDY WITH AND WITHOUT REACTIVE POWER SUPPORT