Optimal Power Dispatch in Energy Systems considering Grid Constraints

As a consequence of the increasing share of renewable energies and sector coupling technologies, new approaches are needed for the study, planning, and control of modern energy systems. Such new structures may add extra stress to the electric grid, as is the case with heat pumps and electrical vehicles. Therefore, the optimal performance of the system must be estimated considering the constraints imposed by the different sectors. In this research, a dispatch optimization method with an iterative grid constraint generation, decoupled from the linear unit commitment problem, is employed. From the considered scenarios, it was found that in a typical German neighborhood with 150 households, PV penetration of ∼ 5kWp per household can lead to curtailment of ∼ 60MWh per year due to line loading. Furthermore, the proposed method eliminates grid violations due to the addition of new sectors reducing the curtailment up to 60%. With the optimization of the heat pump operation, an increase of 7% of the self-consumption was achieved with similar results for the combination of battery systems and electrical vehicles. In conclusion, a safer and optimal operation of a complex energy system is fulfilled. Safer control strategies and more accurate plant sizing could be derived from this work.


Introduction
Nowadays, there are several initiatives and international efforts to reduce the CO 2 emissions in all energy sectors as part of the Paris agreement [1]. In Germany, the so-called "Energiewende" establishes the goals for the energy transformation towards a zero-emission national energy system [2]. A fundamental step to achieve such ambitious goals is the electrification of the residential heat and transport sectors that accounted in 2016 for ∼ 10% and ∼ 18.2% of the total emissions in Germany respectively [3]. By 2050, it is expected an increase of 50% of the district heating in Europe, with approximately 30% of that demand being covered by heat pumps [4]. However, combined heat and power is expected to serve as a bridge technology coupling electricity and heat sectors [5]. Additionally to this, a fleet of around 6 million electrical vehicles is planned by the German government by 2030 [6]. This makes the analysis of modern and future energy systems more challenging, due to the added complexity of the different new technologies and energy sectors. Along with a significant deployment of renewable sources in the electricity grid, the integration of these sector coupling technologies may add an extra burden to the existing distribution grids [7,8]. Therefore, new concepts and techniques are needed in order to properly study and optimize the grid structure to adequate the operation of such the new energy systems [9]. In this research, a co-simulation toolchain that enables the ease evaluation and optimization of energy systems considering the power grid limits is developed. This methodology was based on the energy system for the "Energetisches Nachbarschaftsquartier Fliegerhorst Oldenburg", which will be a living laboratory in the city of Oldenburg, Germany [10].
Typically, the aggregation approach has been of common use in the literature when it comes to the analysis and optimization of energy systems [11]. Then the optimization problem is independent of its actual physical distribution. Mathematically, the energy system optimization problem can be expressed as: The equation 1 minimizes the cost in a period T at a resolution τ. The sets E and N represent the flows between nodes and the flows from a source associated to a node respectively. Whereas the sets I 1 to I 4 establish the possibility of multiple flows or costs between nodes or from a source to a node. Fixed and time-variable costs c and power p can be included in the optimization problem. The inequality constraint 2, assures that the sum of the M demands for each sector j is fulfilled by the sum of the sources multiplied by the coupling factor a corresponding to the n source and the j sector. The set J constitutes the types of sectors to consider (e.g. Heat and electricity). The constraints 3 and 4 represent the boundary conditions for flows and sources. Some considerations of grid constraints can be applied to the linear optimization problem, they are based on the DC power flow (linear). Hence, making assumptions about voltage and reactive power [12]. This is due to the fact that in AC systems, the apparent power has a quadratic dependency of the real and reactive power. Many approaches are found in the literature dealing with the optimization of energy systems considering the actual electrical grid topology. The implementation of linearized power flows approaches to relax the optimization problem is of common use in the researched literature [13]. DC power flow studies have been enhanced by adding the consideration of reactive power and the consideration of data-driven approaches to determine voltage magnitudes and angles [14]. Novoa et al. [15] have applied a decoupled linearized power flow [16] in combination with a mixed-integer linear problem in order to find the optimal allocation of PV and batteries within an energy system. A combination of a commercial tool to solve power flow problems with a linear unit commitment is presented by Nolden et al. [17] to solve an electrical system without storage at a single time step. Fortenbacher et al. [11] propose a distributed model predictive control within sub-grids to solve a multi-period dispatch optimization problem. To avoid the over-simplification of the models, specialized tools can be used in a co-simulation for each sector [18]. With the analysis of an energy hub, the consideration of a multiple energy carrier system with hydraulic equations can lead to non-convex systems [19]. The utilization of the Newton-Rhapson method is inefficient in time-domain equations. Therefore, Levron et al. [20] have used in combination with a power flow solver, dynamic programming to tackle the time-dependent functions.
To the best of the authors' knowledge, the decoupling of the economic linear dispatch and the power flow has been applied only for the commitment of electric units. Moreover, the integration of grid constraints into a single optimization problem usually leads to very complex problems when no linearization of the power flow is considered. Therefore, a decoupled approach is proposed using oemof-Solph and PowerFactory. As a result, the optimized dispatch of all the sectors comprising the energy system is obtained by adding flexibilization options whenever is possible to avoid curtailment (economic constraint) and violation of grid operation limits (technical constraints).

