Skip to content

efficiency_tracking

efficiency_tracking ¤

EnergyEfficiencyEvents ¤

EnergyEfficiencyEvents(
    dataframe: DataFrame,
    *,
    event_uuid: str = "energy:efficiency",
    time_column: str = "systime",
    uuid_column: str = "uuid"
)

Bases: Base

Energy: Efficiency Tracking

Track energy efficiency metrics against production and machine state.

Supports two data models via constructor parameters:

  • Standard (ts-shape default)::

    EnergyEfficiencyEvents(df)

    expects: systime | uuid | value_double / value_integer / value_bool¤

  • Raw CSV (time + id + value)::

    EnergyEfficiencyEvents(df, time_column="time", uuid_column="id")

    pass value_column="value" to each method¤

Methods: - efficiency_trend: Rolling efficiency metric over time. - idle_energy_waste: Detect energy consumption during idle periods. - specific_energy_consumption: Energy per unit output trend. - efficiency_comparison: Compare efficiency across shifts or periods. - normalize: Static helper to convert raw CSV format to standard schema.

normalize staticmethod ¤

normalize(
    df: DataFrame,
    *,
    series_id: str,
    time_column: str = "time",
    value_column: str = "value",
    id_column: str | None = None
) -> pd.DataFrame

Convert a raw energy DataFrame to the standard ts-shape schema.

Parameters:

Name Type Description Default
df DataFrame

Raw DataFrame.

required
series_id str

UUID to assign when no id_column is provided.

required
time_column str

Name of the timestamp column in df.

'time'
value_column str

Name of the value column in df.

'value'
id_column str | None

Optional column name whose values become the uuid.

None

Returns:

Type Description
DataFrame

DataFrame with columns: systime, uuid, value_double, is_delta

efficiency_trend ¤

efficiency_trend(
    meter_uuid: str,
    counter_uuid: str,
    *,
    energy_column: str = "value_double",
    counter_column: str = "value_integer",
    window: str = "1h",
    trend_window: int = 24
) -> pd.DataFrame

Rolling energy efficiency trend (units produced per kWh).

Parameters:

Name Type Description Default
meter_uuid str

UUID of the energy meter signal.

required
counter_uuid str

UUID of the production counter signal.

required
energy_column str

Column with energy readings.

'value_double'
counter_column str

Column with counter readings.

'value_integer'
window str

Time window for aggregation.

'1h'
trend_window int

Number of windows for rolling average.

24

Returns:

Name Type Description
DataFrame DataFrame

start, uuid, source_uuid, is_delta, energy, units, efficiency, rolling_avg_efficiency, trend_direction

idle_energy_waste ¤

idle_energy_waste(
    meter_uuid: str,
    state_uuid: str,
    *,
    energy_column: str = "value_double",
    state_column: str = "value_bool",
    window: str = "15min",
    idle_threshold: float = 0.0
) -> pd.DataFrame

Detect energy consumed during idle periods (waste).

Compares energy consumption with machine run/idle state to find windows where the machine is idle but still consuming energy.

Parameters:

Name Type Description Default
meter_uuid str

UUID of the energy meter signal.

required
state_uuid str

UUID of the boolean machine state signal (True=run).

required
energy_column str

Column with energy readings.

'value_double'
state_column str

Column with boolean state.

'value_bool'
window str

Time window for analysis.

'15min'
idle_threshold float

Energy above this during idle is waste.

0.0

Returns:

Name Type Description
DataFrame DataFrame

start, uuid, source_uuid, is_delta, energy_consumed, machine_running_pct, is_idle_waste, waste_energy

specific_energy_consumption ¤

specific_energy_consumption(
    meter_uuid: str,
    counter_uuid: str,
    *,
    energy_column: str = "value_double",
    counter_column: str = "value_integer",
    window: str = "1D"
) -> pd.DataFrame

Daily/periodic specific energy consumption (SEC = energy / output).

Lower SEC indicates better efficiency.

Parameters:

Name Type Description Default
meter_uuid str

UUID of the energy meter signal.

required
counter_uuid str

UUID of the production counter.

required
energy_column str

Column with energy readings.

'value_double'
counter_column str

Column with counter readings.

'value_integer'
window str

Time window (default daily).

'1D'

Returns:

Name Type Description
DataFrame DataFrame

start, uuid, source_uuid, is_delta, total_energy, total_output, sec, sec_trend

efficiency_comparison ¤

efficiency_comparison(
    meter_uuid: str,
    counter_uuid: str,
    *,
    energy_column: str = "value_double",
    counter_column: str = "value_integer",
    shift_definitions: dict[str, tuple] | None = None
) -> pd.DataFrame

Compare energy efficiency across shifts.

Parameters:

Name Type Description Default
meter_uuid str

UUID of the energy meter signal.

required
counter_uuid str

UUID of the production counter.

required
energy_column str

Column with energy readings.

'value_double'
counter_column str

Column with counter readings.

'value_integer'
shift_definitions dict[str, tuple] | None

Dict mapping shift name to (start_time, end_time) strings. Default: 3-shift operation.

None

Returns:

Name Type Description
DataFrame DataFrame

shift, avg_energy, avg_output, avg_efficiency, total_energy, total_output