Skip to content

performance_loss

performance_loss ¤

Performance/speed loss tracking.

Track when machine runs slower than ideal/target speed: - Identify slow periods vs target cycle time - Calculate performance loss in minutes and parts - Performance trend over time

PerformanceLossTracking ¤

PerformanceLossTracking(
    dataframe: DataFrame,
    *,
    time_column: str = "systime",
    shift_definitions: Optional[
        Dict[str, tuple[str, str]]
    ] = None
)

Bases: Base

Track performance and speed losses against target cycle times.

Identifies hidden losses where the machine is running but slower than it should be. Typically 10-20% of production time is lost to speed losses.

Each UUID represents one signal: - cycle_uuid: cycle trigger or production counter - part_id_uuid: part number signal (optional, for per-part targets)

Merge keys: [date, shift] for shift-level, [period] for trend data.

Pipeline example::

perf = PerformanceLossTracking(df)
shift_perf = perf.performance_by_shift('cycle', target_cycle_time=45)
# → merge with DowntimeTracking.downtime_by_shift() on [date, shift]
# → merge with QualityTracking.nok_by_shift() on [date, shift]
# → feed into ShiftHandoverReport.from_shift_data()
Example usage

tracker = PerformanceLossTracking(df)

Performance by shift¤

perf = tracker.performance_by_shift( cycle_uuid='cycle_trigger', target_cycle_time=45.0, )

Identify slow periods¤

slow = tracker.slow_periods( cycle_uuid='cycle_trigger', target_cycle_time=45.0, threshold_pct=90, )

performance_by_shift ¤

performance_by_shift(
    cycle_uuid: str,
    target_cycle_time: float,
    *,
    value_column: str = "value_integer"
) -> pd.DataFrame

Calculate performance percentage per shift.

Performance = (target_cycle_time * actual_parts) / elapsed_run_time.

Parameters:

Name Type Description Default
cycle_uuid str

UUID of cycle trigger or counter signal.

required
target_cycle_time float

Target (ideal) cycle time in seconds.

required
value_column str

Column with counter values.

'value_integer'

Returns:

Type Description
DataFrame

DataFrame with columns:

DataFrame
  • date, shift, actual_parts, avg_cycle_time_s, target_cycle_time_s, performance_pct, loss_minutes

slow_periods ¤

slow_periods(
    cycle_uuid: str,
    target_cycle_time: float,
    *,
    threshold_pct: float = 90.0,
    window: str = "1h",
    value_column: str = "value_integer"
) -> pd.DataFrame

Identify time windows where performance is below threshold.

Parameters:

Name Type Description Default
cycle_uuid str

UUID of cycle trigger or counter signal.

required
target_cycle_time float

Target cycle time in seconds.

required
threshold_pct float

Performance must be below this to flag (default 90%).

90.0
window str

Rolling window size (default '1h').

'1h'
value_column str

Column with counter values.

'value_integer'

Returns:

Type Description
DataFrame

DataFrame with columns:

DataFrame
  • window_start, window_end, actual_parts, avg_cycle_time_s, performance_pct, loss_minutes

performance_trend ¤

performance_trend(
    cycle_uuid: str,
    target_cycle_time: float,
    *,
    window: str = "1D",
    value_column: str = "value_integer"
) -> pd.DataFrame

Track performance trend over time.

Parameters:

Name Type Description Default
cycle_uuid str

UUID of cycle trigger or counter signal.

required
target_cycle_time float

Target cycle time in seconds.

required
window str

Time window for aggregation (default '1D').

'1D'
value_column str

Column with counter values.

'value_integer'

Returns:

Type Description
DataFrame

DataFrame with columns:

DataFrame
  • period, actual_parts, avg_cycle_time_s, performance_pct, loss_minutes