*2.1. Data*

We received 40 load profiles from the Flemish distribution grid operator (Fluvius) Each profile is the active power (in kW) of an enterprise for the 3-year period between 1 January 2014, 00:00 and 31 December 2016, 23:45. All enterprises are low-voltage users with peak demand pricing and a connection capacity above 56 kVA and lower than 1 MVA. The data was logged through automatic measurement reading (AMR) devices with a time resolution of 15 min. The mean power of the users varied between 1.92 and 53.75 kW (Figure 1a). The peak-to-mean power ratio was between 1.5 and 40; however, for 90% of the users, the ratio is lower than 10 (Figure 1b).

**Figure 1.** Boxplots, 40 load profiles–(**a**) Mean power (left), (**b**) Ratio: Peak-to-mean power (right).

## *2.2. Power Flow Model*

Figure 2 shows the topology of our system. The battery is connected through a DC/AC inverter behind the meter of the user. The grid serves as the only power supply since there are no renewable energy sources. In general, for peak shaving, the energy storage system should have high energy efficiency as well as high power capacity (C rate) [28]. For these reasons, we selected a Lithium-ion battery to carry out our analysis (See Table 1).

**Figure 2.** System topology.


**Table 1.** LFP Cell Characteristics, according to [29].

The simulation model, built in Matlab/Simulink is shown in Figure 4. Here, it is worth noting that a part of the present model used for peak shaving was based on the model described in [30]. Therefore, in this paper, we will only detail the new model components, which are blocks 1 and 5 (See Figure 4). For the remaining blocks 2, 3 and 4, we provide a generic description, but for more information, the reader is referred to [30], in particular its Section 2.3. For the development of the model, we relied heavily on a real test-setup—microgrid emulator (The microgrid emulator makes part of the laboratory infrastructure of EELab/Lemcko, an expertise center of Ghent university, specialized in Renewable Energy System applications. For more information, contact the first author (Vasileios.Papadopoulos@UGent.be)) comprising of: (i) a low-voltage grid (250 kVA power source), (ii) a 90 kVA DC/AC converter, (iii) a 20 kWh LiFePO4 battery, (iv) a 30-kW programmable load. The behavior of each component and the interaction between them was studied analytically and converted into simulation models using information from test measurements, scientific papers and commercial datasheets.

To begin with, the model has three variables: (i) the time resolution of the load profile, (ii) the battery capacity (kWh) and (iii) its C rate. Furthermore, it receives two data inputs: (i) the load profile and (ii) a power threshold. The load profile is simply a time series of the active power in kW at 15 min resolution. The power threshold is a constant specifying the 'desired' maximum power. This value must be lower than the peak power but also higher than the mean power. Given the time step (resolution) and the 3-year period, in total, there are 105,216 simulation steps (1096 days × 96 quarters/day). At each step, the model reads the load power of that moment and the current State-of-Charge (SoC). Then, it undergoes three sequential processes (1, 2 and 3) to calculate the battery power Pbat (inverter's DC side), the inverter power Pinv (inverter's AC side) and the power of the grid Pgrid. Next, after updating the State-of-Charge (SoC) of the battery, it proceeds to the next simulation step and hence, the simulation progresses. Figure 3 shows the DC/AC conversion e fficiency of the inverter in charging mode. Additionally, all the equations that were used to calculate the inverter power Pinv and battery power Pbat in charging and discharging mode.

$$P\_{\text{bat}} = f(\mathbf{x}) \cdot P\_{\text{inv}} \tag{1}$$

$$\frac{P\_{\text{bat}}}{P\_{\text{nom}}} = f(\mathbf{x}) \cdot \frac{P\_{\text{inv}}}{P\_{\text{nom}}} \tag{2}$$

$$\frac{P\_{\text{bat}}}{P\_{\text{nom}}} = f(\mathbf{x}) \cdot \mathbf{x} = \text{ g}(\mathbf{x}) \tag{3}$$

$$\frac{P\_{\text{inv}}}{P\_{\text{nom}}} = \text{ g}^{-1}(\frac{P\_{\text{bat}}}{P\_{\text{nom}}}) \tag{4}$$

$$\mathbf{P\_{bat}} = \frac{\mathbf{P\_{inv}}}{\mathbf{f(x)}} \tag{5}$$

$$\frac{\mathbf{P\_{bat}}}{\mathbf{P\_{nom}}} = \frac{\mathbf{P\_{inv}}}{\mathbf{P\_{nom}}} \cdot \frac{\mathbf{1}}{\mathbf{f(x)}} \tag{6}$$

$$\frac{P\_{\text{bat}}}{P\_{\text{nom}}} = \frac{\text{x}}{\text{f}(\text{x})} = \text{h}(\text{x}) \tag{7}$$

(8)

**Figure 3.** DC/AC efficiency, Y = f(x).

With respect to the sequential processes, process 1 performs the power conversion from AC to DC compensating for the efficiency losses (AC to DC). Process 2 applies two saturation constraints to the battery power: one for the given C rate and one for the given time resolution. Finally, process 3 performs the reverse conversion from DC to AC considering the inverse (DC to AC) efficiency losses. In the following paragraph, we describe with more detail those processes.

Process 1—AC/DC power conversion (Figure 4, block 1): Initially, we set the inverter power equal to the difference PThreshold − Pload. In case of a power surplus (positive difference), the inverter is in charging mode to restore the battery's energy capacity, otherwise, in case of a power deficit (negative difference), the inverter is in discharging mode to shave the peak. After setting the inverter power, next, we calculated the battery power compensating for the efficiency losses. In charging mode, the battery power is always lower than the inverter power (See Equation (1)) and vice versa in discharging mode the battery power is always higher than the inverter power (See Equation (5)).

Process 2—Power saturation constraints (Figure 4, block 2, 3, 4): Here, we impose two constraints to the battery power. First (block 2), the battery power can never exceed its power capacity as specified by its C rate limit and the SoC level. For this battery technology, the recommended C rate is 1. How we calculate exactly the power from the C rate limit, has been explained in [30], Section 2.3. (As an approximation, we can state that the power capacity is equal to the battery's nominal voltage times the C rate, times its energy capacity in Ah: Pbat max = Unom·Crate·CAh.) Second (block 3), we must take into account also the time resolution of our data (15 min). This constraint comes into effect when the SoC level is very close either to its upper or lower limit (90% and 10% respectively) (10–90% is the recommended by the manufacturer SoC range to maximize the lifetime of the battery). Since our simulation is executed in discrete steps of 15 min, we need to consider how much energy is left inside the battery and saturate its power accordingly (see [30], Section 2.3). Afterwards, at the output of the second constraint, the battery power was finally defined and hence the SoC can be updated (block 4).

**Figure 4.** Power flow model for peak shaving designed in Matlab/Simulink.

Process 3—DC/AC power conversion (Figure 4, block 5): Knowing the final value of the battery power, it is then possible to calculate the final value of the inverter power. At this point, the DC/AC efficiency function f(x) needs to be inverted. In charging mode, we make use of Equation (4) (function g −1) and in discharging mode Equation (8) (function <sup>h</sup>−1). As a result, we finally know both the load power Pload and the inverter power Pinv. Therefore, we can also calculate the power of the grid Pgrid (Pgrid = Pload + Pinv) and proceed to the next simulation step.
