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.
| Name | Description |
|---|---|
ChangeoverProfileEvents | Changeovers between product variants and their standard steps. |
StartupProfileEvents | Restarts after stops and changeovers, and what holds them back. |
ChangeoverProfileEvents
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
| Name | Description |
|---|---|
changeover_records | One record per changeover. |
changeover_view | The standard step sequence of a changeover. |
changeover_register | What each changeover segment costs: the SMED ranking. |
changeover_matrix | Changeover times per from -> to variant. |
evaluation_window | Whether the changeover profile can be trusted, and why not. |
summary | Headline numbers (JSON-able). |
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format signals of one PLC. | required |
cycle_profile | CycleProfileEvents | None | A computed cycle profile of the same signals to reuse; None (default) builds one. | None |
signal_uuids | list[str] | None | Signals to use (default: all). | None |
presence_ratio | float | A step is standard when it occurs in at least this share of the changeovers. | 0.6 |
ramp_cycles | int | The changeover ends with this many consecutive normal cycles of the new variant. | 3 |
min_changeovers | int | Fewer changeovers are not evaluable. | 5 |
external_share | float | A step done while still producing in at least this share of the changeovers is external_possible. | 0.2 |
time_column | str | Timestamp column. | 'systime' |
uuid_column | str | Signal column. | 'uuid' |
event_uuid | str | uuid of the changeover records. | 'prod:changeover_profile' |
**cycle_options | Any | Options of the cycle profile built when cycle_profile is None. | {} |
changeover_records
changeover_records() -> pd.DataFrame
One record per changeover.
| Type | Description |
|---|---|
DataFrame | Point events at the changeover end: systime, uuid, |
DataFrame | source_uuid (the variant signal), unit_uuid, |
DataFrame | start_ns, end_ns, duration_seconds, from_variant, |
DataFrame | to_variant, changeover_seconds (until the first new cycle |
DataFrame | ends), ramp_up_seconds, ramp_up_cycle_count and |
DataFrame | steps_seen (standard steps that occurred). |
changeover_view
changeover_view() -> pd.DataFrame
The standard step sequence of a changeover.
| Type | Description |
|---|---|
DataFrame | One row per standard step in order: position, step (event |
DataFrame | label; <signal>Δ for a changing id such as a fixture number), |
DataFrame | presence_ratio, median_offset_seconds (from the |
DataFrame | changeover start), lift_factor (vs running), |
DataFrame | external_demonstrated_ratio and step_hint |
DataFrame | (external_possible / internal). |
changeover_register
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.
| Type | Description |
|---|---|
DataFrame | One row per segment: segment, unit_count, |
DataFrame | median_seconds, p10_seconds, p90_seconds, |
DataFrame | spread_seconds, mean_seconds, total_seconds, |
DataFrame | potential_seconds (median - P10), total_potential_seconds, |
DataFrame | potential_rank and step_hint of the closing step. |
changeover_matrix
changeover_matrix() -> pd.DataFrame
Changeover times per from -> to variant.
| Type | Description |
|---|---|
DataFrame | from_variant, to_variant, changeover_count, |
DataFrame | median_seconds, p10_seconds (whole changeover incl. |
DataFrame | ramp-up). |
evaluation_window
evaluation_window() -> pd.DataFrame
Whether the changeover profile can be trusted, and why not.
| Type | Description |
|---|---|
DataFrame | One row: scope (all), unit_count (changeovers), |
DataFrame | evaluable, reason (ok, too_few_units, |
DataFrame | no_candidate_signal: variant when the cycle profile found no |
DataFrame | variant signal, upstream_not_evaluable without cycles), |
DataFrame | time_resolution_seconds, variant_uuid and |
DataFrame | standard_step_count. |
summary
summary() -> dict[str, Any]
Headline numbers (JSON-able).
| Type | Description |
|---|---|
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
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
| Name | Description |
|---|---|
startup_records | One record per start-up. |
startup_signals | Which signals hold the restart back. |
startup_register | Lost time of start-ups per trigger, ranked by potential. |
evaluation_window | Whether the start-up profile can be trusted, and why not. |
summary | Headline numbers (JSON-able). |
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format signals of one PLC. | required |
cycle_profile | CycleProfileEvents | None | A computed cycle profile of the same signals to reuse; None (default) builds one. | None |
signal_uuids | list[str] | None | Signals to use (default: all). | None |
ramp_cycles | int | A start-up ends with this many consecutive normal cycles (robust z at most :data:RAMP_MAX_Z). | 3 |
band_quantiles | tuple[float, float] | Quantiles of a signal's per-cycle mean in steady running that bound its running band. | (0.1, 0.9) |
min_startups | int | Fewer start-ups are not evaluable. | 5 |
time_column | str | Timestamp column. | 'systime' |
uuid_column | str | Signal column. | 'uuid' |
event_uuid | str | uuid of the start-up records. | 'prod:startup_profile' |
**cycle_options | Any | Options of the cycle profile built when cycle_profile is None. | {} |
startup_records
startup_records() -> pd.DataFrame
One record per start-up.
| Type | Description |
|---|---|
DataFrame | Point events at the start-up end: systime, uuid, |
DataFrame | source_uuid, unit_uuid, start_ns, end_ns, |
DataFrame | duration_seconds, trigger (pause / changeover), |
DataFrame | variant, startup_cycle_count, lost_seconds (cycle |
DataFrame | time beyond the variant median) and last_signal (the analog |
DataFrame | signal that was last back in its running band, or one that was |
DataFrame | not back before the next stop at all). A start-up ends at the |
DataFrame | next stop or changeover at the latest; start-ups do not overlap. |
startup_signals
startup_signals() -> pd.DataFrame
Which signals hold the restart back.
| Type | Description |
|---|---|
DataFrame | One row per analog signal: signal, band_low / |
DataFrame | band_high (running band), startup_count (start-ups in |
DataFrame | which it settled), median_settle_seconds, |
DataFrame | p90_settle_seconds, last_to_band_ratio (share of |
DataFrame | start-ups in which it was the last signal back in its band) and |
DataFrame | never_settled_count; slowest first. |
startup_register
startup_register() -> pd.DataFrame
Lost time of start-ups per trigger, ranked by potential.
| Type | Description |
|---|---|
DataFrame | func:~ts_shape.events.profiling._base.potential_register |
DataFrame | of the start-up durations per trigger, plus lost_seconds |
DataFrame | (cycle time beyond the median, summed). |
evaluation_window
evaluation_window() -> pd.DataFrame
Whether the start-up profile can be trusted, and why not.
| Type | Description |
|---|---|
DataFrame | One row: scope, unit_count (start-ups), evaluable, |
DataFrame | reason, time_resolution_seconds and |
DataFrame | analog_signal_count. |
summary
summary() -> dict[str, Any]
Headline numbers (JSON-able).
| Type | Description |
|---|---|
dict[str, Any] | evaluable, reason, startup_count, |
dict[str, Any] | median_startup_cycles, lost_hours and slowest_signal. |