The Cost of Photovoltaic Forecasting Errors in Microgrid Control with Peak Pricing

Model predictive control (MPC) is widely used for microgrids or unit commitment due to its ability to respect the forecasts of loads and generation of renewable energies. However, while there are lots of approaches to accounting for uncertainties in these forecasts, their impact is rarely analyzed systematically. Here, we use a simplified linear state space model of a commercial building including a photovoltaic (PV) plant and real-world data from a 30 day period in 2020. PV predictions are derived from weather forecasts and industry peak pricing is assumed. The effect of prediction accuracy on the resulting cost is evaluated by multiple simulations with different prediction errors and initial conditions. Analysis shows a mainly linear correlation, while the exact shape depends on the treatment of predictions at the current time step. Furthermore, despite a time horizon of 24 h, only the prediction accuracy of the first 75 min was relevant for the presented setting.


Introduction
The control of microgrids has gained huge attention in the research community within the last decade. One of the most popular methods is model predictive control (MPC). Its task is to find optimal control sequences for power generation and distribution, thereby including forecasts of external conditions such as load demands, renewable energy sources and electricity pricing. However, these forecasts are always subject to uncertainties. Different strategies to handle these uncertainties exist, e.g., robust [1,2] or stochastic [3][4][5] MPC. Essentially, their aim is to either ensure stability and/or constraint satisfaction (in case of robust MPC), or to minimize a stochastic entity, such as the expected value of costs (in case of stochastic MPC). The literature on different MPC approaches for microgrid control is rich and includes various models, optimization goals and such strategies, see, e.g., the reviews [6][7][8].
However, the urgency of handling uncertainties depends on their impact, which, again, might depend heavily on the respective application. Specifically, the most common objective, monetary cost, varies with different pricing structures. With the high peak costs encountered in German industry pricing, for example, forecasting errors can have serious consequences. Thus, a systematic analysis of how (realistic) forecasting errors affect the control outcome is necessary.
One important source of uncertainties in modern microgrids is the use of photovoltaic (PV) plants as renewable energy sources. While their power production can be predicted from widely available weather forecasts [9,10], simulation studies with real-world predictions are comparatively rare. Mostly, strategies to handle uncertainties are presented, and the effect of forecasting errors themselves is only investigated in the evaluation of the new strategy.
An interesting example of an application using historical weather forecasts as predictions for the PV production is [11]. The uncertainties are accounted for by a stochastic MPC approach with chance constraints. The stochastic MPC outperforms a deterministic MPC, but the relationship between the forecasting error and the resulting additional energy use remains unclear. The effect of PV and wind power production forecasts on their integration in the German power grid is considered in [12]. Namely, the resulting control reserve power, the regime switches per week (i.e., how often a storage has to change between charging and discharging) and the storage energy losses are evaluated. However, the authors come to the conclusion that today's forecasts are sufficient and further improvement would have no significant effects. In [13], an affine arithmetic method for microgrid control is introduced and compared, among others, to MPC methods. Three different levels of artificial forecasting errors are considered, for which the error increases linearly within the time horizon (but with three different slopes). The numerical results show that, for regular MPC, costs increase significantly with the error (level). In [14], a residential home with plannable loads and PV and wind energy sources is controlled. Five different levels of uniformly distributed forecasting errors from 6 % to 30 % are respected, resulting in increasing costs. In [15], a microgrid with intraday pricing is considered. Simulation results suggest a perfectly linear relation between a forecast error, varied between 19 % and 21 % and costs. However, this cost increase seems negligible in comparison to additional costs from forecasting errors on electricity prices. In [16], a microgrid is controlled in a rolling horizon fashion with forecasts for both PV production and load demand. The authors scale the prediction error and show that the resulting operation costs increase more strongly than the linear with the normalized root mean square error of the forecasts. Costs arise from fuel consumption and the number of generator start-ups. In [17], a microgrid with forecasts for electricity prices, load demand, PV and wind power generation is controlled using MPC. The forecasting error for PV generation is varied from 8 to 24 %. However, the results suggest no significant effect. In [18], an AC/DC microgrid model with a wind turbine and a PV plant is controlled in real-time. Reference points for power generation and use under uncertain forecasts are derived by a robust optimization of a mixed-integer linear programming problem [19]. Forecast uncertainties are respected by possible variations in ±2 % of power generation. Simulation results show an increase in total costs over the 200 s simulation period of 12.45 % for the worst-case scenario. In [20], a microgrid with multiple distributed generators and storages is controlled. Using dual decomposition, the optimization problem can be solved by a distributed algorithm. Uncertainties in wind forecasts are robustly respected by minimizing the worst-case transaction cost. However, no analysis of the cost impact on the dependence of the uncertainty is conducted. In [21], a closed-loop robust MPC approach is developed for the control of a building with uncertain heat gains. The effect of different uncertainty levels on thermal discomfort and energy usage is evaluated for the proposed approach and the use of open-loop robust MPC and only regular MPC. The robust MPC approaches are effective in reducing thermal comforts; however, this leads to an expense of energy usage. In [22], this closed-loop robust MPC is approach is used for temperature control of a single room. In a comparison with regular MPC and a rule-based controller, it shows superior results only for an intermediate level of uncertainty (30-67 %). With less uncertainty, the regular MPC is advantageous and for higher uncertainty, the rule-based controller is advantageous. In [23], different MPC variants are compared for the temperature control of a building. While the simulated thermal sensation of the inhabitants deteriorates with an increasing level of uncertainty for all control schemes, the energy usage shows no clear trend and varies by less than 1 %. In [24], a stochastic MPC approach is used to control the heating, ventilation and air conditioning (HVAC) unit and zone temperature of a building. For the uncertain loads (outside air temperature and occupancy), probability distributions are derived from historical data. Then, the expected energy usage is minimized while satisfying chance constraints. The stochastic MPC approach is compared to a standard MPC, which uses expected load values. The results suggest superiority of the stochastic MPC, if the uncertainty level is not too high, i.e., if the forecasting errors are scaled with a factor ≤ 5. In [25], stochastic MPC with explicit chance constraints is used for demand response in a residential energy management system. Uncertainties in PV power production and ambient temperature are modeled as normally distributed. A doubling of the standard deviation of the PV forecasting error leads to an increase in necessary grid power reduction of ≈ 43 %.
In summary, while there are many approaches to address uncertainties in predictive microgrid control, we see a gap in research into the effect of realistic uncertainties if unhandled, especially for the challenging case of peak costs. However, this is crucial for the assessment of investments in forecasting technologies. Thus, we try to answer the following questions: • Are state-of-the-art weather predictions already sufficient to reduce demand peaks? • What is the correlation between prediction accuracy and resulting cost? • What is the time horizon in which the prediction accuracy is relevant?
To address them, we first describe a linear state space model of a microgrid, an economic MPC approach for its control, and real-world data used for simulation, as well as how we adjust the prediction errors from weather forecasts, in Section 2. We investigate the operational cost of the microgrid for a 30-day period from 2020 for various settings in Section 3. These include different initial peaks (i.e., limits from which peak costs occur), prediction errors, assumed knowledge of PV production at the current time step and different forecasting errors at the beginning of the prediction horizon.
As our main contributions, we show that, for a realistic microgrid setting of a mediumsized company building with real-world data: • Using solar irradiance forecasts from weather services as predictions for PV power generation can reduce peak costs; • The cost reduction scales with the prediction error, specifically -If PV generation is known at the current time step, the costs increase linearly with the prediction error; -If only predictions are used for the current time step, the correlation resembles a piece-wise linear function, with a significantly higher slope for lower errors.
• Our results suggest that the prediction accuracy for PV generation is only relevant within a short period at the beginning of the prediction horizon.

