Database Testplan Template by tje33733

VIEWS: 11 PAGES: 65

More Info
									EPICS Training @ PSI

   Controls Section PSI
           2007
Acknowledgment
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

                  EPICS Training @ PSI
Contents

•   What is EPICS
•   The Parts of EPICS
•   What are Records
•   An Example for a Record
•   How to Solve Problems with EPICS




                   EPICS Training @ PSI
What are we doing?

We need to control an accelerator (SLS) with many
 components remotely (due to radiation and size of the
 machine). How can we do this?


                       ?
                      EPICS

Operator

Our answer is EPICS
                                            Accelerator
                     EPICS Training @ PSI
What is EPICS?


EPICS is an abbreviation for:
Experimental Physics and Industrial Control System


EPICS is:
• A collaboration
• A tool kit
• A control system architecture


                  EPICS Training @ PSI
The History
–In1989 started a collaboration between Los Alamos
 National Laboratory (GTA) and Argonne National
 Laboratory (APS)                GTA: Ground Test Accelerator
  (Bob Dalesio & Marty Kraimer)        APS: Advanced Photon Source


–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
–Collaborative efforts vary
  • Assistance in finding bugs
  • Share tools, schemes, and advice

                      EPICS Training @ PSI
EPICS – 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) in Villigen, Schweiz
 – KEK in Tsukuba, Japan
 – DIAMOND Light Source (Rutherford Appleton Laboratory) in
   Oxfordshire, England
 – The Australian Synchrotron (AusSy) in Melbourne, Australien

                        EPICS Training @ PSI
Are there alternatives to EPICS?

• Tango/Taco
  Developed at ESRF
  Used by ESRF, Elettra, Soleil
• DOOCS
  Developed and used by DESY
• Tine
  Developed and used by DESY
• ACS
  Developed and used at PSI

                  EPICS Training @ PSI
The architecture of EPICS

Network based Client/Server Model (hence the EPICS


          EPICS
logo)
                                              A Server provides
                                              information and
                                              service
      CA                CA
                                              A Client uses the
     Client            Client
                                              service or asks for the
                                              information
                CA                   CA
              Server                Server

 For EPICS, client and server refer to their Channel
   Access role
 i.e. Channel Access Client and Channel Access Server
                       EPICS Training @ PSI
What is Channel Access

• A protocol how to transfer data
• A single data unit is called Process Variable
• A Process Variable has a unique name, which is
  used to refer to the data
• The detailed operation of Channel Access is
  unimportant for most programmers (it already
  works…)
• Channel Access is not dependent on a single
  programming language


                 EPICS Training @ PSI
Channel Access network flow
                     1. Query: Broadcast

      CA Client      2. Answer: direct connection
                     3. All further querys and answers work
                     directly (Point-To-Point)


                                             Network




  CA Server 1     CA Server 2         CA Server 3



                    EPICS Training @ PSI
Control System Architecture

–A network based “Client/Server” Model, whose smalest
 data set is a Process Variable
–The Channel Access Protocol defines, what data (Process
 Variable) is transferred between server and client
–The entire set of Process Variables establish a Distributed
 Real-time Database of machine status, information and
 control parameters


                           CAS         CAS         CAS         CAS

                         Process    Process     Process     Process
                        Variables   Variables   Variables   Variables
  EPICS Database

                      EPICS Training @ PSI
What 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


                  EPICS Training @ PSI
Contents

•   What is EPICS
•   The Parts of EPICS
•   What are Records
•   An Example for a Record
•   How to Solve Problems with EPICS




                   EPICS Training @ PSI
 Parts of EPICS
                                                         Client Software
                                                         MEDM          OAG Apps
                                                       ALH     TCL/TK StripTool
                                                         Perl Scripts Many, many
Output




                                                                       others …




                                          Input
          IOC          IOC                            Channel Access
            CAS          IOC
              CAS          IOC
                                                    CA Server Software
                                                        EPICS Database
         Commercial        Custom                 consists of Process Variables
                                                             Records     Custom
         Instruments      hardware                Sequence              Programs
                       Technical                  Programs
                                                                 Realtime
                                                                  control
                       Equipment
                         EPICS Training @ PSI
