A Modular Optimal Power Flow Method for Integrating New Technologies in Distribution Grids