Skip to main content
Version: 0.0.98

ts_shape.events.profiling.changeovers

Mapping-free changeover (SMED) and start-up profiling.

:class:ChangeoverProfileEvents answers which changeover step to shorten first? and :class:StartupProfileEvents how long until the machine runs normally again after a stop, and what holds it back? -- both from the raw signals of one PLC, on top of its cycle profile (:class:~ts_shape.events.profiling.cycles.CycleProfileEvents).

Changeovers A changeover is a change of the product variant the cycle profile found (the article / recipe signal). It runs from the end of the last normal cycle of the old variant to the start of the first run of ramp_cycles normal cycles of the new one, and is split into the changeover itself (until the first new cycle ends) and the ramp_up. Events much more frequent in changeovers than in running are step candidates; those present in most changeovers form the standard step sequence, ordered by their median offset. The time between consecutive steps is a segment, ranked by its potential (median - P10). A step that has also been done while the machine was still producing is tagged external_possible (SMED: it can move out of the stop).

Start-ups A start-up follows a stop (a pause cycle) or a changeover and lasts until ramp_cycles consecutive normal cycles. Each analog signal gets its running band (P10-P90 of its per-cycle mean in steady running); the time a start-up needs until a signal is back in its band, and which signal is last, shows what holds the restart back.

Classes
NameDescription
ChangeoverProfileEventsChangeovers between product variants and their standard steps.
StartupProfileEventsRestarts after stops and changeovers, and what holds them back.

ChangeoverProfileEvents​

classsource
ChangeoverProfileEvents(
dataframe: pd.DataFrame,
*,
cycle_profile: CycleProfileEvents | None = None,
signal_uuids: list[str] | None = None,
presence_ratio: float = 0.6,
ramp_cycles: int = 3,
min_changeovers: int = 5,
external_share: float = 0.2,
time_column: str = "systime",
uuid_column: str = "uuid",
event_uuid: str = "prod:changeover_profile",
**cycle_options: Any
) -> None

Bases: _UnitProfiler

Changeovers between product variants and their standard steps.

Example
>>> import ts_shape
>>> frame, truth = ts_shape.make_plc_cycles(
... n_cycles=600, seed=2, article_block=40, changeover_steps=True)
>>> co = ts_shape.ChangeoverProfileEvents(frame)
>>> int(co.evaluation_window()["unit_count"].iloc[0]) >= 10
True
Functions
NameDescription
changeover_recordsOne record per changeover.
changeover_viewThe standard step sequence of a changeover.
changeover_registerWhat each changeover segment costs: the SMED ranking.
changeover_matrixChangeover times per from -> to variant.
evaluation_windowWhether the changeover profile can be trusted, and why not.
summaryHeadline numbers (JSON-able).
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format signals of one PLC.required
cycle_profileCycleProfileEvents | NoneA computed cycle profile of the same signals to reuse; None (default) builds one.None
signal_uuidslist[str] | NoneSignals to use (default: all).None
presence_ratiofloatA step is standard when it occurs in at least this share of the changeovers.0.6
ramp_cyclesintThe changeover ends with this many consecutive normal cycles of the new variant.3
min_changeoversintFewer changeovers are not evaluable.5
external_sharefloatA step done while still producing in at least this share of the changeovers is external_possible.0.2
time_columnstrTimestamp column.'systime'
uuid_columnstrSignal column.'uuid'
event_uuidstruuid of the changeover records.'prod:changeover_profile'
**cycle_optionsAnyOptions of the cycle profile built when cycle_profile is None.{}

changeover_records​

methodsource
changeover_records() -> pd.DataFrame

One record per changeover.

Returns
TypeDescription
DataFramePoint events at the changeover end: systime, uuid,
DataFramesource_uuid (the variant signal), unit_uuid,
DataFramestart_ns, end_ns, duration_seconds, from_variant,
DataFrameto_variant, changeover_seconds (until the first new cycle
DataFrameends), ramp_up_seconds, ramp_up_cycle_count and
DataFramesteps_seen (standard steps that occurred).

changeover_view​

methodsource
changeover_view() -> pd.DataFrame

The standard step sequence of a changeover.

Returns
TypeDescription
DataFrameOne row per standard step in order: position, step (event
DataFramelabel; <signal>Δ for a changing id such as a fixture number),
DataFramepresence_ratio, median_offset_seconds (from the
DataFramechangeover start), lift_factor (vs running),
DataFrameexternal_demonstrated_ratio and step_hint
DataFrame(external_possible / internal).

changeover_register​

methodsource
changeover_register() -> pd.DataFrame

What each changeover segment costs: the SMED ranking.

The segments run from the changeover start to the first standard step, between consecutive steps, and from the last step to the end of the changeover phase; ramp_up is the time after it until normal running. A segment whose closing step did not occur is left out for that changeover.

Returns
TypeDescription
DataFrameOne row per segment: segment, unit_count,
DataFramemedian_seconds, p10_seconds, p90_seconds,
DataFramespread_seconds, mean_seconds, total_seconds,
DataFramepotential_seconds (median - P10), total_potential_seconds,
DataFramepotential_rank and step_hint of the closing step.

