# OEE and downtime reference

> The facts of OEE and downtime (Pro and Enterprise) in one place - the production config.yaml section with every key, default and range, the seven rights and their defaults, the HTTP routes under /api/production with methods, rights, API tokens, the per-machine read rule and the order of the refusals, error codes, the configuration documents and their limits, the dataset family production (relations, columns, helpers, the quality save rule), the open_downtime screen action, audit events, the system alarm and the metrics.

Product: eaxScada · Type: Reference · Editions: Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/reference/oee-and-downtime/
Verified against commit 041a1be.

OEE and downtime is part of eaxScada **Pro and Enterprise** (edition feature `production`), not Starter and not Free. It reads the historian and never writes to equipment. Concepts: [OEE and downtime](/docs/eaxscada/explanation/oee-and-downtime/). Set-up: [Set up OEE and downtime](/docs/eaxscada/how-to/set-up-oee-and-downtime/).

## Configuration: `production:`

Server configuration (`config.yaml`), on each server. Off by default. Every value is checked at start; **a refused value keeps the whole module off** (the server starts, the log says "OEE and downtime not started: refused configuration").

```yaml
production:
  enabled: true
  backfill_days: 30
  settle: 2s
  write_interval: 10s
  hook_queue: 65536
  retention:
    intervals: 400d
  duckdb:
    memory_limit: 512MB
```