Microgrid Modeling
The microgrid represents a medium-sized office building in Offenbach, Germany, and is given as a discrete-time linear state space model of the form The state vector x consists of the stored energy of a battery E and the building temperature ϑ b . The inputs u are the power bought from/sold to the grid P grid , the power produced by a combined heat and power plant (CHP) P chp and heating (Q rad ) and cooling (Q cool ) power from a heating, ventilation and air conditioning system. Influences which cannot be controlled are modeled as disturbances d, i.e., the generated PV power P ren , the load demand P dem and the ambient air temperature ϑ air . Figure 1 shows an overview of the microgrid's structure.
Disturbances ϑ air P dem P ren

States
Inputs Figure 1. Illustration of the microgrid's components.
The state dynamics are given by where µ = 1−e − H air C th Ts H air . Electrical powers are denoted by P and thermal powers by Q. For details of the modeling, the reader is referred to [26]. Note that the battery charging power P charge is no input on its own, but is implicitly given by P charge (k) = E(k + 1) − E(k), see (7). The model parameters are given in Table 1, the constraints in Table 2.

Economic MPC Approach
In contrast to regular tracking MPC, in econonomic MPC, the objective function may be of an arbitrary form. In this study, we minimize three objectives. First, the desired temperature set point is ϑ set = 21°C. Thus, to punish both too-high and too-low temperature values, we use the quadratic deviation as costs, The scaling with T s (k) is necessary due to the varying step widths. Second, we minimize all occurring monetary costs, which stem from buying/selling power to the grid and gas costs for both CHP and gas heating. For German industry pricing, these can be described as . . . + c grid,buy · max 0, P grid (k) − c grid,sell · max 0, −P grid (k) · T s (k) . . . + c grid,peak · max 0, P grid (k) − P grid,peak (k) , where c chp , c gas , c grid,buy , c grid,sell and c grid,peak are constants [26]. P grid,peak (k) refers to the maximum peak in P grid , which has occurred until time step k. In Germany, the peak costs c grid,peak · P grid,peak are evaluated annually. In other countries, they might be evaluated and reset monthly. Furthermore, they tend to increase, while c grid,peak = 100.01 e kW for 2020 has already been comparatively high. Note that the max-terms in (5) and (6) can be translated into a linear expression by an epigraph reformulation (see [26] for details).
Third, we slightly punish the use of the stationary battery to prevent arbitrary charging and discharging. Otherwise, if there is no incentive to either shave peaks in P grid or store excessive energy from P ren , there would be an infinite number of equally optimal solutions for P grid (since no battery losses are assumed). We use a linear cost term bat (k) = P grid (k) + P chp (k) +Q cool (k) ε c + P ren (k) + P dem (k) where the absolute value | · | can again be translated into a linear expression by an epigraph reformulation. The prediction horizon has an overall length of 24 h, split into 56 steps. However, since forecast accuracy decreases with time, we sample the first 8 h window denser than the middle and last interval, The overall objective function, which is minimized at every time step, i.e., every 15 min, is then given by w comf · comf (x(k), u(k)) + w mon · mon (u(k)) + w bat · bat (u(k)).
The weights w comf and w mon have been derived from 2D Pareto optimization over a longer time periods [26,27]. w bat is then chosen to be large enough to prevent the arbitrary charging and discharging of the battery, but small enough to keep the rewarding incentives of battery use described above.

