Skip to content

threshold_monitoring

threshold_monitoring ¤

ThresholdMonitoringEvents ¤

ThresholdMonitoringEvents(
    dataframe: DataFrame,
    signal_uuid: str,
    *,
    event_uuid: str = "eng:threshold",
    value_column: str = "value_double",
    time_column: str = "systime"
)

Bases: Base

Engineering: Threshold Monitoring

Multi-level threshold monitoring with hysteresis for numeric signals.

Methods: - multi_level_threshold: Intervals exceeding configurable warning/alarm/critical levels. - threshold_with_hysteresis: Alarm entry/exit with separate high/low thresholds. - time_above_threshold: Time and percentage above a threshold per window. - threshold_exceedance_trend: Track exceedance frequency over time.

multi_level_threshold ¤

multi_level_threshold(
    levels: Dict[str, float], direction: str = "above"
) -> pd.DataFrame

Detect intervals where signal exceeds configurable threshold levels.

Parameters:

Name Type Description Default
levels Dict[str, float]

Dict mapping level names to threshold values. e.g. {'warning': 80, 'alarm': 90, 'critical': 95}

required
direction str

'above' or 'below'.

'above'

Returns:

Type Description
DataFrame

DataFrame with columns: start_time, end_time, duration, level, peak_value.

threshold_with_hysteresis ¤

threshold_with_hysteresis(
    high: float, low: float
) -> pd.DataFrame

Alarm intervals with hysteresis to prevent chattering.

Enter alarm when signal crosses high, exit when it drops below low.

Parameters:

Name Type Description Default
high float

Upper threshold to enter alarm state.

required
low float

Lower threshold to exit alarm state.

required

Returns:

Type Description
DataFrame

DataFrame with columns: start_time, end_time, duration, peak_value.

time_above_threshold ¤

time_above_threshold(
    threshold: float, window: str = "1h"
) -> pd.DataFrame

Per window: total time and percentage above threshold.

Parameters:

Name Type Description Default
threshold float

Value threshold.

required
window str

Resample window.

'1h'

Returns:

Type Description
DataFrame

DataFrame with columns: window_start, time_above, pct_above, exceedance_count.

threshold_exceedance_trend ¤

threshold_exceedance_trend(
    threshold: float, window: str = "1D"
) -> pd.DataFrame

Track exceedance frequency and duration trend over time.

Parameters:

Name Type Description Default
threshold float

Value threshold.

required
window str

Resample window (e.g. '1D' for daily).

'1D'

Returns:

Type Description
DataFrame

DataFrame with columns: window_start, exceedance_count,

DataFrame

total_duration, trend_direction.