Title: EPICS Training @ PSI
1EPICS Training _at_ PSI
- Controls Section PSI
- 2015
2Acknowledgment
- Some slides in this talk came form the
- Getting started with EPICS lecture series of
APS. - My special thanks go to
- Ned Arnold
- and
- John Maclean
- from the Advanced Photon Source.
- The original talks can be found on
- www.aps.anl.gov/epics/docs/GSWE.php
3Contents
- What is EPICS
- The Parts of EPICS
- What are Records
- An Example for a Record
- How to Solve Problems with EPICS
4What is an Accelerator Control System?
- The Accelerator Control System connects the
Operator in the control room with the accelerator
hardware. The control room might not be near the
accelerator - Our Control System
- is called EPICS
?
EPICS
Operator
Accelerators
5What does EPICS Control?
For example Swiss Light Source (SLS at PSI)
Accelerator components to control ca. 200
computers ca. 600 magnets (power supplies) 300
vacuum pumps 9 cavity structures ca. 150 beam
position monitors 21 beamlines (together) ca.
300 computers 10 undulator magnets more than 1200
motors Distances between components (storage
ring with 130 m diameter) 50 km power cable and
more than 500 km signal cable
6What is EPICS?
EPICS is an abbreviation for Experimental
Physics and Industrial Control System
- EPICS is
- A collaboration
- A software tool kit
- A control system architecture
- EPICS
- supports distributed control systems for large
research facilities like accelerators - uses Client/Server and Publish/Subscribe methods
- uses the Channel Access (CA) network protocol
7The History
- In1989 started a collaboration between Los Alamos
National Laboratory (GTA) and Argonne National
Laboratory (APS) - (Jeff Hill, Bob Dalesio Marty Kraimer)
- More than 150 licenses agreements were signed,
before EPICS became Open Source in 2004 - Team work on problems, for example over Tech
Talk mailing list - Two collaboration meetings every year (spring and
autumn) in turns in America, Asia, and Europe - Collaborative efforts vary
- Assistance in finding bugs
- Share tools, schemes, and advice
GTA Ground Test Accelerator APS Advanced Photon
Source
8EPICS Who is Using That?
- Some members of the collaboration (not
complete!) - ANL (APS Accelerator, APS Beamlines, IPNS) in
Chicago, USA - LANL in Los Alamos, USA
- ORNL (SNS) in Oak Ridge, USA
- SLAC (SSRL, LCLS) in Standford, USA
- JLAB (CEBAF) in Newport, USA
- DESY in Hamburg, Deutschland
- BESSY in Berlin, Deutschland
- PSI (SLS, HIPA, PROSCAN, SwissFEL) in Villigen,
Schweiz - KEK in Tsukuba, Japan
- DIAMOND Light Source (Rutherford Appleton
Laboratory) in Oxfordshire, England - Iter (Test Fusion Power Plant), South France
- ESS (European Spallation Source), Lund, Sweden
9Are There Alternatives to EPICS?
- System Name
- EPICS
- TANGO
- DOOCS
- Tine
- ACS
- PVSS(Cern)
10The Architecture of EPICS
Network based Client/Server Model (hence the
EPICS logo)
A Server provides information and service A
Client uses the service or asks for the
information
CA
CA
Client
Client
CA
CA
Server
Server
- For EPICS, client and server refer to their
Channel Access role i.e. Channel Access Client
and Channel Access Server - This standard control system architecture is
often called - 3 tier architecture or 3 layer model
11What is Channel Access?
- A protocol how to transfer data over network
- A single data unit is called Process Variable
- A Process Variable has a unique name, which is
used to refer to the data (Naming convention
needed!) - The detailed operation of Channel Access is
unimportant for most programmers (it already
works) - Channel Access is not dependent on a single
programming language (native library in C/C,
Java, and C available) - The entire set of Process Variables establish a
Distributed Real-time Database of machine status,
information and control parameters
EPICS Database
12Channel Access Network Flow
1. Query Broadcast
CA Client
2. Answer direct connection
3. All further queries and answers work directly
(Point-To-Point)
Network
CA Server 1
CA Server 2
CA Server 3
13Channel Access Commands
connection request or search request
put or caput
get or caget
set a monitor
Change its value to 30.5
Notify me when the value changes
Who has a PV named S1AH1CurrentAO?
What is its value?
Channel Access Client
CA Client
CA Server
I do.
25.5 AMPS
OK, it is now 30.5
It is now 20.5 AMPS
It is now 10.5 AMPS
It is now 0.0023 AMPS
Channel Access Server
Process Variables
put complete
S1AH1CurrentAO S1P1x S1P1y S1G1vacuum
30.5 is too high. It is now set to the maximum
value of 27.5.
post an event or post a monitor
or
You are not authorized to change this value
or
14How is it Done?
Channel Access Client
Channel Access Client
Channel Access Client
Operator
Network (Channel Access Protocol)
Channel Access Server
Process Variables
Power Supply
Computer Interface
S1AH1CurrentAO S1P1x S1P1y S1G1vacuum
Beam Position Monitor
Computer Interface
Vacuum Gauge
Computer Interface
Machine
15What is EPICS - Conclusion
- EPICS is a control system architecture
- EPICS is the connection between accelerator and
operator - EPICS is based on a transfer protocol named
Channel Access - Channel Access works with data sets called
Process Variables - EPICS is used by many institutes all over the
world
16Contents
- What is EPICS
- The Parts of EPICS
- What are Records
- An Example for a Record
- How to Solve Problems with EPICS
17Parts of EPICS
Client Programs alarmhandler Striptool,
caQtDM, many more (user programs)
CA Client
CA Client
Control Room
Cannel Access (UDP/TCP)
Input
CA Server
IOC
CA Server
Server Programs (user programs) Realtime
Control Records
4th Layer Hardware maybe controllers and PLCs
18VME Computer
- VME is an abbreviation for VERSAmodule Eurocard
- Industry Computer
- Developed since 1980
- It is not a PC
- Real-time capable (i.e. delays are calculable)
- Operating system was VxWorks from Wind River
company will be real time Linux (at PSI) - Very expensive(search for new solutions in EPICS
community)
19What is an IOC?
IOC means Input Output Controller
- A special CA Server and CA Client (IOCs can
talk to each other) - A computer running the IOC Core program (at
least once) - This computer may be
- VME based, operating system vxWorks (only
possibility for old EPICS Versions up to 3.14),
Linux, RTEMS - PC, operating system Windows, Linux, RTEMS
- Apple, operating system OSX
- UNIX Workstation, operating system Solaris
- An IOC normally is connected to input and/or
output hardware (otherwise called softIOC) - An IOC runs a record database, which defines what
this IOC is doing
20Some CA Clients
- (from the EPICS Website - incomplete)
- ALH Alarm Handler
- BURT Backup and Restore Tool
- CASR Host-based Save/Restore
- CAU Channel Access Utility
- Channel Archiver (SNS)
- Channel Watcher (SLAC)
- EDM Extensible Display Manager (ORNL)
- JoiMint Java Operator Interface and Management
INtegration Toolkit (DESY) - Knobs Knob Manager und KnobConfig, eine
Schnittstelle zu SunDials - MEDM Motif Editor und Display Manager
- StripTool Strip-chart Plotting Tool
- Command line tools (caget, caput, )
- and many more
21Client Program Command Line Tools
- Read a PV named ltNAMEgt
- caget NAME
- Write a PV named ltNAMEgt
- caput NAME value
- Get information about that Record
- cainfo NAME
- Start a monitor
- camonitor NAME
- (Cancel with Ctrl c)
gtcaget ARIDI-PCTCURRENT ARIDI-PCTCURRENT
350.56 gt
gtcaput ARIDI-PCTCURRENT 401.5 Old
ARIDI-PCTCURRENT 350.56 New ARIDI-PCTCURRENT
401.5 gt
gtcainfo ARIDI-PCTCURRENT ARIDI-PCTCURRENT
State connected Host
sls-cagw-1 Access read, no write Data
type DBR_DOUBLE Element count 1 gt
gtcamonitor ARIDI-PCTCURRENT ARIDI-PCTCURRENT
250.542 ARIDI-PCTCURRENT 250.537 ARIDI-PCTCURREN
T 250.533 ARIDI-PCTCURRENT 250.525 gt
22Some CA Clients
- (from the EPICS Website - incomplete)
- ALH Alarm Handler
- BURT Backup and Restore Tool
- CASR Host-based Save/Restore
- CAU Channel Access Utility
- Channel Archiver (SNS)
- Channel Watcher (SLAC)
- EDM Extensible Display Manager (ORNL)
- JoiMint Java Operator Interface and Management
INtegration Toolkit (DESY) - Knobs Knob Manager und KnobConfig, eine
Schnittstelle zu SunDials - MEDM Motif Editor und Display Manager
- StripTool Strip-chart Plotting Tool
- Command line tools (caget, caput, )
- and many more
23Example ALH
24Alarms and Colours
NO_ALARM Green Everything ok
MINOR Yellow Warning
MAJOR Red Error(no Controls Problem)
INVALID White Device not reachable
Not connected White block or Pink Record not known
25Example ALH
Tree structure of Records
Panel with more Information
Guidance
Usefull for users who know the environment (for
example operators in the main control room)
26Some CA Clients
- (from the EPICS Website - incomplete)
- ALH Alarm Handler
- BURT Backup and Restore Tool
- CASR Host-based Save/Restore
- CAU Channel Access Utility
- Channel Archiver (SNS)
- Channel Watcher (SLAC)
- EDM Extensible Display Manager (ORNL)
- JoiMint Java Operator Interface and Management
INtegration Toolkit (DESY) - Knobs Knob Manager und KnobConfig, eine
Schnittstelle zu SunDials - MEDM Motif Editor und Display Manager
- StripTool Strip-chart Plotting Tool
- Command line tools (caget, caput, )
- and many more
27Examples StripTool
28Some CA Clients
- (from the EPICS Website - incomplete)
- ALH Alarm Handler
- BURT Backup and Restore Tool
- CASR Host-based Save/Restore
- CAU Channel Access Utility
- Channel Archiver (SNS)
- Channel Watcher (SLAC)
- EDM Extensible Display Manager (ORNL)
- JoiMint Java Operator Interface and Management
INtegration Toolkit (DESY) - Knobs Knob Manager und KnobConfig, eine
Schnittstelle zu SunDials - MEDM Motif Editor und Display Manager
- StripTool Strip-chart Plotting Tool
- Command line tools (caget, caput, )
- and many more
caQtDM Display Manager
29Examples for caQtDM
30Contents
- What is EPICS
- The Parts of EPICS
- What are Records
- An Example for a Record
- How to Solve Problems with EPICS
31Close Look at a Measured Value
295,5
Value with a data type
with a unit mA
with a time stamp 17.2.2005 142116
with a severity (alarm state) NO_ALARM
with technical limits 0 to
400
with graphical limits 0 to 370
with a description Beam current in SR
A measured value is an object with multiple
related information that have different data types
32What are Records?
- A Record is an object with
- a unique name
- properties (fields) that contain information
(data) different data types can appear in
different fields - the ability to perform actions on that data
unique name
XYZ1234 Employee James Bond Badge Number
007 Address Whitehall, London Salary
70070.07
fields
data
33Make a Record from a Measured Value
with a unique name ARIDI-PCTCURRENT
record (ai, "ARIDI-PCTCURRENT")
Configured by
developer
295,5
ai
A value with a data type
field (EGU, "mA")
field (EGUF, "400") field (EGUL, "0")
with a unit mA
with a time stamp
17.2.2005 142116
field (HOPR, "370") field (LOPR, "0")
NO_ALARM
with a severity (alarm status)
field (DESC, "Beam current in SR")
with technical limits 0 to 400
field (DTYP, "HY8401") field (INP, "C3 S0 _at_")
with graphical limits 0 to 370
with a description Beam current in SR
VAL SEVR TIME
34A Process Variable Name
- A PV name is comprised of two parts
- The record name, and
- the name of a field belonging to that record
- For example
that meansmost record fieldscan be
accessedindividually
ARIDI-PCTCURRENT
EGU
.
A Process variable name
A record name
A dot to join them
A field name
- Note that if no field name is given, Channel
Access will default to using the .VAL field
ARIDI-PCTCURRENT is interpreted as
ARIDI-PCTCURRENT.VAL
35View of a Record
record(ao,"DemandTemp") field(DESC,"Temperat
ure") field(ASG,"") field(SCAN,"Passive")
field(PINI,"NO") field(PHAS,"0")
field(EVNT,"0") field(DTYP,"VMIC 4100")
field(DISV,"1") field(SDIS,"")
field(DISS,"NO_ALARM") field(PRIO,"LOW")
field(FLNK,"") field(OUT,"C0 S0")
field(OROC,"0.0e00") field(DOL,"")
field(OMSL,"supervisory") field(OIF,"Full")
field(PREC,"1") field(LINR,"NO
CONVERSION") field(EGUF,"100")
field(EGUL,"0") field(EGU,"Celcius")
field(DRVH,"100") field(DRVL,"0")
field(HOPR,"80") field(LOPR,"10")
field(HIHI,"0.0e00") field(LOLO,"0.0e00")
field(HIGH,"0.0e00") field(LOW,"0.0e00")
field(HHSV,"NO_ALARM") field(LLSV,"NO_ALARM
") field(HSV,"NO_ALARM")
field(LSV,"NO_ALARM") field(HYST,"0.0e00")
field(ADEL,"0.0e00") field(MDEL,"0.0e00")
field(SIOL,"") field(SIML,"")
field(SIMS,"NO_ALARM") field(IVOA,"Continue
normally") field(IVOV,"0.0e00")
All record fields have default values (in case
they are notspecified by thedeveloper)
36What do Records do?
- Depends on
- Record Type
- Field values
- Records are active, they do things
- Get data from other records or from hardware
- Perform calculations
- Check values are in range and raise alarms
- Put data to other records or to hardware
- Activate or disable other records
- Wait for hardware signals (interrupts)
- record do nothing until they are processed
- Analog in
- Analog out
- Binary in
- Binary out
- Calculation
- Calculation out
- Compression
- Data fanout
- Event
- Fanout
- Histogram
- Motor
- Multi bit binary input
- Multi bit binary output
- PID control
- Pulse counter
- Pulse delay
- Scan
- Select
incomplete list!
37Record Processing
Record Processing means Trigger Record to do
what itis configured to do.
- Record processing can be periodic or event
driven - Periodic Standard scan rates are
- 10, 5, 2, 1, 0.5, 0.2 and 0.1 seconds
- Custom scan rates can be configured up to speeds
allowed by operating system and hardware - No precise timing!
- Event driven Events include
- Hardware interrupts
- Request from another record via links
- EPICS Events
- Channel Access Puts
38The Record Reference Manual
- Explains records from the EPICS base release
- Explains database concepts, record types, and
record fields - New Version as Wikihttp//www.aps.anl.gov/epics/
wiki/index.php/RRM_3-14 - Old Version (R3.13) pdf http//www.aps.anl.gov/
epics/EpicsDocumentation/AppDevManuals/RecordRef/R
ecordref.pdf - More Records exist.For example Motor Record
(part of synApps package)
Test What does the field HSV of an ai Record?
39Contents
- What is EPICS
- The Parts of EPICS
- What are Records
- An Example for a Record
- How to Solve Problems with EPICS
40Example Record
IOC
Database
Analog to Digital Converter
Process
Temperature Sensor
record (ai, MTRT1-TEMPREAD) field (EGU,
deg C) field (EGUL, 0) field (EGUF, 100)
field (HSV, MAJOR) field (HIGH, 51)
field (SCAN, .1 second) field (DTYP,
Hy8401) field (INP, C3 S0 _at_)
Normal Operation 5 - 50C
0 100C 0 10V
8 bit ADC 0 10V 0 255 bits
41Example Record
CA Client caQtDM
caQtDM sets a CA monitor
IOC
Record Support
record (ai, MTRT1-TEMPREAD) field
(SCAN, .1 second) field (DTYP, Hy8401)
field (INP, C3 S0 _at_) field (VAL, 34)
Device Support
every 0.1 seconds the recordasks the driver for
a value
Driver
and the driver reports back
Value (34 C)
42Get a Values from a Record
- Switch on VME (on every VME a Record is created,
which is connected to the first potentiometer) - Type into a terminal
- caget MTRT1-TEMPREAD
- (change the 1 to the number of your training
station) - Move the potentiometer
- Ask for another values
43CA Commands
- Read a PV named ltNAMEgt
- caget NAME
- Get information about that Record
- cainfo NAME
- Start a monitor
- camon NAME
- (Cancel with Ctrl c)
- Without argument all commands show some help
caget MTRT1-TEMPREAD
cainfo MTRT1-TEMPREAD
camon MTRT1-TEMPREAD
caget
44Create a Graphical User Interface (GUI)
- To start the Qt Designer(editor to create new
GUI)caqtdm_designer - To start an existing GUI (configuration file
already exist)caqtdm ltnamegt.ui
45Create a caQtDM window (1/4)
select Main Window
create
46Create a caQtDM window (2/4)
47Create a caQtDM window (3/4)
MTRT1-TEMPREAD
48Create a caQtDM window(4/4)
Temperature.ui
49Create a Graphical User Interface (GUI)
- To start the Qt Designer(editor to create new
GUI)caqtdm_designer - To start an existing GUI (configuration file
already exist)caqtdm ltnamegt.ui
50Running a caQtDM Window
51Files for the Temperature Example
- Change into local directory cd G/TRAINING/T1
- Open the files in an editor G_TRAINING_T1_TEMPER
ATUR.template - MTEST-VME-T1_example.subs
- For example use nedit (click on file -gt
open)
52Inside the Files
substitution file
template file
53Why Substitution and Template Files?
- What to do if you have more than one instance of
a device? - Multiply the record and change the name works ok
- If you have 20 devices the file gets lengthy
- If the device not only needs one record but
more(BPM with at least x, y, and intensity)the
file gets even more lengthy and confusing spell
maintenance nightmare - Solution provided by EPICSsubstitution (with
macro definition) and template files
54Inside the Files
DEVICE MTRT1 (DEVICE)-TEMPREAD MTRT1-TEMPREA
D
55Exercise a Second Record
- Imagine we have a second temperature sensor we
need a second record - Edit the substitution file (MTEST-VME-T1_example.s
ubs)
56How to get the Record to the VME
New records can only be created during restart
of an IOC (for VME this means reboot)
get filesduring reboot
install files
Linux PC
Central Server
Trainings VME
57Installing an EPICS Database
- Everything written correctly?
- Install to the boot directory of the IOC
- swit V -ioc IOC-NAME
- (enter command in the local directory which
contains the files to be installed) - Reboot IOCLog into the IOC using
- rmc IOC-NAME
- and type in (soft reboot)
- reboot
swit -V -ioc MTEST-VME-T1
rmc MTEST-VME-T1
MTEST-VME-T1gt reboot
58What Happens at Booting
- Boot Info (memory) VME-IOC where to find the
startup.script - Load startup.script
- In startup.script list of .subs files
- Load .subs files
- In .subs files List of .template files
- Load .template files with substitutions
- Create all loaded records
59Commands on the VME Computer
- Get a list of all installed records (on this IOC)
- dbl
- Get the number of installed records
- dbnr
- View interesting fields of a record
- dbpr "MTRT1-TEMPREAD",1
- To get a list of VxWorks commands
- help
60SLS Naming Convention
- Records need unique names
- XBeamline, AMachine, MTest (1 character)
- Project abbreviation (4 characters), e.g. 06SA,
TEST, RIRing, DIDIAGNOSE - Optional Device, Group, Component, e.g. OP, ID
- Device, e.g. MO
- Optional Function (max. 11 characters),
- z.B. TRY1-SET
12 3 4 5
Length of 3length of 4 12 characters older
EPICS Names have 27 characters at maximum
61Name for the Temperature Sensors
- M Test
- TR Training
- T1, T2, T3, T4 Training IOCs
- TEMP Temperature
- READ Record for reading
- For a second sensor
- TEMP1 for the first, TEMP2 for the second
- MTRT1-TEMP1READ und MTRT1-TEMP2READ
62Exercise caQtDM Application
- Create an caQtDM GUI, which shows
- Your own Records
- All Records of the course
- The alarm states of all records
- More to do Create a second GUI, which displays
all records with names starting like MTEST-VME-T
running on your IOC.
63IOC Status
- On every IOC there are some Status Records
created automatically
caqtdm -macro IOCMTEST-VME-T1 /work/sls/config/qt
/G_IOCMON_ioc_status.ui
64Contents
- What is EPICS
- The Parts of EPICS
- What are Records
- An Example for a Record
- How to Solve Problems with EPICS
65Solve a Problem in EPICS
IOC
ADC
Database
Analog In
MTTR1-LI-COOLTEMP1
BinaryI/O
VAL
INP
Problem In the LINAC we have a water chiller
that must be turned ON whenever the average
temperature of two temperature sensors rises
above a set point. The set point is nominally 10
degrees centigrade.
Calculation
Binary out
EGU deg C
MTRT1-LI-COOLCALC
MTRT1-LI-COOLSW
INPA
INPB
VAL
DOL
OUT
ADC
C 10
Chiller
Analog In
CALC ( (AB)/2 ) gt C
MTRT1-LI-COOLTEMP2
SCAN 10 second
INP
VAL
EGU deg C
66The subs File
- Name of the file MTEST-VME-T1_example.subs
means this line is a comment
67Different Styles of subs files
few instances
many instances
Files are written for programmers not for
computers!
68The Template File
- Predefined records in the file G_TRAINING_T1_COOL
ER.template
69Useful Scripts
- Is everything spelled correctly?
- externalLinks subs-File
- What was the name of this record?
- findrecord Name-Part
- When was this IOC booted last time?
- bootinfo IOC-Name
externalLinks MTEST-VME-T1_example.subs
findrecord MTRT1-LI
bootinfo MTEST-VME-T1
70Steps of Development
- Change your files
- Save your files
- Check syntax with externalLinks
- Install IOC files
- Reboot IOC(in rmc window reboot)
- Test
externalLinks MTEST-VME-T1_example.subs
swit -V -ioc MTEST-VME-T1
7110 Really Neat Things About EPICS
- It is free
- It is Open Source
- There are lots of users
- All a client needs to know to access data is a
PV name - You can pick the best tools out there
- or build your own
- The boring stuff is already done
- There is a lot of expertise available close by
- A good contribution becomes internationally
known - It does not matter, if you need 10 or 10
million PVs - It is fun (dont tell the management)
72EPICS Web Page
- The central site for EPICS information
- - Documentation
- - CA Clients
- - Device support (driver)
- - Tech-talk (mailing list and archive)
- http//www.aps.anl.gov/epics