  The conventional approach for the control of distribution networks, in the
presence of active generation and/or controllable loads and storage, involves a
combination of both frequency and voltage regulation at different time scales.
With the increased penetration of stochastic resources, distributed generation
and demand response, this approach shows severe limitations in both the optimal
and feasible operation of these networks, as well as in the aggregation of the
network resources for upper-layer power systems. An alternative approach is to
directly control the targeted grid by defining explicit and real-time setpoints
for active/reactive power absorptions/injections defined by a solution of a
specific optimization problem; but this quickly becomes intractable when
systems get large or diverse. In this paper, we address this problem and
propose a method for the explicit control of the grid status, based on a common
abstract model characterized by the main property of being composable. That is
to say, subsystems can be aggregated into virtual devices that hide their
internal complexity. Thus the proposed method can easily cope with systems of
any size or complexity. The framework is presented in this Part I, whilst in
Part II we illustrate its application to a CIGR\'E low voltage benchmark
microgrid. In particular, we provide implementation examples with respect to
typical devices connected to distribution networks and evaluate of the
performance and benefits of the proposed control framework.
