Given the increasing penetration of photovoltaic and battery-powered systems in macro and microgrids, efficient and reliable modelling of the inverters for studying the stability of such systems is paramount. In the current academia standard, generic inverter models, which do not coherently represent inverter behavior nor consider inverter topology and filter, are used - undermining the presented results. This paper presents a thorough and comprehensive per-unit modelling of inverter systems based on a strong mathematical foundation. This modelling is compatible with Equivalent Phasor techniques, generally used for synchronous machines, which allow simulation and study of stability of mixed systems where both technologies are present.