Live streams

Cycles

Cut any data into cycles and phases with limits and KPIs, have the collector cut any stream 24/7 and email when one runs late, and compare runs against a reference.

A cycle is one run of the process (a batch, a start-up, a test cycle, a shift, a lap), and a phase is a stretch inside each cycle. This page shows how to cut any dataset into cycles, keep KPIs for each, have the collector cut them 24/7 and email when one runs late, and build a reference from good runs to compare runs against it.

Cycles, phases and limits

A rule says where a cycle starts and where it ends. A phase rule does the same inside each cycle (Heating from the start of the batch until the temperature reaches 30 °C). Starts and ends are built from these:

Building blockExamples
A tag changes, or crosses a valueA batch number changes; a pressure rises through 2.5 bar.
A counter starts overA lap distance or a cycle counter goes back to zero.
A condition, held for a whileTIC201 ≥ 80 and PIC102 ≥ 2.0 for at least 5 min. All of or any of several conditions.
TimeShifts at 06:00, 14:00 and 22:00; 15 min after the start.
The cycle itself (phases)From the start of the cycle; until the cycle ends.
The next startCycles that run back to back: each one ends where the next begins.

Limits flag a cycle or phase without ever dropping it: late (not over within a time from the cycle’s start), too long and too short. Flags show in the tables and can email someone (see Cycles in the collector).

KPIs: a cycle’s duration always, and per tag any of minimum, maximum, mean, integral, first value, last value and change (last minus first). The mean is the plain mean of the samples; the integral is value × seconds, so a flow in kg/s integrates to kg.

Cut any dataset into cycles

  1. Load the data: a file, a folder, a live stream, or a recording from Cloud.
  2. In Data, click the dataset’s Cycles button. The library on the left lists your rules: Personal ones first, then one group per project. Click a rule to use it, or Create new cycle to write one; it is listed at once as Not saved yet.
  3. In Cycle, give it a name and choose its Value to compare, shown beside each cycle: its duration, or a channel’s change, mean, maximum or minimum over the cycle (the energy used, the peak temperature).
  4. In Start and End, each condition is a card: a channel changes, starts over, rises or falls through a value, or compares with a value; a fixed time has passed; the next cycle starts. + Add condition adds another, and All hold or Any holds joins them. Held at least keeps a comparison from firing on a blip.
  5. Add limits and KPIs if you need them, and + Phase for a phase inside each cycle. The Preview on the right redraws the cycles this data gives as you edit.
  6. Click Show N cycles. The cycles appear under the dataset, each with its value and flags; the arrow beside a cycle shows its phases. Tick the ones to plot: each has a Cycle time column (seconds since its start), so set it as X to lay the runs over each other.

A rule measures time with the dataset’s own time column (a column named like Time first). Remove cycles puts the dataset back as one.

A rule keeps the channels it names even when the data open doesn’t have them, like a multiband chart’s signals: they stay in their fields, marked Not in the loaded data, and work again with data that has them.

A live stream works the same: its Cycles button cuts it as it streams, and each cycle appears under the stream when it ends, with the running one last.

A file whose channel starts over each cycle (a lap distance, a cycle counter) opens a new rule on that channel already filled in.

The library

Save to library keeps the rule, with its phases and its value to compare, in the place chosen under Saved in. A Personal rule is yours alone and follows you to any workbook and any browser. A rule saved in a project is there for everyone in the project (encrypted with the project’s key when the project is end-to-end encrypted): editors and leads save them, and the author or a lead changes or deletes them. Workbooks never keep rules or cycles. Show N cycles also works without saving, to try a rule out.

The Cycles library

Cycles library, on the left sidebar, is where rules are made, changed and deleted without opening any data, like math channels. Use it to write the rule for a line before it sends anything.

  1. Click Cycles library, then Create new cycle, or click a rule in the list to change it.
  2. Type the channel names in the conditions, the KPIs and Value to compare (empty shows the duration). Suggest channels from offers the names of a dataset you opened or of a project’s Cloud source as you type; Nothing leaves every name to you.
  3. Pick Saved in and click Save to library. The trash icon beside a rule deletes it with its phases.

