EPICS Data Validity using the TRIUMF Modtcp driver
Rolf Keitel, updated 2005/04/07
The TRIUMF modtcp driver uses a memory buffer in the IOC to store PLC data.
EPICS device support reads and writes data from/to this memory buffer.
Two vxWorks tasks (plcRead, plcWrite) move data between this memory buffern and the PLC using TCP/IP.
One vxWorks task (plcWatch) monitors the PLC-to-IOC communication.
This section is based on Quantum Series PLCs.
Problems, which can lead to "stale" = invalid data.
- Channel access (CA) broken: The IOC is running ok, but does not communicate with CA clients
- IOC<>PLC communication broken: EPICS device support is reading/writing to the memory buffer, but the plcRead task does not communicate with the PLC
- PLC program stopped: EPICS
device support is reading/writing to the memory buffer, plcRead task
reads from the PLC, but the PLC program has stopped. Note that in this
case communication with the PLC still works on Quantum Series PLCs.
In the control system, stale data must be
recognizable and it is desirable to have diagnostics to also recognize the cause of stale data.
How does the ISAC control system handle these issues?
Case 1) is handled by the CA protocol, which notifies the CA clients
about the state of the connection between the client and a process
the CA client
must respond properly to invalid data
Case 2 and 3): the modtcpSupport EPICS driver counts successful
read transactions and monitors a watchdog location in the PLC. If the watchdog is not updated for
five seconds, all EPICS input records are flagged invalid and are put
into an invalid alarm state.
The successful read counters are provided as vxWorks global variables
to EPICS. This allows to distinguish case 2) (neither read counters
nor watchdog are updating) from case 3) (read counters are
updating, but watchdog is not).
- the PLC program must provide a watchdog location. The
value at this location should increment at every scan and wrap around
at a high value. The same value should not reappear in the watchdog
location for several seconds.
- the IOC startup script must call modtcpWatchdog() in order to identify this location to EPICS.
- the EPICS database designer must ensure that the invalid severity of a hardware input record is propagated to any derived records.