## 6 Control Capabilities and Ancillary Services  
The main functions of the DER-AC are to: (i) ensure the monitoring of all the supervised DERs of the VPP, (ii) implement the control schedules and the power constraints set by the EMS, and (iii) provide ancillary services to the DSO or to IOs. While the DER monitoring and communication capabilities are presented in Section 4, the control capabilities and ancillary services provided by the DER-AC are discussed in the following.  
The above-mentioned control capabilities are discussed by referring to the schematic diagram depicted in Figure 7. This diagram represents the simplified control architecture of the VPP system (i.e., the hierarchical control architecture among the DER-AC and the supervised DERs) in case of a system with a PV generator and a battery storage unit. The power flow measurements in Figure 7 are reported according to the nomenclature defined in the IEC 61724 standard [52], where: \(P\) and \(Q\) represent, respectively, active and reactive power flows, PV is referred to the power production of the photovoltaic plant, TU and FU represent the power flows measured at a user's POD (respectively fed to the utility and taken from the utility), TS and FS are the power flows measured by the BESS controller (respectively fed to the battery and taken from the battery), and L represents the aggregated power consumption of loads.  
The DER-AC can operate in two different modes, namely: the normal operating mode and the emergency operating mode. During the normal operating mode, the DER-AC implements the management decisions of the EMS, while in the emergency mode (i.e., when emergency signals are sent by the DSO/IO-DMS), the control signals provided by the EMS are discarded, and the DER-AC takes the control of the supervised DERs to match the requirements of the DSO/IO by implementing active and reactive power control algorithms.  
Figure 7: Simplified architecture of the DER Automated Controller. BESS: Battery Energy Storage System; BMS: Battery Management System; DC: direct current; EMS: Energy Management System.  
During the normal operating mode, the DER-AC operates according to the requirements of the EMS unit. In the case of the system described in Figure 7, where a single programmable DER is considered (i.e., the BESS unit), the scheduled active power profiles of the BESS unit (\(P_{\text{BESS}}\)) are provided by the EMS and forwarded by the DER-AC to the BESS control unit (the BESS Controller in Figure 7), which, in turn, is responsible for the low-level control of the Battery Management System (BMS) and of its related inverter. If Incentive-Based DRs have been accepted by the EMS optimization process, active power limitation constraints are also provided to the DER-AC to ensure that, in case of unexpected behavior of the PV generator during the time period specified by the DR request, the required constraints can be accomplished. In this case, the DER-AC implements the control of the charge and discharge active power of the battery unit, with priority against the power set-points defined by the BESS schedules, to ensure that the power flows measured at the user's POD would not exceed the limits defined in the DR request.  
If emergency signals are sent by the DSO or by IOs, the management decisions of the EMS are discarded and the DER-AC takes full control of the supervised DERs by providing active and reactive control functions to meet the desired requirements set by the DSO/IO-DMS. The active and reactive power set-points of both the BESS unit and the PV inverter are computed by the DER-AC according to DSO/IO-DMS requests. In particular, in case the amount of power fed to the grid exceeds the constraints set by the DSO/IO-DMS, and the BESS unit is not able to store the excess of power (i.e., the BESS unit has reached its maximum storage capacity), the output power produced by the PV system is reduced by off-tracking the maximum power point voltage of the PV strings.