line_balancing
line_balancing ¤
Line balancing and takt analysis for assembly / production lines.
Classic industrial-engineering line-balancing metrics computed from per-station cycle-completion signals:
- station cycle times (windowed),
- line balance efficiency, balance delay and smoothness index,
- theoretical minimum number of stations for a given takt,
- a Yamazumi (station-loading) table.
A station is identified by a boolean cycle-completion-trigger signal; the time between consecutive rising edges is that station's cycle time.
LineBalancingEvents ¤
LineBalancingEvents(
dataframe: DataFrame,
station_uuids: dict[str, str],
*,
event_uuid: str = "prod:line_balance",
value_column: str = "value_bool",
time_column: str = "systime"
)
Bases: Base
Line balancing and takt analysis from per-station cycle signals.
Example usage::
lb = LineBalancingEvents(
df,
station_uuids={
"uuid_s1": "Station 1",
"uuid_s2": "Station 2",
"uuid_s3": "Station 3",
},
)
lb.station_cycle_times(window="1h")
lb.balance_metrics(takt_time="55s", window="1h")
lb.yamazumi(demand=480, available_time="8h")
Initialize the line-balancing analyser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataframe
|
DataFrame
|
Input DataFrame with timeseries data. |
required |
station_uuids
|
dict[str, str]
|
Mapping of cycle-completion-trigger UUID -> station
name, in line order, e.g. |
required |
event_uuid
|
str
|
UUID to tag derived events with. |
'prod:line_balance'
|
value_column
|
str
|
Column holding the boolean cycle trigger. |
'value_bool'
|
time_column
|
str
|
Name of the timestamp column. |
'systime'
|
station_cycle_times ¤
station_cycle_times(window: str = '1h') -> pd.DataFrame
Per-station cycle-time statistics per time window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window (e.g. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary-shape DataFrame with columns: start, end, duration_seconds, |
DataFrame
|
uuid, station_name, cycle_time_mean, cycle_time_median, |
DataFrame
|
cycle_time_std, cycle_count. |
balance_metrics ¤
balance_metrics(
*,
takt_time: _Number | None = None,
demand: float | None = None,
available_time: _Number | None = None,
window: str = "1h"
) -> pd.DataFrame
Line-level balance metrics per time window.
Balance efficiency = sum(station times) / (n_stations * bottleneck).
Takt is resolved from takt_time or from demand plus
available_time; when neither is given, theoretical_min_stations
is NaN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
takt_time
|
_Number | None
|
Takt time as seconds or an offset string (e.g. "55s"). |
None
|
demand
|
float | None
|
Units required over |
None
|
available_time
|
_Number | None
|
Available production time (seconds or offset string). |
None
|
window
|
str
|
Resample window. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary-shape DataFrame with columns: start, end, duration_seconds, |
DataFrame
|
n_stations, bottleneck_uuid, bottleneck_cycle_time, takt_seconds, |
DataFrame
|
balance_efficiency_pct, balance_delay_pct, smoothness_index, |
DataFrame
|
theoretical_min_stations. |
yamazumi ¤
yamazumi(
*,
takt_time: _Number | None = None,
demand: float | None = None,
available_time: _Number | None = None
) -> pd.DataFrame
Yamazumi (station-loading) table over the whole dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
takt_time
|
_Number | None
|
Takt time as seconds or an offset string. |
None
|
demand
|
float | None
|
Units required over |
None
|
available_time
|
_Number | None
|
Available production time (seconds or offset string). |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: uuid, station_name, cycle_time_mean, |
DataFrame
|
takt_seconds, loading_pct, idle_to_takt_seconds, is_bottleneck. |
DataFrame
|
Stations are returned in the order given to the constructor. |