| Key | Default | Allowed | Meaning |
|---|---|---|---|
| `production.enabled` | `false` | `true`, `false` | Run the module on this server. Off: nothing starts and nothing is created. |
| `production.backfill_days` | `30` | 0 to 400 | How far back a machine without stored results is computed from the history. |
| `production.settle` | `2s` | 100 ms to 60 s | Results are final up to now minus this. |
| `production.write_interval` | `10s` | 1 s to 10 min | How often final results are written. |
| `production.hook_queue` | `65536` | 1,024 to 16,777,216 | Logged points of source tags buffered between two takes (every 100 ms). When full, the machines of the points not kept are recomputed from the historian; the historian never waits. |
| `production.retention.intervals` | `400d` | at least `1d` | How long state intervals (and count notes) are kept. Downtime events and slices are kept. |
| `production.duckdb.memory_limit` | empty: 512 MiB | empty, or a size of at least 64 MB | Memory cap of `production.duckdb`. Past it the store spills to disk (`production.duckdb.tmp`, next to the file). The store runs one thread per 64 MiB of the cap, at most every core: 8 threads at the default (before, every core). [Memory caps of the stores](/docs/eaxscada/explanation/historian/#memory-caps-of-the-stores) |

Durations take `ms`, `s`, `m`, `h`, `d`, `w` and `y` (`400d`); sizes take `MB`, `GB`... (powers of 1,024).

The module runs when `production.enabled` is `true`, the licence includes `production` **at start-up**, the section is valid and the historian has its columnar store; the service starts at the first machine. Its files: `data/production/production.duckdb` (results; encrypted at rest like the historian when `historian.tde_encryption` is on) and `data/production/config/` (the configuration documents, also in the HA configuration store and in project checkpoints). The shift calendars come from `reports.shifts`, the site clock from `site.time_zone`.

The generated list of keys: [Server configuration](/docs/eaxscada/reference/generated/config/server-config/).

## Rights

Feature rules (Target Type **SCADA Feature**, pattern the right's name or `feature:<right>`):

| Right | Lets a person | Default rule on a new installation |
|---|---|---|
| `production_view` | See the downtime panel, the OEE figures and the production datasets | Shift_Operator, Process_Supervisor, Lead_Engineer |
| `production_reason` | Enter and change reasons while the shift is open | Shift_Operator, Process_Supervisor, Lead_Engineer |
| `production_reason_closed` | Change reasons after the shift closed (with an e-signature) | Process_Supervisor, Lead_Engineer |
| `production_plan` | Add, change and remove planned stops | Process_Supervisor, Lead_Engineer |
| `production_counts` | Adjust counts | Process_Supervisor, Lead_Engineer |
| `production_configure` | Machines, reason codes, plans, ideal cycles, settings, historian logging | Lead_Engineer |
| `production_recompute` | Recompute | none (Administrator only) |

How a right is decided, in order: no user, refused; an unknown right, refused; **the AI co-pilot holds `production_view` only**, whatever a rule says; rules that cannot be read refuse everyone, the Administrator included; **a DENY** of the right, of `*` or of a prefix (`production_*`, `prod*`), with or without `feature:`, refuses it, **the Administrator included**; an ALLOW naming the right exactly grants it (`*` and prefixes grant nothing); no rule: the Administrator holds it, nobody else. An existing installation gets no rule on upgrade.

**Per machine.** On top of the right, a machine is visible, and may be written for, only when the person's tag read rights allow **every** source tag of it (state, unit mode, condition inputs, fault code, product, count tags). Rights that cannot be read, or a machine without a source tag, hide the machine. A hidden machine answers exactly as one that does not exist, and is left out of every list and sum.

## HTTP routes

Every route is under `/api/production`, answers JSON, and is never served to a remote session. Times are Unix nanoseconds or RFC 3339 strings. A range (`from`, `to`) defaults to the last 24 hours up to now and may span at most 400 days.

| Method and path | Right | Token | What |
|---|---|---|---|
| `GET /me` | any production right | | Your seven rights: `{rights: {production_view: true, ...}}`. |
| `GET /machines` | `production_view` | yes | The machines you may read with the service's state (`live`, `recompute`, `idle`), processed and written times, dirty flag, last error. |
| `GET /machines/{id}` | `production_view` | yes | One machine. |
| `GET /machines/{id}/intervals?from&to&live` | `production_view` | yes | State intervals (`class`, `label`, `external`, `state_source`, `quality`, `simulated`, `provisional`). `live` (default true) adds the rows not written yet. |
| `GET /machines/{id}/events?from&to&live` | `production_view` | yes | Downtime events (no micro-stops) with the reason in force, `closes_at_ns`, `closed` and the shift pieces. |
| `GET /events/{id}` | `production_view` | yes | One event. |
| `GET /events/{id}/history` | `production_view` | yes | The event's reason records, oldest first (action, time, by, old, new, reason, signature, record hash). |
| `POST /events/{id}/reason` | `production_reason` (open shift) or `production_reason_closed` (closed) | | `{reason_code, comment, change_reason, signature_ticket}`. Sets or changes the reason. |
| `POST /events/{id}/reason/clear` | as above | | `{change_reason, signature_ticket}`. Clears the operator reason. |
| `POST /events/{id}/sign-ticket` | `production_reason_closed` | | `{reason_code, comment, change_reason, password}`: checks the signed-in user's password over exactly this change and returns a one-time ticket (object `production-event:<id>`, meaning "Changed after shift close"). `409 PRODUCTION_OPEN` while the shift is still open. |
| `GET /oee?machines=a,b&from&to&by&per_machine&live` | `production_view` | yes | OEE rows: `by` = `shift`, `day`, `hour` or `total` (default). Without `machines`, every machine you may read. Grouping by shift across calendars is refused (`400`) unless `per_machine`. |
| `GET /reasons?machine=` | `production_view` | yes | The reason tree; with `machine`, each code's `selectable` for that machine's group. |
| `GET /reasons/review` | `production_view` | | Reasons detached by a recompute (Reasons to review). |
| `GET /config` | `production_configure` | | Every configuration document (machine documents only for machines you may read). |
| `GET, PUT /config/{reasons\|settings\|ideal_cycles}` | `production_configure` | | One document. `PUT` with `If-Match` (its revision; `409 PRODUCTION_STALE` when older). |
| `GET, PUT, DELETE /config/{machine\|plan}/{id}` | `production_configure` | | A machine or plan document. `PUT` with `If-None-Match: *` creates only (`412 PRODUCTION_EXISTS`). A machine is saved only by someone who may read every source tag of the old and the new document (`403 PRODUCTION_MACHINE_TAGS`). A plan a machine uses cannot be deleted (`409 PRODUCTION_IN_USE`). |
| `GET /config/machine/{id}/logging` | `production_configure` | | The historian logging each source tag needs against the rules in force (`match`, per tag `problems`). |
| `POST /logging/apply/dry-run` | `production_configure` | | `{machines}` (1 to 500, each once): the rules the apply would create or change, and what stays unresolved. Writes and records nothing. |
| `POST /logging/apply` | `production_configure` | | `{machines}`: records `LOGGING_RULES_APPLIED` first, then saves the rules through the historian's rule API (this server's historian). `503 PRODUCTION_HISTORIAN_OFF` without a historian. |
| `POST /recompute/dry-run` | `production_recompute` | | `{machines, from, to}`: what a recompute would change (old and new slices, sums, reasons that would detach or move, `before_watermark`) and a `dry_run_token` valid 30 minutes for this user, machines and range. Writes nothing. |
| `POST /recompute` | `production_recompute` | | `{machines (1 to 50), from (in the past), to, reason (required, one line, at most 500), confirm, dry_run_token}`. Recorded first (`RECOMPUTE_REQUESTED`); answers `202` with the request id and `progress`. A range before an HA takeover point without `confirm`: `409 PRODUCTION_RECOMPUTE_CONFIRM`, the refusal recorded (`RECOMPUTE_REFUSED`). `dry_run_token` is required: without it `409 PRODUCTION_DRY_RUN_REQUIRED`; a token that is not this request's (another user, machines, `from` or `to`) or older than 30 minutes: `409 PRODUCTION_DRY_RUN_STALE`. Nothing is recorded in either case. Send the same `from` and `to` as the dry run. |
| `GET /recompute?machine&from&to&limit` | `production_recompute` | | Requests and refusals from the audit trail, newest first, `limit` 1 to 500 (default 100). |
| `GET /recompute/{id}` | `production_recompute` | | A request's progress per machine: `queued`, `running`, `done`, `retrying` (with `error`), `not_computing`. |
| `GET /planned-stops?machine&from&to` | `production_plan` | | Planned stops (default from 7 days ago to 60 days ahead). |
| `POST /planned-stops` | `production_plan` | | `{machines (1 to 500), start, end (at most 31 days), reason_code (an active planned code offered for every machine), comment}`. |
| `POST /planned-stops/{id}/change` | `production_plan` | | As add, plus `change_reason` (required). |
| `POST /planned-stops/{id}/remove` | `production_plan` | | `{change_reason}` (required). |
| `GET /counts/adjustments?machine&from&to` | `production_counts` | | Count adjustments (default the last 7 days). |
| `POST /counts/adjustments` | `production_counts` | | `{machine, ts (not in the future), n (1 to 1,000,000 units from good to reject), reason (required)}`. |
| `GET /calendars` | `production_configure` | | The `reports.shifts` calendars and their shifts. |

A recorded write answers `200` when applied, or `202` with `"status": "recorded"` and a `warning` when the record is written and the service applies it a moment later. Bodies are JSON objects of at most 64 KiB (1 MiB for a configuration document); an unknown field is refused.

### Order of the checks

Every request passes these checks in this order; the first that fails answers:

1. **The route.** An unknown path: `404 PRODUCTION_NOT_FOUND`. A method the path does not serve: `405` with `Allow`.
2. **Sign-in.** No user: `401`. Security off: `403 PRODUCTION_SECURITY_OFF`. A remote session: `403 PRODUCTION_REMOTE`.
3. **The edition**, fail closed: `403` `{"status": "edition_required", "code": "EDITION", "feature": "production", "required_edition", "edition"}`. After a downgrade while the module runs, reads stay open and every write is refused.
4. **API tokens** read the routes marked token and nothing else: `403 PRODUCTION_TOKEN`.
5. **For a write**: never the AI co-pilot (`403 PRODUCTION_AI`); never an HA standby (`409 ha_standby`, with `primary`) nor a primary without quorum (`503 ha_no_quorum`).
6. **The route's right** (any of those listed): `403 PRODUCTION_RIGHT` with `required`.
7. **The module on this server**: `503 PRODUCTION_OFF` when it does not run here.
8. **The machine**: a machine you may not read answers `404 PRODUCTION_NOT_FOUND`, as one that does not exist; a write covering one answers `403 PRODUCTION_MACHINE_TAGS`.

For a reason write, the right is then decided by the event: `production_reason` while its shift is open, `production_reason_closed` after (`403 PRODUCTION_RIGHT` with `closed`). After close, a missing ticket answers `403 PRODUCTION_SIGNATURE_REQUIRED`; a ticket that does not match this change, this user or this meaning answers `403 PRODUCTION_SIGNATURE_REFUSED` (sign again).

### Error codes

| Status and code | Meaning |
|---|---|
| `400 PRODUCTION_INVALID` | A body, range, field or value that is not valid (`fields` lists the field errors of a configuration document). |
| `400 PRODUCTION_REASON_CODE` | An unknown or inactive reason code, or one not offered for the machine's group. |
| `403 PRODUCTION_MACHINE_TAGS` | The write covers a machine whose source tags you may not read. |
| `404 PRODUCTION_NOT_FOUND` | No such route, machine (or one you may not read), event, planned stop, recompute or document. |
| `409 PRODUCTION_UNCHANGED` | The event already has this reason and comment. |
| `409 PRODUCTION_BEFORE_FIRST_STATE` | The stop started before the machine's first computed state. |
| `409 PRODUCTION_GOOD_NEGATIVE` | The adjustment would make the slice's good count negative. |
| `409 PRODUCTION_NOT_COMPUTED` | No computed slice holds that time yet. |
| `409 PRODUCTION_BUSY` | The machine is being recomputed (or a dry run runs): try again. |
| `409 PRODUCTION_DRY_RUN_REQUIRED` | A recompute request without its `dry_run_token`: run the preview first. Nothing recorded. |
| `409 PRODUCTION_DRY_RUN_STALE` | A `dry_run_token` of another user, other machines, another `from` or `to`, or older than 30 minutes: run the preview again. Nothing recorded. |
| `409 PRODUCTION_STALE` | The document changed since the revision in `If-Match`. |
| `409 PRODUCTION_IN_USE` | A plan a machine still uses. |
| `412 PRODUCTION_EXISTS` | `If-None-Match: *` on a document that exists. |
| `503 AUDIT_NOT_WRITTEN` | The audit trail cannot write: nothing changed. |
| `503 PRODUCTION_NOT_COMPUTING` | No service computes on this server now (standby, no quorum, paused). |
| `503 PRODUCTION_HA` | The HA configuration store refused the commit. |

The generated table of routes and rights: [HTTP API](/docs/eaxscada/reference/generated/http-api/).

## Configuration documents

The documents of the project domain `production` (`GET`/`PUT /api/production/config/<name>`):

| Document | Content and limits |
|---|---|
| `machine/<id>` | `id` (letters, digits, `_`, `-`, at most 64), `name`, `path`, `group` (at most 64), `calendar` (a `reports.shifts` calendar), `plan` (optional, same calendar), `state` (`kind` `map`, `packml`, `conditions` or `counter_activity`; `tag`, `map` of `{codes, class, label, external}` (at most 1,024 codes), `unmapped` (`stop` default, `planned_stop`, `unknown`; never `run`), `mode_tag`, `production_modes` (default `[1]`), `rules` (2 to 32, the last `otherwise`, at most 8 tags), `k` (1 to 100, default 5)), `fault_code` `{tag, map}`, `alarm_scope` (at most 32 paths or prefixes ending in `/>`), `product` `{tag, map}`, `counts` (exactly two of `total`, `good`, `reject`, each `{kind: counter\|increment\|genealogy\|manual, tag, rollover, station, fail}`; `max_rate`), `ideal_cycle` `{default_s (0 to 86400), unit}`, `micro_stop_s` (above 0, at most 3600, default 120), `gap_limit_s` (1 to 86400, default 120), `accept_plc_reasons` (default false), `effective_from` (default the save time). |
| `reasons` | `nodes`: at most 3 levels and 2,000 codes; each `code` (upper-case letters, digits, `_`, `-`, at most 48, unique), `labels` (`en` required; `de`, `fr`, `es`, `it`; at most 120 characters), `planned`, `active`, `comment_required`, `groups`, `children`. |
| `plan/<id>` | `calendar`, `week` (all seven days `mon`..`sun`, each a list of shift names, `[]` for none), `breaks` (at most 64: `shift`, `start` HH:MM, `minutes` 1 to 480, `reason` a planned code; inside the shift, not overlapping), `exceptions` (at most 1,000: `date` YYYY-MM-DD, `shifts`), `effective_from`. |
| `ideal_cycles` | `rows` (at most 100,000): `machine`, `product` (at most 64), `seconds_per_unit` (above 0, at most 86400), `effective_from`; one row per machine, product and start. |
| `settings` | `coverage_min` (above 0, at most 1, default 0.95), `reason_grace_h` (above 0, at most 168, default 8), `groups` `{<group>: {oee_machine}}` (a machine of that group). |

A save is checked against the server (calendars, plans, reasons, the tag list), recorded first as `CONFIG_SAVED` or `CONFIG_REMOVED`, then committed to the HA configuration store and applied. If the record cannot be written, nothing is saved (`503 AUDIT_NOT_WRITTEN`). If the commit fails after the record, a `CONFIG_NOT_SAVED` record names it.

## Dataset family `production`

Datasets and analytics queries of the family **production** read the results as the person who runs them: the family is refused without the licence (asked at every run) and without `production_view`; only the machines in the dataset's **tag scope** (matched on the machine's path; a scope is required) whose every source tag the runner may read are in the relations. Hidden machines are counted (`machines_hidden` in the run record), never named; a `machine` parameter naming a hidden machine is refused before the query runs. The relations read only the stored (final) results: `ongoing` and `provisional` are always `false` here. On an HA standby they hold the primary's rows.