Typical Realisation



                                        Desktop


  IOC         IOC                                          Laptop
    CAS         IOC
      CAS         IOC
                                      Most CAServer       Most IOCs are
                                     applications are   based on vxWorks
Commercial        Custom                based on
                                      Unix/Linux or
                                                        (VME), but as well
                                                          on Linux and
Instruments      hardware               Windows         Windows (SoftIOC)
                                     (becoming rare)
              Technical
              Equipment
                        EPICS Training @ PSI
VME 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 is VxWorks from Wind River
  company
• Very expensive – search for new solutions in
  EPICS community
                  EPICS Training @ PSI
What is an IOC                      IOC means
                                    Input Output Controller

• A special CA Server and CA Client
• A computer running “IOC Core”
• This computer may be:
 - VME based, operating system vxWorks (only possibility up to 3.14) or
   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
• An EPICS control system is based on at least one
Channel Access Server (normally an IOC)
• An IOC runs a record database, which defines what this
IOC is doing
                           EPICS Training @ PSI
Inside an IOC
The major software components of an IOC
(IOC Core)
                                             LAN (Network)


          IOC       Channel Access


                   Database           Sequencer



                 Device Support


                     I/O Hardware

                    EPICS Training @ PSI
For what to use a Sequencer?

                                      State Machine
                    Red light




 Yellow and    Broken traffic light     Yellow light
  red lights




 Start             Green light




                    EPICS Training @ PSI
Some 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
•and many more …


                         EPICS Training @ PSI
Example: ALH




               EPICS Training @ PSI
Alarms and Colours

   NO_ALARM         Green                  Everything ok

     MINOR          Yellow                    Warning

    MAJOR             Red                      Error

    INVALID          White           Device not reachable

                  White block
  Not connected                           Record not known
                  or Pink

                   EPICS Training @ PSI
Example: ALH




               EPICS Training @ PSI
Some 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
•and many more …


                         EPICS Training @ PSI
Examples: StripTool




                 EPICS Training @ PSI
Some 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
•and many more …


                         EPICS Training @ PSI
Examples: medm




                 EPICS Training @ PSI
 Channel Access Commands
                            “connection          “get”             “put” or            “set a monitor”
                             request” or           or              “caput”
                          “search request”      “caget”
                                                                   Change its         Notify me when the value
                          Who has a PV named    What is its         value to                  changes
  Channel Access Client
                          “S1A:H1:CurrentAO”?    value?               30.5

      CA Client
      CA Server                  I do.           25.5            OK, it is           It is    It is      It is
Channel Access Server                           AMPS             now 30.5            now      now        now
                                                                                      20.5    10.5       0.0023
Process Variables:                                                                   AMPS    AMPS        AMPS
                                                                 “put
   S1A:H1:CurrentAO                                            complete”
                                                              30.5 is too high. It     “post an event”
                                                               is now set to the
                S1:P1:x
                S1:P1:y
                                                    or          maximum value                 or
                                                                    of 27.5.
                                                                                       “post a monitor”
                                                                 You are not
                                                                authorized to
        S1:G1:vacuum
                                                    or        change this value


                                         EPICS Training @ PSI
How does it do it?

                                                         Channel Access Client



                              Channel Access Client
Operator                                                                          Channel Access Client




                         Network (Channel Access Protocol)
 Channel Access Server


Process Variables:
                           Computer           Power
    S1A:H1:CurrentAO       Interface          Supply

                                             Beam
               S1:P1:x     Computer
                           Interface
                                            Position
               S1:P1:y
                                            Monitor

        S1:G1:vacuum       Computer          Vacuum
                           Interface          Gauge                              Machine

                                       EPICS Training @ PSI
Contents

•   What is EPICS
•   The Parts of EPICS
•   What are Records
•   An Example for a Record
•   How to Solve Problems with EPICS




                   EPICS Training @ PSI
