MATLAB Examples

Harmonic Analysis of a Three-Phase Rectifier

This example shows how to use functions which analyze Simscape™ logging data to get harmonic magnitudes, calculate total harmonic distortion percentage and plot harmonic magnitudes. The model to which this analysis is applied is of a three-phase rectifier. The functions demonstrated are:

  • pe_getHarmonics
  • pe_calculateThdPercent
  • pe_plotHarmonics

Contents

Open Model

Open the model.

open_system( 'pe_harmonics_rectifier' );

Specification of Parameters

Where:

  • Rated AC voltage, $V_{Rated} \rm{V}$
  • Rated AC frequency, $F_{Rated} \rm{Hz}$
  • AC real power load, $P_{AC} \rm{W}$
  • DC real power load, $P_{DC} \rm{W}$
  • Total apparent power, $S_{Rated} \rm{VA}$

For the test circuit, the AC load is set to consume 5MW, and the DC load is set to consume approximately 5MW.

V_Rated = 4160;
F_Rated = 60;
P_AC = 5e6;
P_DC = 5e6;
S_Rated = P_AC + P_DC;

Calculate Source Impedance

Where:

  • X/R Ratio, $XR$
  • Per-unit impedance, $Z_{pu}$
  • Per-unit base impedance, $Z_{base}$
  • Per-unit base inductance, $L_{base}$
  • Source series resistance, $R_{series} \rm{\Omega}$
  • Source series inductance, $L_{series} \rm{H}$
XR = 15;
Z_pu = 0.01;
Z_base = ((V_Rated/sqrt(3))^2)/(S_Rated/3);
L_base = Z_base/(2*pi*F_Rated);
R_series = cos(atan(XR))*Z_pu*Z_base;
L_series = sin(atan(XR))*Z_pu*L_base;

Calculate DC Resistance

Where:

  • Average DC voltage calculated neglecting losses, $V_{DC} \rm{V}$
  • DC resistance, $R_{DC} \rm{\Omega}$

(Consult appendix for derivation of equations)

V_DC = 3*sqrt(2)*V_Rated/pi;
R_DC = V_DC^2/P_DC;
disp( [ 'DC resistance required to draw ', num2str( P_DC ), ' W on DC side = ', num2str( R_DC ), ' Ohm' ] );
DC resistance required to draw 5000000 W on DC side = 6.3123 Ohm

Use Parameters in Simscape Model

The parameters calculated can now be used in a Simscape model, pe_harmonics_rectifier. Once simulated, the model is set to create a Simscape logging variable, simlog_harmonics_rectifier.

sim( 'pe_harmonics_rectifier' );
Voltage_Source_Currents = simlog_harmonics_rectifier.Voltage_Source.I;

Obtain Harmonic Data

Details of harmonic order, harmonic magnitude and fundamental frequency can be obtained from a Simscape logging variable using the pe_getHarmonics function.

[ harmonicOrder, harmonicMagnitude, fundamentalFrequency ] = pe_getHarmonics( Voltage_Source_Currents );

Calculate Peak Fundamental Value

The peak value of fundamental can be extracted.

fundamentalPeak = harmonicMagnitude( harmonicOrder==1 );
disp( [ 'Peak value of fundamental = ', num2str( fundamentalPeak ), ' A' ] );
Peak value of fundamental = 1945.806 A

Remove Small Harmonics

Find and keep harmonics which are greater than one thousandth of fundamental.

threshold = fundamentalPeak ./ 1e3;
aboveThresold = harmonicMagnitude > threshold;
harmonicOrder = harmonicOrder( aboveThresold )';
harmonicMagnitude = harmonicMagnitude( aboveThresold )';

Display Tabular Harmonic Data

Harmonic data can be contained in a MATLAB® table.

harmonicRms = harmonicMagnitude./sqrt(2);
harmonicPercentage = 100.*harmonicMagnitude./harmonicMagnitude( harmonicOrder==1 );
harmonicTable = table( harmonicOrder,...
    harmonicMagnitude,...
    harmonicRms,...
    harmonicPercentage,...
    'VariableNames', {'Order','Magnitude','RMS','Percentage'});
display( harmonicTable );
harmonicTable =

  10x4 table

    Order    Magnitude     RMS      Percentage
    _____    _________    ______    __________

      1       1945.8      1375.9         100  
      5       218.86      154.75      11.248  
      7       105.83      74.835       5.439  
     11       85.135        60.2      4.3753  
     13       57.599      40.729      2.9602  
     17       50.417       35.65      2.5911  
     19       37.612      26.596       1.933  
     23       33.859      23.942      1.7401  
     25       26.507      18.743      1.3622  
     29       23.979      16.955      1.2323  

Total Harmonic Distortion

Calculate Total Harmonic Distortion (THD) percentage from harmonic data using the pe_calculate_ThdPercent function.

thdPercent = pe_calculateThdPercent( harmonicOrder, harmonicMagnitude );
disp( [ 'Total Harmonic Distortion percentage = ' num2str( thdPercent ), ' %' ] );
Total Harmonic Distortion percentage = 14.1721 %

Plot Harmonics

The harmonic data could be plotted from the harmonic data using the MATLAB bar function. For convenience the pe_plotHarmonics function plots a bar chart directly from the Simscape logging variable.

pe_plotHarmonics( Voltage_Source_Currents );
h1_pe_rectifier_thd = gcf;

Conclusion

This example shows how to use three functions which are callable from the MATLAB command line. The functions analyze Simscape logging data to get harmonic magnitudes, calculate total harmonic distortion percentage and plot harmonic magnitudes.

Appendix - Equations for Calculation of DC Resistance Value

The relationship between peak AC input, $V_P$, and average DC output, $V_{DC}$, of a three-phase rectifier, neglecting losses, can be calculated as follows:

$V_{DC}=\frac{1}{2\pi/6} \int_{2\pi/3}^{\pi/3} \sqrt{3} V_P \,\mathrm{sin}(\omega t) \,\mathrm{d}(\omega t)$

$V_{DC}=\frac{3\sqrt{3}}{\pi} V_P$

As the relationship between the rated voltage (line-line RMS), $V_{Rated}$, and peak phase voltage, $V_P$, is:

$V_P = \frac{\sqrt{2}}{\sqrt{3}} V_{Rated}$

The relationship between rated AC voltage and average DC voltage is:

$V_{DC}=\frac{3\sqrt{2}}{\pi} V_{Rated}$

The resistance, $R$ required to draw a particular power, $P$, is:

$R = \frac{V_{DC}^2}{P}$