Optimal Planning and Operation of Transmission and Distribution Networks With a High Share of RES