Table of Contents
Chapter 1: EPICS Overview
EPICS consists of a set of software components and tools with which Application Developers can create a control system. The basic components are:
Figure 1-1 shows the basic physical structure of a control system implemented via EPICS.
- OPI: Operator Interface. This is a UNIX based workstation which can run various EPICS tools.
- IOC: Input/Output Controller. This is a VME/VXI based chassis containing a Motorola 68xxx processor, various I/O modules, and VME modules that provide access to other I/O buses such as GPIB.
- LAN: Local Area Network. This is the communication network which allows the IOCs and OPIs to communicate. EPICS provides a software component, Channel Access, which provides network transparent communication between a Channel Access client and an arbitrary number of Channel Access servers.
Figure 1-1: EPICS Based Control System
The rest of this chapter gives a brief description of EPICS:
The basic attributes of EPICS are:
- Basic Attributes: A few basic attributes of EPICS.
- Platforms: The vendor supplied Hardware and Software platforms EPICS supports.
- IOC Software: EPICS supplied IOC software components.
- Channel Access: EPICS software that supports network independent access to IOC databases.
- OPI Tools: EPICS supplied OPI based tools.
- EPICS Core: A list of the EPICS core software, i.e. the software components without which EPICS will not work.
- Tool Based: EPICS provides a number of tools for creating a control system. This minimizes the need for custom coding and helps ensure uniform operator interfaces.
- Distributed: An arbitrary number of IOCs and OPIs can be supported. As long as the network is not saturated, no single bottle neck is present. A distributed system scales nicely. If a single IOC becomes saturated, its functions can be spread over several IOCs. Rather than running all applications on a single host, the applications can be spread over many OPIs.
- Event Driven: The EPICS software components are all designed to be event driven to the maximum extent possible. For example, rather than having to poll IOCs for changes, a Channel Access client can request that it be notified when changes occur. This design leads to efficient use of resources, as well as, quick response times.
- High Performance: A SPARC based workstation can handle several thousand screen updates a second with each update resulting from a Channel Access event. A 68040 IOC can process more than 6,000 records per second, including generation of Channel Access events.
- Unix based Workstation, currently Sun4s
- Hope to support HP RISC workstation in near future
- X Windows
- Motif Toolkit
- Ethernet and FDDI
- ATM in the future
- TCP/IP protocols via sockets
- VME/VXI bus and crates
- Motorola 68020, 68030 and 68040
- Various VME modules (ADCs, DAC, Binary I/O, etc.)
- Allen Bradley Scanner (Most AB I/O modules)
- GPIB devices
- BITBUS devices
Figure 1-2 contains an overview of the IOC software components and their interactions.
- vxWorks operating system
- Real time kernel
- Extensive "Unix like" libraries
Figure 1-2: System Overview
Let's briefly describe the major components of the IOC and how they interact.
- DATABASE: The memory resident database plus associated data structures.
- Database Access: Database access routines. With the exception of record and device support, all access to the database is via the database access routines.
- Scanners: The mechanism for deciding when records should be processed.
- Record Support: Each record type has an associated set of record support routines.
- Device Support: Each record type has one or more sets of device support routines.
- Device Drivers: Device drivers access external devices. A driver may have an associated driver interrupt routine.
- Channel Access: The interface between the external world and the IOC. It provides a network independent interface to database access.
- Monitors: Database monitors are invoked when database field values change.
- Sequencer: A finite state machine.
The heart of each IOC is a memory resident database together with various memory resident structures describing the contents of the database. EPICS supports a large and extensible set of record types, e.g. ai (Analog Input), ao (Analog Output), etc.
Each record type has a fixed set of fields. Some fields are common to all record types and others are specific to particular record types. Every record has a record name and every field has a field name. The first field of every database record holds the record name, which must be unique across all IOCs attached to the same TCP/IP subnet.
A number of data structures are provided so that the database can be accessed efficiently. Most software components, because they access the database via database access routines, do not need to be aware of these structures.
With the exception of record and device support, all access to the database is via the channel or database access routines. See "Runtime Database Access" on page 45 for details.
Database scanning is the mechanism for deciding when to process a record. Four types of scanning are possible: Periodic, Event, I/O Event, and Passive.
- Periodic: A request can be made to process a record periodically. A number of time intervals are supported.
- Event: Event scanning is based on the posting of an event by any IOC software component. The actual subroutine call is:
- I/O Event: The I/O event scanning system processes records based on external interrupts. An IOC device driver interrupt routine must be available to accept the external interrupts.
- Passive: Passive records are processed as a result of linked records being processed or as a result of external changes such as Channel Access puts.
Record Support, Device Support and Device Drivers
In order to remove record specific knowledge from database access, each record type has an associated record support module. Similarly, in order to remove device specific knowledge from record support, each record type can have a set of device support modules. If the method of accessing hardware is complicated, a device driver can be provided to shield the device support modules. Record types not associated with hardware do not have device support or drivers.
The IOC software is designed so that the database access layer knows nothing about the record support layer other than how to call it. The record support layer in turn knows nothing about its device support layer other than how to call it. Similarly the only thing a device support layer knows about its associated driver is how to call it. This design allows a particular installation and even a particular IOC within an installation to choose a unique set of record types, device types, and drivers. The remainder of the IOC system software is unaffected.
Because an Application Developer can develop record support, device support, and device drivers, these topics are discussed in greater detail in a later chapter.
Every record support module must provide a record processing routine to be called by the database scanners. Record processing consists of some combination of the following functions (particular records types may not need all functions):
- Input: Read inputs. Inputs can be obtained, via device support routines, from hardware, from other database records via database links, or from other IOCs via Channel Access links.
- Conversion: Conversion of raw input to engineering units or engineering units to raw output values.
- Output: Write outputs. Output can be directed, via device support routines, to hardware, to other database records via database links, or to other IOCs via Channel Access links.
- Raise Alarms: Check for and raise alarms.
- Monitor: Trigger monitors related to Channel Access callbacks.
- Link: Trigger processing of linked records.
Channel Access is discussed in the next section.
Database monitors provide a callback mechanism for database value changes. This allows the caller to be notified when database values change without constantly polling the database. A mask can be set to specify value changes, alarm changes, and/or archival changes.
At the present time only Channel Access uses database monitors. No other software should use the database monitors. The monitor routines will not be described because they are of interest only to Channel Access.
Channel Access provides network transparent access to IOC databases. It is based on a client server model. Each IOC provides a Channel Access server which is willing to establish communication with an arbitrary number of clients. Channel Access client services are available on both OPIs and IOCs. A client can communicate with an arbitrary number of servers.
The basic Channel Access client services are:
In addition to process variable values, get and add event, any combination of the following additional information may be requested:
- Search: Locate the IOCs containing selected process variables and establish communication with each one.
- Get: Get value plus additional optional information for a selected set of process variables.
- Put: Change the values of selected process variables.
- Add Event: Add change of state callback. This is a request to have the server send information only when the associated process variable changes state. Any combination of the following state changes can be requested: change of value, change of alarm status and/or severity, and change of archival value. Many record types provide hysteresis factors for value changes.
It should be noted that channel access does not provide access to database records as records. This is a deliberate design decision. This allows new record types to be added without impacting any software that accesses the database via Channel Access. A Channel Access client can communicate with multiple IOCs having differing sets of record types.
- Status: Alarm status and severity.
- Units: Engineering units for this process variable.
- Precision: Precision with which to display floating point numbers.
- Time: Time when the record was last processed.
- Enumerated: A set of ASCII strings defining the meaning of enumerated values.
- Graphics: High and low limits for producing graphs.
- Control: High and low control limits.
- Alarm: The alarm HIHI, HIGH, LOW, and LOLO values for the process variable.
Channel Access provides a server which waits for Channel Access search messages. These are generated when a Channel Access client (for example when an Operator Interface task starts) searches for the IOCs containing process variables the client uses. This server accepts all search messages, checks if any of the process variables are located in this IOC, and, if any are found, replies to the sender.
Connection Request Server
For each IOC containing process variables it uses, the Channel Access client issues connection requests. The connection request server accepts the request and establishes a connection to the client. Each such connection is managed by two separate tasks. ca_get and ca_put requests map to dbGetField and dbPutField database access requests. ca_add_event requests result in database monitors being established. Database access and/or record support routines trigger the monitors via a call to db_post_event.
Each IOC provides a connection management service. When a Channel Access server fails (e.g. its IOC crashes) the client is notified and when a client fails (e.g. its task crashes) the server is notified. When a client fails, the server breaks the connection. When a server crashes, the client automatically re-establishes communication when the server restarts.
EPICS provides a number of OPI based tools. These can be divided into two groups based on whether or not they use Channel Access. Channel Access tools are real time tools, i.e. they are used to monitor and control IOCs.
Channel Access Tools
- MEDM: Motif version of combined display manager and display editor.
- DM: Display Manager. Reads one or more display list files created by EDD, establishes communication with all necessary IOCs, establishes monitors on process variables, accepts operator control requests, and updates the display to reflect all changes.
- ALH: Alarm Handler. General purpose alarm handler driven by an alarm configuration file.
- AR: Archiver. General purpose tool to acquire and save data from IOCs.
- Sequencer: Runs in an IOC and emulates a finite state machine.
- BURT: Backup and Restore Tool. General purpose tool to save and restore Channel Access channels. The tool can be run via Unix commands or via a Graphical User Interface.
- KM: Knob Manager - Channel Access interface for the sun dials (a set of 8 knobs)
- PROBE: Allows the user to monitor and/or change a single process variable specified at run time.
- XMCA: Allows the user to monitor and/or change a set of process variables specified at run time.
- XMSEQ: GUI which allows the user to prepare sequence programs that can be run on Unix or on an IOC.
- CAMATH: Channel Access interface for Mathematica.
- CAWINGZ: Channel Access interface for Wingz.
- Other tools are also available.
Other OPI Tools
EPICS consists of a set of core software and a set of optional components. The core software, i.e. the components of EPICS without which EPICS would not function, are:
- DCT: Database Configuration Tool. Used to create a run time database for an IOC.
- GDCT: Graphical Database Configuration Tool. Used to create a run time database for an IOC.
- EDD: Display Editor. This tool is used to create a display list file for the Display Manager. A display list file contains a list of static, monitor, and control elements. Each monitor and control element has an associated process variable.
- SNC: State Notation Compiler. It generates a C program that represents the states for the IOC Sequencer tool.
- Build Tools: Tools are available to create the various database components from ASCII definition files.
- Source/Release: EPICS provides a Source/Release mechanism for managing EPICS.
All other software components are optional. Of course, any application developer would be crazy to ignore tools such as MEDM (or EDD/DM). Likewise an application developer would not start from scratch developing record and device support. Most OPI tools do not, however, have to be used. Likewise any given record support module, device support module, or driver could be deleted from a particular IOC and EPICS will still function.
- Channel Access - Client and Server software
- DCT or GDCT
- Build Tools
Table of Contents