How do microgrids operate as small-scale electrical systems that can operate independently or in conjunction with the main grid? What are the key components of a microgrid, and how do they enable the integration of renewable energy sources, energy storage systems, and smart grid technologies? How do microgrids improve the reliability, resilience, and efficiency of the overall power system?