Mathematical modelling of an inverter-based distributed generator