Methodology
In this section, the implemented methodology to consider grid limitations in dispatch optimization problems in energy systems is presented. The idea behind this work is to reduce the complexity of the optimization problem when considering grid constraints. Similar to the approach taken by [11,17], in which the unit commitment problem and the power flow solutions are decoupled, the solution to the unit commitment is realized considering a mixed-integer linear problem (MILP) using oemof-Solph [21] whereas an AC optimal power flow (OPF) calculation is carried out in PowerFactory [22], to verify grid quality standards compliance. From this OPF, grid congestion and voltage violations are avoided; the measurements taken to achieve that, are re-implemented in the linear problem as constraints. Figure 1 shows this iterative process to obtain the solution of the optimization problem in the energy system. Even though this approach could be applied to any energy system, regardless of its dimension, this work is primarily intended for its implementation on mid and low voltage systems as described in section 1.

Overview Iterative Process
Since sector coupling and energy storage technologies will be present in the energy systems of the future, an iterative approach is needed when decoupling the unit dispatch optimization and the grid constraint generation. This due to the fact that the constraint generation from the OPF may influence the dispatch of the sector coupling technologies and storage such as heat pumps, heat water tank, and batteries.
This section presents an overview of the main steps depicted in Figure 1.

Energy system structure:
Here the energy sectors to be considered are defined as well as the relevant technologies and their models. Natural renewable resources and demands time series must also be included. Time steps have to be big enough in order to make valid the steady-state assumption of the different energy sectors [18]. In this work, only the electric and heat sector are considered and a time step of an hour during a year is evaluated. Although several technologies, markets, and demands could be present in a distributed energy system [23], only the ones presented in Table 1 were considered in this study. 2. Linear unit commit: Using a holistic approach, an abstraction of the energy system structure is created in oemof-Solph. This abstraction contains all possible energy flows between sources and sinks and between energy sectors through the coupling technologies as the example depicted in Figure 2. Costs and additional constraints can be associated with each of the energy flows [21]. Here, the system will only consider the economical constraints of the energy flows. Therefore, the objective function is the minimization of cost, as expressed in Equation 1.
As a result, the optimized dispatch of power for each source to fulfill the demand at each time step is obtained. However, up to this point, just the total installed capacities and demands have been considered. The actual topology of the electrical and thermal grid has been also disregarded as a common practice in the optimization of energy systems due to the increased complexity of it [19].
3. Grid topology consideration: Before integrating these flows into the electrical grid in PowerFactory, the distribution of the flows must be considered. This applies only to the electric sources, sinks, and sector coupling technologies. The distribution of heat technologies is disregarded since only the electrical grid topology is being considered in this study.
To represent a typical low voltage grid, one of the so-called "Merit Order Netz-Ausbau 2030" (MONA) reference grids is used. The ONT_8003 grid model is used as reference [24] and depicted in Figure 3.  Table 1 4. Power flow calculation: Once having obtained the distribution of flows for each technology at each node in the previous step as time series, these energy flows must be added as time characteristics to the corresponding elements in PowerFactory.
In order to determine if the optimized dispatch fulfills the grid standards, a quasi-dynamic power flow (QDPF) study is performed for a year with 1 hour time steps. From the results of the QDPF, lines exceeding 100% loading and voltage variation outside of the range of ±10% of the nominal voltage are considered as grid violations [8].
The time steps containing such violations will be re-optimized by PowerFactory to avoid line congestion and bus voltage violations. In order for the system to converge, a dispatchable source is considered as slack, so it has enough power to cover the demand in case that the renewable sources are curtailed due to system violations.