The library only keeps rules; it doesn’t cut anything, since it isn’t tied to any data. Use a rule from a dataset’s or a live stream’s Cycles button, or under Cycle in Reports & analysis.

Cycles in the collector (24/7)

Cycles that must be cut with no browser open go in the collector’s cycles: section (collector 2.0). Each rule watches one stream of the collector, mode: live or mode: record, and runs on its values as they arrive, watched or not. A rule never changes what the stream records: that is its own mode.

collector.yaml
cycles:
  - source: Customer A DCS         # a stream of this collector, live or record
    name: Batch                    # shown in the app; its id is the name in lowercase unless you give id:
    start: BatchNumber changes
    end: next-start
    at_most: 4h                    # longer is flagged "too long"
    phases:                        # optional; each phase lives inside its cycle
      - name: Heating
        start: parent-start
        end: TIC201 >= 30
        expected_within: 15min     # from the cycle's start; later is flagged "late"
      - name: Reaction
        start: {all: [TIC201 >= 80, PIC102 >= 2.0]}
        min_hold: 5min             # both held 5 min before it starts
        end: {any: [TIC201 < 75, parent-end]}

  - source: Customer A DCS
    name: Shift
    start: {at: ["06:00", "14:00", "22:00"]}   # in the machine's time zone (TZ in Docker)
    end: next-start

alerts:                            # optional: an email when a cycle or phase misses a limit
  email: shift.lead@customer.example
  severity: {late: critical}       # optional: info, warning or critical, one for all or per flag (default warning)
  # smtp: {host: mail.customer.local, port: 587, user: kymoscope, password: "file:smtp.txt", from: kymoscope@customer.local}
KeyMeaning
sourceRequired. The name of a stream in this collector.yaml.
nameThe name of the cycle: its live channels and alert emails use it. Its id is the name in lowercase, or id:.
startRequired. BatchNumber changes · LapDistance starts over · PIC102 rises through 2.5 (or falls through) · a condition such as TIC201 >= 30 · {all: [...]} / {any: [...]} · {at: ["06:00"]} · in a phase, parent-start.
endRequired. next-start (back to back) · a condition · {after: 10min} · {all: [...]} / {any: [...]} · in a phase, parent-end.
min_holdA start condition must hold this long before the cycle starts.
ignore_dipsAn end condition must hold this long before the cycle ends, so a short dip keeps it going.
expected_withinOver within this time, from the cycle’s start (a phase) or from its own start (from: start); later is flagged late.
at_mostLonger is flagged too long.
at_leastShorter is flagged too short.
phasesA list of phase rules with the same keys (not source, not phases).

Durations are written 500ms, 30s, 15min, 4h, or a plain number of seconds. Clock rules (at:) use the machine’s time zone; in Docker set TZ.

  • Restart the collector after changing the section.
  • The live stream carries Batch.number, Batch.start (Unix seconds) and, with phases, Batch.phase (1 for the first phase in collector.yaml, 0 between phases), so a chart or an alert can follow the running cycle. On a mode: record stream they are recorded with the other channels.
  • The collector uploads no cycles. To list, flag and compare them later, record the stream and apply the same rule to its recordings in Reports & analysis.
  • A cycle open when the collector stops starts again at the next start.
  • A stream takes at most 50 cycle and phase rules.

Alerts

With alerts:, the collector emails when a cycle or phase is flagged, with nobody’s browser open. email takes one address or a list; on picks the flags (late, too-long, too-short; all three by default); severity sets how serious each one is: info, warning or critical, one level for every flag (severity: critical) or one per flag (severity: {late: critical, too-long: warning}). Flags left out are warnings.

  • Through Kymoscope (no smtp): the email names the rule, the flag, its severity, the stream and the times, never a value, and the flag is kept in the alert history (the project’s Alerts tab; a personal stream’s: its owner’s History in the Alerts panel), marked Collector, where any member can acknowledge it with a note. It reaches only members of the stream’s project (a personal stream: its owner); the collector’s log names any address that isn’t one. Included on Team and Enterprise, up to 120 emails an hour per stream.
  • Through your own mail server (smtp: host, port, user, password, from, security: starttls, ssl or none): the collector sends it directly, its subject starting with the severity, and Kymoscope sees nothing. Write the password as file:smtp.txt or env:SMTP_PASSWORD.

