**3.1. The window for showing the 3-phase voltage**

114 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

inverter which is controlled by low-cost dsPIC.

the SagWage GUI had designed consisted of:

1. The window for showing the 3-phase voltage. 2. The window for showing vector of A, B and C phase.

6. Display normal or repeat mode of voltage sag.

8. Sag duration time for period time of voltage sag.

10. The button "Plot" for generated the voltage sag waveform.

12. The button "Refresh" for clear the value and graphic display.

7. Point on wave in degree.

& O. Thomas Holland., 2003).

9. Number of repeat of voltage sag.

4. Phase angle jump of voltage sag on A, B or C phase.

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

complex structure and requires control of signal processors. The TCR type creates a difference in voltage by firing the TCR at different angles. The disadvantages of TCR are the generation of low frequency harmonic current components and higher losses when working in the inductive region (Teke *et al.,* 2008). The generator type uses a synchronous generator that provides voltage sag by changing the exciting current of the generator. The control of sag generator's operation and monitoring of the system under test in performed by the Visual Basic programming (Collins and Morgan, 1996). The software of this paper had not displayed the waveform of voltage sag and disadvantages of this type are that it needs more space to install and is more expensive (Ma & Karady, 2008). The amplifier type can provide voltage sags with varying magnitude, duration, frequency and harmonics. After defining the desired waveform data is passed to power amplifier, at which outputs of adequate voltage levels of voltage sag are produced. This type is more convenient than others types, because it enables more precise control of all voltage sag characteristics and also allows testing of equipment in context of frequency variations and harmonic distortions. Therefore, a power amplifier type of voltage sag generator is selected for designing the voltage sag generator in this study. This chapter presents a 3-phase 4-wire voltage sag generator based on an *abc* algorithm((Oranpiroj *et al.,* 2009). Voltage sag generator has been created waveform by SagWave software. The actual voltage sag is created by the 3-phase 4-wire

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,

3. Magnitude of Voltage (A, B and C phase), user had used value box or slider bar.

11. The button "Send" for send the data from SagWave to the dsPIC microcontroller.

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

5. Sag type for selected the voltage sag type (single-phase, two-phase and three-phase).

This is an "Axes" object in component palette ( ) on the left-side of window. The "Axes" can move and resize by drag it with the mouse. This "Axes" to shown the 3-phase voltage of voltage sag, then we assigned name to "Time\_Plot" in Property inspector by double click on "Axes1" as shown in Fig. 3.
