Skip to main content

Timeseries · Manufacturing · Continuous Improvement

Turn machine signals into continuous improvement.

Manufacturing time-series analytics for pandas: events, KPIs, SPC and event logs from long-format signal data.

pip install ts-shape
  • 90+ detectors for production, quality, engineering, maintenance and energy
  • Long-format signals in (systime, uuid, value_*), plain DataFrames out
  • OCEL 2.0 / XES event logs from any result, for process mining

Questions from the plant, answered in a few lines

Five everyday plant situations: a film extrusion line, dryer temperature loops, an extruder, an injection moulding machine. The data comes from ts-shape's plant simulators, tagged and timed the way a historian logs it; every chart is real ts-shape output, and the code is under each chart.

Production · OEE

Why did film line 2 stop on Monday and Tuesday?

Two days of one extrusion line, six shifts, from its run signal, part counter and alarm tags, with no mapping of which alarm means what: 23 stops cost 6 hours and OEE was 68.9%. ts-shape finds the alarm that rises before each stop: die-pressure alarms cause 49% of the lost time (31 min per stop), web breaks 41%.

The code behind this chart
import ts_shape
from ts_shape import MachineStateEvents, OEEEvents
from ts_shape.events.profiling.stops import StopProfileEvents

# film extrusion line 2, Monday 06:00 to Wednesday 06:00 (six shifts)
df, _ = ts_shape.make_line_stops(duration="48h", start="2026-03-09 06:00",
prefix="film2", seed=3)
states = MachineStateEvents(df, run_state_uuid="film2:running").detect_run_idle()
oee = OEEEvents(df).oee(run_state_uuid="film2:running",
counter_uuid="film2:produced_count", ideal_cycle_time=8.0) # per day
stops = StopProfileEvents(df) # no alarm mapping: finds what precedes stops
causes = stops.stop_signatures() # lost time per cause
OEE and machine states →
OEE, 48 h68.9%Mon 70.1% · Tue 72.5%
Availability86.3%
Stops236.0 h lost
Top cause49%die pressure alarm
  • Die pressure alarm
  • Web break alarm
  • No alarm before it
Mon 06:00Mon 14:00Mon 22:00Tue 06:00Tue 14:00Tue 22:00Wed 06:00
Die pressure alarm2.9 h · 6 stopsWeb break alarm2.5 h · 11 stopsNo alarm before it0.6 h · 6 stops
Data: 23 stops with their cause
FromToMinutesCause (alarm rising before the stop)
Mon 06:1006:2314Web break alarm
Mon 06:5407:0814Die pressure alarm
Mon 08:3808:5113Web break alarm
Mon 09:1409:3318Die pressure alarm
Mon 10:5511:3541Die pressure alarm
Mon 13:2413:327No alarm before it
Mon 14:2514:306No alarm before it
Mon 17:4417:539Web break alarm
Mon 22:2922:4112Web break alarm
Tue 00:3200:365No alarm before it
Tue 02:3803:0931Die pressure alarm
Tue 03:4403:506No alarm before it
Tue 04:0804:146No alarm before it
Tue 05:0105:109Web break alarm
Tue 07:2207:3110Web break alarm
Tue 13:5414:0814Web break alarm
Tue 14:4715:1932Die pressure alarm
Tue 20:2320:4017Web break alarm
Tue 22:4322:495No alarm before it
Wed 00:0100:2019Web break alarm
Wed 00:5001:0818Web break alarm
Wed 01:2602:0742Die pressure alarm
Wed 05:1005:2313Web break alarm

Engineering · control loops

Which dryer temperature loops need retuning?

Hand it the raw PLC tags of the dryer: it pairs setpoint, process value and controller output itself, measures every setpoint change in the shift and diagnoses each loop. TIC-102 overshoots by 59%, TIC-103 settles in only 18% of its setpoint changes.

The code behind this chart
import ts_shape
from ts_shape import ControlLoopProfileEvents

# three dryer temperature loops, logged every 2 s over one shift
df, _ = ts_shape.make_control_loops(duration="8h", start="2026-03-10 06:00", seed=1)
loops = ControlLoopProfileEvents(df) # finds the SP / PV / OP triples itself
register = loops.loop_register() # one row per loop, with a diagnosis
Control loop health →
Loops found3no tag mapping
Need tuning2TIC-102, TIC-103
Setpoint steps assessed56
  • Process value
  • New setpoint
