The paper investigates the performance of a combined heat and power system by means of a fully dynamic numerical approach. An ad-hoc library for the simulation of energy conversion systems is developed under the OpenModelica open source platform; the library includes the main components that usually equip a Combined Heat and Power (CHP) system and they can be connected as they are logically connected in the real plant. Each component is modelled by means of equations and correlations that calculate their performance on a time dependent basis. Therefore, many configurations can be evaluated not only in terms of cumulative annual results or average performance, but the instantaneous behavior can be investigated. The numerical library is constructed using the lumped and distributed parameter approach and it is validated by comparing the numerical results with the measured values over a one-year time period. The prediction capabilities of the proposed numerical approach are evaluated by simulating a case study of a health spa. This case study is selected since it is characterized by significant requirements of both thermal and electric energy. The comparison demonstrated that the calculated results are in good agreement with the measurements in terms of both annual values and distribution over the reference period.
Furthermore, an optimization algorithm is adopted and linked to the developed library in order to estimate the best size of different components of the CHP system according to a number of constraints. This feature is particularly important when addressing the energy efficiency of a complete system that is depending on a number of interdependent variables. Therefore, the case study is investigated by accounting also for additional technologies that can be further enhance the performance of the system both in terms of energy consumption and economic investment. In particular, the numerical model is used to optimized the CHP energy efficiency by estimating the best trade-off between the reduction of the energy purchased and the overall cost of the system. The application of PV panels and electric energy accumulators is also investigated and the simulation demonstrates that the size of the cogeneration unit equal to 48 kW, the number of PV panels of 299 and the battery capacity of 45 kWh provide the lowest amount of energy purchased, while the best return of investment is obtained by the CHP unit of 40 kW along with 109 PV panels and a battery of 40 kWh.