Open access

# Voltage Sag Waveform Using SagWave GUI

Written By

Kosol Oranpiroj, Worrajak Moangjai and Wichran Jantee

Submitted: December 16th, 2011 Published: September 26th, 2012

DOI: 10.5772/46448

Chapter metrics overview

View Full Metrics

## 1. 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).

Type A

Va=VVb=12Vj123VVc=12V+j123V}E1

Type B

Va=VVb=12j123Vc=12+j123}E2

Type C

Va=1Vb=12j123VVc=12+j123V}E3

Type D

Va=VVb=12Vj123Vc=12V+j123}E4

Type E

Va=1Vb=12Vj123VVc=12V+j123V}E5

Type F

Va=VVb=j3312Vj36VVc=+j3312V+j36V}E6

Type G

Va=23+13VVb=1316Vj32VVc=1316V+j32V}E7

## 2. 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, switching-impedance, generator and amplifier. The transformer type uses a switch to adjust both pre-sag 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.used MOSFET 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 non-conducting 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 abcalgorithm((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.

## 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:

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).

### 3.1. 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.

### 3.2. 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.

### 3.3. 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.

### 3.4. 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.

### 3.5. 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.

### 3.6. 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.

### 3.7. 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.

### 3.8. 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.

### 3.9. 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.

### 3.10. 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.

### 3.11. 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.

### 3.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.

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.

### 4. SagWave programming

The concept of SagWave programming shown in Fig. 13. Form the 3th 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.

### 4.1. Magnitude of Voltage Sag

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

1. 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.

1. Slider (Phase A, Phase B, Phase C Magnitude)

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.

### 4.2. Phase angle of Voltage Sag

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

1. Edit Text (Phase A, Phase B, Phase C Phase angle)

The Edit Text is an element that user to enter a text string (-90 to +90). The program of this element is shown in Fig.16, in this program shown how to converse string to numeric.

1. Slider (Phase A, Phase B, Phase C Phase angle)

The program of this element is shown in Fig.17.

### 4.3. Voltage Sag Type

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

### 4.4. Show

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

### 4.5. 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.

### 4.6. 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.

### 4.7. 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.

### 4.8. 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.

## 5. 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 abcalgorithm.

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.

 Voltage Sag Type Phase Voltage A B C Magnitude Phase Magnitude Phase Lag Lead Magnitude Phase Lag Lead A V 0° 0.6 −120° - - 0.6 120° - - B V 0° 1 −120° - - 1 120° - - C 1 0° 0.72 −133.9° −13.39° - 0.72 133.9° - 13.39° D 0.6 0° 0.92 −109.1° - 10.9° 0.92 109.1° −10.9° - E 1 0° 0.6 −120° - - 0.6 120° - - F V 0° 0.808 −111.79° - 8.21° 0.808 111.79° −8.21° - G 0.867 0° 0.6 −129.83° −9.83° - 0.6 129.83° - 9.83°

### Table 1.

Parameter for seven type of voltage sag.

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.

 Case Manitude(%) Duration(ms) Point on Wave (degree) 1 5 60 45 2 25 60 45 3 25 60 270

### Table 2.

Parameter of point on wave voltage sag.

 Case Manitude(%) Duration(ms) Number of repeated 1 60 60 4 2 60 60 6

### Table 3.

Parameter of repeated voltage sag.

## 6. Experimental of 3-phase 4-wire voltage sag generator

From section 3 the SagWave software generates the parameter file and sends it to the dsPIC microcontroller. The dsPIC uses this file to control the 3-phase 4-leg 4-wire inverter in order to create the actual waveform. Experimental results for voltage sag types A, B and E are shown in Fig. 27-29, respectively.

The experimental results in Fig. 27 are according with simulation results in Fig.24 (Type A). Fig.27 shows the 3-phase voltage and 3-phase current of voltage sag Type A. During voltage sag, the voltage on phase A (Va), phase B (Vb) and phase C (Vc) are reduced to 60%. The current on phase A (Ia), phase B (Ib) and phase C (Ic) also are reduced to 60%. Before voltage sag occurs, the neutral current (In) has zero currents due to the balanced load condition. However during voltage sag transition, the unbalance load currents causes non-zero in the neutral current (In).