TIC-101 dryer zone 1well tuned0%100%0 min5 min10 minTIC-102 dryer zone 2oscillates0 min5 min10 minTIC-103 dryer zone 3sluggish0 min5 min10 min
Data: one row per loop, medians over its setpoint steps
LoopDiagnosisStepsOvershootSettle timeSteps settled
TIC-101 dryer zone 1ok132.1%207 s77%
TIC-102 dryer zone 2oscillating2158.7%94 s95%
TIC-103 dryer zone 3sluggish2247.0%529 s18%

Quality · SPC

Is the extruder melt temperature drifting before parts go out of spec?

Last week's in-control shift sets the control limits (227.1–232.8 °C). Today the melt temperature creeps up through the shift: the Nelson run rules flag the shifted mean (shaded), without a break from 10:08 on, and 49 readings end up beyond the upper limit. One call returns both, ready to alarm on.

The code behind this chart
import pandas as pd
import ts_shape
from ts_shape import StatisticalProcessControlEvents

# extruder 3 melt temperature (°C, one reading a minute): last week's
# in-control shift sets the limits, today's early shift is checked
df = pd.concat([
ts_shape.make_timeseries(["extruder3:melt_temp_baseline"], n_points=480,
freq="1min", start="2026-03-02 06:00", baseline=230, noise=1.0, seed=1),
ts_shape.make_timeseries(["extruder3:melt_temp"], n_points=480,
freq="1min", start="2026-03-10 06:00", baseline=230, noise=1.0,
drift=2.5, seed=21),
])
spc = StatisticalProcessControlEvents(df, value_column="value_double",
tolerance_uuid="extruder3:melt_temp_baseline",
actual_uuid="extruder3:melt_temp", event_uuid="extruder3:spc")
limits = spc.control_limits()
violations = spc.detect_violations()
Statistical process control →
  • Melt temperature (°C)
  • Beyond 3σ
  • Run rules flag a drift
