Explainer
Why a PI value timestamp is not a receipt time
Short answer
No, an AFDataPipe event carries one timestamp — the value's event time, assigned by whatever wrote it — and the PI Data Archive exposes no per-value server receipt time. A sync over a one-way diode therefore restarts from the earlier of the two readers' last sent timestamps minus an overlap margin, journals every event locally before sending, and reconciles archives on a schedule. Treat 0% data loss as a requirement you validate, not something AFDataPipe guarantees.
On this page
No. An event you receive through AFDataPipe carries exactly one timestamp, and that timestamp is the event time: the moment associated with the value, set by whatever wrote it. The PI Data Archive does not expose a second timestamp recording when the server accepted the write, so no AF SDK call returns everything that arrived since a chosen moment. That hurts most when you replicate one PI Server to another across a one-way data diode and must not lose a single update, because the event timestamp then cannot serve as your progress cursor. It still works as the data's own clock. Journal every event locally before you send, backfill from the earlier of your readers' last sent timestamps minus an overlap, reconcile the archives on a schedule, and treat the zero-loss figure as something you verify at the destination.
One timestamp per value, and it is not arrival time #
The AF value model has one timestamp, and its meaning depends entirely on the writer. A PLC or RTU stamps at acquisition on its own clock. An interface may stamp when it scans. A person keying history in the PI SMT Archive Editor, or an application writing through PI RDBMS or PI UFL, can set any event time at all. Arrival time and arrival order are not fields in that record, so a write that lands long after its neighbours can carry an event time older than data already on disk.
Event times are only as consistent as the clocks behind them: when one stored value reads hours off from the rest, the usual culprit is a source clock or a UTC offset, which we untangle in Historian shows a real value hours off: check the UTC offset.
Reading the archive by event time answers which values exist in a time range now. It cannot answer which writes arrived after a given moment, and that second question is the whole problem for a sync.
Why the last timestamp fails as a restart cursor #
Save the newest event timestamp you have processed, go down for a while, and every write that landed during the outage with an event time older than your cursor is invisible to a recovery query that starts there. Interfaces buffer and flush late, sources backdate, operators fix yesterday's bad entry: each lands behind the cursor after the fact.
Replacements and deletes hide the same way. A new value written at a timestamp you already hold creates no new time to find, so a check for missing timestamps sees nothing. If the destination must mirror replacements and deletions, recovery has to compare content, not just collect times.
The restart marker therefore cannot be the event timestamp alone. It has to be an application-level record of what you captured and sent, paired with a query strategy that assumes writes can land behind the cursor.
The workarounds, and what each one actually records #
Three partial substitutes exist, each covering a slice:
- Interface timestamps. Some interfaces expose two times: the OPC-DA interface, for instance, gives you the source timestamp and the interface's own timestamp, and no archive receipt time. That diagnoses acquisition latency on the tags that interface feeds, and nothing else.
- Writer-side annotations. An application that creates or edits values can stamp write context on the event, such as the time it wrote the value or the user who wrote it. That is an application-recorded write time, not a server-confirmed receipt, and it exists only where writers participate.
- Periodic sampling of the server clock. An analysis or performance equation that runs every second and writes a value when the current value has changed gives one-second resolution on change detection. Writes between scans collapse into one observation, and historical edits never trip it.
None of these is a generic, source-independent receipt cursor, which is why the design below does not need one.
| Approach | What it records | Covers | Why it is not a receipt time |
|---|---|---|---|
| Interface timestamps | Source time and interface-node time | Only that interface's tags | Per-interface; blind to manual and application writes |
| Writer annotations | Whatever the writing application stamps | Only participating writers | Not ordered, not durable, not universal |
| Server-clock sampling | Whether the current value changed, once per scan | Everything the calculation reads | One-second sampling; collapses bursts; misses historical edits |
| AFDataPipe streaming | The event time of every captured value | Values present in the queried ranges | No arrival time or order; backdated writes outside the range are invisible |
The sync design that works over a data diode #
Separate four stages and record progress at each: capture from the source, persist locally, transmit, apply at the destination. Handing bytes to the TCP stream on the sending side of the diode proves nothing; a one-way link returns no acknowledgement, no gap list and no count, so the sender never knows what the destination holds. Completeness is measured by reading the destination, never inferred from a clean transmit.
Journal before you send #
Define the replicated record first: point identity, event timestamp, value, status and the fields the destination needs, plus insert, replace and delete semantics if you must mirror those. Persist every captured event to a local journal before you call it recoverable, and never let a checkpoint advance past what is on disk. It is the same discipline as the reconnect-and-resume pattern in Reconnect an edge PC to SQL Server after connection loss: durable state first, transmission second.
Run two reader instances for redundancy, each on its own machine beside the source; when you specify that machine, a fanless mini PC with room for the local journal is the usual fit. Enforce single-sender ownership so only one instance transmits at a time, the way hot-standby interface pairs do, and keep both instances recording their last sent timestamp even while one stands by.
Backfill with overlap, then reconcile #
On startup, read both instances' last sent timestamps, take the earlier one, subtract an overlap margin, and replay from there to the present; the overlap swallows writes whose event time sits behind the cursor when they finally land. Streaming plus that backfill covers interface-fed tags. It cannot cover manual entry or writes through PI RDBMS and PI UFL, which can backdate arbitrarily, so run a scheduled reconciliation pass across your site's historical edit window and compare content, not timestamp presence. Applying backfilled values at the destination, where late arrivals land out of order, is its own task; we walk a receiver-side pattern in Backfill late and out-of-order data into Canary collectors.
Before building any of this, check whether the PI-to-PI interface can carry your path; it exists to replicate between archives, and a custom stack is only worth its maintenance when a requirement such as a TCP stream through one-way hardware rules it out. Teams running custom stacks like this report engineering toward a small measured residual instead of literal zero: one practitioner building exactly this diode sync reported targeting on the order of 0.001% residual loss.
Example: picking the restart point after both readers stall #
Illustrative numbers for the design above; the rule is the failover rule: start from the earlier of the two last sent timestamps and subtract the overlap.
Inputs:
- Reader A, the active sender, last transmitted an event with timestamp 14:05:00 UTC when its feed dropped.
- Reader B, the standby, last recorded 13:58:20 UTC, because its capture ran behind the active sender.
- Overlap margin: 10 minutes, chosen because this site's worst interface buffering lag is 5 minutes and the margin doubles it.
- The feed recovers at 14:20:00 UTC.
Rule: restart point = the earlier of the two last sent timestamps minus the overlap margin.
Arithmetic: the earlier of 14:05:00 UTC and 13:58:20 UTC is 13:58:20 UTC. Subtract the margin: 13:58:20 UTC − 10 minutes = 13:48:20 UTC. The replay runs from 13:48:20 UTC to 14:20:00 UTC, which is 31 minutes 40 seconds of archive history to re-read and re-send.
Result: replay every event with a timestamp from 13:48:20 UTC onward, writing to the destination with repeatable semantics so replaying an event you already sent replaces it rather than duplicating it.
Decision: the 10 minute margin comes from this site's inputs, not a rule of thumb — size yours from the longest lag between an event's timestamp and the moment the write lands on your system, then verify by watching what reconciliation finds inside the overlap. Anything backdated before 13:48:20 UTC arrives only through reconciliation, which is why that pass exists.
The decision for each case #
- You want the server's arrival time for each value: it is not exposed, so build the application so it never needs one. No AF SDK call, pipe option or archive query returns a generic receipt timestamp.
- Interface-fed tags across a diode: AFDataPipe streaming into a durable local journal, overlapping backfill from the earlier of the two readers' last sent timestamps, and repeatable writes at the destination.
- Manual entry, PI RDBMS or PI UFL, or any writer that can backdate: those never appear in the timestamp replay, so schedule reconciliation across your site's historical edit window and compare content.
- Zero loss as an acceptance criterion: the only direct proof is freezing inflow and comparing both archives end to end, so run that as a scheduled audit and let reconciliation measure everything between audits. Do not write AFDataPipe, dual readers or the diode itself into the specification as a loss guarantee.
Questions asked
Does the PI Data Archive store a receipt time for each value?
Not one you can read back. The archive stores each event under its event timestamp, and AF SDK surfaces that value and timestamp only. Server and interface logs may record write activity, but there is no per-value receipt field to query as a cursor, and interface logs cover only that interface's own traffic, not manual edits or writes from other applications.
Can the interface node clock stand in for the receipt time?
For diagnosis on one interface, often yes: if the interface node's clock and time zone line up with the source, its timestamp lands close to the receipt moment. It stays per-interface. It says nothing about entries made in the PI SMT Archive Editor or through PI RDBMS and PI UFL, and the server-clock sampling trick gives you one-second resolution at best.
Why can't the sender find out what the destination is missing?
A one-way diode carries traffic in one direction by design, so no acknowledgement, gap list or event count can travel back to the sending application. The sender's transmit log proves only that bytes left. Completeness is a property of the destination, so it has to be measured there: read the destination archives and compare tags, timestamps and values against the source.
What should the overlap margin be?
There is no universal figure. It has to exceed the longest lag between an event's timestamp and the moment the write actually lands on your system, including clock skew. Buffered interfaces, batch backfills and operator corrections set that lag. Size it from your own worst writer, then validate by watching what reconciliation finds inside the overlap window; the worked example's margin doubled a measured buffering lag.