A modular and flexible network architecture for smart grids