  Cyber-physical systems such as microgrids consist of interconnected
components, localized power systems, and distributed energy resources with
clearly defined electrical boundaries. They can function independently but can
also work in tandem with the main grid. Power system converters and their
control loops play an essential role in stabilizing grids and interfacing a
microgrid with the main grid. The optimal selection of microgrid components for
installation is expensive. Simulation of microgrids provides a cost-effective
solution. However, when studying the electromagnetic transient response, their
simulation is slow. Furthermore, software packages facilitating electromagnetic
transient response may be prohibitively expensive. This paper presents a faster
method for simulating the electromagnetic transient response of microgrid
components using SystemC-AMS. We present a use case of a photovoltaic
grid-following inverter with a phase-locked loop to track reference active and
reactive power. Our results demonstrate that the simulation performed using
SystemC-AMS is roughly three times faster than the benchmark simulation
conducted using Simulink. Our implementation of a photovoltaic grid-following
inverter equipped with a phase-locked loop for monitoring reference active and
reactive power reveals that the simulation executed using SystemC-AMS is
approximately three times faster than the benchmark simulation carried out
using Simulink. Our implementation adopts a model-based design and produces a
library of components that can be used to construct increasingly complex grid
architectures. Additionally, the C-based nature allows for the integration of
external libraries for added real-time capability and optimization
functionality. We also present a use case for real-time simulation using a DC
microgrid with a constant resistive load.
