An optimization model for the provision of flexibility and dispatching resources by multi-vector smart energy districts

. The Clean Energy Package expects a fundamental contribute for the decarbonisation of European energy system from Distributed Energy Resources (DERs), pushing Member States to favour the diffusion of energy production plants for individual and collective self-consumption. At the same time, DERs are required to contribute to system security mainly providing dispatching resources. The model developed includes the possibility to provide real-time balancing flexibility in a generic architecture where different energy vectors can be integrated through energy production, consumption and storage facilities. The optimization problem is built over a weekly time horizon with a stepwise approach where internal and external energy exchanges are defined updating meteorological forecasts, energy demands and markets results while approaching real-time operations. According to the Italian Authority consultation document 322/2019, both energy-only and capacity remunerated services are included in the model. The aim of the model is both to estimate the economic opportunities coming from energy markets participation for smart energy districts in the future energy framework, and to assess the actual capability and reliability of diverse DERs aggregates to provide flexibility to the external electric grid. These evaluations are carried out applying the presented model to a university campus case study where different energy conversion and storage plants are integrated at a Distribution Network level.


Introduction
The Clean Energy Package, and specifically Regulation 2019/943 [1] and Directive 2019/944 [2], started a deep reformation process of electricity markets, driven at EU level by a set of Network Codes (NC) and Guidelines (GL). Among these, CACM (Capacity Allocation and Congestion Management) NC [3] deals with the organization of Day-Ahead and Intraday Markets (DAM-IM) while BM (Balancing Market) NC [4] focuses on the exchange of balancing energy. Transposing these rules into national codes, the Italian Regulatory Authority ARERA issued a consultation document (DCO 322/2019) [5] that defines the intentions and the next regulatory steps that are expected to lead Italy into a new dispatching framework by 2022.
For the purpose of this paper, it is necessary to highlight the main aspects of the aforementioned documents that impact the model presented. First, the reformation process will impact electricity markets timing, bringing financial markets (DAM-IM) closure near to real-time operations; because of this, especially in central dispatch systems such as the Italian one, it is * Corresponding author: filippo.bovera@polimi.it needed a decoupling between the commercial position of markets operators portfolio, and the physical program of units producing and consuming electricity: this allows TSOs to assure the security of power system. In this sense, EU legislation defines two new figures that bridge between units, TSOs and NEMOs: on one hand, the Balance Responsible Party (BRP) is responsible for the respect of injection and withdrawal programs associated to each unit or aggregate of units; on the other hand, the Balance Service Provider (BSP) is responsible for the correct provision of ancillary services. Finally, products exchanged on Ancillary Services and Balancing Markets (ASM-BM) should be harmonised at a EU level: this entails setting the technical requirements for each service, identifying the different kind of units participating to the different electricity markets and defining the commercial tools through which diverse dispatching resources are supplied.
In this context, the paper presents a model focusing on energy districts, a typical Distributed Energy Resources (DER) framework, exploiting the main novelties of Italian and European regulation to introduce flexibility provision in district's operations. Section 2 describes how flexibility has been included in the model, section 3 applies the model to a case study illustrating the results obtained. Finally, conclusions include a lesson-learnt statement and some purposes for future elaborations intending to further develop the model bringing it to real-life workable conditions.

