Development of an optimization algorithm for the energy management of an industrial Smart User