  As a critical component of modern infrastructure, data centers account for a
huge amount of power consumption and greenhouse gas emission. This paper
studies the electricity purchase strategy for a data center to lower its energy
cost while integrating local renewable generation under uncertainty. To
facilitate efficient and scalable decision-making, we propose a two-layer
hierarchy where the lower layer consists of the operation of all electrical
equipment in the data center and the upper layer determines the procurement and
dispatch of electricity. At the lower layer, instead of device-level scheduling
in real time, we propose to exploit the inherent flexibility in demand, such as
thermostatically controlled loads and flexible computing tasks, and aggregate
them into virtual batteries. By this means, the upper-layer decision only needs
to take into account these virtual batteries, the size of which is generally
small and independent of the data center scale. We further propose an online
algorithm based on Lyapunov optimization to purchase electricity from the grid
with a manageable energy cost, even though the prices, renewable availability,
and battery specifications are uncertain and dynamic. In particular, we show
that, under mild conditions, our algorithm can achieve bounded loss compared
with the offline optimal cost, while strictly respecting battery operational
constraints. Extensive simulation studies validate the theoretical analysis and
illustrate the tradeoff between optimality and conservativeness.
