Skip to content

line_throughput

line_throughput ¤

LineThroughputEvents ¤

LineThroughputEvents(
    dataframe: DataFrame,
    *,
    event_uuid: str = "prod:throughput",
    time_column: str = "systime"
)

Bases: Base

Production: Line Throughput

Methods: - count_parts: Part counts per fixed window from a monotonically increasing counter. - takt_adherence: Cycle time violations against a takt time from step/boolean triggers. - cycle_quality_check: Cycles from a trigger signal, flagged when outside the expected range. - throughput_oee: Availability, performance and OEE ratios (0-1) per window. - throughput_trends: Throughput trend with moving averages and degradation flags.

count_parts ¤

count_parts(
    counter_uuid: str,
    *,
    value_column: str = "value_integer",
    window: str = "1min",
    handle_resets: bool = True
) -> pd.DataFrame

Compute parts per window for a counter uuid.

When handle_resets is True (default), per-reading increments are computed on the raw counter (a decreasing counter is treated as a reset and the post-reset value counted as new production) and summed into each window, and a resets column reports the number of resets per window. When False, the count per window is the window-over-window difference of the counter maximum, clipped at zero, so a window in which the counter resets to a lower value loses that production.

Parameters:

Name Type Description Default
counter_uuid str

UUID of the part counter signal.

required
value_column str

Column holding the counter value.

'value_integer'
window str

Count window (pandas offset string, e.g. '1min', '1h').

'1min'
handle_resets bool

Count production across counter resets (see above) and add a resets column. Default True.

True

Returns:

Type Description
DataFrame

DataFrame with columns: start, end (start + window),

DataFrame

duration_seconds, uuid, source_uuid, is_delta, count (plus

DataFrame

resets when handle_resets=True).

takt_adherence ¤

takt_adherence(
    cycle_uuid: str,
    *,
    value_column: str = "value_bool",
    takt_time: str = "60s",
    min_violation: str = "0s"
) -> pd.DataFrame

Flag cycles whose durations exceed the takt_time.

For boolean triggers: detect True rising edges as cycle boundaries. For numeric counters/steps: detect increments as cycle boundaries; a decrease (a counter reset) is not a cycle boundary.

Parameters:

Name Type Description Default
cycle_uuid str

UUID of the cycle trigger signal.

required
value_column str

Column holding the trigger. "value_bool" uses rising edges as cycle boundaries; a numeric column uses every increase of the value (a reset or other decrease is not a boundary, so the cycle spanning it runs to the next increase); a non-numeric column (e.g. a string step name) uses every change of value.

'value_bool'
takt_time str

Takt time (pandas offset string, e.g. '60s').

'60s'
min_violation str

How far a cycle must exceed takt_time to be a violation: a cycle is a violation when it is strictly longer than takt_time + min_violation. Default "0s": any cycle longer than the takt time counts; a cycle exactly equal to the takt time does not.

'0s'

Returns:

Type Description
DataFrame

DataFrame with columns: systime (at the boundary that closes the

DataFrame

cycle), uuid, source_uuid, is_delta, cycle_time_seconds,

DataFrame

violation.

throughput_oee ¤

throughput_oee(
    counter_uuid: str,
    *,
    value_column: str = "value_integer",
    window: str = "1h",
    target_rate: float | None = None,
    availability_threshold: float = 0.0,
    handle_resets: bool = True
) -> pd.DataFrame

Calculate Overall Equipment Effectiveness (OEE) metrics.

OEE = Availability × Performance × Quality

This counter-only estimate has no run-state signal, so availability is a production proxy: a window counts as available when its part count is at least availability_threshold × target_rate. Quality is assumed to be 1.0.

Parameters:

Name Type Description Default
counter_uuid str

UUID for the part counter signal

required
value_column str

Column containing counter values

'value_integer'
window str

Time window for aggregation

'1h'
target_rate float | None

Target production rate (parts per window). If None, uses the 95th percentile of observed counts

None
availability_threshold float

Fraction of target_rate a window must reach to count as available (0.0-1.0). The default 0.0 keeps the historical behavior -- any window with at least one part is available. (Previously this argument was accepted but ignored.)

0.0
handle_resets bool

When True (default), the part counter is treated as reset-aware (see :meth:count_parts), so a window where the counter resets is not dropped. Default True.

True

Returns:

Type Description
DataFrame

DataFrame with columns: start, end (start + window),

DataFrame

duration_seconds, uuid, source_uuid, is_delta, actual_count,

DataFrame

target_count, availability, performance, oee_score, followed by

DataFrame

the basis of the ratios:

DataFrame
  • run_seconds: the window length when the window counts as available, else 0 (the counter-only availability proxy)
DataFrame
  • planned_seconds: the window length
DataFrame
  • resets (only when handle_resets=True): counter resets in the window (see :meth:count_parts)
DataFrame

Canonical twin columns: availability_ratio (after availability),

DataFrame

performance_ratio (after performance), oee_ratio (after

DataFrame

oee_score); each holds the same values as the deprecated column right

DataFrame

before it, which is removed in the next major release.

throughput_trends(
    counter_uuid: str,
    *,
    value_column: str = "value_integer",
    window: str = "1h",
    trend_window: int = 24
) -> pd.DataFrame

Analyze throughput trends with moving averages and degradation detection.

Parameters:

Name Type Description Default
counter_uuid str

UUID for the part counter signal

required
value_column str

Column containing counter values

'value_integer'
window str

Time window for counting parts

'1h'
trend_window int

Number of windows for trend calculation

24

Returns:

Type Description
DataFrame

DataFrame with columns: start, end (start + window),

DataFrame

duration_seconds, uuid, source_uuid, is_delta, count, moving_avg,

DataFrame

trend_direction, degradation_detected

cycle_quality_check ¤

cycle_quality_check(
    cycle_uuid: str,
    *,
    value_column: str = "value_bool",
    expected_cycle_time: float | None = None,
    tolerance_pct: float = 0.1
) -> pd.DataFrame

Enhanced cycle detection with quality validation.

Parameters:

Name Type Description Default
cycle_uuid str

UUID for the cycle trigger signal

required
value_column str

Column containing cycle trigger (bool/integer)

'value_bool'
expected_cycle_time float | None

Expected cycle time in seconds. If None, uses median

None
tolerance_pct float

Tolerance percentage for cycle time validation

0.1

Returns:

Type Description
DataFrame

DataFrame with cycle times, validation status, and quality flags