A General Advanced Intelligent Architecture (GAIA)
The General Advanced Intelligent Architecture (from now on GAIA) is a generic, object-oriented frame for the optimization over a weekly, daily or hourly time horizon of the operations of a Smart Multi-vector Energy District (Smart MED).
The operational problem is built over the design problem defined in [6] and models the energy exchanges from the facility manager point of view on a 15 minutes time-step; the main added value of the new model, is the possibility to provide flexibility for the external electric grid under the form of different types of ancillary services. On one hand, a specific set of production, consumption and/or storage technologies can be exploited to offer flexibility on weekly auctions where short term balancing capacity is traded [5]: we refer to them as capacity remuneration based services. One the other hand, when it comes to short and very short term operation programming, GAIA entails the possibility to offer balancing capacity on ASM and BM, considering both the technical limits related to district's energy conversion and storage systems, and the economic opportunity represented by energy markets: we refer to these as energy remuneration based services.
GAIA consists in a three-step optimization frame: − a weekly optimization, where the main target is to determine the optimal value of capacity to be offered (thus potentially reserved) on weekly auctions for capacity remuneration based services; − a daily optimization, that allows to define for each POD the electricity injection or withdrawal program to be presented on DAM, together with the optimal volumes for upward and downward bids on ASM; − an hourly optimization, whose objective is to reschedule the injection/withdrawal program and to set the bids presented on BM, according to the contingencies encountered in real-time operations. The optimization framework is schematically presented in Fig. 1. As it can be seen, part of the outputs of the model can be made available to external actors and help them fulfilling their own tasks. The problem includes a set of constraints related to different technologies operations (e.g., combustion engines, chillers, batteries, boilers) and to their monetary valuation (i.e., electricity and natural gas billing): these aspects are not treated here for the sake of brevity, and it's advisable to refer [6][7] and to future works for a proper discussion on them. The next two subsections illustrate how flexibility is introduced in the model concerning both short-term balancing resources and weekly auction-based capacity remunerated services.

Short-term balancing flexibility
According to the possibility to sell energy on different spot markets, the physical energy injected or withdrawn from the public grid is expressed as the summation of the contributions possibly coming from all energy markets (Eq.1). Subscripts s and t identify a specific POD (belonging to an enabled unit) and a single optimization time interval, respectively.
The electricity withdrawn (E with ) or injected (E inj ) represents the physical net exchange of energy with the external grid; the electricity purchased (E purch ) or sold (E sold ) refers to the volumes of electric energy traded on DAM and IM. The last two terms of Eq.1 represent the energy provided through downward (DW) and upward (UP) balancing calls, respectively, on balancing markets (ASM-BM). Energy markets exchanges are also included in the electricity balance (Eq.2), together with the electricity demand (D EE ), the electricity consumption linked to demand response actions (DR), electrochemical storage charging (P cha ) and other electricity consumption facilities (EE CONS ); moreover, electricity production facilities (EE PROD ) and photovoltaic (PV) contributions are considered, with storage discharging (P dis ).
Considering the presence in Eq.2 of four marketrelated energy basins, in order to avoid the possibility to have illegal mutual feeding between the terms of the electricity balance, EE purch and EE sold are linked by a disjunctive constraint, while DW and UP are subject to ASM and BM acceptance or refusal results. Instead, arbitrages between DAM or IM (EE purch and EE sold ) and ASM or BM (DW and UP) are permitted: however, it is necessary to highlight that, while this practice is fully granted, the level of uncertainty linked to ASM and BM results outweights the price differential with respect to DAM and IM. The fact that this price differential remains high is an evidence of how arbitrage between these markets remains difficult to perform.
Following Eq.1, it is possible to have different scenarios of energy exchange with the external network: these involve diverse energy volumes associated to different energy markets, taking care also of the temporal sequence in which markets are operated. Figure 2(a-b) provides two examples where upward balancing flexibility is provided. In case (a), the initial (DAM) program foresees an injection, that increases because of an upward dispatching call, defining the final physical injection; vice versa, in case (c), the initial program is instead characterised by a withdrawal of energy that is decreased through an upward ASM call. It is worth noticing that selling energy on DAM (or even on IM) does not prevent from withdrawing it in realtime, if downward flexibility is activated in the meantime; similarly, it is possible to have a real-time power injection even if energy was initially purchased on DAM or IM. These enables GAIA to catch and exploit all the economic opportunities coming from electricity markets, modifying the internal and external energy exchanges depending on the economic opportunities expressed through prices appearing on different energy markets.

