Difference between revisions of "EPICS for Dummies"
Line 104: | Line 104: | ||
Records do nothing until they are processed. Records can be processed multiple ways: | Records do nothing until they are processed. Records can be processed multiple ways: | ||
* Manually: | * Manually: | ||
** Write 1 (or any non-zero value) to a record’s PROC field | ** Write 1 (or any non-zero value) to a record’s '''PROC''' field | ||
**Forward link (FLNK) from another record | **Forward link ('''FLNK''') from another record | ||
* Periodically: | * Periodically: | ||
** Set the SCAN field to something other than | ** Set the '''SCAN''' field to something other than <code>Passive</code> | ||
*** <code>Passive</code> | *** <code>Passive</code> | ||
*** <code>Event</code> | *** <code>Event</code> | ||
Line 118: | Line 118: | ||
*** <code>0.2 second</code> | *** <code>0.2 second</code> | ||
*** <code>0.1 second</code> | *** <code>0.1 second</code> | ||
** <code>I/O Intr</code> processes a record when the driver gets a new value, but is device/driver dependent | ** <code>I/O Intr</code> processes a record when the driver gets a new value, but is device/driver dependent and isn’t guaranteed to work | ||
** If a record’s SCAN field is not specified in a database, it defaults to “Passive.” | |||
Note: the SCAN field is common to *all* record types and the options can be selected by index instead of by string. | Note: the SCAN field is common to *all* record types and the options can be selected by index instead of by string. |
Revision as of 15:21, 13 February 2023
What is EPICS?
EPICS (Experimental Physics and Industrial Control System) is a distributed control system, which means that the IOC (software) can run on a different computer as the user interfaces.
What is an IOC?
IOC (Input/Output Controller) is a piece of software running on a computer:
- loads databases
- serves something called process variables (PVs) that you can read and write to
- used to run on VMEs, but nowadays it runs on anything.
- usually talks to hardware, but that isn’t a requirement.
IOCs are started with startup scripts. Those scripts tell the IOC what database files to load and where those files are. When the IOC is told to load a database, what it is doing is parsing that database file, identifying the records that are contained within, and then generating the actual epics PVs that a user will interact with.
Records and databases (lists of records) are configuration files describing the initial setup for PVs, the IOC is the software that manages the behavior of PVs and communication to get/set their values.
What is a databases?
Databases are lists of records.
What is a PV?
PV (Process Variable) is a the field from a record:
PV = record_name + . + field_name
Most of the interactive parts of user displays have PVs associated with them.
What is a record?
Records are the building blocks of EPICS:
- There is a lot of different types of record, and each type is designed to perform a specific function
- Records are customizable via fields that allow users to configure how they behave and monitor their state.
- Records do nothing until they are processed (see #SCAN, PROC & FLNK fields)
- Records vary significantly in complexity (see #More about records)
- It is rare for new records to be created, now that asyn device support exists. add link to asyn?
Where do records come from?
Typically, records at the APS comes from either:
- EPICS base: main core of EPICS
- synApps: a collection of EPICS modules that are commonly used at the APS
A module is similar to a python package: it is an already written set of databases and associated behavior you can load into your IOC to do certain things, for example talk to specific hardware. An IOC can link to several modules.
Module | Records | Module | Records |
---|---|---|---|
alive | alive | motor | motor |
asyn | asyn | optics | table |
busy | busy | scaler | scaler |
calc | acalcout, scalcout, sseq, swait, transform | sscan | sscan |
camac | camac | std | epid, timestamp, throttle |
lua | luascript | vac | digitel, vs |
mca | mca | vme | vme |
allenBradley | ab1771IFE, ab1771N, ab1771IX, ... | allenBradley | ..., ab1791, abDcm |
If a record isn't listed here, it probably comes from EPICS base.
The advantage to using synApps over a collection of modules one assembles on their own is that some amount of BCDA testing has been done.
What is a record field?
- A controllable or informative property of a record
- Noteworthy fields:
- VAL - the default field (used if no field is specified in the vast majority of cases)
- SCAN - determines when a record processes
- NAME - the record name (helpful if records are aliased)
- DESC - record description
- RTYP - the record type
- DTYP - the device support type (not meaningful for all record types)
- DISP - disable puts (ca = channel access & pva = pv access) from outside the IOC (when non-zero); e.g. disable a motor from the motorx_all screen
- DISV/DISA/SDIS - disable record processing internally
- Record processing is disabled when DISA equals DISV (e.g. uses SDIS field to read in a value/mode, which will disable some control if a certain mode is active)
- DISA is set to the value of the PV in the SDIS field, if it isn't empty
- TPRO - trace processing: when set to 1 prints out all the records that get processed after the record is processed; used only for troubleshooting
- Note: some of the fields of a record are actually record attributes (they return the same value for all instances of the record type; see https://epics.anl.gov/)
SCAN, PROC & FLNK fields
Records do nothing until they are processed. Records can be processed multiple ways:
- Manually:
- Write 1 (or any non-zero value) to a record’s PROC field
- Forward link (FLNK) from another record
- Periodically:
- Set the SCAN field to something other than
Passive
Passive
Event
I/O Intr
10 second
5 second
2 second
1 second
0.5 second
0.2 second
0.1 second
I/O Intr
processes a record when the driver gets a new value, but is device/driver dependent and isn’t guaranteed to work- If a record’s SCAN field is not specified in a database, it defaults to “Passive.”
- Set the SCAN field to something other than
Note: the SCAN field is common to *all* record types and the options can be selected by index instead of by string.
How to learn more about record fields?
To find documentation for a specific field you need to know/find answers to the following questions:
- Is the field common to all or input/output record types?
- If not, does the record come from EPICS base or a different EPICS module (synApps)?
- The EPICS base record reference documentation is the best place to find information about record types that come from EPICS base.
Field documentation appears in multiple locations:- Fields common to all record types
- Fields common to input record types
- Fields common to output record types
- Record-specific documentation
- synApps record reference documentation
- In each module's documentation directory
- https://github.com/epics-modules
/APSshare/epics/synApps_X_Y/support
- In each module's documentation directory
- The EPICS base record reference documentation is the best place to find information about record types that come from EPICS base.
What is a device?
More about records
- Records vary significantly in complexity; one way to classify them would be (*):
- Simple records are associated with individual data types
- bi, bo, mbbi, mbbo, longin, longout, ai, ao, stringin, stringout, waveform
- Intermediate records often perform calculations or link multiple records
- calcout, scalcout, acalcout, swait, transform, fanout, dfanout
- Complex records are associated with devices or higher-level functionality
- motor, scaler, mca, sscan, table, digitel, vs
- Flexible records allow custom functionality to be implemented
- sub, aSub, luascript
(*) this is not an official classification, nor an exhaustive list of records.
Note that:
- areaDetector databases are composed of mostly simple record.