Choose a Simscape Electrical Function for an Offline Harmonic Analysis
Harmonic Distortion
Nonlinear loads create power distortion in the form of harmonics, that is, voltages and currents that are multiples of the fundamental frequency. Harmonic waveforms can result in energy losses through heat dissipation and in reduced power quality. They can also cause equipment to malfunction or to become damaged. Standards development organizations such as the Institute of Electrical and Electronics Engineers (IEEE) and the International Electrotechnical Commission (IEC) define the recommended limits for harmonic content in electric power systems.
Harmonic Analysis Functions
You can use the simulation and analysis functions in Simscape™
Electrical™ to perform an offline, that is postsimulation, analysis to examine harmonic distortion in your model. The ee_plotHarmonics
function generates a bar chart. The ee_getHarmonics
and ee_calculateThdPercent
functions provide harmonic data in numerical form.
To decide which functions and workflows to use for your harmonic analysis, consider your goals. The table crossreferences the harmonic functions with common harmonic analysis according to the data the function outputs and the task requires.
Goal  ee_plotHarmonics  ee_getHarmonics  ee_calculateThdPercent 

Evaluate the relative overall harmonic distortion 
 
Compare the harmonic distortion to standard limits 
 Total harmonic distortion (THD) percentage  
Determine the parameters for filtering harmonic distortion 

Evaluate Relative Overall Harmonic Distortion
Use this workflow for a highlevel understanding of the waveform distortion in your power system.
Enable Simscape data logging.
Save the logged voltage or current data to a variable.
Use the
ee_plotHarmonics
function to generate a bar chart of harmonic percentages with the peak fundamental magnitude and the total harmonic distortion (THD) percentage displayed in the plot title.
Compare Harmonic Distortion to Standard Limits
Use this workflow to obtain values for evaluating the IEEE or IEC suitability of your power system.
Enable Simscape data logging.
Save the logged voltage or current data to a variable.
Use the
ee_getHarmonics
function to obtain the harmonic orders, the magnitude for each order, and the fundamental frequency.Save the fundamental peak to a new variable.
Calculate the RMS voltage or current for each order.
Calculate the harmonic distortion percentage for individual harmonics.
Use the
ee_calculateThdPercent
function to obtain the total harmonic distortion (THD).Compare the percentage data for each order and the THD percentage to the standard limits.
Minimize Harmonic Distortion with Passive Filters
Use this workflow to determine the parameters for filtering the distorted waveforms with passive filters. Use individual, seriestuned filters for specific harmonic orders. Use a single highpass filter to filter higher orders.
Enable Simscape data logging.
Save the logged voltage or current data in a variable.
Use the
ee_getHarmonics
function to obtain the harmonic orders, the magnitude for each order, and the fundamental frequency.Identify the harmonic orders that you want to filter.
For each filter:
Specify the filter size, in terms of reactive power compensation, and specify the filter quality.
Calculate the capacitor reactance at the tuned harmonic order.
Calculate the filter capacitance.
Calculate the inductor reactance at the tuned harmonic order.
Calculate the filter inductance.
Calculate the filter resistance.
Verify the Results of an Online Harmonic Analysis
You can examine harmonic distortion in your model online, that is during simulation, using the Simscape Spectrum Analyzer block. To verify the results from the Spectrum Analyzer block:
To determine the THD in your model, perform an online analysis. For information, see Perform an Online Harmonic Analysis Using the Simscape Spectrum Analyzer Block.
Use the
ee_getHarmonics
andee_calculateThdPercent
functions to determine the THD in your model.Compare the THD values for the online and offline analyses. If the results differ, reconfigure the Spectrum Analyzer block.