**3. Graphic user interface (GUI) waveform generator**

The graphic user interface (GUI) "SagWave" (Oranpiroj *et al.,* 2010, Oranpiroj *et al.,* 2011) is designed for easy input of the designed waveform. The user can create sag magnitude, sag duration, phase angle jump and point on wave for a designed sag waveform from the front panel of GUI. Users can verify the desired waveform in time domain or vector form as shown in windows. Then, parameters of desired sag waveform can be sent to dsPIC microcontroller directly from GUI to control voltage sag generator. From the requirement, the SagWage GUI had designed consisted of:


The layout of GUI "SagWave" designed as shown in Fig.2. The SagWave development on MATLAB's Graphical User interface Development Environment (GUIDE)(Patrick Marchand & O. Thomas Holland., 2003).
