This document describes the configuration and control of a DSTATCOM (distributed static compensator) using genetic algorithms. A DSTATCOM consists of a voltage source inverter connected to a distribution network via a transformer to regulate voltage and compensate for reactive power. The performance depends on regulating the DC capacitor voltage. Typically a PI controller is used but it does not perfectly regulate the capacitor voltage. This paper applies a genetic algorithm to optimize the PI controller gains in order to improve the dynamic response by reducing disturbances in the DC voltage. The optimized PI coefficients are implemented in the controller and simulations show improved convergence speed and reduction in errors and overshoot.