LCL 227.1mean 230.0UCL 232.806:0007:0008:0009:0010:0011:0012:0013:00226228230232234
Data: 49 points beyond 3σ, 212 run-rule points
Time°CRule
06:17231.30rule 6
06:18229.07rule 6
06:19231.38rule 6
07:20230.62rule 2
07:26231.19rule 6
07:27231.50rule 6
07:28230.96rule 6
07:52231.47rule 6
08:06231.34rule 6
08:07231.91rule 6
08:08228.68rule 6
08:24230.97rule 6
08:25231.45rule 6
08:26230.13rule 2
08:36232.33rule 5
08:46230.15rule 2
08:47231.27rule 2
08:48230.51rule 2
08:49230.81rule 2
08:50230.95rule 2
08:51230.33rule 2
08:52231.32rule 2
08:53231.36rule 2
08:54231.33rule 2
08:55232.02rule 2
08:56230.65rule 2
09:02231.76rule 6
09:03230.84rule 6
09:06232.00rule 2
09:07230.71rule 2
09:19231.45rule 6
09:25232.13rule 5
09:26230.03rule 5
09:28231.18rule 6
09:43231.45rule 2
09:44231.14rule 2
09:53232.91rule 1 (beyond 3σ)
09:54230.92rule 5
09:55231.78rule 6
09:56233.22rule 1 (beyond 3σ)
09:57230.91rule 2
09:58230.34rule 2
09:59230.83rule 2
10:08231.03rule 6
10:10230.47rule 2
10:11231.63rule 2
10:12231.18rule 2
10:13231.65rule 2
10:14232.33rule 2
10:15232.35rule 2
10:16230.22rule 2
10:17230.49rule 2
10:18231.09rule 2
10:19231.48rule 2
10:20232.30rule 2
10:21230.40rule 2
10:22230.93rule 2
10:23231.62rule 2
10:24232.61rule 2
10:25232.76rule 2
10:26230.38rule 2
10:27231.18rule 2
10:28230.59rule 2
10:29232.25rule 2
10:30231.86rule 2
10:31231.06rule 2
10:32230.81rule 2
10:33231.72rule 2
10:34232.41rule 2
10:35230.67rule 2
10:36231.12rule 2
10:37231.56rule 2
10:38231.47rule 2
10:39231.79rule 2
10:40230.46rule 2
10:41230.87rule 2
10:52232.90rule 1 (beyond 3σ)
10:56231.52rule 6
10:57232.15rule 6
10:58232.06rule 2
10:59231.41rule 2
11:00232.89rule 1 (beyond 3σ)
11:01232.28rule 2
11:02231.85rule 2
11:03231.72rule 2
11:04231.49rule 2
11:05231.51rule 2
11:06232.26rule 2
11:07232.08rule 2
11:08231.65rule 2
11:09232.63rule 2
11:10231.36rule 2
11:11232.06rule 2
11:12232.49rule 2
11:13230.52rule 2
11:14231.38rule 2
11:15233.31rule 1 (beyond 3σ)
11:16230.69rule 2
11:17232.81rule 2
11:18230.60rule 2
11:19232.07rule 2
11:20230.61rule 2
11:21231.06rule 2
11:22231.31rule 2
11:23231.14rule 2
11:24232.70rule 2
11:25232.53rule 2
11:26232.57rule 2
11:27231.90rule 2
11:28233.35rule 1 (beyond 3σ)
11:29232.75rule 2
11:30232.05rule 2
11:31230.68rule 2
11:32232.42rule 2
11:33232.39rule 2
11:34231.84rule 2
11:35232.46rule 2
11:36232.52rule 2
11:37231.46rule 2
11:38232.33rule 2
11:39232.12rule 2
11:40232.09rule 2
11:41231.44rule 2
11:42231.32rule 2
11:43231.91rule 2
11:44233.23rule 1 (beyond 3σ)
11:45234.13rule 1 (beyond 3σ)
11:46231.44rule 2
11:47230.76rule 2
11:48231.48rule 2
11:49230.99rule 2
11:50231.41rule 2
11:51232.23rule 2
11:52230.92rule 2
11:53232.45rule 2
11:54232.64rule 2
11:55233.37rule 1 (beyond 3σ)
11:56233.68rule 1 (beyond 3σ)
11:57232.86rule 1 (beyond 3σ)
11:58234.14rule 1 (beyond 3σ)
11:59231.37rule 2
12:00232.16rule 2
12:01232.06rule 2
12:02232.33rule 2
12:03232.92rule 1 (beyond 3σ)
12:04231.58rule 2
12:05233.62rule 1 (beyond 3σ)
12:06233.19rule 1 (beyond 3σ)
12:07232.27rule 2
12:08232.39rule 2
12:09230.96rule 2
12:10229.46rule 6
12:11231.86rule 6
12:12232.27rule 6
12:13232.18rule 5
12:14230.86rule 5
12:15231.52rule 6
12:16233.72rule 1 (beyond 3σ)
12:17232.70rule 5
12:18232.60rule 5
12:19231.68rule 2
12:20232.73rule 2
12:21233.28rule 1 (beyond 3σ)
12:22232.76rule 2
12:23231.61rule 2
12:24232.30rule 2
12:25231.15rule 2
12:26231.72rule 2
12:27232.62rule 2
12:28231.51rule 2
12:29231.81rule 2
12:30233.48rule 1 (beyond 3σ)
12:31231.89rule 2
12:32232.82rule 1 (beyond 3σ)
12:33231.77rule 2
12:34230.94rule 2
12:35232.08rule 2
12:36231.72rule 2
12:37230.09rule 2
12:38230.90rule 2
12:39231.68rule 2
12:40233.57rule 1 (beyond 3σ)
12:41231.54rule 2
12:42232.08rule 2
12:43232.74rule 2
12:44232.41rule 2
12:45231.79rule 2
12:46233.82rule 1 (beyond 3σ)
12:47233.47rule 1 (beyond 3σ)
12:48229.72rule 5
12:49233.10rule 1 (beyond 3σ)
12:50232.69rule 5
12:51233.13rule 1 (beyond 3σ)
12:52232.25rule 5
12:53232.99rule 1 (beyond 3σ)
12:54234.09rule 1 (beyond 3σ)
12:55233.88rule 1 (beyond 3σ)
12:56233.96rule 1 (beyond 3σ)
12:57233.24rule 1 (beyond 3σ)
12:58233.11rule 1 (beyond 3σ)
12:59233.14rule 1 (beyond 3σ)
13:00231.10rule 2
13:01234.47rule 1 (beyond 3σ)
13:02232.45rule 2
13:03232.55rule 2
13:04232.35rule 2
13:05232.70rule 2
13:06230.14rule 2
13:07232.47rule 2
13:08230.99rule 2
13:09231.28rule 2
13:10230.42rule 2
13:11230.56rule 2
13:12232.85rule 1 (beyond 3σ)
13:13231.79rule 2
13:14232.18rule 2
13:15232.11rule 2
13:16231.14rule 2
13:17231.59rule 2
13:18231.05rule 2
13:19231.99rule 2
13:20230.10rule 2
13:21231.92rule 2
13:22233.22rule 1 (beyond 3σ)
13:23233.52rule 1 (beyond 3σ)
13:24233.46rule 1 (beyond 3σ)
13:25232.82rule 1 (beyond 3σ)
13:26231.34rule 2
13:27233.24rule 1 (beyond 3σ)
13:28232.86rule 1 (beyond 3σ)
13:29232.61rule 2
13:30231.15rule 2
13:31232.75rule 2
13:32233.77rule 1 (beyond 3σ)
13:33233.11rule 1 (beyond 3σ)
13:34232.15rule 2
13:35232.92rule 1 (beyond 3σ)
13:36232.39rule 2
13:37232.57rule 2
13:38233.23rule 1 (beyond 3σ)
13:39232.74rule 2
13:40232.48rule 2
13:41232.79rule 2
13:42231.60rule 2
13:43231.43rule 2
13:44232.91rule 1 (beyond 3σ)
13:45231.84rule 2
13:46232.99rule 1 (beyond 3σ)
13:47230.61rule 2
13:48233.63rule 1 (beyond 3σ)
13:49232.35rule 2
13:50234.11rule 1 (beyond 3σ)
13:51230.00rule 2
13:52230.79rule 2
13:53233.87rule 1 (beyond 3σ)
13:54232.63rule 2
13:55232.78rule 2
13:56232.61rule 2
13:57232.65rule 2
13:58233.03rule 1 (beyond 3σ)
13:59231.50rule 2

