  This paper presents a novel framework for collective control of Distributed
Energy Resources (DERs) in active Distribution Networks (DNs). The proposed
approach unifies the commonly employed local (i.e., decentralized) voltage and
frequency droop control schemes into a transfer matrix relating frequency and
voltage magnitude measurements to active and reactive power injection
adjustments. Furthermore, the transfer matrices of individual DER units are
adaptively tuned in real-time via slow communication links using a novel online
gain scheduling approach to enable primary frequency support provision to the
transmission system and ensure that the DN voltages are kept within the
allowable limits. A global asymptomatic stability condition of the analyzed
droop-controlled DN is analytically established. The considered gain scheduling
problem is solved by leveraging an online primal-dual gradient-based method and
a suitable linearized power flow model. Additional ancillary service providers
can be trivially incorporated into the proposed framework in a plug-and-play
fashion. Numerical simulations of the 37-bus IEEE test system and a realistic
Swedish 533-bus DN confirm the validity and the scalability of the approach and
demonstrate numerous advantages of the proposed scheme over the
state-of-the-art.
