We consider an interconnected network of consumers powered through an electrical grid of limited capacity. A subset of the consumers are intelligent consumers and have the ability to store energy in a controllable fashion; they can be filled and emptied as desired under power and capacity limitations. We address the problem of maintaining power balance between production and consumption using the intelligent consumers to ensure smooth power consumption from the grid. Further, certain capacity limitations to the links interconnecting the consumers must be honored. In this paper, we show how this problem can be formulated as an optimization problem, leading directly to the design of a model predictive controller. Using this scheme, we are abl...