Development of an optimization algorithm for the energy management of an industrial Smart User. (15th December 2017)