how to calculate maximum demand