Microgrids offer localized, resilient energy solutions, contrasting centralized grids with enhanced sustainability and efficiency. Microgrids are localised network of energy loads and distributed energy resources, such as solar panels, wind turbines, and battery storage systems, that can operate independently or in conjunction with the main power grid. This electricity is then transmitted over long distances through the grid to end-users. Here, we extend REopt— a techno-economic optimization model developed at the National Renewable Energy Laboratory—to consider both within a.