Energy · kWh per part

What does a moulded part cost in energy, and when is it wasted?

Injection moulding machine IMM-07 over two shifts, from its cumulative kWh meter and shot counter: a median of 0.35 kWh per part, up to 0.45 in half hours with an interruption, while the machine keeps drawing idle power. At the best half hour's rate the 996 parts would have needed 47 kWh less.

The code behind this chart
import ts_shape
from ts_shape import EnergyEfficiencyEvents
from ts_shape.utils.counters import counter_increments

# injection moulding machine IMM-07, early and late shift, two articles
df, _ = ts_shape.make_plc_cycles(n_cycles=1000, start="2026-03-10 06:00",
prefix="imm07", articles=("housing", "cover"), energy=True, seed=1)
meter = df["uuid"] == "imm07:energy_kwh" # cumulative kWh meter
df.loc[meter, "value_double"] = counter_increments(df.loc[meter, "value_double"])
sec = EnergyEfficiencyEvents(df).specific_energy_consumption(
"imm07:energy_kwh", "imm07:part_counter", window="30min")
Energy efficiency →
Median0.35 kWhper part
Best half hour0.31 kWhper part
Above best rate47 kWhof 353 kWh, 996 parts
0.250.300.350.400.450.5006:0008:0010:0012:0014:0016:000.4518:0020:00median 0.35
Data: 32 half hours
FromkWh / partPartskWh
06:000.3063912.0
06:300.3423712.6
07:000.357248.6
07:300.3812911.0
08:000.3363712.4
08:300.3463411.8
09:000.432177.4
09:300.3513612.6
10:000.3153912.3
10:300.414187.5
11:000.3703412.6
11:300.3413712.6
12:000.370217.8
12:300.3373712.5
13:000.3763412.8
13:300.339279.2
14:000.349279.4
14:300.3623512.7
15:000.3693412.5
15:300.365228.0
16:000.3173912.4
16:300.3803312.6
17:000.453156.8
17:300.3413712.6
18:000.3353812.7
18:300.359207.2
19:000.3923212.5
19:300.3343812.7
20:000.331309.9
20:300.421239.7
21:000.3843413.0
21:300.3183912.4

Data science · causality

What actually drives the dryer temperature?

A Granger test of every tag logged near the loop against its temperature, with a Bonferroni-corrected p-value: Setpoint (TIC-101 SP) and Heating valve (TIC-101 OP) drive it; the look-alikes (line speed setting, hall temperature, bypass damper) do not. Transfer entropy and lead-lag are in the same class.

The code behind this chart
import ts_shape
from ts_shape import CrossSignalAnalytics

# dryer zone 1: its temperature loop plus the other tags logged nearby
df, _ = ts_shape.make_control_loops(loops=("good",), duration="8h",
start="2026-03-10 06:00", seed=1)
signals = CrossSignalAnalytics(df) # long format in, one column per signal
tests = {c: signals.granger_causality(c, "plc:tic101_pv", max_lag=10)
for c in signals.signals if c != "plc:tic101_pv"}
Cross-signal analytics →
  • Drives the temperature (significant)
  • No effect
1101001,00010,000100,000Setpoint (TIC-101 SP)drives it, 2 s aheadHeating valve (TIC-101 OP)drives it, 2 s aheadLine speed settingno effectHall temperatureno effectBypass damperno effect
Data: Granger test of each signal against the process temperature
SignalF statisticAdjusted pBest lagCausal
Setpoint (TIC-101 SP)11,412.302 syes
Heating valve (TIC-101 OP)11,12502 syes
Line speed setting1.4112 sno
Hall temperature1.3120 sno
Bypass damper0.9116 sno