Planning and operation of active smart grids