"This paper optimizes cogeneration of a hydro-thermal-wind-solar system. In the proposed hybrid system, the energy storage systems are also incorporated to smooth out the fluctuations of renewable energies. The uncertainties of wind and solar powers are included, and stochastic programming is adopted to deal with the uncertainties. The hydro system comprises two cascade reservoirs. The optimal scheduling of both reservoirs is presented, and the electricity generated by each reservoir is optimized. The optimal scheduling of thermal unit is also determined. The optimal location, capacity, power, and charging-discharging pattern are determined for battery energy storage systems. The simulations are carried out using an IEEE 69-bus distribution network, and the model is implemented in GAMS software and solved as a mixed integer linear programming. The objective of the problem is to minimize energy cost in the network. The results demonstrate that the proposed stochastic model can successfully optimize cogeneration of hydro-thermal- wind-solar system. The planning moreover optimally utilizes energy storage systems for damping the fluctuations of renewable energies and minimizing energy cost."