Simulation Framework 2.3.1. Data Sources
We use the real-world data of a medium-sized office building in Germany, recorded over 30 days, starting from 14 April 2020. The building contains a comparatively large PV plant, such that the effective power demand P ren + P dem has negative peaks on most days, see Figure 2. Figure 2. Effective power demand, i.e., building consumption and PV production summed for the simulated time horizon. The black line shows the limit above which the CHP is insufficient to maintain a peak of 100 kW. The red line shows the limit if the battery is discharged at its maximum, i.e., the theoretic demand limit for which the initial peak of 100 kW could be held. On 11 May, a minimum peak of P grid ≥ 118 kW is unavoidable, even if the CHP and the battery are employed at their maximum.

Effective Power Demand
For this study, perfect knowledge of building demand P dem and outside air temperature ϑ air is assumed. For PV power production P ren , real-world forecasts of the solar irradiance I sol from a commercial weather service are used. Forecasts are updated every ≈65 min. The real values were measured with an on-site weather station.
The solar irradiance I sol has to be converted into the PV power output P ren . In general, the relationship can be described bỹ with η PV being the reference efficiency, A PV the surface area, T cell the operating temperature of the cell and a constant β ≈ 0.04 [28]. For the purpose of this study, we neglect the temperature influence, resulting in the linear approximation Figure 3 shows the true trajectory of I sol for two days together with different forecasts. The closer a forecast is, the better it resembles the ups and downs. However, even with only 2 h ahead, the prediction error is still significant.

