continuous_process_alignment
continuous_process_alignment ¤
Continuous-process alignment: transport-lag compensation for multi-station lines.
ContinuousProcessAlignmentEvents ¤
ContinuousProcessAlignmentEvents(
dataframe: DataFrame,
speed_uuid: str,
line_config: list[dict],
*,
ref_uuid: str | None = None,
cut_uuid: str | None = None,
time_column: str = "systime",
uuid_column: str = "uuid",
value_column: str = "value_double",
speed_unit: str = "m/min",
min_speed: float = 0.01
)
Bases: Base
Align multi-station readings on a continuous production line.
Readings are shifted to a common material reference time via speed-based transport lag compensation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataframe
|
DataFrame
|
Long-format DataFrame with |
required |
speed_uuid
|
str
|
UUID of the line-speed signal. |
required |
line_config
|
list[dict]
|
Physical layout description — list of dicts with keys
|
required |
ref_uuid
|
str | None
|
Deprecated; has no effect and will be removed in the next major release
(passing it emits a DeprecationWarning). Put a reference-point
signal into |
None
|
cut_uuid
|
str | None
|
Optional UUID whose values carry the cut piece length in
meters. Used by |
None
|
time_column
|
str
|
Name of the timestamp column (default |
'systime'
|
uuid_column
|
str
|
Name of the UUID/identifier column (default |
'uuid'
|
value_column
|
str
|
Value column of the speed signal, and the default
station value column when no override is supplied to a method
(default |
'value_double'
|
speed_unit
|
str
|
Unit of the speed signal. One of |
'm/min'
|
min_speed
|
float
|
Minimum speed in m/s used to clamp the speed before
computing lag, preventing infinite lag at standstill (default
|
0.01
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
align_to_reference ¤
align_to_reference(
station_uuids: list[str] | None = None,
*,
value_column: str | None = None
) -> pd.DataFrame
Shift each station reading backward by its transport lag.
This produces a common material_ref_time for all stations:
systime - offset / speed, with the most recent valid speed reading
at each station sample (missing speed values are skipped; samples
before the first speed reading use the first one), clamped to at
least min_speed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_uuids
|
list[str] | None
|
Subset of UUIDs to process. Defaults to all UUIDs in
|
None
|
value_column
|
str | None
|
Value column to carry through. Defaults to the
constructor |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |
segment_by_cut ¤
segment_by_cut(
aligned_df: DataFrame,
*,
cut_length_uuid: str | None = None,
part_counter_uuid: str | None = None,
value_column_cut: str = "value_double",
handle_resets: bool = True
) -> pd.DataFrame
Add piece columns to the output of align_to_reference.
Adds piece_id, piece_length_m, and piece_cut_ref_time to
aligned_df.
Cut-event detection strategies (in priority order):
part_counter_uuid(boolean): each True row = 1 cut.part_counter_uuid(integer/float): each step where the counter increases bydeltacounts asdeltacuts, all attributed to the same timestamp when the signal resolution is coarser than the cut rate. The first reading is the baseline; missing readings are gaps.cut_length_uuidonly: each row of the length signal = 1 cut.
Each cut time is shifted back to the reference point by the cutter's
own transport lag (when the cutter's uuid is in line_config), the
same way align_to_reference shifts station readings.
Piece assignment: a cut finishes the piece whose material passed the
reference point since the previous cut. Rows with material_ref_time
in (previous cut, this cut] get this cut's piece_id; rows up to
and including the first cut belong to piece 1; rows after the last
cut are not cut yet and get piece_id piece_length_m NaN
and piece_cut_ref_time NaT. Pieces cut at the same instant (a
counter step > 1) share one boundary, so the material goes to the
first of them and the others have no rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aligned_df
|
DataFrame
|
Output of |
required |
cut_length_uuid
|
str | None
|
UUID carrying the cut piece length value.
Defaults to the constructor |
None
|
part_counter_uuid
|
str | None
|
UUID of a part-counter signal (boolean or monotonically increasing integer). |
None
|
value_column_cut
|
str
|
Column holding the length value in
|
'value_double'
|
handle_resets
|
bool
|
When True (default) and a numeric |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither |
lag_profile ¤
lag_profile(
station_uuids: list[str] | None = None,
*,
window: str = "1min"
) -> pd.DataFrame
Compute per-window mean lag for each station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_uuids
|
list[str] | None
|
Subset of UUIDs to process. Defaults to all UUIDs in
|
None
|
window
|
str
|
Pandas resample frequency for the speed averaging window
(default |
'1min'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |
alignment_quality ¤
alignment_quality(
station_uuids: list[str] | None = None,
*,
window: str = "1h"
) -> pd.DataFrame
Coverage check: sample counts per window for speed and each station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_uuids
|
list[str] | None
|
Subset of UUIDs to check. Defaults to all UUIDs in
|
None
|
window
|
str
|
Pandas resample frequency for the counting window (default
|
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns |