A comprehensive model for the optimal design and management of Distributed Generation systems