Intraday Market (IM) trading and physical imbalance
As stated in DCO 322/2019 [5], to cope with EU Directives and Regulations while keeping a proper degree of predictability and security in power system operations, each market operator will be able to change the commercial position of its portfolio up to one hour before the energy delivery time.
Regarding this, only for the hourly optimization problem (see Fig. 1), the model foresees the possibility to change the physical program associated to each POD; since this occurs when it is no more possible to change the commercial position of the POD, a penalty is considered to perform the former action, hence supposing that the economic burden of rescheduling energy flows near the real time is shifted from the market operator (generally coinciding with the BRP) to the facility manager, who runs the hourly optimization. In order to do so, the optimised valued for EE purch and EE sold resulting from the daily optimisation is introduced as a parameter in the hourly problem as: − EE purch,ref : the expected reference purchased energy after the DAM+IM trading, associated to each specific POD; − EE sold,ref : the expected, reference sold energy after the DAM+IM trading associated, to each specific POD.
After the DAM and the ASM (which is also known as the integrated scheduling phase of ancillary markets), up to one hour before the energy delivery, each BRP can change its commercial position in the Intraday Market (IM), hence changing the volume of energy purchased or sold; once a BRP position is defined, a specific (binding) program is associated to each POD. Eq.3 defines the physical imbalance (Imb) as the difference between the reference value of traded energy (the binding program of the POD) and the newly defined value when (and if) the facility manager decides to reschedule energy flows near real-time, when it is not possible to further communicate these changes to the BRP. The apex kW for Imb indicates that it is evaluated as the mean value over the optimisation time interval, that should be converted in kWh when computing the imbalance fee. The imbalance can be positive or negative, and depending on its value, an imbalance fee is calculated. This is expressed in Eq.4(a-c), where the imbalances prices are parameters depending on the zonal imbalance sign for the time interval considered. The imbalance fee entails a revenue in the case of a positive imbalance, and a cost in case of a negative one. Finally, in certain time intervals, it is possible that bids presented on the ASM have been accepted by the TSO; moreover, also bids presented on BM could be accepted in real-time, in upward or downward direction. Since in GAIA no dispatching order disrespect is allowed, Eq.5(a-b) is introduced to limit the possibility to perform an imbalance only in one direction: if any downward call from ASM or BM is active, only negative imbalance is allowed, while if an upward correction is requested, only positive imbalance is allowed. The procedure that brings to the definition of the final program is presented schematically in Fig. 3, where case (a) of Fig. 2 is resumed.
For a specific POD, the injection program is initially defined by the DAM energy sold; this program is then modified by the TSO when an upward reserve provision is requested on the ASM (scheduling phase), and then it is set to its final value by the BRP in the IM: at this point a modified and binding program, which must be respected and is valid for the calculation of physical imbalances, is assigned to the POD. During real-time, the program can be further corrected by BM calls, defining the final binding, modified and corrected program. With respect to it, the facility manager can decide to perform a physical imbalance that, in GAIA, is allowed only in a concordant direction with respect to possible TSO calls: in the example, hence, no negative imbalance is allowed.

