This paper examines the perspective of developing a model for a microgrid to optimize the utilization of local clean energy sources for a grid-connected. The suggested model for a microgrid includes clean energy sources employing wind turbines and photovoltaic (PV) systems and diesel generators, the grid. This model is examined with HOMER software. The capacity of the suggested micro-grid model is simulated according to the load profiles and the accessibility of the resources. The basic objectives of energy management are to reduce costs and reduce harmful emissions. The microgrid model with the greatest capacity produced the lowest energy costs, depending on the simulation results, the most significant reduction in CO2 emissions, and the greatest percentage of renewable energy.