# Dynamic Energy Management

## Abstract

We present a unified method, based on convex optimization, for managing the power produced and consumed by a network of devices over time. We start with the simple setting of optimizing power flows in a static network, and then proceed to the case of optimizing dynamic power flows, i.e., power flows that change with time over a horizon. We leverage this to develop a real-time control strategy, model predictive control, which at each time step solves a dynamic power flow optimization problem, using forecasts of future quantities such as demands, capacities, or prices, to choose the current power flow values. Finally, we consider a useful extension of model predictive control that explicitly accounts for uncertainty in the forecasts. We mirror our framework with an object-oriented software implementation, an open-source Python library for planning and controlling power flows at any scale. We demonstrate our method with various examples. Appendices give more detail about the package, and describe some basic but very effective methods for constructing forecasts from historical data.

## Notes

### Acknowledgements

This research was partly supported by MISO energy; we especially thank Alan Hoyt and DeWayne Johnsonbaugh of MISO for many useful discussions.

## References

- 1.R. Baldick.
*Applied Optimization: Formulation and Algorithms for Engineering Systems*. Cambridge University Press, 2006.CrossRefGoogle Scholar - 2.A. Bemporad. Model predictive control design: New trends and tools. In
*45th IEEE Conference on Decision and Control*, pages 6678–6683. IEEE, 2006.Google Scholar - 3.D. Bertsekas.
*Nonlinear Programming*. Athena Scientific, 3rd edition, 2016.Google Scholar - 4.S. Boyd, E. Busseti, S. Diamond, R. Kahn, K. Koh, P. Nystrup, and J. Speth. Multi-period trading via convex optimization.
*Foundations and Trends in Optimization*, 3(1):1–76, August 2017.CrossRefGoogle Scholar - 5.S. Boyd and L. Vandenberghe.
*Convex Optimization*. Cambridge University Press, 2004.CrossRefGoogle Scholar - 6.S. Boyd and L. Vandenberghe.
*Introduction to Applied Linear Algebra – Vectors, Matrices, and Least Squares*. Cambridge University Press, 2018.zbMATHGoogle Scholar - 7.M. Cain, R. O’Neill, and A. Castillo. History of optimal power flow and formulations.
*Federal Energy Regulatory Commission*, pages 1–36, 2012.Google Scholar - 8.J. Carpentier. Contribution à l’étude du dispatching économique.
*Bulletin de la Société Française des Electriciens*, 3:431–447, 1962.Google Scholar - 9.F. Clarke. Generalized gradients and applications.
*Transactions of the American Mathematical Society*, 205:247–262, 1975.MathSciNetCrossRefGoogle Scholar - 10.G. Davison. Dividing load between units.
*Electrical World*, 80(26):1385–1387, 1922.Google Scholar - 11.S. Diamond and S. Boyd. CVXPY: A Python-embedded modeling language for convex optimization.
*Journal of Machine Learning Research*, 17(83):1–5, 2016.MathSciNetzbMATHGoogle Scholar - 12.J. Friedman, T. Hastie, and R. Tibshirani.
*The Elements of Statistical Learning*. Springer, 2nd edition, 2008.Google Scholar - 13.A. Fu, B. Narasimhan, and S. Boyd. CVXR: An R package for disciplined convex optimization. https://web.stanford.edu/~boyd/papers/cvxr_paper.html, 2017.
- 14.M. Grant and S. Boyd. Graph implementations for nonsmooth convex programs. In V. Blondel, S. Boyd, and H. Kimura, editors,
*Recent Advances in Learning and Control*, Lecture Notes in Control and Information Sciences, pages 95–110. Springer-Verlag Limited, 2008. http://stanford.edu/~boyd/graph_dcp.html. - 15.M. Grant and S. Boyd. CVX: Matlab software for disciplined convex programming, version 2.1. http://cvxr.com/cvx, March 2014.
- 16.H. Happ. Optimal power dispatch – A comprehensive survey.
*IEEE Transactions on Power Apparatus and Systems*, 96(3):841–854, 1977.CrossRefGoogle Scholar - 17.C. Harris.
*Electricity Markets: Pricing, Structures and Economics*. John Wiley & Sons, 2006.CrossRefGoogle Scholar - 18.M. Kraning, E. Chu, J. Lavaei, and S. Boyd. Dynamic network energy management via proximal message passing.
*Foundations and Trends in Optimization*, 1(2):73–126, 2014.CrossRefGoogle Scholar - 19.J. Lavaei and S. Low. Zero duality gap in optimal power flow problem.
*IEEE Transactions on Power Systems*, 27(1):92–107, 2012.CrossRefGoogle Scholar - 20.W. Liu, J. Zhan, and C. Chung. A novel transactive energy control mechanism for collaborative networked microgrids.
*IEEE Transactions on Power Systems*, early access, 2018.Google Scholar - 21.J. Löfberg. YALMIP: A toolbox for modeling and optimization in MATLAB. In
*Proceedings of the IEEE International Symposium on Computer Aided Control Systems Design*, pages 284–289, 2004.Google Scholar - 22.S. Long, O. Marjanovic, and A. Parisio. Generalised control–oriented modelling framework for multi–energy systems.
*Applied Energy*, 235:320–331, 2019.CrossRefGoogle Scholar - 23.D. Luenberger.
*Microeconomic Theory*. McGraw-Hill College, 1995.Google Scholar - 24.T. Ma, J. Wu, L. Hao, H. Yan, and D. Li. A real–time pricing scheme for energy management in integrated energy systems: A Stackelberg game approach.
*Energies*, 11(10):2858, 2018.CrossRefGoogle Scholar - 25.J. Mattingley, Y. Wang, and S. Boyd. Receding horizon control: Automatic generation of high-speed solvers.
*IEEE Control Systems Magazine*, 31(3):52–65, June 2011.MathSciNetCrossRefGoogle Scholar - 26.E. Munsing, J. Mather, and S. Moura. Blockchains for decentralized optimization of energy resources in microgrid networks. Available at https://escholarship.org/uc/item/80g5s6df, 2017.
- 27.N. Padhy. Unit commitment – A bibliographical survey.
*IEEE Transactions on power systems*, 19(2):1196–1205, 2004.CrossRefGoogle Scholar - 28.A. Papavasiliou. Analysis of distribution locational marginal prices.
*IEEE Transactions on Smart Grid*, 2017.Google Scholar - 29.T. Rockafellar.
*Convex Analysis*. Princeton University Press, 1997.zbMATHGoogle Scholar - 30.F. Schweppe, M. Caramanis, R. Tabors, and R. Bohn.
*Spot Pricing of Electricity*. Kluwer Academic Publishers, 1988.CrossRefGoogle Scholar - 31.R. Shumway and D. Stoffer.
*Time Series Analysis and its Applications*. Springer, 4th edition, 2017.Google Scholar - 32.M. Steinberg and T. Smith.
*Economy Loading of Power Plants and Electric Systems*. J. Wiley & Sons, Inc., 1943.Google Scholar - 33.J. Taylor.
*Convex Optimization of Power Systems*. Cambridge University Press, 2015.CrossRefGoogle Scholar - 34.M. Udell, K. Mohan, D. Zeng, J. Hong, S. Diamond, and S. Boyd. Convex optimization in Julia.
*SC14 Workshop on High Performance Technical Computing in Dynamic Languages*, 2014.Google Scholar - 35.W. Wood and B. Wollenberg.
*Power Generation, Operation, and Control*. John Wiley & Sons, 2012.Google Scholar