# Connect alarms to the controller (handshake)

> Tell the controller when an alarm was shown to an operator and when it was acknowledged, let a field pushbutton acknowledge it, and define alarms that need no acknowledgement. Covers the Alarm_Manager write grant, the row warnings, high availability, retries and a worked Structured Text example.

Product: eaxScada · Type: How-to guide · Editions: Starter, Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/how-to/alarm-controller-handshake/
Verified against commit bf9a205.

## Goal

Exchange an alarm's life with the controller that raised it:

- the controller learns that the alarm **was shown** to an operator, and that
  it **was acknowledged** (by an operator or from the field);
- a pushbutton wired to the controller **acknowledges** the alarm in eaxScada;
- an alarm can be defined as **needing no acknowledgement**: it is active while
  its condition holds and returns to normal on its own.

The handshake is part of **Starter**, **Pro** and **Enterprise**. It is not in
**Free**: a definition that uses it cannot be saved there.

## The four settings

Open **Alarms > Alarm Definitions Studio**, select an alarm (or **New Alarm**)
and open the **Controller handshake** section. Every setting is optional; an
alarm without them behaves as before.

| Setting | Field in the definition | What it does |
|---|---|---|
| **Acknowledgement required** | `ack_required` | On (the default): the ISA-18.2 lifecycle, an operator acknowledges. Off: the alarm needs no acknowledgement (see [Alarms that need no acknowledgement](#alarms-that-need-no-acknowledgement)). |
| **Shown signal tag** | `shown_tag` | eaxScada writes **1** to this tag once a signed-in operator's screen has displayed the alarm (see [What "shown" means](#what-shown-means)). |
| **Acknowledged signal tag** | `ack_tag` | eaxScada writes **1** to this tag when the alarm is acknowledged, by an operator or by the controller. |
| **Controller acknowledge tag** | `plc_ack_tag` | eaxScada watches this tag. A change from 0 to non-zero while the alarm is unacknowledged acknowledges it, recorded as the controller's (`PLC:<tag>`). |

**eaxScada writes 1, never 0.** The controller resets the shown and
acknowledged tags itself, normally when it resets the trip. Until it does, the
tag stays at 1.

The tags are checked when you save:

- each one is a different tag, and none is the alarm's own tag;
- each one is a boolean or an integer;
- the shown and acknowledged tags are written, so each must be a writable
  device tag (a driver tag whose mapping is not read-only, or a member of an
  eaxPLC that outside clients may write) or a writable eaxTag;
- the controller acknowledge tag is only read;
- the plant emergency-stop signal is never a handshake tag.

Next to each tag the editor shows whether the alarm manager may write it
(**Writable by the alarm manager**, or **Not written until granted**, with
the reason). With **Acknowledgement required** off, the acknowledged signal
tag and the controller acknowledge tag are shown as **Ignored**.

## One-time setup: let the alarm manager write the tags

The handshake writes are made by a system actor, the **alarm manager**. It
writes a tag only when the security permissions explicitly allow it, with the
same rules as an operator's write permission. A security administrator sets
this up once:

1. Open **Security > Roles** and create a role named exactly `Alarm_Manager`.
2. Open **Topic Rights** and click to add a rule:
   - **Target Role**: `Alarm_Manager`;
   - **Target Type**: UNS Topic;
   - **Action**: `publish` (write tag / command);
   - **Target Subject / Pattern**: the tag, or a pattern that covers the
     signal tags, for example `Plant/Tank1/>` (`*` matches one level, `>`
     the rest of the path). For an eaxPLC member, a rule on one of its
     containers also matches;
   - **Effect**: ALLOW.
3. Save. The editor's check of each signal tag now says **Writable by the
   alarm manager**.

Rules for the grant:

- **A DENY wins.** A `publish` DENY rule of the role that matches the tag (or
  one of its containers) refuses the write, whatever the ALLOW rules and the
  priorities say.
- No role, or no matching ALLOW rule: every write is refused. Nothing is
  skipped silently: the refusal is audited and shown on the alarm's row.
- The role is for the alarm manager. Do not give it to people: they would
  get the same write rights.

After the grant, the write goes through the same checks as an operator's
write: an eaxPLC member that is read-only is refused, then the write policy
applies as for an external writer (interlocks, write ranges and limits), then
the tag's engineering range, and only then the device or eaxTag write. Every
write and every refusal is in the audit trail.

**A tag the write policy asks a person to sign or confirm is never written by
the alarm manager.** Nobody signs for it, so the write is refused
(`WRITE_POLICY_PERSON_REQUIRED`). Use signal tags without a signature or
confirmation requirement.

## Row warnings and how to fix them

In **Alarms > Active Standing Alarms**, the **Controller handshake** column
shows each signal of the current activation: **Shown** and **Ack**, each
**written** (✓), **waiting** (⧗), **failed** (✕) or **not yet shown** (•);
a signal dropped because the alarm ended first shows **Not sent: alarm
ended**.
A row with a waiting or failed write gets a warning marker, and the chip
above the grid ("2 handshake warnings") filters to those rows. Click the
marker for the detail: which write is missing (1 to which tag), the reason,
the number of attempts and the fix.

| The detail says | Fix |
|---|---|
| The alarm manager may not write the tag (no role `Alarm_Manager`, no matching rule, or a rule denies it) | Grant it as described above. |
| The write policy asks for a person's signature or confirmation | Use a signal tag without that requirement. |
| Refused by the write policy, out of range, read-only | Change the tag's write policy, range or access, or pick another tag. |
| A device write failed | Check the device connection and the tag. The write is retried while the alarm stands; once it has ended the signal is dropped (see below). |
| This server is the standby | Nothing to fix: the primary writes the controller signals. |
| The runtime is stopped | Start the runtime: no controller signal is written while it is stopped. |
| The edition | The handshake needs a Starter licence or higher. |

## When the writes happen

**Diagram: One controller signal, from due to written or not sent** (state machine)

A shown or acknowledged signal of one activation starts as waiting. The primary writes 1 to its tag and the signal is written. A write that is refused or fails leaves it failed, and it is retried while the alarm stands. Once the alarm has ended, a signal that is not written is dropped and never sent. A new trip of the alarm ends the pending signals of the previous activation.

**States**

- **WAITING** (state): held on a standby, or while the runtime is stopped
- **WRITTEN** (state): 1 is in the tag
- **NOT SENT** (state): "Not sent: alarm ended"
- **FAILED** (state): refused, or not written

**Transitions**

- **Start → WAITING** (transition). The signal becomes due: a signed-in operator's screen showed the alarm, or the alarm was acknowledged.
- **WAITING → WRITTEN** (transition): the primary writes 1. Only the primary with quorum writes, only while the runtime runs.
- **WAITING → FAILED** (transition): refused, or the write fails
- **FAILED → FAILED** (transition): retried after 1 s, doubling to 30 s; 5 min or more when every try is audited. Every try is audited after a refusal by the write policy, a refusal by the eaxPLC, or a device write that failed after its record.
- **FAILED → WRITTEN** (transition): a retry succeeds
- **FAILED → NOT SENT** (transition): alarm ended. The alarm is back to normal or shelved: no retry after that.
- **WAITING → NOT SENT** (transition): alarm ended. A signal that became due at most 5 s before the end, or after it, and was never tried or held, gets one attempt: written if it succeeds, not sent if it fails. A standby keeps it waiting for the primary.

Retries stop when the alarm ends: a late 1 would stand for a trip that nobody saw or acknowledged.

- **Only the primary writes.** In a high availability pair (Enterprise), only
  the primary with quorum writes the signal tags and acts on the controller
  acknowledge tag. A standby refuses shown confirmations (`409 not_primary`):
  the primary records them, and its alarm states are replicated. The signals
  already written or dropped travel to the standby with the alarm states, so
  a new primary after a failover never sends them; one still pending, it
  sends under the same rules (writing 1 again is harmless).
- **Only while the runtime runs**, and only in an edition that includes the
  handshake.
- **Only while the activation stands.** Each trip starts a new activation. While
  the alarm stands (unacknowledged, acknowledged, or returned but
  unacknowledged), a write that fails is retried with a growing delay (1 s,
  doubling, up to 30 s; at least 5 minutes after a refusal by the write policy
  or by the eaxPLC, or after a device write that failed, because each of these
  attempts is audited). When the alarm trips again,
  the previous activation's pending writes are **dropped, never sent**: the
  new activation gets its own.
- A refusal is journaled once per distinct reason, not on every retry.

### No signal after the alarm has ended

Once the alarm is back to **normal** or **shelved**, its activation has ended
(the time is recorded as `ended_time`). A shown or acknowledged signal not yet
written by then is no longer retried:

- it gets **at most one attempt**, and only if it became due at most **5 s
  before the end, or after it** (typically the acknowledgement that returns a
  returned-unacknowledged alarm to normal);
- otherwise, or if that one attempt fails, or if this node may not write at
  that moment (for example the runtime is stopped), the signal is
  **dropped**: it is never sent, by this server or by a new primary after a
  failover (the dropped state is replicated);
- a dropped signal is journaled once as a `SIGNAL` record, `shown signal not
  written: the alarm returned to normal before the write succeeded (<reason>)`
  (or `acknowledged signal …`), and audited once as
  `MANUAL_OVERRIDE_REFUSED` with the code `SIGNAL_DROPPED_ALARM_ENDED`. The
  alarm's row shows **Not sent: alarm ended**.

The reason: after the end the controller may already have reset its tags, and
a late 1 would stand for an activation that nobody saw or acknowledged on the
next trip. A standby leaves an ended activation's signal to the primary, and
drops it itself if it takes over.

## What "shown" means

The shown signal is written once the alarm has been displayed **to a
person**: a signed-in user's screen showed it **while the page was visible**,
and that user is allowed to see the alarm. These views confirm it:

- the alarm banner, the alarm summary and the annunciator on runtime screens;
- the alarm summary card of a dashboard;
- the alarm list of the phone runtime, only while the list is open.

The first confirmation wins and is recorded with that user's name.

These never confirm an alarm shown:

- a kiosk screen without a signed-in user;
- an API token or a PLC token;
- the AI co-pilot;
- a browser tab in the background (it confirms once it becomes visible).

Only a standing alarm is confirmed: unacknowledged, acknowledged, or returned
but unacknowledged. An alarm back in the normal state, a shelved alarm, or an
activation already replaced by a new trip is not.

## The controller acknowledge tag: rising edges only

Only a **change from 0 to non-zero** acknowledges, and only while the alarm is
unacknowledged:

- **A held button acknowledges once.** If the tag is still 1 when the alarm
  trips again, nothing happens: release the button (0) and press it again.
- An edge while no alarm waits for acknowledgement is spent: it does not
  acknowledge a later trip.
- **The first value read is the reference, never an edge**: after eaxScada
  starts, after the runtime is stopped and started again, and after the tag of
  the definition is changed. A button pressed across a runtime stop
  acknowledges nothing; press it again.
- With **Acknowledgement required** off, the tag is ignored.

An acknowledgement by the controller is recorded like an operator's, with the
acknowledger `PLC:<tag>` and the reason "acknowledged by the controller", and
it makes the acknowledged signal due like any other acknowledgement.

## Alarms that need no acknowledgement

With **Acknowledgement required** off:

- the alarm is **active** while its condition holds (the grid shows
  **ACTIVE**, "Active (no acknowledgement required)") and **returns to normal
  on its own** when the condition clears;
- it never waits for an acknowledgement (no unacknowledged or returned
  unacknowledged state), so there is nothing to acknowledge;
- it plays **one short beep per activation** when it trips live. The beep
  follows the alarm's **sound alert** setting and its class sound (no sound,
  or volume 0, means silent); it never repeats, and reloading the page does
  not replay it. It also plays while the horn is silenced, without lifting
  the silence. The runtime's backup horn, used when its main alarm sound
  module is not available, follows the same one-beep rule;
- its trip and return records in the journal say "no acknowledgement
  required";
- the shown signal still works; the acknowledged signal and the controller
  acknowledge tag are ignored.

## The AI assistant and the handshake settings

The handshake settings are set by an engineer, never by the AI assistant:

- an alarm the assistant proposes cannot set **Acknowledgement required**,
  the **Shown signal tag**, the **Acknowledged signal tag** or the
  **Controller acknowledge tag** (`ack_required`, `shown_tag`, `ack_tag`,
  `plc_ack_tag`): such a proposal is refused;
- a change the assistant makes to an existing alarm leaves these four
  settings as they are.

## Worked example: a latched trip in the controller

A tank's high-level switch latches a trip that stops the pump. The operator
acknowledges in eaxScada or with a pushbutton at the tank; a reset button
clears the trip once the level is back and the alarm is acknowledged.

```text
PROGRAM TankAlarm
VAR
    HighLevel : BOOL;  (* level switch, from the I/O *)
    ResetPB   : BOOL;  (* reset pushbutton, from the I/O *)
    AckPB     : BOOL;  (* field acknowledge pushbutton, from the I/O *)
    Trip      : BOOL;  (* the alarm's tag: the eaxScada alarm watches it *)
    Shown     : BOOL;  (* Shown signal tag: eaxScada writes 1 *)
    Acked     : BOOL;  (* Acknowledged signal tag: eaxScada writes 1 *)
    FieldAck  : BOOL;  (* Controller acknowledge tag: eaxScada watches its 0 -> 1 edge *)
    PumpRun   : BOOL;  (* permissive: the pump runs only while no trip is latched *)
END_VAR

(* 1. Trip latch: the condition sets it; only the reset below clears it. *)
IF HighLevel THEN
    Trip := TRUE;
END_IF;

(* 2. The field acknowledge button drives the controller acknowledge tag.
   eaxScada acknowledges on a 0 -> 1 change only: a button held down
   acknowledges once, never a later trip. *)
FieldAck := AckPB;

(* 3. Reset: only once the condition is gone and the alarm is acknowledged
   (by an operator or by the field button: eaxScada writes Acked := 1 for
   both). eaxScada never writes 0: the controller clears Shown and Acked,
   so the next trip starts from 0. *)
IF ResetPB AND NOT HighLevel AND Acked THEN
    Trip := FALSE;
    Shown := FALSE;
    Acked := FALSE;
END_IF;

PumpRun := NOT Trip;
END_PROGRAM
```

The alarm definition in eaxScada:

| Setting | Value |
|---|---|
| Tag | `Trip` (condition `HIGH`, setpoint `1`, deadband `0`) |
| Acknowledgement required | On |
| Shown signal tag | `Shown` |
| Acknowledged signal tag | `Acked` |
| Controller acknowledge tag | `FieldAck` |

Use the full tag paths your project gives these variables (pick them with
**Pick** in the editor). `Shown` and `Acked` must be writable from the
network on the PLC, and the role `Alarm_Manager` needs a `publish` ALLOW rule
on them.

What happens:

**Diagram: A latched trip, shown, acknowledged and reset** (sequence)

The controller latches a trip and eaxScada raises the alarm. Once a signed-in operator's screen has displayed it, eaxScada writes 1 to the shown tag. The alarm is then acknowledged, by the operator on the screen or by the field pushbutton through the controller acknowledge tag, and eaxScada writes 1 to the acknowledged tag. The controller resets the trip and clears both tags itself, and the alarm returns to normal.

**Participants**

- **Controller** (device or controller): TankAlarm
- **eaxScada** (product): alarm manager
- **Runtime screen** (service or process): signed-in user
- **Operator** (person or role)

**Steps, in order**

1. **Controller**: Latches the trip: HighLevel rises: Trip := TRUE; the pump stops
2. **Controller → eaxScada** (data or telemetry): Trip reads 1. the alarm's tag
3. **eaxScada**: Raises the alarm: unacknowledged (UNACK_ALARM); a new activation
4. **eaxScada → Runtime screen** (alarm or event): The alarm, unacknowledged
5. **Runtime screen → eaxScada** (data or telemetry): Confirms it was shown. the page was visible; the first confirmation wins
6. **eaxScada → Controller** (command to equipment): Writes Shown := 1. only the primary, after the checks of a write
7. Note: A write that is refused or fails is retried while the alarm stands
8. Acknowledged on screen:
   1. **Operator → Runtime screen** (data or telemetry): Acknowledges
   2. **Runtime screen → eaxScada** (data or telemetry): Acknowledgement. by the operator
9. Or by the field button:
   1. **Controller → eaxScada** (data or telemetry): FieldAck goes 0 to 1. AckPB pressed: recorded as PLC:\<tag>
10. **eaxScada**: Records the acknowledgement: acknowledged (ACK_ALARM); the acknowledged signal is due
11. **eaxScada → Controller** (command to equipment): Writes Acked := 1. for either acknowledgement
12. **Controller**: Resets the trip: ResetPB, level back, Acked = 1; clears Trip, Shown and Acked
13. **Controller → eaxScada** (data or telemetry): Trip reads 0
14. **eaxScada**: The alarm returns to normal: the activation has ended

eaxScada writes 1 and never 0: the controller clears Shown and Acked when it resets the trip, so the next trip starts from 0.

1. `HighLevel` rises: `Trip` latches, the pump stops, eaxScada raises the
   alarm (unacknowledged).
2. The operator's runtime screen shows it: eaxScada writes `Shown := 1`.
3. The operator acknowledges in eaxScada, or presses `AckPB` at the tank
   (`FieldAck` goes 0 to 1): eaxScada records the acknowledgement and writes
   `Acked := 1`.
4. The level drops and the operator presses `ResetPB`: the controller clears
   `Trip`, `Shown` and `Acked`. The alarm returns to normal in eaxScada.

Treat `Shown` and `Acked` as meaningful only while `Trip` is set. eaxScada
does not write a signal after the alarm has ended (see
[No signal after the alarm has ended](#no-signal-after-the-alarm-has-ended)),
so a 1 does not arrive for a trip you have already reset, except for the one
attempt allowed right at the end. The reset in
this example needs `Acked`: if the acknowledged signal cannot be written (see
the row warning), the trip stays latched until it is fixed, which is the safe
side. If your process must reset without it, base the reset on your own
condition instead.

## What is recorded

| Where | Record |
|---|---|
| Alarm journal (Sequence of Events) | `SHOWN`: `shown on the screen of <user>`. `SIGNAL`: `shown signal: 1 written to <tag> (for <user>)` or `acknowledged signal: …`, by `alarm manager`; for a dropped signal, `shown signal not written: the alarm returned to normal before the write succeeded (<reason>)`. `ACK` by `PLC:<tag>` for a controller acknowledgement. |
| Audit trail | `ALARM_SHOWN` by the operator; `ALARM_ACKNOWLEDGE` by `PLC:<tag>` (role Controller); `MANUAL_OVERRIDE` or `MANUAL_OVERRIDE_REFUSED` by `alarm manager (for <user>)` or `alarm manager (for PLC:<tag>)`, role `Alarm_Manager`; a dropped signal is one `MANUAL_OVERRIDE_REFUSED` row with the code `SIGNAL_DROPPED_ALARM_ENDED`. |
| Access audit | `WRITE_DENIED` for a write the alarm manager is not granted. |

## Verify

1. Save the definition: the editor shows every signal tag as writable by the
   alarm manager.
2. Force the alarm's condition in a test: the row shows **Shown** not yet
   shown, then written once a signed-in operator's runtime screen displays it, and
   the controller's shown tag reads 1.
3. Acknowledge: **Ack** turns written and the acknowledged tag reads 1.
4. Toggle the controller acknowledge tag 0 to 1 on a new trip: the alarm is
   acknowledged by `PLC:<tag>`.

## Related

- [Alarms](/docs/eaxscada/explanation/alarms/): the alarm lifecycle and the journal.
- [Put alarms on a screen](/docs/eaxscada/how-to/configure-alarm-objects/).
- [Limit tag writes](/docs/eaxscada/how-to/limit-tag-writes/): write ranges and the write policy.
- [Manage security](/docs/eaxscada/how-to/manage-security/): roles, topic rules and the audit trails.
- [HTTP API](/docs/eaxscada/reference/generated/http-api/): `POST /api/alarms/shown`, `GET /api/alarms/handshake`, `GET /api/alarms/handshake/check`.
- [Alarm configuration reference](/docs/eaxscada/reference/generated/config/alarms/): `ack_required`, `ack_tag`, `shown_tag`, `plc_ack_tag`.