Constraints generation:
Similar to the constraint generation for the linear optimization [25], the oemof-Solph model will be limited by constraints generated from the OPF as denoted in Equation 4. The real power is the linking parameter between the two tools. Therefore, PowerFactory and oemof-Solph will just exchange information about the active power flows, being the reactive power flow after the last OPF calculation considered as optimal.
The grid violations considered are: • Overvoltage: This could be caused due to a high feed-in of active power. If this is the case, the optimizer would increase the reactive power consumption of the sources at that particular node if the loading of the lines allows it, otherwise, it would curtail the generation at that particular node. • Undervoltage: This is caused by high loads or by the low inductive power factor. If this is the case, reactive power compensation would take place as long as the capacity of the units is not exceeded. If reactive power from the sources does not suffice, then the active power of the load would be curtailed if flexible loads are present at the node. Alternatively, if dispatchable sources are present at the node, the OPF would tend to increase its production. • Overloading: Caused by a high apparent power flow, it could be caused by either the high feed-in of renewables, high demand, or by an uncontrolled reactive power flow.
In any case, the PowerFactory optimizer prioritizes the renewable energy dispatch, given its marginal cost of zero. Therefore, it will try to adjust just the reactive flows, whenever that is enough to meet the grid constraints and then use the balancing capacity of the slack CHP when the reactive power management does not suffice. At any point of time when the optimizer changes the active power flow, this has to be passed as a maximum constraint for that particular time step in the next oemof-Solph simulation. Then the iteration starts again until no violations occur.

Evaluation Scenarios
In order to assess the described method in Section 2, three main scenarios are evaluated. Here, the size of the PV installation is reduced to 700kW. Heat pumps and heat storage are initially added with 600kW th and 150m 3 of capacity respectively.

Electromobility scenario:
A fleet of 62 EVs and 500kWh of battery storage are added to the Heat pump and heat storage scenario. These are distributed within the grid and it is assumed that the EVs are only connected from 6 pm to 7 am of next day [26]. Additionally, it is assumed that the required demand of the EVs is around 10kWh, which is approximately the double required per EV per day [6].

Results
In this section, the main results obtained from the implementation of the electric grid constraints into the optimal operation of an energy system are presented.

High Generation Scenario
As described in Section 2, a significant amount of PV is considered in order to force power to flow back into the medium voltage distribution grid. In Figure 4a, the loading on the main feeder of the low voltage grid throughout the year before the consideration of the grid limits in the optimization is observed. Line loading reaching 120% of its capacity occurs around midday and with a higher incidence in the summer. Figure 4b shows the new line loading after the OPF has generated the corresponding grid constraints at each time step. At the violated hours shown in Figure 4a, the optimization with the grid constraints reduces the load in the line at around 100% of its nominal capacity. Similarly, Figures 5a and 5b depict the voltage behavior on the PV bus before and after the grid constraints generation. It is worth to note that in this scenario, the distributed PV capacity up to 1500kW did not lead to major events. Therefore, the total PV capacity was concentrated on a single bus. Following the same pattern than the over-loading caused by the high in-feed depicted in Figure 4a, over-voltages around 6% above of the nominal voltage occur along with the main feeder over-loading. Even though the steady value of voltage is allowed to exceed up to 10% of the nominal voltage value, the optimizer was set to maintain it below 5% as shown in Figure 5b. However, this also limits the amount of power that can be exported to the grid. Figures 6a and 6b show the power dispatched by the PV plant before and after the consideration of the voltage and loading constraints of the grid. A noticeable curtailment is needed in order to maintain the grid quality parameters of loading and voltage within the admissible ranges. The absence of means to store or shift loads during such midday peaks lead to the unavoidable PV curtailment.