Artificial Errors
To systematically analyze the effect of different prediction errors, we introduce artificial errors by scaling the actual prediction errors linearly. Let P ren (k) be the real value at time step k and P ren (n|k) the value of P ren (n + k) predicted at time step k (with n ∈ [0, N pred − 1]). Then, the new prediction with an error scale of s err is P s err ren (n|k) = min max P ren (n + k) + s err · (P ren (n + k) − P ren (n|k)) regular prediction error e ren (k) , P max ren , 0 .
Note that we limit predictions to stay within physical limitations, i.e, 0 ≤ P s err ren ≤ P max ren . Thus, we use the resulting mean absolute error within the prediction horizon for the subsequent analyses. It is calculated by where N sim is the total number of simulation steps.

Treatment of Disturbances at Current Time Step
A non-trivial challenge is the handling of predictions at the current time step. If no robust MPC approach is used, differences in predicted values d(0|k) for disturbances and real values d(k) lead to x(k + 1) = x(1|k), potentially violating state constraints. Figure 4 illustrates how predictions for the solar irradiance I sol (0|k) at the current time step and its true values I sol (k) can be different. Thus, the error e ren (k) = P ren (k) − P ren (0|k) has to be handled, for which we propose two options.
First, in the optimistic scenario, we assume perfect measurements, i.e., P ren (0|k) = P ren (k). This neglects that a measurement at time k is most likely to change within the time step (i.e., during the following 15 min), and thus does not represent the necessary average. In this case, no further handling of e ren is necessary and all constraints will be fulfilled. Second, in the pessimistic scenario, we assume no additional measurement at time k, which means that we use a value which was predicted up to 65 min ago. We use heuristic rules to account for e ren (k). If e ren (k) > 0 (i.e., higher PV production than expected), the surplus is balanced by decreasing P grid (k). If e ren (k) < 0 (i.e., lower PV production than expected), we discharge the stationary battery if this is necessary to prevent a new peak in P grid (while respecting all constraints). Otherwise, P grid (k) is used to compensate e ren (k).

