Combined heat and power system (CHP) with renewable energy generation, which operates with high efficiency and low costs, is an important form of microgrid. This paper deals with the problem of economic operation of cogeneration system including wind energy, PV, heat recovery boiler and battery. On the basis of predicting the next 24-hours' wind energy and PV power, power and heat demand, a nonlinear optimal model is built to deal with the economic operation of available power resources and formulate the 24-hours' work schedule. Besides, this paper focuses on the effect of battery and peak-valley electricity price on system operation costs. Four different cases with a test CHP system are compared. Test results indicate that peak-valley electricity price would increase the system operating costs, while using battery and peak load shifting can effectively reduce operating costs.Index Terms-Combined Heat and Power (CHP) system, renewable energy, economic operation, peak-valley electricity price, microgrid, smart grid