runtime_accounting
runtime_accounting ¤
Runtime / operating-hours accounting for equipment.
Computes operating-time metrics from a single boolean run signal:
- total run time, idle time and utilization,
- equipment start count and longest continuous run,
- run time per calendar window,
- a cumulative operating-hours meter (like a physical hour meter).
Per-sample duration is the gap to the next sample, summed over True
samples -- the same approach as OEECalculator.calculate_availability.
This is distinct from DutyCycleEvents (duty percentage and cycle
counts): here the focus is absolute run time and an hour-meter reading.
RuntimeAccountingEvents ¤
RuntimeAccountingEvents(
dataframe: DataFrame,
run_uuid: str,
*,
event_uuid: str = "prod:runtime",
value_column: str = "value_bool",
time_column: str = "systime"
)
Bases: Base
Operating-hours accounting from one boolean run signal.
Example usage::
rt = RuntimeAccountingEvents(df, run_uuid="machine:running")
rt.runtime_summary()
rt.runtime_per_window(window="1D")
rt.operating_hours_meter(window="1h")
Initialize the runtime-accounting analyser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataframe
|
DataFrame
|
Input DataFrame with timeseries data. |
required |
run_uuid
|
str
|
UUID of the boolean run-state signal (True = running). |
required |
event_uuid
|
str
|
UUID to tag derived events with. |
'prod:runtime'
|
value_column
|
str
|
Column holding the boolean run state. |
'value_bool'
|
time_column
|
str
|
Name of the timestamp column. |
'systime'
|
runtime_summary ¤
runtime_summary() -> pd.DataFrame
Overall operating-time summary across the whole dataset.
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary-shape DataFrame (one row) with columns: start, end, |
DataFrame
|
duration_seconds, run_seconds, run_hours, idle_seconds, |
DataFrame
|
start_count, longest_run_seconds, mean_run_seconds, |
DataFrame
|
utilization_pct. |
runtime_per_window ¤
runtime_per_window(window: str = '1D') -> pd.DataFrame
Run time per calendar window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window (e.g. |
'1D'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary-shape DataFrame with columns: start, end, duration_seconds, |
DataFrame
|
run_seconds, run_hours, start_count, utilization_pct. |
operating_hours_meter ¤
operating_hours_meter(window: str = '1h') -> pd.DataFrame
Cumulative operating-hours meter, sampled per window.
Mirrors a physical equipment hour meter: a monotonically increasing total of run hours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window for the meter readings. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary-shape DataFrame with columns: start, end, duration_seconds, |
DataFrame
|
run_seconds, cumulative_run_hours. |