ChangeoverEvents¤
Product or recipe changes as point events, and changeover windows that end after a fixed time or once process metrics are stable again, from a product/recipe signal.
ts_shape.events.production.changeover · Production guide · API reference
Example¤
import ts_shape
from ts_shape.events.production.changeover import ChangeoverEvents
df = ts_shape.make_id_signal("line1:product", ["SKU-A", "SKU-B", "SKU-A"], hold=120, freq="1min")
co = ChangeoverEvents(df)
print(co.detect_changeover(product_uuid="line1:product", include_initial=False))
windows = co.changeover_window(product_uuid="line1:product", until="fixed_window",
config={"duration": "10min"})
metrics = co.changeover_quality_metrics(product_uuid="line1:product")
Methods¤
| Method | Returns |
|---|---|
detect_changeover(product_uuid, min_hold='0s', include_initial=True) |
point events: systime, new_value |
changeover_window(product_uuid, until='fixed_window', config=None, fallback=None) |
one window per change: start, end, duration_seconds, method, completed |
changeover_quality_metrics(product_uuid) |
per product: changeover_count, avg_/min_/max_/std_time_between_seconds |
Notes¤
include_initial=True(default) emits the first reading as a changeover. PassFalseto report only real value changes.min_hold: the new product must persist at least this long to count.until="fixed_window"ends the window atstart + config["duration"](default10min).until="stable_band"ends it when every metric inconfig["metrics"]({"uuid", "value_column", "band", "hold"}) stays withinbandof its reference forhold; the reference isconfig["reference_method"]:expanding_median,rolling_mean(rolling_windowpoints),ewma(ewma_span) ortarget_value(target_values).- If the end cannot be found,
fallbackapplies (default{"default_duration": "10min", "completed": False}), and itscompletedvalue is copied to the output. changeover_quality_metricsmeasures how often and how far apart changeovers to each product occur, not how long they take; it is empty with fewer than two changeovers.