We present an electrical grid optimization method for economical benefit. After simplifying an IEEE feeder diagram, we build a compact smart grid system including a photovoltaic-inverter system, a shunt capacitor, an On-Load Tap- Changer U+0028 OLTC U+0029 and transmission lines. The system Power Factor U+0028 PF U+0029 regulation and reactive power dispatching is indispensable to improve power quality. Our control method uses predictive weather and load data to decide engaging or tripping the shunt capacitor, or reactive power injection by the photovoltaic-inverter system, ultimately to keep the system PF in a good range. From the perspective of economics, the economical model is considered as a decision maker in our predictive data control method. Capacitor-only control strategy is a common photovoltaic U+0028 PV U+0029 regulation method, which is treated as a baseline case. Simulation with GridLAB-D on profiled loads and residential loads have been carried out. The comparison results with baseline control strategy and our predictive data control method show the appreciable economical benefit of our method.