A study on forecasting electricity production and consumption in smart cities and factories