Close look at a Measured Value
                 Value with a data type             295,5
                              with a unit                     mA
                      with a time stamp         17.2.2005 14:21:16
           with a severity (alarm state)              NO_ALARM
                   with technical limits                 0 bis 400
                   with graphical limits                 0 bis 370
                    with a description        „Beam current in SR“

A measured value is an object with multiple related information


                       EPICS Training @ PSI
What are Records?
A Record is an object with
 – a unique name
 – properties (fields) that contain information (data)
 – the ability to perform actions on that data


     unique name   XYZ1234
                   Employee    : James Bond

          fields   Badge Number: 007
                   Address     : Whitehall, London   Data
                   Salary      : £70070.07




                       EPICS Training @ PSI
From Measured Value to Record
           with "ARIDI-PCT:CURRENT") {
     record (ai, a unique name ARIDI-PCT:CURRENT
      A value with afield (EGU, "mA") 295,5
                      data type               ai
                     field (EGUF,
                     with a unit "400")             mA
                     field (EGUL, "0")
                      time stamp
              with afield (HOPR, "370")
                                     17.2.2005 14:21:16
                     field (LOPR,
    with a severity (alarm status) "0")     NO_ALARM
                     field (DESC, "Beam current in SR")
             with technical limits "HY8401") 0 bis 400
                     field (DTYP,
                     field (INP, "#C3 S0 @") 0 bis 370
            with graphical limits
               with a}description „Beam current in SR“

Readback from hardware:

                     EPICS Training @ PSI
A 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…

          ARIDI-PCT:CURRENT .                     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
• i.e. “ARIDI-PCT:CURRENT” = “ARIDI-PCT:CURRENT.VAL”
                           EPICS Training @ PSI
What do Records do?
 • 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)
 • What a record does depends upon its type and the
   values in its fields
 • A wide range of records have already been created
 • New record types can be added to a new application as
   needed
 • A record does nothing until it is processed
                           EPICS Training @ PSI
Some Record Types
•Analog in                             •Multi bit binary output
•Analog out                            •PID control
•Binary in                             •Pulse counter
•Binary out                            •Pulse delay
•Calculation                           •Scan
•Calculation out                       •Select
•Compression                           •Sequence
•Data fanout                           •String in
•Event                                 •String out
•Fanout                                •Subarray
•Histogram                             •Subroutine
•Motor                                 •Waveform
•Multi bit binary input

                          EPICS Training @ PSI
IOC view of a Record
record(ao,"DemandTemp") {                           field(DRVH,"100")
    field(DESC,"Temperature")                       field(DRVL,"0")
    field(ASG,"")                                   field(HOPR,"80")
    field(SCAN,"Passive")                           field(LOPR,"10")
    field(PINI,"NO")                                field(HIHI,"0.0e+00")
    field(PHAS,"0")                                 field(LOLO,"0.0e+00")
    field(EVNT,"0")                                 field(HIGH,"0.0e+00")
    field(DTYP,"VMIC 4100")                         field(LOW,"0.0e+00")
    field(DISV,"1")                                 field(HHSV,"NO_ALARM")
    field(SDIS,"")                                  field(LLSV,"NO_ALARM")
    field(DISS,"NO_ALARM")                          field(HSV,"NO_ALARM")
    field(PRIO,"LOW")                               field(LSV,"NO_ALARM")
    field(FLNK,"")                                  field(HYST,"0.0e+00")
    field(OUT,"#C0 S0")                             field(ADEL,"0.0e+00")
    field(OROC,"0.0e+00")                           field(MDEL,"0.0e+00")
    field(DOL,"")                                   field(SIOL,"")
    field(OMSL,"supervisory")                       field(SIML,"")
    field(OIF,"Full")                               field(SIMS,"NO_ALARM")
    field(PREC,"1")                                 field(IVOA,"Continue normally")
    field(LINR,"NO CONVERSION")                     field(IVOV,"0.0e+00")
    field(EGUF,"100")                           }
    field(EGUL,"0")
    field(EGU,"Celcius")

                                  EPICS Training @ PSI
The Record Reference Manual

