Peak Shaving for Electric Vehicle Charging Infrastructure—A Case Study in a Parking Garage in Uppsala, Sweden

: The need for a more ﬂexible usage of power is increasing due to the electriﬁcation of new sectors in society combined with larger amounts of integrated intermittent electricity production in the power system. Among other cities, Uppsala in Sweden is undergoing an accelerated transition of its vehicle ﬂeet from fossil combustion engines to electrical vehicles. To meet the requirements of the transforming mobility infrastructure, Uppsala municipality has, in collaboration with Uppsala University, built a full-scale commercial electrical vehicle parking garage equipped with a battery storage and photovoltaic system. This paper presents the current hardware topology of the parking garage, a neural network for day-ahead predictions of the parking garage’s load proﬁle, and a simulation model in MATLAB using rule-based peak shaving control. The created neural network was trained on data from 2021 and its performance was evaluated using data from 2022. The performance of the rule-based peak shaving control was evaluated using the predicted load demand and photovoltaic data collected for the parking garage. The aim of this paper is to test a prediction model and peak shaving strategy that could be implemented in practice on-site at the parking garage. The created neural network has a linear regression index of 0.61, which proved to yield a satisfying result when used in the rule-based peak shaving control with the parking garage’s 60 kW/137 kWh battery system. The peak shaving model was able to reduce the highest load demand peak of 117 kW by 38.6% using the forecast of a neural network.


