Modelling and optimization of a local smart grid for an agro-industrial site