Algorithms and devices for the dynamical reconfiguration of PV arrays