This study designs a hybrid micro turbine-photovoltaic generation system, using DC/AC converters to supply electric power and heat energy of urban buildings. In order to minimize costs the study has to take into account as dependent variables the investment costs the hybrid system, environmental pollutants, peakload reduction{paykzedaie} and buying and selling of electricity from and to the national grid. In view of the large number of variables and the complexityof the objective function, we use Particle Swarm Optimization (PSO) algorithm to solve the optimization problem. The hybrid system has 100 variables which relate to the definition of optimal capacity of micro-turbines, photovoltaic panels, inverters, and installation angles of photovoltaic panels and how to optimize the productivity of the system over 24 hours in different seasons. The optimalization problem is solved using software developed using the MATLAB programming context. The results show that for a hospital with a peak electricity load of 340 kws and energy load of 870 kW, so long as the rate applied for electricity and peak load reduction( the subsidy paid by the government for each KW os hybrid system) is above $1000 per KW, the project will have a total return of $64,361 over its lifetime. The optimal capacity of micro-turbines and inverters to be used are respectively 349 and 315 kW.