PulseMeas
Advanced Analysis Library Only
AnalysisLibErrType PulseMeas (double waveform[], ssize_t waveformSize, int polarity, ssize_t pulseNumber, double highRefLevel, double midRefLevel, double lowRefLevel, int referenceUnits, int method, ssize_t histogramBins, double *period, double *pulseDuration, double *dutyCycle, double *pulseCenter, double *lowRefValue, double *midRefValue, double *highRefValue);
Purpose
Calculates the period, pulseDuration (pulse width), pulseCenter, and dutyCycle (duty factor) of a waveform in user-defined cycle.
The distance between the midRefLevel and the highRefLevel must equal the distance between the lowRefLevel and the midRefLevel. If the two distances are not equal, LabWindows/CVI adjusts either the highRefLevel or the lowRefLevel to match the smaller of the two distances. For example, if you specify a highRefLevel of 90%, a midRefLevel of 50%, and a lowRefLevel of 20%, LabWindows/CVI uses 80% instead of 90% for the highRefLevel.
Parameters
Input | ||
Name | Type | Description |
waveform | double [] | The waveform to measure. |
waveformSize | ssize_t | The size of waveform x. |
polarity | int | Defines a pulse as high or low. A high pulse consists of the interval between a rising midRefLevel crossing and the next falling midRefLevel crossing. Specify a nonzero value or ANALYSIS_HIGH or select High in the function panel to specify a high pulse. This is the default value. Specify 0 or ANALYSIS_LOW or select Low in the function panel to specify a low pulse. |
pulseNumber | ssize_t | Specifies which pulse of polarity, high or low, to measure. |
highRefLevel | double | The high reference level of the waveform in percent or absolute units. After the signal crosses the midRefLevel in the rising direction, it must cross the highRefLevel before this function can count the next falling midRefLevel crossing. |
midRefLevel | double | The middle reference level in percent or absolute units. The interval between consecutive rising midRefLevel crossings defines one cycle, or period, of the waveform. At least one high/low reference level crossing must separate each midRefLevel crossing. |
lowRefLevel | double | The low reference level of the waveform in percent or absolute units. After the signal crosses the midRefLevel in the falling direction, it must cross the lowRefLevel before this function can count the next rising midRefLevel crossing. |
referenceUnits | int | Specifies whether the highRefLevel, midRefLevel, and lowRefLevel are interpreted as a percentage of the full range of the waveform or as absolute levels. Specify one of the following values:
|
method | int | The method of calculating high and low state levels of the waveform.
|
histogramBins | ssize_t | The number of bins in the Histogram method. LabWindows/CVI ignores histogramBins if you select Peak method as method. |
Output | ||
Name | Type | Description |
period | double | The time between adjacent midRefLevel crossings in the same direction in samples. |
pulseDuration | double | The time difference in samples between the first two midRefLevel crossings of the pulseNumber you specify. |
dutyCycle | double | A fraction of a period. dutyCycle is also known as duty factor. LabWindows/CVI calculates dutyCycle by the following equation: dutyCycle = 100*(pulseDuration/period) |
pulseCenter | double | The time instant of the midpoint of the pulseNumber. |
lowRefValue | double | The returned low reference level of the waveform in absolute units. |
midRefValue | double | The returned middle reference level of the waveform in absolute units. |
highRefValue | double | The returned high reference level of the waveform in absolute units. |
Return Value
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later