Introduction
Air pollution, greenhouse gases (GHG), and the resulting effect on climate change have been major concerns for the world for several decades [1].One of the largest contributing sectors is the transport sector, as a result of its dependency on fossil fuels and subsequent emissions of GHG.Thus, one way to reduce the transport sector's emissions is to transform the transport sector through electrification.This can be accomplished by replacing the internal combustion engine vehicles with electric ones [2].This has been identified as one of the solutions that will contribute to counteracting the dependency on future fossil fuel resources [3].There are also several additional benefits of rapid EV adoption, such as less local air pollution and reduced oil dependency [4,5].
However, there are various obstacles for a larger share of EVs to be feasible in today's society.One is the lack of charging station (CS) infrastructure, and as the number of EVs are rapidly growing so is the demand for more accessible CSs [6].However, where should these be located for optimal accessibility?In a recent review, three CS locations were listed based on how they impact the likelihood of buying an EV and which locations were most frequently used [7].Based on previous research [8][9][10], this review indicated that the home location was the most impactful and thus the most frequently used by EV owners.The review further declared the workplace as the second most impactful location for CSs when trying to persuade consumers to purchase EVs [11][12][13].The workplace was also the second most used type of charging infrastructure.Apart from these, public charging infrastructure was also mentioned to be influential in order to increase the number of purchased EVs [14 -18].For example, parking garages are a popular location for public charging amongst EV users [16].
Despite this impact and the need for CS infrastructure, several papers indicate that the expansion of the CS infrastructure is not rapid enough to keep up with EV adoption [2,[19][20][21].Additionally, it seems to be uncertain as to how many locations and CSs in relation to the number of EVs are needed to meet the charging demand [7].The causality if EVs or CSs come first is not entirely clear.In contrast, it has been suggested that expanding the public CSs infrastructure would bolster the adoption rate, especially in urban areas [22].The expansion of CSs has also been shown to reduce range anxiety, which is another obstacle for EV adaptation, referring to EV owners' fear that the battery's capacity is not enough to reach the desired destination [23,24].An increased expansion of CSs could encourage consumers to purchase EVs and thereby support the transformation of the transport sector [6].Thus, it is important that policymakers, companies, and local authorities aim to be one step ahead in the development of CS infrastructure.
A hindering factor to the adoption of EVs (or vehicle fleets) is the accessibility to sufficient local grid power.The CSs often contribute to high peak power on the grid which, if they are not controlled or restricted in any way, present a challenge for cities where the electric power transmission network has limited capacity and/or experience periods of congestion [25].The power peaks caused by EV charging can be mitigated using a local energy storage with peak shaving capabilities to support the EV charging during peak hours.Another option would be to implement a flexible EV charging algorithm or schedule which could alter the charging power and when the EVs are charged throughout the day.Previous research has presented multiple scheduling and control algorithms for the charging of EVs with the goal of supporting the local distribution/transmission network.One way presented by previous research is to include renewable energy (RE) production such as photovoltaic (PV) or wind energy with a complementing energy storage to support EV charging [26,27].Other research instead focuses on intelligent scheduling and control algorithms that control EV charging with the goal of supporting the electrical grid.Many of these papers include Vehicle-to-grid (V2G) technology, i.e., the possibility to discharge the EVs battery for peak shaving or for ancillary services [28][29][30].Some papers also present scheduling and control algorithms for an entire parking facility such as a parking garage and even coordinating multiple EV charging facilities [31,32].To conclude, there are many different approaches to address the issue of EV charging and power shortage.However, due to the complexity of the real world and the specific condition of a system, there is a need to test these approaches with experimental data from a defined case.
Along with other larger urban cities in Sweden, Uppsala is currently experiencing grid capacity limitations which was concluded by Svenska Kraftnät, the authority responsible for ensuring Sweden's transmission system for electricity [33].Such a capacity limitation increases power subscription costs and limits the expansion of a city's infrastructure and business.
Uppsala municipality and Uppsala University have collaborated to build a mobility house that is both a commercial parking facility but at the same time a research laboratory.The parking house, called Dansmästaren, aims at answering a number of questions such as how charging infrastructure can be developed to boost EV expansion while simultaneously alleviating, or at least decreasing, the grid capacity congestion.
The mobility house is the first of its kind and consists of three parts: a parking garage, a grocery store, and 133 student apartments.The name "mobility house" refers to the facility's purpose to offer flexible mobility services and solutions to residents and visitors.Currently, the electricity assigned for EV charging at the parking garage is primarily used for charging passenger cars (1.4-22 kW) owned by residents of the building or visitors.In the current case of Dansmästaren, the main mobility service is providing accessible EV charging possibilities that primarily use PV energy.
By providing EV charging possibilities, the aim of Dansmästaren is to assist in the electrification of Uppsala's vehicle fleet.The parking garage in the mobility house features the three aforementioned types of EV charging (home, work, and public charging) and is equipped with a battery energy storage system (BESS), a PV system, and an energy management system (EMS).The purpose of this paper is to investigate a battery storage control method, tailored to the case study of the technical infrastructure at Dansmästaren, that will alleviate the EV charging load's contribution to the facility's load demand peaks and serve as part of an EMS strategy for EV infrastructure in cities.
The contributions of this paper can be summarized as follows: • A rule-based peak shaving algorithm presented in previous research is tested and evaluated using experimental load demand and EV data from the mobility house Dansmästaren.

•
A two-layer neural network is constructed using historical experimental load demand, EV, and weather data from the mobility house Dansmästaren and is combined with a rule-based peak shaving algorithm.

•
Three day-ahead predictions are presented for the days with the best and worst performances of the prediction model as well as the day with the highest load demand peak.In addition to this, the corresponding rule-based peak shaving operation for the three days based on the prediction is presented and evaluated.

•
Finally, this study shows that a perfect prediction model is not required for the rulebased peak shaving algorithm to effectively reduce the load demand peaks in a parking facility such as Dansmästaren.

System Description
The energy system at Dansmästaren is divided into four subsystems, EMS (A), CSs (B), BESS (C), and PV (D), as shown in Figure 1.A more detailed description of the system can be seen in Table 1.
World Electr.Veh.J. 2022, 13, x FOR PEER REVIEW 3 of 19 the current case of Dansmästaren, the main mobility service is providing accessible EV charging possibilities that primarily use PV energy.By providing EV charging possibilities, the aim of Dansmästaren is to assist in the electrification of Uppsala's vehicle fleet.The parking garage in the mobility house features the three aforementioned types of EV charging (home, work, and public charging) and is equipped with a battery energy storage system (BESS), a PV system, and an energy management system (EMS).The purpose of this paper is to investigate a battery storage control method, tailored to the case study of the technical infrastructure at Dansmästaren, that will alleviate the EV charging load's contribution to the facility's load demand peaks and serve as part of an EMS strategy for EV infrastructure in cities.
The contributions of this paper can be summarized as follows: • A rule-based peak shaving algorithm presented in previous research is tested and evaluated using experimental load demand and EV data from the mobility house Dansmästaren.

•
A two-layer neural network is constructed using historical experimental load demand, EV, and weather data from the mobility house Dansmästaren and is combined with a rule-based peak shaving algorithm.

•
Three day-ahead predictions are presented for the days with the best and worst performances of the prediction model as well as the day with the highest load demand peak.In addition to this, the corresponding rule-based peak shaving operation for the three days based on the prediction is presented and evaluated.

•
Finally, this study shows that a perfect prediction model is not required for the rulebased peak shaving algorithm to effectively reduce the load demand peaks in a parking facility such as Dansmästaren.

System Description
The energy system at Dansmästaren is divided into four subsystems, EMS (A), CSs (B), BESS (C), and PV (D), as shown in Figure 1.A more detailed description of the system can be seen in Table 1.The load demand (P d ) at Dansmästaren consists of two components (Equation ( 1)): the EV charging (P EV ) and the peripheral load (P per ).The peripheral load includes loads such as light, elevators, and ventilation.At the moment, EV charging in parking garages cannot be controlled and therefore can be regarded as an uncontrollable load.The highest peak during 2021 ranged between 80 and 110 kW and occurs in the afternoon at 18:00-20:00.
The load demand is covered by several sources (P s ): the grid (P grid ), the PV farm (P pv ), and the local BESS (P b ), as can be seen in Equation (2).
The load demand should always be equal to the sources, as shown by Equation (3).

Subsystem A-Energy Management System (EMS)
In order to gather data and control the subsystems (B-D), an EMS was built using a Windows-based Beckhoff C6030 Ultra-Compact Industrial PC with the associated programming language TwinCAT 3 Structured Text.The system uses a combination of Modbus TCP/IP and Modbus RTU to gather measurement data from the subsystem's devices and sensors at the parking garage.

Subsystem B-Charging Station (CS)
The 30 CSs at the parking garage are of the brand Charge Amps AURA and each CS has two 22 kW charging points, i.e., 2 × 22 kW.The CS is capable of load balancing and is also prepared for the international communication standard ISO 15118 used for the bidirectional charging (V2G) of EVs.The CSs are also capable of limiting the output power to between 0 and 22 kW via the charging station manufacturer's internet portal service and a REST API.

Subsystem C-Battery Energy Storage System (BESS)
The BESS of 137 kWh can charge or discharge at a maximum power of 60 kW; e.g., it has a C-rating of 0.44.The BESS is capable of performing peak shaving operations using three static limits: An upper limit (lim u ), a lower limit (lim l ), and a rate limit for the maximum charge and discharge from the BESS.The BESS continually measures the transferred power to and from the local distribution grid with an external network analyzer to determine how to utilize peak shaving.If the parking garage's power consumption exceeds the upper limit, the BESS tries to compensate by discharging the battery with the goal of keeping the power consumption at the upper limit for as long as possible.In the same manner, if the power consumption of the parking garage drops below the lower limit, the BESS charges its batteries whilst keeping the power consumption at the lower limit.The BESS's peak shaving operation is described in Table 2.The rate limit determines the allowed charge and discharge power in the BESS.

Subsystem D-Photovoltaic (PV) Farm
The 160 PV panels at Dansmästaren have a total output power of 62 kW with two 25 kW power inverters.There are two different types of PV panels: 80 monofacial and 80 bifacial.The 80 monofacial panels have a maximum output power of 385 W, each with an efficiency of 19.95%.The remaining 80 are bifacial, meaning they can absorb solar irradiation from both sides of the panel module.The bifacial panels have a maximum output power of 390 W and an efficiency of 19.5%.In order to easily compare the different types of PV panels, they are connected to their own power inverter and an energy meter sensor device.

Method
In this paper, a rule-based peak shaving control was simulated using predicted load demand and measured PV data from the parking garage at the mobility house Dansmästaren.The mobility house's load demand profile consists of two elements: the EV charging and the peripheral load, as described in Equation ( 1).The rule-based peak shaving control in this paper was originally published by [34] and uses a dynamic demand limit and a PV feed-in limit for a grid-connected PV system including a battery subsystem.The method provides a day-ahead charge and discharge schedule for a given day and therefore requires a day-ahead forecast of the load demand and the PV power pattern.Because of this, a simple 2-layer feedforward neural network was created to obtain the load demand profile forecast of Dansmästaren.
The method of this paper can be divided into 4 sections: (i) Modeling background; (ii) Neural network and data for prediction of load demand; (iii) PV day-ahead predicition; (iv) Rule-based peak shaving control.

Modeling Background
Peak shaving is a well-known method to alter the load demand with the goal of alleviating residential buildings, industries, and grids [35].Peak shaving can be carried out by charging, e.g., a local BESS during off-peak hours and discharging it during peak hours, resulting in a flatter load demand curve.A flatter load demand curve in this manner results in a reduction in the facility's power subscription costs since the electricity is more expensive during peak hours [36].Thus, peak shaving is a suitable option to flatten the load demand curve at Dansmästaren.However, before implementing a peak shaving schedule or plan that can be deployed in practice on-site, a day-ahead forecast of the future load demand and PV production is required [37].
Using simple feedforward neural networks is a fairly common way of obtaining a day-ahead (24 h) prediction of a facility's or system's load demand profile [38].A previous study describes a feedforward single layer with 20 hidden units' neural network based on the Kolmogorov theorem with a linear regression index of R = 0.99189 when forecasting a load containing diesel generators, a PV setup, and a BESS [39].The neural network created in this paper was heavily inspired by the work conducted by a research group from the Centre for Research & Technology Hellas and the National Technical University of Athens [39].After a satisfactory implementation of the forecasting model, peak shaving algorithm was chosen.
The rule-based peak shaving control published by the research group from Vasavi College of Engineering, Hyderabad India, was chosen to be evaluated via simulation using data from Dansmästaren due to their simplicity and robustness, and also due to the similarities in the presented energy system and Dansmästarens energy system [34].The major difference is the scale and rating of the different subsystems; for example, the BESS in the paper has a total capacity of 12 kWh and the PV system a maximum power output of 1.6 kW and the BESS at Dansmästaren has a capacity of 137 kWh and PV power output of 62 kW.Another difference is that the load at Dansmästaren primarily consists of EV charging sessions.However, these differences do not affect the performance of the rule-based peak shaving control, which was chosen to be used in the simulation of Dansmästaren.
The model presented by [34] included a method for determining the charge and discharge schedule for the battery system using 3 battery operation modes and 8 rules.The modes and rules are described as follows:

•
Discharging mode: When the load demand is larger than the determined peak shaving limit and the produced PV power is not sufficient.The battery is discharged for the amount that the PV source cannot provide and is determined by rule 1.

•
Charging mode 1: When the load demand is less than the determined peak shaving limit.The mixture of power from the grid or the PV system for the load and the BESS is determined by rules 2-5.

•
Charging mode 2: When the load demand is less than the determined peak shaving limit and the PV system can meet the demand, the power usage is determined by rules 6-8.
The operating modes of the battery and the associated 8 rules as well as the process of obtaining the necessary control parameters are explained in further detail in the paper [34].The rule-based peak shaving control uses several constraints, one of which is that the battery's state-of-charge at the end of the day (SoC f ) should be equal to its state-of-charge at the start of the day (SoC i ), i.e., SoC f == SoC i , and SoC i = 50%, which is described to be desired for flexible day-to-day management.

Neural Network and Data for Prediction of Load Demand
As previously stated, in order to implement the rule-based control presented by [34], a day-head prediction of the load demand and PV production is needed.Therefore, a forecasting model was implemented to predict the load demand by creating a simple twohidden-layer feedforward neural network containing 8 hidden units in each layer based on the method presented by [39].The neural network was created by the first author using MATLAB.The number of hidden layers and units in each layer was determined using a trial-and-error approach with the goal of finding a set of layers and units that yielded the lowest Root mean square error (RMSE) for testing data.
A diagram overview of the created neural network is shown in Figure 2 and the input variables are explained in Table 3.The parking garage's load demand, PV production, EV charging, and ambient temperature from 2021 were used to train the network.The parking garage's load demand (P d ) was calculated using grid demand (P grid ) data collected from the grid owner Vattenfall's customer portal and the PV data (P PV ), as shown in Equation (4).
P d (t) = P grid (t) + P PV (t) − P grid,sold (t), t = 0 : 1 : 23 (4) Hourly discrete time steps were used due to the grid demand and the sold PV data having an hourly time resolution of kWh/h The energy data from the parking garage's PV system (P PV15 ) was collected from Sunny Portal cloud service and had the time resolution kWh/15 min, i.e., 4 measurements per hour.An average of the 4 measurements each hour was calculated using Equation ( 5), thereby converting the data to kWh/h.
The data from the EV charging (P EV120 ) were provided by the manufacturer of the charging stations used at Dansmästaren with a resolution of 2 measurements per minute, i.e., 120 measurements per hour.The data contained measurements including three-phase voltage and current as well as time stamps from when each measurement was performed.Using the voltage and current measurements, the power for EV charging was calculated and then converted to kWh/h using equation Equation (6).
Temperature data were collected from the Swedish Meteorological and Hydrological Institute (SMHI) and had a time resolution of one measurement per hour.However, there were several missing temperature measurements in the data set.To adjust for this, linear interpolation was used to create a complete data set.The temperature data were included in addition to the previous load, day, and date, due to it being the weather parameter most commonly used as an input variable in neural networks [40,41].Previous research has shown a stronger correlation between the temperature and the load compared to the load and other weather parameters such as air humidity and wind speed [42].The neural network was trained on the collected data (Table 3) from 2021 and the input data were structured as shown in Equation (7).The input data were also normalized between 0 and 1. Input = P day−1 ; P day−2 ; T day−1 ; D weekday ; D month ; M The data set of 365 days of 2021 was reduced to a set of 363 data points, by excluding two data points (1st and 2nd of January) since two previous days are needed for the prediction model and data from 2020 was not available.The data set of 363 days from 2021 was divided into training and validation data by randomly extracting one day from each week resulting in a data set with 52 days and labeling it as validation data.The other 311 in the data set were labeled as training data.Both data sets were randomized before creating and training the neural network.This resulted in two new data sets, Data Train and Data Val , as can be seen in Table 4.The input variables D weekday and D month indicate which weekday (1-7) or day of the month (1-31) it is without taking into account for holidays and non-working days.Once trained and validated, the neural network was tested using the testing data (Data Test ) from January-April 2022.The testing data were constructed in the same manner as the training and validation data, as shown in Table 3.The neural network's performance was evaluated using RMSE (Equation ( 8)).
N = 24 represents the data points in a day.

PV Day-Ahead Prediciton
As mentioned in the introduction, rule-based control requires a day-ahead prediction of the load demand and of the PV production.However, in this paper, only a model to forecast the load demand profile was implemented since also forecasting a PV production profile was deemed outside the scope of this paper/project.Therefore, the historical PV data collected from the mobility house were used instead of predicted PV data when training and testing the neural network.

Rule-Based Peak Shaving Control
The predicted load demand profile (P grid, predicted ) and PV production (P PV,historical ) were then used in the rule-based peak shaving control presented by [34], with the objective of determining the necessary amount of dischargeable energy from the BESS (E b−disch ) that would yield the lowest power peak in a given day.The control parameter (E b−disch ) informs the peak shaving control of how much energy is available to be discharged from the battery.E b−disch is not allowed to be larger than the BESS's maximum capacity (E b−max ) or less than 0, i.e., Equation (9).The rule-based peak shaving model has four inputs: a 24 × 1 vector of the predicted load demand, a 24 × 1 vector of the predicted PV production, the allowed amount of energy that can be discharged from the battery, and the maximum battery capacity, as can be seen in Figure 3.
The rule-based peak shaving model has three outputs: the resulting load demand (P grid,new ), the used peak shaving limit (P d−lim ), and the used limit for PV feed-in limit (P f il ).P f il is used to limit the hourly PV energy used to charge the BESS if there is excess PV energy.The PV energy is only used to charge the BESS when P PV (t) > P f il , and in this case for the amount of P PV (t) − P f il .
The input variables based on the mobility house's technical system are shown in Table 5.The lower and upper SOCs of the BESS were chosen to be 20% and 90%, respectively.Therefore, the depth of discharge (DOD) was 70% (95.9 kWh), as this is suggested as an acceptable range to reduce battery degradation and maximize the battery's lifetime.The BESS at Dansmästaren has two peak shaving limits, lim u and lim l , as described in Section 2.3, but due to the rule-based peak shaving model only using one limit these two limits were treated as one and the same, The rule-based peak shaving model has three outputs: the resulting load demand ( , ), the used peak shaving limit ( ), and the used limit for PV feed-in limit ( ). is used to limit the hourly PV energy used to charge the BESS if there is excess PV energy.The PV energy is only used to charge the BESS when ( ) , and in this case for the amount of ( ) − .  5.
The input variables based on the mobility house's technical system are shown in Table 5.The lower and upper SOCs of the BESS were chosen to be 20% and 90%, respectively.Therefore, the depth of discharge (DOD) was 70% (95.9 kWh), as this is suggested as an acceptable range to reduce battery degradation and maximize the battery's lifetime.The BESS at Dansmästaren has two peak shaving limits, and , as described in 2.3, but due to the rule-based peak shaving model only using one limit these two limits were treated as one and the same, .As presented in the paper by [34], a genetic algorithm solver in MATLAB was used to determine the control variable that would yield a to lower the highest power peak in a given day, e.g., minimizing the objective function (Equation ( 11)).  5.As described in Section 2.3, the battery capacity at Dansmästaren is 137 kWh, meaning that E b−disch ∈ [0, 137] kWh.As presented in the paper by [34], a genetic algorithm solver in MATLAB was used to determine the control variable E b−disch that would yield a P d−lim to lower the highest power peak P grid−peak in a given day, e.g., minimizing the objective function (Equation ( 11)).
P grid−peak = max P grid−new (10) minimize f = P grid−peak (11) The genetic algorithm had a population size of 20, a maximum generation of 50, and had to satisfy the constraints in Table 6.Table 6.Constraints for the genetic algorithm.

Constraints
for the forecasted data was obtained with the genetic algorithm that satisfied the constraints and yielded the lowest possible P grid−peak for a given day using the forecasted data.

Performance of Neural Network to Predict the Day-Ahead Load Demand
Data from January 2021-April 2022 (Data Train , Data Val , Data Test ) were used to test the performance of the implemented neural network in terms of the linear regression index (R-index).The R-index [−11] describes the relationship between the target P d and the output of the model, i.e., the predicted P d .An R-index close to 1 is desirable since it indicates that the neural network model's output is close to the target.An R-index close to 1 is especially desirable for Data Test since that data have not been used to train the neural network.The corresponding linear regression index (R) for each type of datum is presented in Table 7.The model's performances during the first two weeks in January 2022 (1st-14th) and the last two weeks in April 2022 (17th-30th) are shown in Figure 4.The two time periods were chosen to illustrate the model's performance when there is almost no PV power and much PV power available.Figure 4 also shows the BESS's SOC during the two time periods: (a) when the load prediction is quite close to the actual load demand and therefore the rule-based algorithm is capable of satisfying the constraint SoC f == SoC i each day and (b) when the load prediction is not very accurate and because of that the rule-based algorithm cannot satisfy SoC f == SoC i .Note that there are days when the PV power is high enough to charge the BESS and fully cover the load demand, resulting in P d (t) = 0.Moreover, the model is based on the assumption that the BESS's SoC i = 50% and when simulating longer time periods than a day the assumption is not true for all days if the previous day did not satisfy the constraint SoC f == SoC i .

Day-Ahead Predictions
An attempt was made to make a day-ahead prediction of the 120 days in January-April 2022 using the created neural network.Each day was evaluated using RMSE.Three of these days were investigated: the days with the best RMSE, the worst RMSE, and with

Day-Ahead Predictions
An attempt was made to make a day-ahead prediction of the 120 days in January-April 2022 using the created neural network.Each day was evaluated using RMSE.Three of these days were investigated: the days with the best RMSE, the worst RMSE, and with the high load demand peak.The best predicted day was the 19th of January, with an RMSE index of 5.25 and the day-ahead prediction can be seen in Figure 5.The worst predicted day was the 13th of April with an RMSE index of 26.27 and the prediction can be seen in Figure 6.Finally, the day with the highest load demand peak can be seen in Figure 7, with an RMSE index of 19.37.

Performance of Rule-Based Peak Shaving Model Using Forecasted Data
The three day-ahead predictions shown in Figures 5-7 were used in the genetic algorithm to find the parameter for the predicted 24 h load profile for the three days.Thereafter, the three found from the day-ahead predictions and the actual load profile were used in the rule-based peak shaving control to find the for each day based on the prediction.The effect of the peak shaving control, the resulting load curve, and the BESS charge/discharge operation can be seen in Figure

Performance of Rule-Based Peak Shaving Model Using Forecasted Data
The three day-ahead predictions shown in Figures 5-7 were used in the genetic algorithm to find the control parameter E b−disch for the predicted 24 h load profile for the three days.Thereafter, the three found E b−disch from the day-ahead predictions and the actual load profile were used in the rule-based peak shaving control to find the P d−lim for each day based on the prediction.The effect of the peak shaving control, the resulting load curve, and the BESS charge/discharge operation can be seen in Figures 8-10.

Performance of Rule-Based Peak Shaving Model Using Forecasted Data
The three day-ahead predictions shown in Figures 5-7 were used in the genetic algorithm to find the control parameter for the predicted 24 h load profile for the three days.Thereafter, the three found from the day-ahead predictions and the actual load profile were used in the rule-based peak shaving control to find the for each day based on the prediction.The effect of the peak shaving control, the resulting load curve, and the BESS charge/discharge operation can be seen in Figure        The RMSE, E b−disch and the P d−lim for the three predicted days can be seen in Table 8 and the effect on the load demand peak can be seen in Table 9.The RMSE value for each day in Data Test (January-April 2022) and the average of 13.96 as well as the moving average during the time period are shown in Figure 11b.The RMSE, and the for the three predicted days can be seen in Table 8 and the effect on the load demand peak can be seen in Table 9.The RMSE value for each day in (January-April 2022) and the average of 13.96 as well as the moving average during the time period are shown in Figure 11b.

Discussion
In this paper, a neural network structure was created in MATLAB using collected data from 2021 from the mobility house Dansmästaren in Uppsala, Sweden.The created

Discussion
In this paper, a neural network structure was created in MATLAB using collected data from 2021 from the mobility house Dansmästaren in Uppsala, Sweden.The created neural network was then tested using the testing data set from January-April 2022.The neural networks' regression index on the testing data set was R = 0.61.Thereafter, each predicted day was evaluated based on RMSE.Three days were evaluated and used for peak shaving operation: the day with the best prediction in terms of RMSE, the day with the worst prediction in terms of RMSE, and the day with the highest load demand peak.These days were chosen to show the system's capability during worst-case scenarios, either when the prediction model does not work in a satisfying manner or when there were high peak load demand peaks.These three predicted days were used in the rule-based peak shaving control to find the control parameter E b−disch , which in turn was used to determine the peak shaving scheme for the real day, e.g., using actual data gathered from the mobility house Dansmästaren.
The neural network was trained on data from 2021 and tested on data from January-April 2022 and the network had a linear regression index of 0.61.The resulting day-ahead predictions of the neural network were satisfactory and the best predicted day had an RMSE of 5.25 and the worst predicted day had an RMSE of 26.27.The reason for the relativity low linear regression index was due to the training data set only containing data from 2021.In the future, more data will be available for training the network, and the performance of the neural network will improve.However, the forecasted data were close enough to the real data to yield a satisfying E b−disch , which in turn yielded a day-ahead peak shaving strategy that satisfies the constraint SoC f == SoC i in 96 out of the 120 days in January-April 2022 and would never discharge the battery below 20% of the max SOC.On the day with the highest RMSE (day 2), the constraint SoC f == SoC i was satisfied (SoC i , SoC f = 50%), as can be seen in Figure 9.However, the BESS is not utilized fully since the highest SOC was 82.87 % and only PV was used to charge the BESS.This occurs due to differences between the prediction and the actual load demand curve (Figure 6), resulting in a lower E b−disch that what was necessary, as can be seen in Table 10.In turn, this results in a slightly too high P d−lim (76.48 kW instead of 70.34 kW) and therefore the rule-based peak shaving control misinterprets the load demand and selects incorrect rules for charging and discharging the BESS.Day 3 is a good example of why a better prediction model is required for an optimal peak shaving operation at Dansmästaren.To evaluate if the predictions were good enough, the real data from the three days was used, i.e., assuming perfect prediction results (R testing = 1), as input to the rule-based peak shaving control resulting in the parameters E b−disch−pp and P d−lim−pp .The subscript pp refers to the use of perfect prediction.
Thereafter, the control parameters (E b−disch−pp and P d−lim−pp ) using the real data were compared with the control parameters (E b−disch and P d−lim ) using the predicted data.Table 10 shows this comparison and, as can be seen, the final P d−lim in the two cases of either using the predictive model or a perfect prediction model is quite similar on days 1 and 2. On the day with the highest load demand (day 3), there is a relatively big difference between E b−disch and E b−disch−pp as well as P d−lim and P d−lim−pp , which impacts the performance of the peak shaving control.However, this results in a less active/restrictive peak shaving operation due to P d−lim being higher than P d−lim−pp .This indicated that the prediction model does not have to be perfect for the rule-based peak shaving control to still function in a satisfactory manner.

Conclusions
In this paper, a simple two-layered feedforward neural network used for load prediction and a rule-based peak shaving control algorithm was used to investigate the impact of peak shaving operation at the parking garage Dansmästaren in Uppsala, Sweden.In the three studied days, the model was capable of lowering the load demand peak by 25.4-38.5% while satisfying the constraint of a minimum SOC of 50% at the end of the day.
further improve the performance, more data from the parking garage are required.However, the presented neural network provides rule-based peak shaving control with adequate day-ahead prediction to yield a satisfying peak shaving operation.This shows that the predictive model of such a system does not have to be perfect to yield a satisfying peak shaving result.
To continue electric vehicle (EV) adoption and charging station infrastructure expansion-without contributing to the capacity shortage-it is important to further investigate EV charging operations and how to support the EV charging.A future step would be to incorporate the smart charging of the EVs in the peak shaving operation.Additionally, another future step would be to add a predictive model for the solar farm.Finally, the presented model will be implemented on-site at Dansmästaren using the local energy management system.Funding: The research was funded by the Swedish Energy Agency project 2019-03066.This work was also funded through the SweGRIDS project FPS24, by the Swedish Energy Agency, and Vattenfall.

Data Availability Statement:
The historical PV time-series data that were used in this research are openly available and provided by the Swedish Meteorological and Hydrological Institute (SMHI) [43].

Figure 1 .
Figure 1.A photo of Dansmästaren (a) and a simplified schematic of its energy system (b).

Figure 1 .
Figure 1.A photo of Dansmästaren (a) and a simplified schematic of its energy system (b).

Figure 2 .
Figure 2. Neural network for load demand forecasting at Dansmästaren.The parking garage's load demand, PV production, EV charging, and ambient temperature from 2021 were used to train the network.The parking garage's load demand ( ) was calculated using grid demand ( ) data collected from the grid owner Vattenfall's customer portal and the PV data ( ), as shown in Equation (4).( ) = ( ) + ( ) −

Figure 2 .
Figure 2. Neural network for load demand forecasting at Dansmästaren.

Figure 3 .
Figure 3. Diagram overview of rule-based peak shaving model.The input variables are presented and explained in Table5.

Figure 3 .
Figure 3. Diagram overview of rule-based peak shaving model.The input variables are presented and explained in Table5.

Figure 4 .
Figure 4.The load demand at the parking garage before and after utilizing peak shaving for (a) the first two weeks of January 2022 and (b) the last two weeks in April 2022, as well as the available PV power and the BESS's SOC during the time period.

Figure 4 .
Figure 4.The load demand at the parking garage before and after utilizing peak shaving for (a) the first two weeks of January 2022 and (b) the last two weeks in April 2022, as well as the available PV power and the BESS's SOC during the time period.

19 Figure 5 .
Figure 5.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 19th of January 2022, which was the day with the lowest RMSE in the testing data set.

Figure 6 .
Figure 6.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 13th of April 2022, which was the day with the highest RMSE in the testing data set.

Figure 5 . 19 Figure 5 .
Figure 5.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 19th of January 2022, which was the day with the lowest RMSE in the testing data set.

Figure 6 .
Figure 6.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 13th of April 2022, which was the day with the highest RMSE in the testing data set.

Figure 6 .
Figure 6.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 13th of April 2022, which was the day with the highest RMSE in the testing data set.

Figure 7 .
Figure 7.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 9th of March 2022, which was the day with the highest peak in load demand in the testing data set.

Figure 7 .
Figure 7.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 9th of March 2022, which was the day with the highest peak in load demand in the testing data set.

Figure 7 .
Figure 7.The mobility house's load demand profile and the day-ahead predicted load demand profile on the 9th of March 2022, which was the day with the highest peak in load demand in the testing data set.

Figure 8 .
Figure 8. Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 19th of January).

