A double-step optimization tool for hybrid power generation systems is introduced. Economical aspects and the impact of the system on the environment are considered. A hybrid system comprises PV array-wind turbine-battery-diesel engine is considered. Real time analysis of the system for full year simulation is carried out. System optimum configuration at point where total performance index is maximized.