Heat pump and Heat Storage
In this section, the proposed methodology is tested by adding some flexibilization technologies such as heat storage and heat pumps as a sector coupling technology.
Due to the fact that only PV generation is being considered within the district, similar feeder loading would be obtained. In this case, the considered installed PV capacity is considerably lower and distributed within the grid. Hence, no voltage violations occur during the considered period.
After that the heat pumps and heat storage are considered in the energy system, the optimizer has the chance to store the surplus power from PV, causing over-loading, in another energy carrier. dispatch of the heat pumps and PV. Although the heat pump activation avoids some PV curtailment, this is not enough to avoid the line over-loading and therefore, some PV power output must be reduced.  Figure 8 shows the variation in energy content in the water storage tank. A noticeable difference is found especially in the months of summer. This fits with the fact of higher values of sun irradiance and less thermal demand. Therefore, the heat pumps are continuously being used to tackle PV generation surplus when grid constraint violations occur.

Electromobility Scenario
As the fleet of electric cars is added to the energy system, the yearly demand is increased by around 300MWh. With the presence of batteries, the optimization will tend to store the surplus from PV in the batteries in order to use it at night to supply the newly added EV demand. In Figure 9, it can be seen how the main feeder is over-loaded while supplying energy to the EV. After the consideration of such internal grid constraint, the optimizer re-schedules the loading of the EV's batteries in order to avoid the overload of the line as depicted in Figure 10 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 13 September 2021 doi:10.20944/preprints202109.0211.v1  In general, the addition of the electric grid constrains into the optimization of energy systems can lead to considerably deviations in some indicators. Table 2 provides a summary of the influence of such constraints in some indicators on each scenario.

Discussion
In Section 3 it was found that the high share of PV at the low voltage level of the electrical system can lead to over-loads and over-voltages at the point of common coupling when there is enough electricity production to induce high back-flows of energy. Neighbourhoods with PV capacity of 10kW p per household are prompt to lead to grid violations [8]. Therefore, with the consideration in the simulations of a typical low voltage distribution grid in Germany [24], from the results it may be inferred that the main cause of violation of grid constraints will be over-loads even with penetration in the range of around 5kW p per household. Over-voltages exceeding 10% of the nominal voltage are very unlikely to occur at this level of penetration. Nevertheless, when the voltage constraint was limited to 105% of the nominal value, a significant reduction on the main feeder loading is observed as shown in Figure 4b.
The influence of the grid constraints in the operation of an energy system is more relevant as the share of sector-coupling technologies and renewable sources to be incorporated into the energy system is considerably increased as shown in Table 2. The interaction between different energy sectors may cause some grid events [26][27][28] but it can also, with a proper control strategy, provide some flexibility to the grid [29,30]. From the simulation results, it was found that the methodology here proposed is capable of reducing the energy curtailment up to 45% by adapting to the economical dispatch, the technical grid constraints. Therefore, providing in this manner, the most economically and technically feasible dispatch of the energy system. Some evaluation of the sector coupling potential for grid flexibilization already exist in the literature [31,32]. Nevertheless, the usage of oemof-Solph along with a power system analysis tool such as PowerFactory allows the rapid incorporation of new technologies and markets to optimize its operation.
In many applications, some assumptions are made about the voltage angle and magnitude, as well as the reactive power flows are often neglected. This might reduce the accuracy of the studies since such assumptions are sometimes just valid under very special conditions or require additional adjustments that end up adding complexity to the simplified DC power flow [15,17]. For this reason, the full AC power flow grid constraint generation proposed in this investigation can be used in an exchange of simulation time, making it suitable for relatively small systems and off-line applications, such as system planning, control strategies, or provision of ancillary services to the grid [33].

Summary and Outlook
The proposed method combining a linear optimizer such as oemof-Solph and a power analysis tool such as PowerFactory provides a complete dispatch optimization of an entire energy system. With the consideration of the actual grid limits, a more realistic assessment of the energy system performance can be obtained. This has as a benefit, a more accurate system planning and also ensures the optimal and save operation of the system. Energy management system controls can profit from such a toolchain to add grid flexibilization measurements into their operation.
In order to scale the method to bigger grids, different open source tools might provide a faster interface and interaction with oemof-Solph compared to the PowerFactory API. Most of these tools are written in python or julia [34]. Another novel approach would be to consider a data-driven constraint generation. This might be especially relevant for online applications or analysis in the transmission system. Due to its high accuracy and run-time, this topic is yet to be exploited [35].