Polybench® Reference
Follows the input signal until a peak, and then follows the Slope settings until a new peak is about to come.

Peak detector

Overview

Use the Peak Detector operator to scan a signal for either maximum (top), or minimum (bottom) values.

The peak detector follows the input signal in positive or negative direction (depending on the Type property) until the signal differential crosses 0. The output will then hold its value (Slope = 0) at the peak value, until a new peak is detected.

To test how the detector finds the next peak, the detection signal can be made visible by setting the Hold property to False, so that the output changes with a constant (linear) slope (Slope < 0 or Slope > 0).

Operator ports

Input S: Floating point values

Output S_peak: Floating point values

Properties

Find more information about changing properties here: "Properties Viewer"

Slope
type: See description
If the Type property is set to SLOPE, then the Slope is the output return slope in units per second. If the Type property is set to RETURN, then Slope is the output return slope in number of seconds. This value can be positive or 0 only.


Type
type: Select from the list
You may select to detect the top or the bottom of the signal. Here you also select how the output resets itself, either by a RETURN slope in units per second, or a gradual return in time.
Select one of those presets:
DetectTop_SLOPE
Detect positive peaks using the SLOPE method
DetectBottom_SLOPE
Detect negative peaks using the SLOPE method
DetectTop_RETURN
Detect positive peaks using the RETURN method
DetectBottom_RETURN
Detect negative peaks using the RETURN method

For more information about the difference between RETURN and SLOPE types, see the Details section.

Hold
type: True or False
If set to True, the output will hold the peak value, until a new peak is detected.
Select one of those presets:
True or False
True may also be read like 'yes' and false like 'no'


Time-out time (s)
type: See description
Optional Time-Out time in seconds. If the no peak is detected before the time out, the output resets. 0 means No Time-out.

Use the Time-Out function to reset the peak detector when within the specified time no peaks were detected. This sometimes happens when very large artefacts enter the peak detector.
The time out time is specified in seconds. Set to 0 to disable the time out function.
Note that the time out works for each input channel separately.

Caption
type: Word or phrase
The name of the object in the project. This name must not contain '.', '$' nor '@' characters.

For more information about the rules and usage of the Caption property, please refer to "Caption property - background and usage".

Documentation
type: See description
Optional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.

Variable Parameters

Find more information about Variable Parameters here: "Variable Parameters"

Slope
type: See description
If the Type property is set to SLOPE, then the Slope is the output return slope in units per second. If the Type property is set to RETURN, then Slope is the output return slope in number of seconds. This value can be positive or 0 only.


TimeOutTime
type: See description
Optional Time-Out time in seconds. If the no peak is detected before the time out, the output resets. 0 means No Time-out.

See the property Time-out time (s) for more information.

Details

The Peak Detector offers two peak detection methods, both in two directions: top or bottom.
For example: If you want to detect a top peak, set the detection method to DetectTop. Internally the Peak Detector then follows the input signal on its way up, until the next sample value is less than the previous. At this moment a peak has been detected, and the value is put to the output. Internally, the detector will now gradually lower its value by a certain slope, until the input signal is greater than the detection line. Then the procedure starts over again.

If you set to detect bottom values, the above procedure is applied in the other direction.

The detection line can be made visible by setting Hold to False, like is done in the figure below. You can use this to find the optimal slope value of the detector, before putting the Peak Detector to work.


Shows how the peak detector tries to find peaks. The end-result would be displayed if the Hold property would be set to True.

SLOPE versus RETURN

The difference between SLOPE and RETURN is, that SLOPE sets the output to return at a constant rate of a number of units per second. RETURN sets the output to return to the average value of the last n seconds, in exactly n seconds. The RETURN method better protects agains high peak artefacts, because it will always 'return' to the average level in n seconds. The SLOPE method could take a very long time to detect a 'normal' peak again in that case.

Timing out

In the occasion of very large artefacts, the peak detector may be distrurbed in a way that it takes very long before the next peak is detected. For those cases, optionally a Time-Out can be set. Find more information for the property Time-out time (s).

Examples

Example: Peak Bottom Demo
This project demonstrates the Peak Detector operator. Both the RETURN and the SLOPE detection methods are used.
Change the Hold property of the peak detectors to see what happens in the background of the peak detectors.
Press the Artefact button to make the amplitude of the signal larger, and see what effect this has for the RETURN and the SLOPE detection methods.
Examples\DF0204015_001_PeakDetector_Demo.xmc