Statistics for Modelling, Control, and Planning of Microgrids for Power Quality Assurance