This paper presents a dynamic analysis of a double-source air-conditioning system, aiming at optimally combining, from the economic point of view, the use of the air and the soil as heat source/sink for a heat pump. The energy model is developed in TRNSYS environment, where a novel component, named Type, for the modelling of the heat pump is adopted. The purpose of the analysis is to investigate the performances of the optimized system, obtained by varying the switching temperature and the sizes of the borehole field and the storage tank, for the climate conditions of two different localities, Helsinki and Athens.