EPICS

Channel Access Concepts
Kazuro Furukawa, KEK(Bob Dalesio, LANL, USPAS1999)

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

1

Why Channel Access?
uEPICS

We don’t have
Network transparent computing in general (yet)Plenty of administration tasks for sharing datau No standard way for remote processinguuuRPC, COM, CORBA, RMI, .NET, etc.

In EPICS, Channel Access provides
Efficient Software Bus on Network
Performance, Rapid development, Maintenance, Administration
Tuned for each operating system(But no internal documentation yet)

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

2

Channel Access :The EPICS Software Bus

EPICSOperator Interface
Archive Tool
Alarm Tool
Application
Application

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

3

Control Processing
Functionalities
uuuu

EPICS

On-demand SynchronousOn-demand Asynchronous
Periodical
On-Change(with value deadband)u (with rate limit)
uuuuu

On-Event (Trigger)
Cache
List of Control Points
Static Information and History using the Same API
Existent Control Systems Support a Part of Those

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

4

What is Channel Access (CA)EPICSuStandardized communication path to a field(s) withina record (process variable) in any IOC database(s).

uThis field is a communication path to an IO channelor software.

uIntegrates software modules into the control system.

u

A callable interface (library of subroutines).

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

5

Why Use Channel Access

EPICS

u

Callable interface designed for easy use by casual applicationsuCallable interface also designed for use by system software
components such as the operator interface, sequencer, and thearchiveruOperating system transparencyuNetwork transparency(access to remote and local channels is identical)u

CPU architecture independence (silent data conversion)uIsolation from system software changes.

uEfficiency (host IO channels)u

Efficiency (network remote IO channels)

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

6

EPICS

Channel Access networkarchitecture
Operator
Interface 1...

CAC

Operator
Interface nCAC

Data logger,
Data Analysis

CAC

CAC

CAC

IEEE 802.3

CAC

CAS

IO Controller 1CASCACCACCASIO Controller 2...

CAS

IO Controller nChannel Access Server

CAC Channel Access ClientChannel Access Concepts – EPICS Training – K.F – Jul.2003.

7

Client Server ModelEPICSu

CA is a network service.

u

Clients use the callable interface (link to the CAlibrary).

uServer replicated in each IOC (part of iocCore).

u

Clients make requests to the servers across thenetwork.

u

CA defines a network protocol.

uLocal operations are initiated and performed by thehost processor.

uRemote operations are initiated but not performed on
the host processor.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

8

Asynchronous Nature of CAEPICSu

CA does not wait to gain access to the network prior to
returning from each library call.

uRemote operation requests are buffered and sent when thebuffer fills or when you ask.

u

Data fetched from a remote machine is generally not
immediately available.

uWith few exceptions values written into your variables by
CA should not be referenced until you have synchronized.

u

All operations guaranteed to be executed in the orderrequested.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

9Why is CA Asynchronous?

EPICS

uCombined operations are more efficient when sharing acommon resource such as a bus.

uCombined operations can be more efficient when passing
through system software layers.

uSometimes it is useful to perform labor on a local
processor while several operations are completing on
remote processors.

u

The plant is often asynchronous.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

10

CA Performance

EPICS

2000
1800

microseconds

1600
1400

local accessremote asynchronous access

1200

remote synchronous access

1000
800
600
400
200
0

Reads

WritesSimple Unconverted I/O Channel Reads and Writes
Channel Access Concepts – EPICS Training – K.F – Jul.2003.

11

Methods of Synchronizing

EPICS

u

No data fetches are left outstanding after completing acall to ca_pend_io().

u

Asynchronous replacement for ca_get():ca_get()ca_pend_io(),u

Use a monitor.

u

Use fetch with callback.

u

Use a synch protocol with a remote program.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

12

Event Propagation

EPICS

u

In any process control system, an application
program must be prepared to respond to any one of anumber of asynchronous events.

u

Events include hardware or software state changes(limit switches, flow indicators, out of range analogchannels, software exceptions, etc.)

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

13

CA Software Interface to Events

EPICS

u

An event is a significant change in either the value ofa field or the condition of the record as a whole.

u

Events are placed in a queue and handled in theorder that they occurred.

u

A channel can be monitored by specifying a handler
to be run each time an event occurs.

u

CA client applications using events tend to be treestructured.

uUpdating the client’s local value for a channel thisway can save on network traffic since a message
soliciting the update need not be sent.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

14

Event Rate Management(Analog Channels)

EPICS

u

The rate at which updates are sent over the network
should be minimized by the project engineer withinreasonable constraints. This rate is managed by adjusting
the channel’s deadband and scan rate.

u(R3.15 may provide facility to limit monitor rate (?))

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

15

CA Exceptions

EPICSuSince the CA client library does not wait to gain access tothe network prior to returning from each call an operation
can fail in the server after the library call that initiated itreturns.

uStatus of these unsuccessful operations are returned fromthe server to the client’s exception handler.

u

The default exception handler prints a message for each
unsuccessful operation and aborts the client if the conditionis severe.

uOperations which fail in the server are nearly always
caused by programming errors.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

16Channel Naming Conventionu

CA requires that channels have a name.

u

The IOC database requires names of the form:
uEPICS<record name>[.<field name>]u

rfhv01.LOPR”

u“rfhv01”u

Record names are assigned by project engineer following projectnaming convention.

u

Record field names and purposes are record type specificu

A list of the field names available for each record can be obtained fromthe database documentation (EPICS Record Reference Manual.)u

If the field name is omitted, the field .VAL is assumed. This field contains
a control or read back value.
Channel Access Concepts – EPICS Training – K.F – Jul.2003.

17

Native Data Types

EPICS

u

All channels have a “native” data storage type in the IOC.

u

All native data storage types are “atomic”.

uAtomic data types include:uinteger, floating point, string, enumerated etc.

u

When transferring a new value to/from a channel theclient program specifies the data format to supply/receive
it in. This is often referred to as the external data type.

u

The external data type can be different from the nativetype if conversion is possible.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

18

Compound Data Types
u

EPICS

Compound data types contain a channel value combinedwith additional status or configuration information.
u

Value + Alarm Status + Timestamp + Drive LimitsuCompound types involve the database record as a whole.

uCompound types can currently only be used with gets andmonitors.

uData types are described in db_access.h. (DBR_XXXX)Channel Access Concepts – EPICS Training – K.F – Jul.2003.

19

Connection ManagementEPICSu

Network Connections are inherently transient.

u

A channel’s connection state is either not found,connected, or disconnected.

u

CA allows you to specify a handler to be run when achannel’s connection state changes.

uConnection requires a server for the channel and a valid
network path to the server.

u

CA automatically restores connection upon notificationfrom the server.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

20

Software Releases

EPICS

u

IOC core and CA client library EPICS major release
number must match, or client will not find sever.

uThis is due to potential CA protocol redesign between
major releases.

u

CA protocol is upwardly compatible within a major release.

uWhen new features are added to the client, older versionsof the server won’t support them.

Channel Access Concepts – EPICS Training – K.F – Jul.2003.

21

EPICSWORKSTATION
user program
Channel Access
Repeater

Channel AccessserverChannel AccessclientChannel Accessclientdatabase access library
DATABASE

C program
SNL sequence

database libraryrecord support
device support
device drivers
IOC
instrumentation
andcontrol hardware
Channel Access Concepts – EPICS Training – K.F – Jul.2003.

22