The experimental results in Fig. 28 are according with simulation results in Fig.24(Type B). Fig.28 shows the 3-phase voltage and 3-phase current of voltage sag Type B. During voltage sag, the voltage on phase A (Va) is reduced to 60%. The current on phase A (Ia) also is reduced to 60%. Before voltage sag occurs, the neutral current (In) has zero currents due to the balanced load condition. However during voltage sag, the unbalance load causes an increase in the neutral current (In) that the return current in fourth leg of inverter.

The experimental results in Fig. 29 are according with simulation results in Fig.24 (Type E). Fig. 29 shows the 3-phase voltage and 3-phase current of voltage sag Type E. During voltage sag, the voltage on phase B (Vb) and phase C (Vc) are reduced to 60%. The current on phase A(Ia) is constant, while current on phase B (Ib) and current on phase C (Ic) are reduced to 60%. Before voltage sag occurs, the neutral current (In) has zero currents due to the balanced load condition. However during voltage sag, the unbalance load causes an increase in the neutral current (In) that the return current in fourth leg of inverter.

The experimental results of point on wave are shown in Fig. 30. The sag generator can generate waveform at any point of wave of sine wave as desired.

The experimental results of repeated voltage sags are shown in Fig. 31. The sag generator can generate repeated voltage sag waveform as many as desired.

## 7. 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.

## References

1. 1. Bollen MHJ2000Understanding Power quality problems voltage sags and interruption. New York, IEEE Press.193196
2. 2. BhavsarS.ShahV. A.GuptaV. “.Voltage dips and short interruption immunity test generator as per IEC 61000-4-11”. in Proc. of 15th National Power Systems Conference. Bombay, India,2008
3. 3. Collins ER, Morgan RL. “A Three-Phase Sag Generator for Testing Industrial Equipment”.IEEE Transaction on Power Delivery.1119961526532
4. 4. MaKaradyY.single-phaseG. G. “. A.voltagesag.generatorfor.testingelectrical.equipments”ingle-phase voltage sag generator for testing electrical equipments”. in Proc. of Transmission and Distribution Conference and Exposition, Chicago IL,152008
5. 5. OranpirojK.PremrudeepreechacharnS.NgoudechM.MuangjaiW.YingkayunK.BoonsaiT. “.The 3-phase 4-wire voltage sag generator based on three dimensions space vector modulation in abc coordinates”. In Proc. of International Symposium on Industrial Electronics ISIE20092009275280
6. 6. OranpirojK.PremrudeepreechacharnS.NgoudechM.MuangjaiW.YingkayunK.BoonsaiT. “.The 3-phase 4-wire voltage sag generator based on abc algorithm”. in Proc. of Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology ECTI-CON200920098285
7. 7. OranpirojK.PremrudeepreechacharnS.HiguchiK. “.SagSagWave for the 3-phase 4-wire voltage sag generator prototype”. in Proc. of IEEE International conference on Control Applications CCA2010201022092212
8. 8. OranpirojK.PremrudeepreechacharnS.MuangjaiW. C. V.NayarDevelopment“.ofthe.3-phase4-wire.voltagesag.generator”Scientific Research and Eassys,620112349604974
9. 9. Patrick Marchand, O.Thomas Holland, Graphics and GUIs with MATLAB.CHAPMAD & HALL/CRC, LTD,2003
10. 10. RylandeM.GradyW. M.ArapostathisA. “.Enhancement and application of a voltage sag station to test transient load response”. in Proc. of IEEE Electric Ship Technology Symposium, Arlington VA.4284332007
11. 11. TakahashiR.CortezJ. A.daSilva. V. F.RezekA. J. J. “. A.prototypeimplementation.ofa.voltagesag.generator”V. I. I.VIII Conferencia Internacional de Aplicacoes Industriais, Poços de Caldas, Brazil,2008
12. 12. TekeA.MEMeralTümayM. “.Evaluation of available power quality disturbance generators for testing of power quality mitigation devices”. Int. J. of Sciences and Techniques of Automatic Control and Computer Engineering, (special issue),6246352008

Written By

Kosol Oranpiroj, Worrajak Moangjai and Wichran Jantee

Submitted: December 16th, 2011 Published: September 26th, 2012