The energy management of virtual power plants faces some fundamental challenges that make it complicated compared to conventional power plants, such as uncertainty in production, consumption, energy price, and availability of network components. Continuous monitoring and scaling of network gain status, using smart grids provides valuable instantaneous information about network conditions such as production, consumption, power lines, and network availability. Therefore, by creating a bidirectional communication between the energy management system and the grid users such as producers or energy applicants, it will afford a suitable platform to develop more efficient vector of the virtual power plant. The paper is treated with optimal sizing of DG units and the price of their electricity sales to achieve security issues and other technical considerations in the system. The ultimate goal in this study to determine the active demand power required to increase system loading capability and to withstand disturbances. The effect of different types of DG units in simulations is considered and then the efficiency of each equipment such as converters, wind turbines, electrolyzers, etc., is achieved to minimize the total operation cost and losses, improve voltage profiles, and address other security issues and reliability. The simulations are done in three cases and compared with HOMER software to validate the ability of proposed model. Energy management is a common and widely spread concept, including all measures that are planned and implemented to ensure the minimum amount of energy consumed in different activities. Trading, industries, and organizations have found themselves under high economic and environmental pressure in the last two decades to minimize their consumptions. Economic competition in the world market (especially the electricity market) and increasing the state of environmental regulations and standards in order to reduce climate pollutants are the most important factors in investment costs and exploitation of all organizations [3]. Actually, energy management is an important instrument in assisting various institutions to reduce their costs in order to meet these essential goals to survive and succeed in long term. The energy management of the VPPs faces challenges that make it complicated. These challenges include uncertainty in production, consumption, energy prices, and availability of network components. The smart grid increases the ability of the energy management system in the fields of overcoming uncertainties, aggregation of renewable sources, load responsiveness, monitoring, and network control [4,5].In [6], a pricing model for the electricity market of the previous day and the regulated market are proposed to maximize the expected profits of the VPP utilization, while the pricing problem is modeled as a two-stage stochastic program. In [7], a two-stage refinement optimization strategy has been proposed for pricing the VPP in day ahead and real time. The practicality of the decisions made and the...