• In English (American style)
• Explains database concepts and record types
• All fields are explained for common record types
  Test: What does the field HSV of an ai Record
• Common fields for all records are described in
  the first part
• The explained records are part of the EPICS
  base release
• More Records exist. Find their documentation in
  the internet
                    EPICS Training @ PSI
Contents

•   What is EPICS
•   The Parts of EPICS
•   What are Records
•   An Example for a Record
•   How to Solve Problems with EPICS




                   EPICS Training @ PSI
  Our First Database
                                                       Channel Access Client
                                                                                       MTRT1-TEMP:READ
                                                                                       MTRT1-TEMP:READ
                        Tell me about                                                  .VAL
                                                                                       .VAL    = 51.5
                                                                                               = 45.5
                                                                                       .EGU
                                                                                       .EGU    = deg C
                                                                                               = deg C
                        MTRT1-TEMP:READ                                                .STAT
                                                                                       .STAT   = MAJOR
                                                                                               = Normal


                                        IOC                       Channel Access Server

      Process         Temperature       Analog to
                        Sensor           Digital
                                                                Database
                                        Converter
                                                                       Analog In
                                                                     MTRT1-TEMP:READ
                                                                                         45.5 deg C
                                                                                         51.5 deg C
                   45.5°C
                   51.5°C     5.15V
                              4.55V                116
                                                   132 bits
                                                                     INP        VAL
                                                                     EGU : deg C
                                                                     EGUL: 0
                                                                     EGUF: 100
Normal Operation       0 – 100°C         8 bit ADC
                                                                     HIGH: 51
    5 - 50°C            0 – 10V          0 – 10V
                                        0 – 255 bits


                                        EPICS Training @ PSI
Get 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-TEMP:READ
  (change the 1 for the number of your training
  station)
• Move the potentiometer
• Ask for another values

                   EPICS Training @ PSI
CA Commands

• Read a PV named <NAME>
     caget NAME
• Get information about that Record
     cainfo NAME
• Start a monitor
     camon NAME
  (Cancel with [Ctrl] + [c])
• Try to remember at least
      ca

                   EPICS Training @ PSI
Create a Graphical User Interface (GUI)

• Open the editor with the command
  medm
• Click to menu File and New
• Click with right mouse button in the new window
  and choose in Object > Monitors a "Text
  Monitor" (select the size of the window with the
  mouse)
• Type to "Readback Channel" the record name
  (MTRT1-TEMP:READ)
• Switch to "Execute"
                  EPICS Training @ PSI
Say it with Pictures




 MTRT1-TEMP:READ



                   EPICS Training @ PSI
Files for the Temperature Example

• The local files are in the directory
      G/TRAINING/T1
• The template file is named
      G_TRAINING_T1_TEMPERATUR.template
• The substitution file is named
      MTEST-VME-T1_example.subs
• The created record is
       MTRT1-TEMP:READ
  (rsp. MTRT2-TEMP-READ, MTRT3-TEMP:READ and
  MTRT4-TEMP:READ)

                     EPICS Training @ PSI
Inside the Files




 DEVICE = MTRT1
 $(DEVICE)-TEMP:READ

 MTRT1-TEMP:READ

                   EPICS Training @ PSI
Exercise: a Second Record

• Imagine we have a second temperature sensor
  – we need a second record:




                 EPICS Training @ PSI
Installing an EPICS database
• Everything written correctly?
• Install to the boot directory of the IOC
  slsinstall –V -ioc IOC-NAME
  (enter command in the local directory which
  contains the files to be installed)
• Reboot IOC (press button = hard reboot) or
• Log into the IOC using
  rmc IOC-NAME
  and type in (soft reboot)
  reboot

                  EPICS Training @ PSI
What 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


                 EPICS Training @ PSI
Commands on the VME Computer

• Get a list of all installed records (on this IOC)
    dbl

• View interesting fields of a record
    dbpr "Record-Name"
    dbpr "MTRT1-TEMP:READ"

• To get a list of VxWorks commands
     help

                    EPICS Training @ PSI