Flags and notes

In Reports & analysis, select cycles and click Mark good, Mark bad… or Exclude… (Clear flag undoes it). Bad and excluded ask for a Reason, so the next reader knows why; hover a flag to read it. Step 1 of the analysis can leave bad and excluded cycles out. Missed limits (late, too long, too short) show in the Flags column too.

Kymoscope keeps an audit record of who created, flagged, noted and versioned what, and when. It records that a note changed, never what it says.

Reports & analysis

Reports & analysis applies a cycle to every sender’s recordings in a project: pick the project and the dates, press Cycles, then pick days in the calendar and the files to open or to report on. See Reports.

Live: follow the running cycle

A live stream’s Cycles button cuts it with a rule as it streams, and each cycle appears under the stream when it ends. To see the running cycle against a Reference, import the Reference with its band from Reports & analysis and lay the stream over it.

On any live multi-band chart, Follow the running cycle (Properties → Live streaming) shows only the running cycle when the X signal starts over, over a dataset or the previous cycle.

Automation

Export CSV (Reports & analysis) writes a rule’s cycles in range as CSV: start and end in ISO 8601 UTC, duration_s, flag, reason, then one column per KPI. It reads directly in pandas:

pandas
import pandas as pd
t = pd.read_csv("Batch.csv", parse_dates=["start", "end"])   # start, end (UTC), duration_s, flag, reason, KPIs
good = t[t.flag == "good"]
print(good["TIC201 max"].describe())
print(t.groupby(t.start.dt.date)["duration_s"].mean())

Your own web app can cut, align and compare with the SDK, with the same rule language the app and the collector use: CycleSet finds cycles and phases, engine.datasets.findCycles and addCycles do it on an open dataset, alignSegment, buildReference and compareToReference line runs up and compare them.

TypeScript
import { CycleSet, findCycles, cycleTables, readSource, alignSegment, buildReference, compareToReference } from '@kymoscope/sdk'

// The same rule language as the app and the collector: a cycle, and a phase inside it.
const defs = [
  { id: 'batch', parentId: null, rule: { start: { kind: 'change', channel: 'BatchNumber' }, end: { kind: 'next-start' } } },
  { id: 'heat', parentId: 'batch', rule: { start: { kind: 'parent-start' },
    end: { kind: 'compare', channel: 'TIC201', op: '>=', value: 30 }, limits: { expectedWithin_s: 900 } } },
]
// t: Unix seconds; cols: your columns by channel name (Float64Array each).
const found = new CycleSet(defs).feed(t, (c) => cols[c])     // closed cycles and phases: { definitionId, index, tstart, tend, flags }

// Each cycle's samples on one axis (time since start), then a reference from the good ones.
const axis = { kind: 'elapsed' } as const
const aligned = good.map((s) => alignSegment(s.t, s.cols, s.tstart, axis))
const ref = buildReference(aligned, ['TIC201', 'PIC102'], 2000)
const { delta, score, deviations } = compareToReference(alignSegment(n.t, n.cols, n.tstart, axis), ref, 3, 'sigma', 10)

Who can do what

  • Viewers of the project read every rule, cycle, note and reference, compare and watch live.
  • Editors and leads create rules, cut a source with a cycle, flag, note, build references and save deviations, and save project rules.
  • The author of a rule or reference, or a project lead, edits or archives it.
  • The collector’s rules live only in its collector.yaml.
  • When the project requires two-step verification or browser approval, saving needs them too.
MessageWhat to do
The project key isn’t available on this browser. Approve this browser in the project, or the project key was regenerated.Ask a project member to approve this browser; if it already is, ask a project lead.
Waiting for this project’s key. A teammate’s browser shares it within a minute.A project rule of an end-to-end encrypted project needs the project’s key on this browser; wait a minute and save again.

Privacy

Project rules of an end-to-end encrypted project are encrypted with the project’s key in the browser before they are stored. Cycles of a file, a recording or a live stream are cut in your browser, and the collector’s on its own machine; the Kymoscope server never sees the values. Alert emails sent through Kymoscope name the rule, the flag, the stream and the times, never a value.