A computational algorithm for multilevel control of system voltage and reactive power