A dataset of this family has no tag parameter; it may declare the text parameters `machine` and `grp` and apply them with `prod_machine(...)`.

### Starter datasets

Ten starter datasets are added on request, never at start-up: `ds_oee_by_shift`, `ds_oee_hourly`, `ds_oee_by_group_day`, `ds_downtime_pareto`, `ds_downtime_events`, `ds_state_timeline`, `ds_mtbf_mttr`, `ds_throughput_target`, `ds_missing_reasons` and `ds_data_quality`. Send `POST /api/reports/starters/production` with `{}` (in the Studio: **Add OEE datasets** in **Analytics and Reports > Schedules**). A dataset id that is taken is added under a new id (`_2`, `_3` ...), never replaced.

| Check | Refusal |
|---|---|
| Pro or Enterprise (OEE and downtime) and the Analytics and Reports licence | `403 EDITION` |
| A person: never an API token, never the AI co-pilot | `403 REPORTS_TOKEN`, `403 REPORTS_AI` |
| `datasets_edit` | `403 REPORTS_RIGHT` |
| The HA primary with quorum | `409` |
| Every dataset checks as a manual create, as you (the family's licence and `production_view`) | `422 REPORTS_REFUSED`, nothing added |
| The audit trail writes | `503 AUDIT_NOT_WRITTEN`, nothing added |

The apply is recorded first (`PROJECT` `TEMPLATE_APPLY`), each dataset as a manual create (`dataset.create`), then `TEMPLATE_APPLY_DONE` or `TEMPLATE_APPLY_FAILED`. Never through eaxCloud remote access.

### Relations and columns

| Relation | Columns |
|---|---|
| `machines` | `machine_id`, `name`, `path`, `grp`, `calendar`, `plan`, `state_source`, `ideal_cycle_default_s`, `micro_stop_threshold_s`, `is_constraint` |
| `shifts` | `calendar`, `plan`, `shift_name`, `shift_start_ns`, `shift_start`, `shift_end_ns`, `shift_end`, `scheduled` (every shift overlapping the window) |
| `state_intervals` | `machine_id`, `machine_name`, `grp`, `start_ns`, `start_ts`, `end_ns`, `end_ts`, `duration_s`, `window_duration_s` (the part inside the window), `state_class`, `state_label`, `external`, `state_source` (`tag` or `inferred`), `quality_class`, `simulated`, `provisional` |
| `downtime_events` | `event_id`, `machine_id`, `machine_name`, `grp`, `start_ns`, `start_ts`, `end_ns`, `end_ts`, `duration_s`, `ongoing`, `planned`, `first_label`, `external`, `auto_reason`, `reason_code`, `reason_label`, `reason_category`, `reason_source`, `comment`, `entered_by`, `entered_by_name`, `entered_at`, `changed_after_close`, `shift_calendar`, `shift_name`, `shift_start` |
| `event_pieces` | `event_id`, `machine_id`, `machine_name`, `grp`, `event_start_ts`, `shift_calendar`, `shift_name`, `shift_start`, `start_ns`, `start_ts`, `end_ns`, `end_ts`, `duration_s`, `planned`, `reason_code`, `reason_label`, `reason_category`, `reason_source`, `external`, `first_label` (pieces starting in the window: sum these for a Pareto) |
| `slices` | `machine_id`, `machine_name`, `grp`, `is_constraint`, `slice_start_ns`, `slice_start`, `slice_end_ns`, `slice_end`, `hour_start`, `site_day`, `shift_calendar`, `shift_name`, `shift_start`, `product`, `ideal_cycle_s`, `state_source`, `not_scheduled_s`, `planned_stop_s`, `run_s`, `run_unscheduled_s`, `micro_stop_s`, `micro_stop_count`, `unplanned_stop_s`, `unknown_s`, `total_count`, `good_count`, `reject_count`, `unclassified_count`, `unknown_state_count`, `ideal_missing_count`, `ideal_s`, `fully_productive_s`, `ideal_missing_s`, `planned_s`, `operating_s`, `performance_base_s`, `quality_base_count`, `state_quality`, `count_quality`, `warnings`, `warning_bits`, `simulated`, `provisional` |
| `count_notes` | `machine_id`, `machine_name`, `grp`, `ts_ns`, `ts`, `tag`, `role`, `kind` (`counter_reset`, `counter_rollover`, `implausible_delta`, `count_lost`), `old_value`, `new_value`, `delta` |
| `reason_codes` | `code`, `label` (the report language), `category`, `category_code`, `parent_code`, `level`, `planned`, `active` |

Times are `TIMESTAMP WITH TIME ZONE`, durations in seconds. A slice is a machine's time cut at hours, shifts, product and configuration changes; its seven time categories add up to its length. `slices` and `event_pieces` hold the rows **starting** in the window; `state_intervals` and `downtime_events` the rows **overlapping** it.

`warnings` names the slice's warnings, comma separated: `ideal_cycle_missing`, `counts_in_unknown_state`, `implausible_count`, `counter_reset`, `unclassified`, `count_lost`, `ideal_cycle_too_slow`, `counts_without_run`, `ha_failover`.

### Helpers

The formulas of the server as SQL, so every dataset divides the same way. A ratio whose base sums to 0 or less is `NULL` ("No data"), never 0 or 100 %.

| Helper | Returns |
|---|---|
| `prod_planned(run_s, micro_stop_s, unplanned_stop_s)` | Planned production time of one row. |
| `prod_availability(operating_s, planned_s)` | Σ operating / Σ planned |
| `prod_performance(ideal_s, performance_base_s)` | Σ ideal / Σ (operating - run time without an ideal cycle) |
| `prod_quality(good_count, quality_base_count)` | Σ good / Σ (total - unclassified) |
| `prod_oee(operating_s, planned_s, ideal_s, performance_base_s, good_count, quality_base_count)` | The product of the three |
| `prod_coverage(planned_s, unknown_s)` | Σ planned / Σ (planned + unknown) |
| `prod_row_quality(operating_s, planned_s, ideal_s, performance_base_s, good_count, quality_base_count, unknown_s, state_quality, count_quality)` | `good`, `uncertain` or `bad` (Incomplete data) |
| `prod_warnings(warning_bits)` | The union of the rows' warnings |
| `prod_machine(machine_id, grp, $machine, $grp)` | True for the rows of the optional machine and group parameters |

**Quality save rule.** A dataset that calls a ratio helper or reads a count column of `slices` must also return the quality: `prod_row_quality(...)` (as `row_quality`), or `state_quality` and `count_quality`, or a `quality`/`quality_class` column. Otherwise the save is refused with the hint "Add quality column".

Example: OEE per machine and shift.

```sql
SELECT machine_id, shift_name, shift_start,
       prod_availability(operating_s, planned_s) AS availability,
       prod_performance(ideal_s, performance_base_s) AS performance,
       prod_quality(good_count, quality_base_count) AS quality,
       prod_oee(operating_s, planned_s, ideal_s, performance_base_s, good_count, quality_base_count) AS oee,
       prod_coverage(planned_s, unknown_s) AS coverage,
       prod_row_quality(operating_s, planned_s, ideal_s, performance_base_s, good_count, quality_base_count,
                        unknown_s, state_quality, count_quality) AS row_quality,
       prod_warnings(warning_bits) AS warnings
FROM slices
WHERE prod_machine(machine_id, grp, $machine, $grp)
GROUP BY machine_id, shift_name, shift_start
ORDER BY shift_start, machine_id
```

**Archived runs.** A report run holding a production dataset opens only while the licence includes OEE and downtime and to a viewer who holds `production_view` now (a DENY refuses the Administrator too); a viewer other than its runner or a reports administrator must also be able to read every source tag of every machine the run included, as recorded at run time.

## Screen action `open_downtime`

| Key | Value |
|---|---|
| `type` | `open_downtime` (designer: **Open downtime panel**) |
| `machine` | Optional machine id; empty: the panel's own choice |

Opens the runtime's Downtime panel. Navigation only: no confirmation, no signature, nothing written. Offered in the designer only when the licence includes `production`; an object that already has it keeps it.

## Audit events

Category `PRODUCTION`:

| Action | Recorded |
|---|---|
| `REASON_SET`, `REASON_CHANGED` | A reason entry or change (the record is the entry; a change after close carries its signature manifest). |
| `REASON_REATTACHED`, `REASON_DETACHED` | A recompute moved a reason to another event, or no event holds it any more (system actor `production`). |
| `PLANNED_STOP_ADDED`, `PLANNED_STOP_CHANGED`, `PLANNED_STOP_REMOVED` | Planned stops (the records are the stops). |
| `COUNT_ADJUSTED` | A count adjustment (machine, time, units, the good count it was checked against). |
| `RECOMPUTE_REQUESTED`, `RECOMPUTE_REFUSED` | A recompute request per machine, or its refusal before an HA takeover point, with `source_node` and `rows_from_node`. |
| `RECOMPUTE_COMPLETED`, `RECOMPUTE_FAILED` | System records (actor `production`) of a requested recompute, naming its request: `COMPLETED` once when written (rows replaced, intervals, events and slices written, old and new sums, the shifts that changed, at most 200 listed); `FAILED` once at its first failure (it is retried). A request still waiting when the server stops or fails over gets neither. |
| `LOGGING_RULES_APPLIED` | A logging apply, every rule before and after. |
| `CONFIG_SAVED`, `CONFIG_REMOVED`, `CONFIG_NOT_SAVED` | A configuration document saved or removed (recorded before the save); `CONFIG_NOT_SAVED` corrects one whose commit then failed. |
| `CAPTURE_PAUSED`, `CAPTURE_RESUMED` | Capture paused or resumed by the licence. |

## System alarm `ALM-SYS-PRODUCTION`

"OEE and downtime capture paused", category Diagnostic, severity High, on the server tag `System/Production/CapturePaused`: raised while the licence no longer includes OEE and downtime (states, downtime and OEE are not computed, reasons cannot be entered, everything recorded stays readable), cleared when capture resumes.

## Metrics

On `/metrics`, in HA:

| Metric | Meaning |
|---|---|
| `eaxscada_production_replication_role{role}` | This server's role in the replication (`primary`, `standby`), one-hot. |
| `eaxscada_production_replication_ready` | 1 when this server is the primary and its store is sealed since the takeover (it computes). |
| `eaxscada_production_replication_lag_operations`, `..._lag_seconds` | Lag: on the primary, operations not on the HA stream yet; on the standby, messages not applied yet. |
| `eaxscada_production_replication_queue` | Operations waiting for the stream (primary). |
| `eaxscada_production_replication_published_total`, `..._applied_total` | Operations published, applied. |
| `eaxscada_production_replication_resyncs_total` | Times the standby replaced its store with the primary's snapshot. |
| `eaxscada_production_replication_failures_total{kind}` | Failures: `apply`, `publish`, `dropped`. |
| `eaxscada_production_replication_takeover_missing_state` | Machines of the last takeover without the replicated state at the takeover point (recomputed only on an explicit request). |
