Voltage Sag Waveform Using SagWave GUI

A recent survey attributes that 92% of all disturbances in power system is caused by voltage sags. Three-phase voltage sag can be classified in seven types as shown in Fig.1 (Bollen MHJ, 2000). The electrical sensitive load often trips of shunts down when voltage sag occur. It's very important to know how these sensitive equipment works when the voltage sag occur. This is the reason to develop the voltage sag generator that can created varied type of voltage sag waveform. The purpose of voltage sag generator is use to test the immunity of equipment against the voltage sag.


Introduction
A recent survey attributes that 92% of all disturbances in power system is caused by voltage sags.Three-phase voltage sag can be classified in seven types as shown in Fig. 1 (Bollen MHJ, 2000).The electrical sensitive load often trips of shunts down when voltage sag occur.It's very important to know how these sensitive equipment works when the voltage sag occur.This is the reason to develop the voltage sag generator that can created varied type of voltage sag waveform.The purpose of voltage sag generator is use to test the immunity of equipment against the voltage sag.
The magnitude and angle of three phase voltage sag can calculate form equation 1 to equation 7 (Bollen MHJ, 2000).

Voltage sag generator
Previous works (Takahashi et al., 2008;Rylander et al., 2007;Bhavar et al., 2008;Teke et al., 2008;Ma and Karady, 2008), have developed voltage sag generator which can be simply classified into 4 types.These four types of voltage sag generator are transformer, switchingimpedance, generator and amplifier.The transformer type uses a switch to adjust both presag voltage and sag magnitudes.The switching-impedance type creates voltage sags by switching impedance into a power system by using a thyristor-controlled reactor (TCR).The generator type uses a synchronous generator to give controlled 3-phase voltage sags.The amplifier type uses a waveform generator to create controlled 3-phase voltage sags.
An autotransformer is used as the 1-phase voltage sag generator as demonstrated (Rylander et al., 2007, Bhavar et al., 2008);Rylander, et al .usedMOSFET to turn-on/turn-off for changing between the primary source and the secondary source.Bhavsar, et al. used motorized variac with multi tapping transformer, the position of the variac is changed using a signal generated by the PIC.The main disadvantage of this method is that the nonconducting pairs connected to the unselected taps dissipate power due to the taps.It has a 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 inverter which is controlled by low-cost dsPIC.

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: 1.The window for showing the 3-phase voltage.
2. The window for showing vector of A, B and C phase.
3. Magnitude of Voltage (A, B and C phase), user had used value box or slider bar. 4. Phase angle jump of voltage sag on A, B or C phase. 5. Sag type for selected the voltage sag type (single-phase, two-phase and three-phase).6. Display normal or repeat mode of voltage sag. 7. Point on wave in degree.8. Sag duration time for period time of voltage sag.9. Number of repeat of voltage sag.10.The button "Plot" for generated the voltage sag waveform.11.The button "Send" for send the data from SagWave to the dsPIC microcontroller.12.The button "Refresh" for clear the value and graphic display.
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).

The window for showing the 3-phase voltage
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.

The window for showing vector of A, B and C phase
This "Axes2" to shown the vector of A, B and C of voltage sag, then we assigned name to "Com_pass" in Property inspector by double click on "Axes2" as shown in Fig. 4.

Magnitude of Voltage (A, B and C phase), user had used value box or slider bar
This group used the Edit Text and Slider object.The Edit Text and Slider object set the default value as 100%.In the property inspector of three Edit Text changed the String to "100", Max to "1.0" and Min to "0.0", as shown in Fig. 5.The String in Edit Text property to changed to the number value in m-file.In the property inspector of three Slider changed the Value to "[100.0]",Max to "100.0" and Min to "0.0", as shown in Fig. 6.

Phase angle jump of voltage sag on A, B or C phase
This group used the Edit Text ( ) and Slider ( ) object, that the same as Magnitude group.In the property inspector of three Edit Text changed the String to "0", Max to "1.0" and Min to "0.0", as shown in Fig. 7.The String in Edit Text property to changed to the number value in m-file.In the property inspector of three Slider changed the Value to "[0,0]", Max to "90.0" and Min to "-90.0", as shown in Fig. 8.

Sag type for selected the voltage sag type (single-phase, two-phase and three-phase)
This group are "Radio Button" objects in component palette ( ) on the left-side of window.The Radio Button of this group used to select the voltage sag type, Single-phase, Two-phase and Three-phase type.The property inspector was shown in Fig. 9.

Display normal or repeat mode of voltage sag
These groups are "Radio Button" objects same as the voltage type group.The Radio Button of this group used to select the graph to shown normal and repeat mode of voltage sag.The property inspector was shown in Fig. 10.

Point on wave in degree
This object is the Edit Text for input degree of voltage on wave.The property inspector was shown in Fig. 11.

Sag duration time for period time of voltage sag
This object is the Edit Text for input time duration of voltage sag.The property inspector was shown in Fig. 11.

Number of repeat of voltage sag
This object is the Edit Text for input the repeated number of voltage sag.The property inspector was shown in Fig. 11.

The button "Plot" for generated the voltage sag waveform
This object is "Button" objects in component palette ( ) on the left-side of window.The "Plot" button is the main object of the GUI "SagWave", this button used to calculate and showed the graph of voltage sag.The property inspector was shown in Fig. 12.

The button "Send" for send the data from SagWave to the dsPIC microcontroller
The "Send" button used to send the wave form data of voltage sag to dsPIC microcontroller.The property inspector was shown in Fig. 12.

The button "Refresh" for clear the value and graphic display
The "Refresh" button used to clear the graphic, all of the value in program to provide the new value.The property inspector was shown in Fig. 12.