changeover_matrix​

methodsource
changeover_matrix() -> pd.DataFrame

Changeover times per from -> to variant.

Returns
TypeDescription
DataFramefrom_variant, to_variant, changeover_count,
DataFramemedian_seconds, p10_seconds (whole changeover incl.
DataFrameramp-up).

evaluation_window​

methodsource
evaluation_window() -> pd.DataFrame

Whether the changeover profile can be trusted, and why not.

Returns
TypeDescription
DataFrameOne row: scope (all), unit_count (changeovers),
DataFrameevaluable, reason (ok, too_few_units,
DataFrameno_candidate_signal: variant when the cycle profile found no
DataFramevariant signal, upstream_not_evaluable without cycles),
DataFrametime_resolution_seconds, variant_uuid and
DataFramestandard_step_count.

summary​

methodsource
summary() -> dict[str, Any]

Headline numbers (JSON-able).

Returns
TypeDescription
dict[str, Any]evaluable, reason, changeover_count,
dict[str, Any]median_changeover_seconds, lost_hours (sum of changeover
dict[str, Any]durations), top_segment and its top_segment_potential_seconds.

StartupProfileEvents​

classsource
StartupProfileEvents(
dataframe: pd.DataFrame,
*,
cycle_profile: CycleProfileEvents | None = None,
signal_uuids: list[str] | None = None,
ramp_cycles: int = 3,
band_quantiles: tuple[float, float] = (0.1, 0.9),
min_startups: int = 5,
time_column: str = "systime",
uuid_column: str = "uuid",
event_uuid: str = "prod:startup_profile",
**cycle_options: Any
) -> None

Bases: _UnitProfiler

Restarts after stops and changeovers, and what holds them back.

Example
>>> import ts_shape
>>> frame, truth = ts_shape.make_plc_cycles(
... n_cycles=400, seed=3, stop_causes=3, stop_probability=0.06,
... rampup_cycles=4)
>>> startups = ts_shape.StartupProfileEvents(frame)
>>> bool(startups.evaluation_window()["evaluable"].iloc[0])
True
Functions
NameDescription
startup_recordsOne record per start-up.
startup_signalsWhich signals hold the restart back.
startup_registerLost time of start-ups per trigger, ranked by potential.
evaluation_windowWhether the start-up profile can be trusted, and why not.
summaryHeadline numbers (JSON-able).
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format signals of one PLC.required
cycle_profileCycleProfileEvents | NoneA computed cycle profile of the same signals to reuse; None (default) builds one.None
signal_uuidslist[str] | NoneSignals to use (default: all).None
ramp_cyclesintA start-up ends with this many consecutive normal cycles (robust z at most :data:RAMP_MAX_Z).3
band_quantilestuple[float, float]Quantiles of a signal's per-cycle mean in steady running that bound its running band.(0.1, 0.9)
min_startupsintFewer start-ups are not evaluable.5
time_columnstrTimestamp column.'systime'
uuid_columnstrSignal column.'uuid'
event_uuidstruuid of the start-up records.'prod:startup_profile'
**cycle_optionsAnyOptions of the cycle profile built when cycle_profile is None.{}

startup_records​

methodsource
startup_records() -> pd.DataFrame

One record per start-up.

Returns
TypeDescription
DataFramePoint events at the start-up end: systime, uuid,
DataFramesource_uuid, unit_uuid, start_ns, end_ns,
DataFrameduration_seconds, trigger (pause / changeover),
DataFramevariant, startup_cycle_count, lost_seconds (cycle
DataFrametime beyond the variant median) and last_signal (the analog
DataFramesignal that was last back in its running band, or one that was
DataFramenot back before the next stop at all). A start-up ends at the
DataFramenext stop or changeover at the latest; start-ups do not overlap.

startup_signals​

methodsource
startup_signals() -> pd.DataFrame

Which signals hold the restart back.

Returns
TypeDescription
DataFrameOne row per analog signal: signal, band_low /
DataFrameband_high (running band), startup_count (start-ups in
DataFramewhich it settled), median_settle_seconds,
DataFramep90_settle_seconds, last_to_band_ratio (share of
DataFramestart-ups in which it was the last signal back in its band) and
DataFramenever_settled_count; slowest first.

startup_register​

methodsource
startup_register() -> pd.DataFrame

Lost time of start-ups per trigger, ranked by potential.

Returns
TypeDescription
DataFramefunc:~ts_shape.events.profiling._base.potential_register
DataFrameof the start-up durations per trigger, plus lost_seconds
DataFrame(cycle time beyond the median, summed).

evaluation_window​

methodsource
evaluation_window() -> pd.DataFrame

Whether the start-up profile can be trusted, and why not.

Returns
TypeDescription
DataFrameOne row: scope, unit_count (start-ups), evaluable,
DataFramereason, time_resolution_seconds and
DataFrameanalog_signal_count.

summary​

methodsource
summary() -> dict[str, Any]

Headline numbers (JSON-able).

Returns
TypeDescription
dict[str, Any]evaluable, reason, startup_count,
dict[str, Any]median_startup_cycles, lost_hours and slowest_signal.