Results & Discussion
Both model and control algorithms from Section 2 were implemented in PARODIS [29] (available at https://github.com/teamparodis/parodis, accessed on 24 April 2020), which is an easy-to-use general MPC framework for MATLAB and builds upon YALMIP [30]. With GUROBI as the solver, a single simulation of 30 days takes ≈ 150 s on an Intel i7-8550U notebook CPU.

Potential Savings
The general potential savings, i.e., the difference in cost between simulation with no and with perfect predictions, are shown for both scenarios (optimistic and pessimistic) in Figure 5.
Assuming perfect predictions, the minimum monetary costs for the 30-day period are 21,980 e (including, however, the entire peak cost for the initially assumed peak of 100 kW). If no predictions for P ren are used (i.e., P ren (n|k) = 0 ∀ n ∈ [0, N pred − 1]), they increase to 28,704 e or 29,324 e for the optimistic and pessimistic scenario, respectively. For the optimistic scenario, this results in potential savings of 6724 e, and we already reach 4577 e with our current prediction quality. However, for the pessimistic scenario, we only reach savings of 1491 e out of the potential 7344 e. This leads to the following question: how good would the predictions need to be to achieve a certain amount of potential savings?

Cost Ranges in Dependence of Predictions
(a) (b)

Correlation between Prediction Accuracy and Costs
To systematically analyze the correlation between prediction accuracy and resulting costs, we run multiple simulations with different initial peaks P grid,peak (0) ∈ [100, 200] kW and vary s err ∈ [0, 8], leading to e avg ∈ [0, 269.6] kW, as described by (13). Figure 6 shows the results for the optimistic scenario. With no prediction errors, the costs rise only with the initial peak costs (if ≥118 kW, which is unavoidable, see Figure 2). For low initial peaks (100 kW or 120 kW), the costs increase linearly with e avg until ≈143.1 kW, from which point they start to saturate. For high initial peaks, e avg has no influence on the costs, since P grid,peak (0) + P max chp ≥ −(P dem (k) + P ren (k))∀ k, and thus it is not necessary to use the battery for peak shaving. Figure 7 shows the results for the pessimistic scenario. Here, the correlation is much less consistent and could be described by piece-wise linear functions for the different initial peaks. For lower initial peaks, the cost increases drastically for e avg > 0. The higher the initial peak, the lower the slope becomes. However, in contrast to the optimistic scenario, costs do increase, even for the highest initial peak of 200 kW. From e avg ≈ 25 kW, the costs plateau (with one negative bump) and increase again with e avg (s err > 1). The negative bump, i.e., the decrease in costs with an increased average error, can be explained by an artifact of the underlying data and would change, e.g., for other simulation time spans. To illustrate this, assume two simulations with s err = 0.5 and s err = 1. Usually, s err = 1 will lead to higher peaks, e.g., at time step k 1 . However, for a new demand peak at k 2 > k 1 , the controller 1 with s err = 0.5 would thus try to shave the peak by discharging the battery, whereas controller 2 with s err = 1 would not. If then, at k 2 + 1, an even higher peak occurs (previously unseen), controller 2 is in a better position and controller 1 might result in an overall higher peak. To conclude, luckily chosen higher prediction errors might lead to lower costs, but the general trend of increasing costs with higher errors is clear. Furthermore, the closer the error gets to 0, the more beneficial it seems, due to the high impact of peak costs, as Figure 8 shows.

Parts of Additional Non-Peak-Costs
(a) (b) Figure 8. Parts of the additional monetary cost which are not caused by higher peaks. Again, the red lines indicate the real average prediction error. For the optimistic scenario (a), only simulations with initial peaks of 100 kW or 120 kW are shown, since, with higher initial peaks, generally, no new peaks occur. For lower initial peaks, they dominate, i.e, the non-peak costs are negligible (≤2 %). For the pessimistic scenario (b), the part of additional non-peak costs increases with both higher e avg and initial peaks in P grid . However, in the most relevant part with initial peaks ≤ 120 kW, they are still low (≤5 %).

Influence of Prediction Accuracy within the Time Horizon
For the simulations shown in Figures 6 and 7, the prediction error werescaled equally over the prediction horizon as described in (12). To analyze whether its influence is equal over the horizon, too, we simulate with perfect predictions for the first n perf steps. Figure 9 shows the resulting additional costs compared to a simulation with perfect overall predictions. Note that n perf = 1 for the optimistic and n perf = 0 for the pessimistic scenario refer to the regular simulations (with real predictions). Furthermore, the pessimistic scenario with n perf = 1 is the same as the regular optimistic scenario. In both scenarios, all additional costs are already avoided with n perf = 5, i.e., with perfect predictions for the first 75 min. Note that this is significantly shorter than a complete charging and discharging cycle of the stationary battery, which would take 250 min.

Conclusions
We apply economic MPC to control a microgrid model of a medium-sized company building with real-world data from a 30-day period. Commercial weather forecasts are used for predictions of the power output of a PV plant. By linearly scaling the prediction error, we analyze the correlation between the average prediction error e avg and the resulting monetary costs if peak costs apply, such as in the German industry pricing. Hereby, we make a distinction with regard to how prediction errors at the current time step are handled. First, we assume perfect knowledge (measurement) of the current power output, which, on average, would need to be the same over the next 15 min (referred to as the optimistic scenario). Second, we assume no additional measurement but the use of previously made forecasts (up to 65 min old), and compensate for errors in the power production by heuristic rules (referred to as the pessimistic scenario).
For both scenarios, the increase in monetary costs is mostly linear (optimistic), or at least peace-wise linear (pessimistic). Current weather forecasts can already be successfully utilized in an economic MPC, but further improvements would be rewarding. Moreover, simulations show that, for the presented setting, the prediction accuracy of only the first 75 min is relevant. Note that, most likely, this depends on the dynamics of the microgrid model. For example, this timespan might increase if minimal up and down times for combustion engines or other producers apply. Nevertheless, the employment of technologies for short-term predictions, such as sky cameras to monitor local cloud movements, seems promising. With these methods, real-world applications would shift towards our optimistic scenario, since the average value for the first 15 min could be predicted more reliably.