SagWave programming
The concept of SagWave programming shown in Fig. 13.Form the 3 th topic, GUIDE will create an M-File with callback function prototypes.The callback function was response to an event by MATLAB code.There must be a callback to implement the function of each graphical component on the GUI.Now we must be programming the callback to implement the function of each component on the SagWave.

Magnitude of Voltage Sag
These groups to input the magnitude of the voltage sag.There are two ways to input the magnitude;

Edit Text (Phase A, Phase B, Phase C Magnitude)
The Edit Text is an element that user to enter a text string(0 to 100).The program of this element is shown in Fig. 14, in this program shown how to converse string to numeric.The Slider is the element that user to select values from continuous range between a specified minimum and maximum value by moving a bar with mouse.The program of this element is shown in Fig. 15.

Phase angle of Voltage Sag
These groups to input the phase angel of voltage sag.There are two ways to input the magnitude;

Voltage Sag Type
These groups to select the voltage sag type, the program of this element shown in Fig. 18.

Show
These groups to select the program to show single or repeat of voltage sag, program of this element shown in Fig. 19.

Point on Wave, Sag Duration and Repeat
These groups to enter the value of Point on Wave, Sag duration and Repeat of voltage sag, the program of this element shown in Fig. 20.

Send Button
The Send Button is the button for user to send the data from SagWave to dsPIC microcontroller.The Duty.dat was generated by SagWave.The user clicked the "Send" button to send the Data.dat to dsPIC microcontroller by a RS-232 port.The program of this element shown in Fig. 21.

Refresh Button
The Refresh Button is the button for user to clear the parameter and graph in SagWave for the next simulation.The program of this element shown in Fig. 22.

Plot Button
The Plot Button is a main element of the SagWave, when user clicked this button the callback program calculated and plot graph of voltage sag.The program of this element shown in Fig. 23 to Fig. 25.

Simulation result
From equation 1 to equation 7 in Topic 1, if we need 60%(V = 0.6) voltage sag there can be calculate and result in Table .1.The operation of this program with the user designing the voltage sag wave form SagWave software.Then the user clicks the "Send" button to send the parameters to dsPIC microcontroller.The actual voltage sag is created by a 3-phase 4-leg 4-wire inverter based on an abc algorithm.For example, the designed waveforms have parameters as found in "Bollen, (2000)".The parameters in Table 1. are used to generate seven types of voltage sag.Users can verify waveforms through graphic display windows as shown in Fig. 24.SagWave software can create point on wave single-phase(phase A) voltage sag, the parameters are shown in Table 2.The display of waveforms was is in Fig. 25.The parameters of single-phase(phase A) repeated voltage sag is shown in Table 3, and the simulation waveform in Fig. 26.

Conclusions
This chapter has proposed the use of GUI SagWave software to provide a visual interactive capability generating data for the dsPIC controller.SagWave software can show the waveform and the phasor of the three-phase voltage.The simulation and experimental results have shown a simple control algorithm for generating the sag signal for testing.The experimental results have shown the main advantages of this prototype: point on wave, sag duration, magnitude of voltage sag and varied type of voltage sag.A future study will design software for the dsPIC microcontroller to generate all seven types of voltage sag and to test the dynamic and nonlinear loads.

Figure 5 .
Figure 5.The property inspector of Edit Text (Magnitude) set Max and Min.(Magnitude) set Max and Min.

Figure 6 .
Figure 6.The property inspector of Slider.

Figure 7 .
Figure 7.The property inspector of Edit Text of the Magnitude group.

Figure 8 .
Figure 8.The property inspector of Slider of the Magnitude group.

Figure 9 .
Figure 9.The property inspector of Radio Button of voltage sag type group.

Figure 10 .
Figure 10.The property inspector of Radio Button of show group set to Normal and Repeat.

Figure 11 .
Figure 11.The property inspector of Point on Wave, Sag Duration and Repeat.

Figure 12 .
Figure 12.The property inspector of Plot, Send and Refresh Button.

Finally
users are ready to let GUIDE create the Fig-file and M-file.They are two options to create; one, simply select menu File → Save As.., or users can run GUI by select menu Tools → Run or click on tool bar.GUIDE will save user's GUI to file with the name as gave by user with extension *.fig and *.m of the same name.

Figure 15 .
Figure 15.Program on Slider(Magnitude) callback function for input Magnitude.

Figure 16 .
Figure 16.Program on Edit Text(Phase angle) callback function for input phase angle.

Figure 18 .
Figure 18.Program on Radio Button callback function for select voltage sag type.

Figure 19 .
Figure 19.Program on Radio Button callback function for show Normal and Repeat.

Figure 20 .
Figure 20.Program on Edit Text(Point on Wave, Sag Duration and Repeat) callback function.

Figure 21 .
Figure 21.Program on "Send" Button callback function for open communication port and send file.

Figure 22 .
Figure 22.Program on "Refresh" Button callback function to clear all parameter.

Figure 23 .
Figure 23.Initial variable sections of Plot button.

Figure 24 .
Figure 24.The program of graph and vector of phase voltage plotting section.

Figure 25 .
Figure 25.The program of Normal and Repeat as Repeat = 3.

Figure 26 .
Figure 26.The seven types of voltage sag created using SagWave software.

Figure 27 .
Figure 27.a) The point on wave at 45 ; b) The point on wave at 45 ; c) The point on wave at 270 a) b) c )

Figure 28 .
Figure 28.The simulation of single-phase voltage sag repeated.

Figure 32 .Figure 33 .
Figure 32.Experimental result: a) point on wave at 45 b) point on wave at 45 c) point on wave at 270

Table 1 .
Parameter for seven type of voltage sag.

Table 2 .
Parameter of point on wave voltage sag.