Weekly balancing capacity retention
According to the possible future evolution of ancillary services regulation in Italy, the provision of fast response, frequency regulation dispatching resources will be based on weekly auctions for balancing capacity provision. When formulating the weekly problem to define the optimal level of Capacity Retention (CR) for these auctions, (together with dispatchable systems operations), it is necessary to consider: − the forecasts in every time interval of intermittent generation resources and of consumption profiles; − the feasible variability with respect to the estimated level of power generated, consumed or stored by each facility able to deliver the required services; − for limited energy content facilities (i.e., storages), the maximum power band which can be retained given the current energy level in the storage and the minimum time availability that must be granted for each ancillary service; − the time periods along the week in which balancing capacity should be available, potentially depending on the type of dispatching resource provided.
Considering Battery Energy Storage Systems (BESS), it is necessary to correlate the maximum charging and discharging power available in each time interval with the Capability Curve (CC). To do this, a look-up table approach, inspired by the work in [7], is followed, where the charging and discharging CCs are modelled by a convex envelope. In each time interval the State of Charge (SoC) of the BESS is used to determine which piece(s) of the look-up table representing the CC is to be activated; hence, it is possible to derive a maximum level of charging and discharging power that can be delivered. Eq.6(a-f) presents the constraints implementing this approach, where b refers to CCs breakpoints, f represents a specific storage unit and τ indicates the time intervals in which balancing capacity should be ensured, being τ a subset of t.
Once maximum power levels have been defined, BESS-related CR level can vary according to the maximum charging and discharging powers previously calculated, and the forecasted power level associated to BESS operations. Fig. 4(a-b) provides a graphical representation of how BESS-related CR is evaluated; the same concept is expressed by Eq.7(a-f) for both upward and downward CR computation.  As stated above, since BESS are limited energy reservoirs, it is necessary to limit the CR level in order to ensure the possibility to provide the requested power for the minimum required time: this means that a minimum energy content should be chargeable or dischargeable from the BESS. Constraint Eq.8(a-b) binds the CR-associated power level to be no greater than the one that could drive the battery to be full or empty. Beside BESS, also some electricity production and consumption technologies could be useful to provide capacity-remunerated services. In this case, while there are no problems related to energy content limits, it is still necessary to consider the maximum and minimum power that different facilities are able to bear. Following the approach used in [6], maximum and minimum power level that are associated to electricity production and consumption facilities are calculated; in this case, both maximum and minimum power are set to zero when a plant is off during the specific time interval: this reflects the necessity that a plant is ready when the frequency regulation signal is received, hence start-up time cannot be considered negligible.
Having set maximum and minimum loads, it is possible to calculate the CR level both for upward and downward reserve provision. Fig. 5 presents in a graphical form how facilities-related CR is evaluated, while Eq.10(a-b) provides its mathematical formulation.

Case study and results
The purpose of this section is to illustrate the application of the presented model to a real-life application. In particular, the considered case study consists in a university campus with an internal electricity distribution network composed by 8 MV/LV substation for a peak electric load of 3.5 MW and a district heating network with 22 heat exchange stations for a maximum heat load around 8 MW; simulation considers a weekly horizon in the winter season. The purpose is to determine the influence of balancing capacity auction over the optimal operations of the Smart MED. Table 1 shows the energy assets present in the Smart MED considered, specifying the conversion technology, the nominal size and the input-output energy carriers. Performance maps for each technology take care of technical limits such as: ramping time, start-up gradient, minimum up time requirement, partial load efficiencies, power charging/discharging limitations. While the first four technologies are present in the district by default, BESS is added afterwards to see its influence on the district operations.  Fig. 6(a) shows the weekly Smart MED optimal scheduling when no balancing capacity payment is foreseen: it is possible to see the tendency to push as much as possible self-consumption of both heat and electricity production from the CHP plant. However, if a balancing capacity auction with a premium equal to 20 k€/MW el for upward CR is simulated, scheduling is the one shown in Fig. 6(b): it is possible to see that, during the time period where CR is required (set τ of the above problem), withdrawal from the public grid is increased, reducing ICE's electricity production and leaving the space for upward capacity regulation. As said, a further step consists in installing a BESS: Fig. 6(c) shows the optimal weekly operations under this framework assumption, always considering the opportunity represented by the CR payment. Considering the three configurations described, the total weekly cost for Smart MED operations resulting from the optimization model is: 60 k€ for case (a), 36 k€ for case (b) and 31 k€ for case (c). This highlights that a balancing capacity remuneration can push economic performances of a Smart MED, and that the presence of a BESS can be useful to optimise the provision of this service.

Conclusions
The model developed shows an effective way to include balancing markets participation in the optimization of the operations for an energy district. This possibility is expected to become fundamental in the future, where a high level of not programmable resources penetration will require that also DER participate to the electric power system balancing. Future work will deal with a twofold purpose. On one hand the proposed model should be equipped with an ad hoc tool to evaluate electricity market's uncertainty, hence developing a stochastic approach that could take care of the peculiarities of ASM functioning. On the other hand, the model should include the possibility to present different types of market offers, such as block bids or minimum income conditions offers: these kinds of bids, currently used in EPEX, North Pool and OMNIE platforms, could potentially show better results in terms of facility management.