Modelling and optimization of polygeneration energy systems