Figure 8 .
Figure 8. Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 19th of January).

Figure 9 .
Figure 9. Load demand and PV profile, charge and discharge behavior of the BESS as as SOC during a day, and a power profile comparison before and after peak shaving operation (the 13th of April).

Figure 9 .
Figure 9. Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 13th of April).

Figure 8 .
Figure 8. Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 19th of January).

Figure 9 .
Figure 9. Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 13th of April).

Figure 10 .
Figure 10.Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 9th of March).

19 Figure 10 .
Figure10.Load demand and PV profile, charge and discharge behavior of the BESS as well as SOC during a day, and a power profile comparison before and after peak shaving operation (the 9th of March).
Figure 11a also shows the highest daily peak hour in the predicted load demand and the real load demand.

Figure 11 .
Figure 11.January-April 2022: (a) The highest daily peak hours in the predicated and target load demand; (b) the corresponding daily RMSE and the moving average for same period.

Figure 11 .
Figure 11.January-April 2022: (a) The highest daily peak hours in the predicated and target load demand; (b) the corresponding daily RMSE and the moving average for same period.

Table 10 .
Energy available to be discharged from the battery using predicted data (E b−disch ) and using perfect prediction (E b−disch−pp ), and P d−lim based on E b−disch as well as P d−lim−pp based on E b−disch−pp .

Table 3 .
Neural network input data.

Table 4 .
Training, validation, and testing data used for the neural network.

Table 5 .
Variables for rule-based control.

Table 5 .
Variables for rule-based control.
l 20%, 27.4 kW Lowest battery SOC limit allowed SoC u 90%, 123.3 kW Highest battery SOC limit allowed SoC i , SoC f 50%, 68.5 kW Initial and final SOC

Table 7 .
Regression indexes for the neural network during training, validation, and testing.

Table 8 .
RMSE, E b-disch , and P d-lim for the three days using predicted data.

Table 9 .
The highest load demand peak before and after the peak shaving operation from the three chosen days in the testing data set.

Table 8 .
RMSE, Eb-disch, and Pd-lim for the three days using predicted data.

Table 9 .
The highest load demand peak before and after the peak shaving operation from the three chosen days in the testing data set.