long_downtime_events
long_downtime_events ¤
LongDowntimeEvents ¤
LongDowntimeEvents(
dataframe: DataFrame,
state_uuid: str,
*,
event_uuid: str = "prod:long_downtime",
value_column: str = "value_bool",
time_column: str = "systime",
value_range: (
tuple[float | None, float | None] | None
) = None
)
Bases: Base
Production: Long Downtime Detection
Detect downtime intervals exceeding a minimum duration threshold from a boolean or integer state signal, then count production events that occur between consecutive long-downtime boundaries.
- LongDowntimeEvents: Long idle intervals and inter-gap production counts.
- detect_long_downtime: Find idle/stopped intervals >= min_gap (default 3 h).
- count_events_between_gaps: Count production events between consecutive long-downtime boundaries.
detect_long_downtime ¤
detect_long_downtime(min_gap: str = '3h') -> pd.DataFrame
Return idle/stopped intervals whose duration is >= min_gap.
Columns: start, end, duration_seconds, downtime_index, uuid, source_uuid, is_delta
count_events_between_gaps ¤
count_events_between_gaps(
production_df: DataFrame,
production_uuid: str,
*,
min_gap: str = "3h",
value_column: str = "value_integer",
aggregation: str = "count"
) -> pd.DataFrame
Count production events in each window between consecutive long downtimes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
production_df
|
DataFrame
|
ts-shape DataFrame with the production signal. |
required |
production_uuid
|
str
|
UUID of the production signal in production_df. |
required |
min_gap
|
str
|
Minimum downtime duration to qualify as a long-downtime boundary. |
'3h'
|
value_column
|
str
|
Column used for 'sum' and 'transitions' aggregations. |
'value_integer'
|
aggregation
|
str
|
How to count events in each window: - 'count': number of rows in the window - 'sum': sum of value_column in the window - 'transitions': number of value changes (state changes) |
'count'
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame
|
DataFrame with one row per inter-gap window. |
|
Columns |
DataFrame
|
start, end, window_duration_seconds, event_count, downtime_index, uuid, source_uuid, is_delta |