The optimal design and operation of an energy supply system is very important for the matching of the energy production and consumption especially in the residential-tertiary sector characterized by an energy demand with a high variability. The main objective of this thesis is to develop an optimisation environment for the preliminary design and analysis of polygeneration plants. The optimisation models are organized in different units represented by blocks that can be connected between each other to create the flowsheet of the polygeneration system. To characterize the energy demand in the residential and tertiary sector a graphic methodology has been developed to select typical energy demand days from a yearly energy demand profile. The environment developed has been applied to two case studies: a small scale polygeneration plant using a liquid desiccant system for air conditioning and a polygeneration plant connected to a district heating and cooling network