AN OPTIMAL POWER FLOW ALGORITHM FOR THE SIMULATION OF ENERGY STORAGE