In recent years, due to lack of sufficient quantity of fossil fuel, the need of Renewable Energy Sources (RESs) has become an important matter. In addition to the shortage of fossil fuel, global warming is another concern for many countries and companies. These issues have caused a large number of RESs to be added into modern distribution systems. Nevertheless, the high penetration of RESs beside the intermittent nature of some resources such as Wind Turbines (WT) and Photovoltaic (PV) cause the variable generation and uncertainty in power system. Under this condition, an idea to solve problems due to the variable outputs of these resources is to aggregate them together. A collection of Distributed Generators (DGs), Energy Storage Systems (ESSs) and controllable loads that are aggregated and then are managed by an Energy Management System (EMS) which is called Virtual Power Plant (VPP). The objective of the VPP in this paper is to minimize the total operating cost, considering energy loss cost in a 24 h time interval. To solve the problem, Imperialist Competitive Algorithm (ICA), a meta-heuristic optimization algorithm is proposed to determine optimal energy management of a VPP with RESs, Battery Energy Storage (BSS) and load control in a case study.