Skip to content

Harness: Power harness documentation #89493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions doc/develop/test/twister.rst
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ harness: <string>
- robot
- ctest
- shell
- power

See :ref:`twister_harnesses` for more information.

Expand Down Expand Up @@ -972,6 +973,43 @@ robot_testsuite: <robot file path> (default empty)
robot_option: <robot option> (default empty)
One or more options to be send to robotframework.

Power
=====
The ``power`` harness is used to measure and validate the current consumption.
It integrates with 'pytest' to perform automated data collection and analysis using a hardware power monitor.

The harness executes the following steps:
1. Initializes a power monitoring device (e.g., ``stm_powershield``) via the ``PowerMonitor`` abstract interface.
2. Starts current measurement for a defined ``measurement_duration``.
3. Collects raw current waveform data.
4. Uses a peak detection algorithm to segment data into defined execution phases based on power transitions.
5. Computes RMS current values for each phase using a utility function.
6. Compares the computed values with user-defined expected RMS values.

.. code-block:: yaml

harness: power
harness_config:
fixture: pm_probe
power_measurements:
element_to_trim: 100
min_peak_distance: 40
min_peak_height: 0.008
peak_padding: 40
measurement_duration: 6
num_of_transitions: 4
expected_rms_values: [56.0, 4.0, 1.2, 0.26, 140]
tolerance_percentage: 20

- **elements_to_trim** – Number of samples to discard at the start of measurement to eliminate noise.
- **min_peak_distance** – Minimum distance between detected current peaks (helps detect distinct transitions).
- **min_peak_height** – Minimum current threshold to qualify as a peak (in amps).
- **peak_padding** – Number of samples to extend around each detected peak.
- **measurement_duration** – Total time (in seconds) to record current data.
- **num_of_transitions** – Expected number of power state transitions in the DUT during test execution.
- **expected_rms_values** – Target RMS values for each identified execution phase (in milliamps).
- **tolerance_percentage** – Allowed deviation percentage from the expected RMS values.

Bsim
====

Expand Down