SLS Naming Convention
Records need unique names
  1. X=Beamline, A=Machine, M=Test (1 character)
  2. Project abbreviation (4 characters), e.g. 06SA, TEST,
     RI=Ring, DI=DIAGNOSE
  3. Optional: Device, Group, Component, e.g. OP, ID
  4. Device, e.g. MO
  5. Optional: Function (max. 11 characters),
     z.B. TRY1-SET

         [1][2] – [3] – [4] : [5]
   Length of [3]+length of [4] ≤ 12 characters
   EPICS: Names have 27 characters at maximum
                     EPICS Training @ PSI
Name of the Temperature Sensors (at SLS)

  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-TEMP1:READ und MTRT1-TEMP2:READ

                  EPICS Training @ PSI
Exercise: medm Application

• Create an medm 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.



                   EPICS Training @ PSI
 IOC Status

 On every IOC there are some Status Records
  created automatically:




medm –x –macro IOC=MTEST-VME-T1 /work/sls/config/medm/G_IOCMON_ioc_status.adl

                             EPICS Training @ PSI
Contents

•   What is EPICS
•   The Parts of EPICS
•   What are Records
•   An Example for a Record
•   How to Solve Problems with EPICS




                   EPICS Training @ PSI
     Solve a Problem in EPICS
                                         IOC
         ADC
                                     Database
                    Analog In
                  MTTR1-LI:TEMP1

                  INP
               Problem:
                            VAL                                           Binary I/O
                                        Calculation
                  EGU:    deg C                              Binary out
                                     MTRT1-LI:CALC
             In the LINAC we have a water chiller that must be
                                                     MTRT1-LI:COOL-SW
Sensor                              INPA
 T1
                 turned ON whenever the average temperature of
                 two temperature sensors rises aboveDOLset point.
                                    INPB     VAL
                                                       a         OUT
         ADC                        C:   10
                 The set point is nominally 10 degrees centigrade.                     Chiller
                    Analog In        CALC: ( (A+B)/2 ) > C

                  MTRT1-LI:TEMP2     SCAN: 10 second

                  INP       VAL
                  EGU:    deg C
Sensor
 T2




                                   EPICS Training @ PSI
The subs File
• Name of the file: MTEST-VME-T1_example.subs




   # means this line is a comment
                   EPICS Training @ PSI
The Template File

• Predefined records in the file
      G_TRAINING_T1_COOLER.template
• Would the IOC boot with this file?
• Please copy Record Fields from the notes
  …

                   Copy the
              temperature record
               you already have!

                    EPICS Training @ PSI
Useful 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
• Some more information from the database:
  http://pc4860/testplan/hosts_iocs_list_pub.php




                   EPICS Training @ PSI
Record Processing
• 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
• Event driven: Events include
   –   Hardware interrupts
   –   Request from another record via links
   –   EPICS Events
   –   Channel Access Puts


                         EPICS Training @ PSI
Develop medm GUIs

What should be displayed:
• Both temperature sensors
• The alarm states of the sensors
• The switch state of the chiller should be given as
  text and with an “LED”, which is lighted yellow
  when the device is switched on
• A title text (never do a GUI without)
• A plot of the temperatures



                   EPICS Training @ PSI
More Exercises

• Display the average temperature
• The temperature limit of 10 deg C should be
  accessible in medm using a new record
• There should be another temperature limit: a
  heater should be switched on if the temperature
  drops below a lower limit
   – Another calc record
   – Another bo record
      "#C2 S33 @"
• In the accelerator there are as well some chillers
  and heaters needed. Duplicate your settings.
                   EPICS Training @ PSI
10 really neat Things about EPICS
1.    It is free
2.    It is Open Source
3.    There are lots of users
4.    All a client needs to know to access data is a PV name
5.    You can pick the best tools out there …
6.    … or build your own
7.    The boring stuff is already done
8.    There is a lot of expertise available close by
9.    A good contribution becomes internationally known
10.   It does not matter, if you need 10 or 10 million PVs

                      EPICS Training @ PSI
EPICS 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

                   EPICS Training @ PSI

								
To top