ee_plotHarmonics
Plot percentage of fundamental magnitude versus harmonic order
Syntax
Description
ee_plotHarmonics(
plots a
bar chart of percentage of fundamental magnitude versus harmonic order of the
loggingNode
)simscape.logging.Node
of an AC or periodic variable. The title of
the bar chart includes the fundamental frequency, fundamental peak value, and total
harmonic distortion (THD) percentage.
You enter the input arguments in a specific order. The Simscape™ logging node input argument is required. All other input arguments are
optional and have default values. If you are specifying a value for a subsequent
optional input argument, enter []
to use the default value for an
optional input argument.
The ee_plotHarmonics
function uses the
ee_getHarmonics
function to:
Find the points in the ith signal (valueIdx) where the Simscape log crosses a threshold (offsetOfInterest).
Use the crossing points to find the required number of periods (nPeriodOfInterest) preceding the specified time (tOfInterest).
Calculate the harmonic magnitudes, up to and including the required number of harmonics (nHarmonic).
Input the down-selected data to the Goertzel algorithm, which calculates the harmonic magnitudes up to and including the required number of harmonics (nHarmonic).
Note
The ee_getHarmonics
function uses threshold crossing
points to determine the fundamental frequency of the data. If your input
data is noisy or crosses the threshold more frequently than half of the
fundamental period, filter it before you use the
ee_plotHarmonics
function to plot it.
The ee_plotHarmonics
function then inputs the harmonic orders
and harmonic magnitudes to the ee_calculateThdPercent
function
to calculate the THD.
ee_plotHarmonics(
uses the index into value data.loggingNode
,valueIdx
)
ee_plotHarmonics(
uses the simulation time.loggingNode
,valueIdx
,tOfInterest
)
ee_plotHarmonics(
uses the number of periods of fundamental frequency.loggingNode
,valueIdx
,tOfInterest
,nPeriodOfInterest
)
ee_plotHarmonics(
uses the DC offset.loggingNode
,valueIdx
,tOfInterest
,nPeriodOfInterest
,...
offsetOfInterest
)
ee_plotHarmonics(
uses the number of harmonics.loggingNode
,valueIdx
,tOfInterest
,nPeriodOfInterest
,...
offsetOfInterest
,nHarmonic
)
Examples
Plot Using Default Values
This set of function arguments uses the Simscape logging node
simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I
,
which contains data from a three-phase current. The function analyzes the
default signal, which is the first, or a-phase, signal at the final simulation
time. The function uses the default values of 12 for the number of periods of
the signal, 0V for the signal bias, and 30 for the number of harmonics.
openExample("simscapeelectrical/SixPulseHarmonicsExample") sim('SixPulseHarmonics') ee_plotHarmonics(simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I)
Plot Using Specified Values
This set of function arguments uses the Simscape logging node
simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I
,
which contains data from a three-phase current. The function analyzes the
second, or b-phase, signal at a simulation time of 0.5
s. The
function uses 10
periods of the signal, assuming a bias of
1
V. The function analyzes 15
harmonics.
openExample("simscapeelectrical/SixPulseHarmonicsExample") sim('SixPulseHarmonics') ee_plotHarmonics(simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I,2,0.5,10,1,15)
Plot Using Default and Specified Values
This set of function arguments uses the Simscape logging node
simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I
,
which contains data from a three-phase current. The function analyzes the first,
or a-phase, signal at a simulation time of 0.5
s. The
function uses 12
periods of the signal, assuming a bias of
1
V. The function analyzes the default number,
30
, of harmonics.
openExample("simscapeelectrical/SixPulseHarmonicsExample") sim('SixPulseHarmonics') ee_plotHarmonics(simlog_SixPulseHarmonics.Sensing_current.Current_Sensor.I,[],0.5,[],1)
Input Arguments
Version History
Introduced in R2014a