  This paper describes a two-layer control and coordination framework for
distributed energy resources. The lower layer is a real-time model predictive
control (MPC) executed at 10 s resolution to achieve fine tuning of a given
energy set-point. The upper layer is a slower MPC coordination mechanism based
on distributed optimization, and solved with the alternating direction method
of multipliers (ADMM) at 5 minutes resolution. It is needed to coordinate the
power flow among the controllable resources such that enough power is available
in real-time to achieve a pre-established energy trajectory in the long term.
Although the formulation is generic, it is developed for the case of a battery
system and a curtailable PV facility to dispatch stochastic prosumption
according to a trajectory at 5 minutes resolution established the day before
the operation. The proposed method is experimentally validated in a real-life
setup to dispatch the operation of a building with rooftop PV generation (i.e.,
101 kW average load, 350 kW peak demand, 82 kW peak PV generation) by
controlling a 560 kWh/720 kVA battery and a 13 kW peak curtailable PV facility.
