Electrical microgrids are deemed to be the future of modern power systems. Microgrids are sophisticated, decentralized, and self-sufficient small-scale power systems consisting of various resources ranging from wind turbines, solar photovoltaics, electric vehicles, smart energy storage, and complex communication infrastructure. However, renewable energy sources such as solar photovoltaics and wind-based generators are highly intermittent, and if not appropriately planned, they can compromise the stability of the grid. Formal methods can define and analyze the functionality and behavior of any system and show if the system design is correct before the actual system is implemented. Although formal methods have been around for many years, it is surprising that little to none are utilized in the design of safety-critical electrical power systems. Currently, in modeling microgrids, few to no attempts of formalization are being used to improve the design reliability and reduce system operating costs and time. This work demonstrates how complex systems such as microgrids can be modeled elegantly using a formal specification method. In this work, the Z state-based formal specification language (Z-Method) is used to model and verify microgrid designs. In this work, 3-interconnected microgrid systems with a high penetration level of solar and wind-based renewable energy sources with plugin hybrid electric vehicles (PHEV) as battery energy storage systems (BESS) are modeled using the Z-method. To the best of authors, the knowledge presented formal method is one of the first reported attempts in modeling microgrid communities using Software Engineering formalism.