Capture genealogy from a PLC
At each station event (a part is serialised, an operation ends, components are fitted, a lot is received), the PLC asks eaxScada for a record. eaxScada reads a consistent set of tags, stores the record durably, then writes an answer back: Err (0 or an error code), then Ack (the request’s sequence number). The PLC moves the part on only when Err is 0.
The two answer writes are commands to equipment. They go through the same checks as any tag write, and they need an explicit grant. Read Part and lot genealogy first for what is recorded.
Before you start
Section titled “Before you start”- eaxScada Pro or Enterprise.
- A Lead_Engineer (or Administrator) for unit types and triggers; an Administrator for the role grant.
- Tags mapped from the PLC for each station: the request, the sequence number, the unit’s ID, and whatever you record (result, measured values, component IDs). Two integer tags written by eaxScada: Ack and Err. Ack must hold every sequence number the PLC uses; neither may be a String tag or a read-only eaxPLC member.
- The runtime running on the primary server: handshakes are never written by a standby or while the runtime is stopped.
1. Create the unit types
Section titled “1. Create the unit types”Open Genealogy > Capture and configuration and choose New unit type for each kind of part or lot you track:
| Field | Meaning |
|---|---|
| Name | Letters, digits, ., _, -, at most 64 characters, such as gearbox or resin. |
| Kind | Discrete (one part, one serial number) or Lot (a quantity). |
| Unit of measure | The default unit of a lot (kg, pcs). |
| ID pattern | A regular expression every captured ID of this type must match, such as ^GB-[0-9]{4}$. A non-matching ID is refused (error 2). |
| A repeated operation is | ATTEMPT (the default: a rework, attempt n+1) or REFUSE (a second operation at the same station and step is refused, error 4). |
| An ID may be used again | never (the default) or after_retire (once the unit is shipped, scrapped or retired; the new unit is the next generation). |
For Lead_Engineers and up, the form also shows Kept for, read only: the retention in force for this type. It is set on the Retention and purge tab (Genealogy retention, purge and archives); a value saved there but not yet applied is noted under the field (it applies at the next start).
A configuration from an older version may carry a unit type or trigger field that no longer has any effect. That type or trigger is marked with a warning in its grid, and the chip above the grid filters to the marked rows. Open it and choose Save: the save removes the field.
2. Create a capture trigger per station event
Section titled “2. Create a capture trigger per station event”Choose New trigger. A trigger is one station event, written as a JSON document in the code editor of the dialog. Its event decides what it records:
event |
Records | Typical use |
|---|---|---|
UNIT_CREATE |
A new unit (the ID must not exist) | Serial number engraved or read at the first station |
RECEIVE_LOT |
A lot received, with its quantity (unit.qty_tag or unit.qty) |
Goods receipt of a material lot |
OP_START |
The start of an operation | Long operations with a start and an end |
OP_END |
The end of an operation: result, measured values, components, new status | Test or assembly station |
OP_RECORD |
A whole operation in one record | Short operations |
CONSUME |
Components consumed by the unit (at least one) | Fitting parts or dosing a lot |
An example for a press-fit station that records one operation, its result, a force and the lots used:
{ "id": "st10-press-fit", "enabled": true, "station": "Line1/ST10", "step": "press-fit", "event": "OP_RECORD", "request": { "tag": "Assembly/ST10/Trace/Req", "edge": "RISING" }, "sequence_tag": "Assembly/ST10/Trace/Seq", "unit": { "type": "drive-module", "tag": "Assembly/ST10/Trace/SerialNo" }, "result": { "tag": "Assembly/ST10/Trace/Result", "map": { "1": "PASS", "2": "FAIL", "3": "REWORK" } }, "components": [ { "type": "bearing-lot", "kind": "LOT", "tag": "Assembly/ST10/Trace/BearingLot", "qty": 2, "uom": "pcs", "required": true } ], "snapshots": [ { "name": "press_force", "tag": "Assembly/ST10/PressForceMax", "uom": "kN", "lo": 4, "hi": 6.5 } ], "consistency": { "mode": "SEQUENCE_STAMP", "stamp_tag": "Assembly/ST10/Trace/Stamp" }, "handshake": { "ack_tag": "Assembly/ST10/Trace/Ack", "error_tag": "Assembly/ST10/Trace/Err" }}The main fields:
request.edge:RISING(the PLC sets a Boolean),FALLING, orCHANGE(the PLC increments a request counter; each change is a request).sequence_tag: the request’s number, which eaxScada echoes in Ack. Required with a handshake. Use a new number for each request.unit.policy: for operations andCONSUME,EXISTING(the default: the unit must exist, else error 2) orIMPLICIT(created when unknown and flagged).components:required: truerefuses the record when the component ID is empty; otherwise an empty component is skipped. At most 100.snapshots: measured values with optional limits, at most 200. Each value keeps its quality; a Bad value is recorded without its value.result.map: tag value to PASS, FAIL, REWORK, SCRAP or INCOMPLETE.operator(TAG,STATION_USERorPLC) andbatch(RECIPE_UNIT,TAGorNONE) for operations.quality_policy.components:REFUSE(the default: a Bad or Uncertain component ID refuses the record) orMARK. The unit’s own ID is always refused when not Good.
Consistency decides how eaxScada knows the tags belong to the same request:
| Mode | How | When |
|---|---|---|
SEQUENCE_STAMP |
The PLC writes the request’s number into the stamp tag last, after the data; eaxScada waits until the stamp equals the sequence (timeout 3 s by default) | Recommended for any driver |
POLL_CYCLE |
eaxScada waits for a full poll cycle of every tag of the record | Polled drivers only |
DELAY |
eaxScada waits a fixed delay (1 s by default) | Weakest; avoid |
Left out, the mode is chosen per record: SEQUENCE_STAMP with a stamp tag, else POLL_CYCLE when every tag is polled, else DELAY. Data that is not consistent in time is refused (error 3).
eaxScada writes only the trigger’s Ack and Err tags: never a tag the trigger reads, never the plant emergency-stop signal or a safety write target. Such a configuration is refused when you save it.
3. Grant the Genealogy_Capture role its writes
Section titled “3. Grant the Genealogy_Capture role its writes”The answers are written by a system actor, genealogy capture (for PLC:<station>), with the role Genealogy_Capture. It writes a tag only when a topic rule allows it. An Administrator sets this up once:
- Open Security > Roles and create a role named exactly
Genealogy_Capture. - Open Topic Rights and add a rule:
- Target Role:
Genealogy_Capture; - Target Type: UNS Topic;
- Action:
publish(write tag / command); - Target Subject / Pattern: the Ack and Err tags, or a pattern covering only them, such as
Assembly/*/Trace/AckandAssembly/*/Trace/Err(*one level,>the rest). For an eaxPLC member, a rule on one of its containers also matches; - Effect: ALLOW.
- Target Role:
- Save, and repeat for each PLC with a genealogy trigger.
Rules for the grant:
- A DENY wins. A
publishDENY rule of the role that matches the tag or one of its containers refuses the write, whatever the ALLOW rules say. - No role, or no matching ALLOW rule: no answer is written, and the PLC waits. The refusal is in the audit trail.
- Keep the pattern narrow, and never give this role to people.
After the grant each write still passes, in order: the primary server with the runtime running; the trigger’s own Ack or Err tag only; the eaxPLC read-only check; the write policy as an external writer (interlocks, write ranges and limits apply); the tag’s engineering range. A tag whose write policy asks a person to sign or confirm is never written by the capture: nobody signs for it. Make sure the write range and the engineering range of Ack accept every sequence number, and those of Err accept 0 to 7.
Each answer is recorded in the audit trail first, as MANUAL_OVERRIDE, or MANUAL_OVERRIDE_REFUSED with the reason, by “genealogy capture (for PLC:<station>)”. A refused write is retried every second, then less often up to every 30 s, and recorded once per reason.
4. Check the handshake
Section titled “4. Check the handshake”In the trigger dialog choose Check. Nothing is saved and nothing is written. The grid lists the trigger and its handshake tags:
| Column | Meaning |
|---|---|
| Field | Trigger, Acknowledgement or Error |
| Tag | The tag path |
| Usable | The tag exists and can be written (not a String tag, not read-only) |
| Kind | The tag’s kind |
| Write granted | Genealogy_Capture may write it |
| Why | The reason when something is missing, such as “no tag …” or “give the role Genealogy_Capture a topic write (publish) permission on …” |
Rows with a problem carry a warning marker; the chip above the grid filters to them. Fix every warning, then choose Save. The triggers grid marks triggers with warnings the same way. Set "enabled": true to start capturing.
5. Program the PLC
Section titled “5. Program the PLC”The handshake is the same for every PLC. For each request:
- Write the data: the unit’s ID, the result, the measured values, the component IDs.
- Write the next sequence number
nto Seq (for example the previous value plus one). - With
SEQUENCE_STAMP, writento Stamp, after the data. - Request the record: set Req to TRUE (
RISING), or increment the request counter (CHANGE). - Wait until Ack = n. Keep Req set and Seq unchanged while you wait.
- Read Err. eaxScada writes Err before Ack, so the Err you read belongs to this request.
- Reset Req to FALSE (not needed with
CHANGE). - Move the part on only when Err = 0. Otherwise stop, divert the part or alarm, as your process requires.
- Product
- Data store
- Device or controller
- Data or telemetry
- Command to equipment
Read as text
The PLC writes the data, the sequence number n and the stamp n, then sets Req. eaxScada waits until the stamp equals the sequence number, reads the tags in one pass and checks them. A refused request is kept as a refusal record and answered with an error code; a record the store does not take (storage full, recording stopped, internal error) is answered the same way, with code 5, 6 or 7. An accepted request is stored on disk first; only then eaxScada writes Err = 0 and Ack = n. The PLC waits for Ack = n, reads Err and moves the part on only when Err is 0.
Participants
- PLC (device or controller): the station
- eaxScada (product): the trigger
- Genealogy store (data store)
Steps, in order
- PLC → eaxScada (data or telemetry): Data, Seq = n, then Stamp = n. unit ID, result, values, component IDs; the stamp last
- PLC → eaxScada (data or telemetry): Sets Req. TRUE (RISING) or counter + 1 (CHANGE)
- eaxScada: Reads the tag set: waits until Stamp = Seq = n (3 s by default); reads every tag in one pass; takes an ID from a Good value only
- The request is refused:
- eaxScada → Genealogy store (data or telemetry): Keeps a CAPTURE_REFUSED record. with the reason
- eaxScada → PLC (command to equipment): Writes Err = 1 to 7, then Ack = n. no record of the part
- The request is accepted:
- eaxScada → Genealogy store (data or telemetry): Appends the record
- Genealogy store → eaxScada (reply): Stored on disk. the answer waits for this
- eaxScada → PLC (command to equipment): Writes Err = 0, then Ack = n. through the server's write path, retried until written
- PLC: Waits for Ack = n: keeps Req set and Seq unchanged; reads Err, then resets Req; moves the part on only when Err = 0; own timeout: no Ack, the part stays
- Note: Req reset or Seq changed before the Ack: the answer is dropped
- eaxScada restarts before the Ack:
- eaxScada: Serves the held request again: Req still set, Seq = n, Ack behind; finds the record by its key
- eaxScada → PLC (command to equipment): Writes Err = 0, then Ack = n. no second record
Add a timeout on the PLC side (for example 10 s): no Ack means no record, and the part must not move on as recorded. While Req stays set and Seq is unchanged, eaxScada keeps trying to write the answer. After a restart or a failover it takes the held request again, finds the record by its sequence number and answers again without a second record. If the PLC resets Req or moves Seq on before the Ack, the answer is dropped, and the same sequence number is not taken a second time while the server keeps running.
Error codes written to Err:
| Err | Meaning | What to do |
|---|---|---|
| 0 | Recorded (or recorded before: the same request again) | Continue |
| 1 | Configuration: the trigger does not allow this record (unknown type, invalid content) | Fix the trigger |
| 2 | Identity refused: the unit or a component ID is Uncertain, Bad, empty, off its pattern, not an exact integer, simulated, or unknown | Check the reader and the ID |
| 3 | Data not consistent in time (the stamp did not match the sequence within the timeout) | Check the order of the PLC writes |
| 4 | Duplicate: the unit exists already (create), or the operation was recorded before (REFUSE) |
Check the part’s route |
| 5 | Storage full: the genealogy storage floor is reached | Free disk on the server |
| 6 | Recording stopped: licence lowered or expired | Restore the licence |
| 7 | Internal: the write queue is full (50,000 records waiting) or an internal error | Retry later; check the Status page |
Every refusal is also kept as a CAPTURE_REFUSED record with the reason. When the server was not recording for a time, a CAPTURE_GAP record covers it.
With no genealogy configuration loaded, nothing is written to any PLC.
Verify
Section titled “Verify”- Genealogy > Status: the trigger’s line shows records, acknowledged, refused and gaps, live.
- Search for the unit ID in Genealogy > Search and open it: the operation, result and components appear.
- Security > Operations audit: a
MANUAL_OVERRIDErow for Err and one for Ack per request.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause and fix |
|---|---|
| The PLC never gets Ack | No grant (step 3), a DENY rule, a write policy that asks for a signature, a range that refuses the value, the runtime stopped, or this server is the standby. The Check and the MANUAL_OVERRIDE_REFUSED rows say which. |
| Err = 3 on every request | The stamp is written before the data, or not at all. Write the stamp last. |
| Err = 2 with a good-looking ID | The tag’s quality is not Good, or the ID does not match the type’s or the trigger’s pattern. |
| Err = 6 | The licence no longer includes genealogy. Records stay readable. |
| Ack arrives late on a high availability pair | ack_durability waits for the standby (up to 2 s). See high availability. |
Related
Section titled “Related”- Part and lot genealogy
- Trace, recall and export genealogy
- Limit tag writes
- Connect alarms to the controller (handshake): the same grant pattern for alarms.