Statistics for Metering and adaptive protection for a microgrid with distributed generation