Regression-based inverter control for power flow and voltage regulation