Managed by UT-Battelle for the Department of Energy EPICS Database Kay Kasemir, SNS/ORNL Many slides from Andrew Johnson, APS/ANL Sept. 2014.

Slides:



Advertisements
Similar presentations
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Advertisements

EPICS Tutorial - IOC Database Raja Ramanna Centre For Advanced Technology Indore India January Presented by: Marty Kraimer Based on Presentations.
SNS Integrated Control System Running IOC Core on Windows and Linux Dave Thompson Wim Blokland Ernest Williams.
Best Ever Alarm System Toolkit Kay Kasemir, Xihui Chen, Katia Danilova SNS/ORNL April, 2013.
EPICS Database Principles Andrew Johnson Computer Scientist, AES Controls.
EPICS Class – Process Database Most slides here are taken from: – “EPICS Database Principles” by Andrew Johnson Some slides modified by me After lecture,
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
PLC OPERATION & PROGRAMMING Dr. ONUR TOKER. What is a PLC ? PLC is a computer system controlling a process. inputs - the keyboard is analogous to a proximity.
OPC Overview OPC Device Support (PLC Gateway for 3.14) Ralph Lange – EPICS Collaboration Meeting at SLAC, April 2005.
Dirk Zimoch, EPICS Meeting April 2007, Hamburg Siemens S7 PLC Communication.
Managed by UT-Battelle for the Department of Energy Kay Kasemir Sept EPICS EtherIP Driver.
EtherIP Driver Kay Kasemir, July 2009.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS State Notation Language (SNL), “Sequencer” Kay Kasemir, SNS/ORNL Many slides from.
Scan System Kay Kasemir, Xihui Chen Jan Managed by UT-Battelle for the U.S. Department of Energy Automated Experiment Control “Scan” should be.
Scan System: Experiment Automation Kay Kasemir, Xihui Chen RAL EPICS Meeting, May 2013.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Managed by UT-Battelle for the Department of Energy EPICS Database … in 1 hour?! Kay Kasemir, SNS/ORNL Many slides from Andrew Johnson, APS/ANL, Jan
Imperial College Tracker Slow Control & Monitoring.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
1 Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, May 31,2010.
Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, June 27,2001.
Ralph Lange: OPC Gateway (Device Support) OPC Gateway (Device Support) Ralph Lange – EPICS Collaboration Meeting March SSRF.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
EPICS Overview 25 August 2009 Matt Boyes EPICS Overview Lecture 1 Matt Boyes.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Feb EPICS ’Stream’ Device Support.
The CSS Scan System Kay-Uwe Kasemir SNS/ORNL Dec
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Feb Material copied from the IOC Application Developer's.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS Automation Kay Kasemir, SNS/ORNL June 2014.
1 1999/Ph 514: EPICS Database II EPICS EPICS Database II Ned D. Arnold APS.
DAQ Control GSI, Aug 2005Hans G. Essel CBM - DAQ Control1 MBS monitor (FOPI) (J.Adamczewski, M.Stockmeier)
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Oct EPICS Meeting, PAL, Korea Control System Studio Training.
Integrating EPICS and LabVIEW on Windows using DCOM Freddie Akeroyd ISIS Computing Group.
DEBUGGING EPICS APPLICATIONS Bob Dalesio and Rozelle Wright February 10, 1997.
Managed by UT-Battelle for the Department of Energy EPICS Sequencer Kay Kasemir, SNS/ORNL Many slides from Andrew Johnson, APS/ANL Feb
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Managed by UT-Battelle for the Department of Energy CSS Update Matthias Clausen, Helge Rickens, Jan Hatje and DESY Delphy Armstrong, Xihui Chen,
Toy IOC Experiments, hierarchical EPICS database A side product of "V4" discussions with: Matthias Clausen, Bob Dalesio, Marty Kraimer, Steve Lewis. Kay-Uwe.
EPICS EPICS Limitations Bob Dalesio Marty Kraimer.
Fast Fault Finder A Machine Protection Component.
1 EPICS January 2009What is an EPICS Database What is an EPICS Database? Andrew Johnson APS (modified by Philip Taylor & Andy Foster )
CSCI1600: Embedded and Real Time Software Lecture 12: Modeling V: Control Systems and Feedback Steven Reiss, Fall 2015.
Use of a Relational Database at Leda Bob Dalesio
1 1999/Ph 514: Flow of Control EPICS Flow of Control Marty Kraimer APS.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
1. LabVIEW and EPICS Workshop EPICS Collaboration Meeting Fall 2011.
1 2003/P571: Lab #2 : IOC Database EPICS Lab #2 IOC Database.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
EPICS Tutorial IOC Database EPICS Meeting INFN October Presented by: Marty Kraimer Based on Presentations by Andrew Johnson and Bob Dalesio.
1 1999/Ph 514: What is an EPICS Database? EPICS What is an EPICS Database? Andrew Johnson APS.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
1 EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 EPICS Flow of Control Marty Kraimer APS.
Managed by UT-Battelle for the Department of Energy Kay Kasemir Jan Experimental Physics and Industrial Control System.
EPICS Records J. Frederick Bartlett Fermilab June 1,1999.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
SNS Control System Slide 1, 4/19/2002 EPICS Interlock Experience Kay-Uwe Kasemir, Los Alamos National Laboratory Presented at the EPICS Collaboration Meeting.
An Introduction to Epics/Tango Steve Hunt Alceli EPICS Meeting 2008 INFN Legnaro 15 Oct 17:15.
1 1999/Ph 514: Lab #2 : IOC Database EPICS Lab #2 IOC Database.
Monitoring Dynamic IOC Installations Using the alive Record Dohn Arms Beamline Controls & Data Acquisition Group Advanced Photon Source.
Using COTS Hardware with EPICS Through LabVIEW – A Status Report EPICS Collaboration Meeting Fall 2011.
EPICS Database Principles Andrew Johnson APS Engineering Support Division October 17th, 2006 SNS EPICS Training.
EPICS Class – Process Database
Andrew Johnson and Eric Norum AES Controls Group, Argonne
Marty Kraimer Advanced Photon Source Argonne National Laboratory
EPICS Database … in 1 hour?!
Channel Access Concepts
Beam Synchronous Acquisition on IOC
Channel Access Concepts
Presentation transcript:

Managed by UT-Battelle for the Department of Energy EPICS Database Kay Kasemir, SNS/ORNL Many slides from Andrew Johnson, APS/ANL Sept. 2014

2Managed by UT-Battelle for the Department of Energy 2 Distributed EPICS Setup  Operator Interface  Input/Output Controller (IOC) Channel Access

3Managed by UT-Battelle for the Department of Energy 3 IOC Channel Access LAN Sequencer Device Support I/O Hardware IOC Database  Database: Data Flow, mostly periodic processing  Sequencer: State machine, mostly on-demand “Hard” IOCs run vxWorks and directly interface to A/D, D/A, LLRF, … hardware. “Soft” IOCs run on Linux etc. and have no I/O Hardware other than serial or networked devices (Moxa to motor controller, …)

4Managed by UT-Battelle for the Department of Energy 4 IOC Database  'iocCore' software loads and executes 'Records' –Configuration of records instead of custom Coding  All control system toolboxes have (better?) –GUI tools –Network protocols –Hardware drivers but few have a comparable database!

5Managed by UT-Battelle for the Department of Energy Task: 1.Read temperature 2.Open/close switch as needed 3.Repeat Software? Example: Basic Temperature Control

6Managed by UT-Battelle for the Department of Energy 6 One Fishy Database Analog Input Record Binary Output Record SCAN Field

7Managed by UT-Battelle for the Department of Energy Database = Records + Fields + Links  IOC loads and executes one or more databases  Each database has records  Each record has –Name (unique on the whole network) –Fields (properties, can be read, most also written at runtime) –Often device support to interface to hardware –Links to other records

8Managed by UT-Battelle for the Department of Energy Records are Active  Records ‘do’ things –Get data from other records or hardware –Perform calculations –Check value ranges, raise alarms –Write to other records or hardware What they do depends on record type and field values  … when they are processed –Records process periodically or when triggered by events or other records No action occurs unless a record is processed

9Managed by UT-Battelle for the Department of Energy Record Types  ai/ao: Analog input/output –Read/write number, map to engineering units  bi/bo: Binary in/out –Read/write bit, map to string  calc: Formula  mbbi/mbbo: Multi-bit-binary in/out –Read/write 16-bit number, map bit patterns to strings  stringin/out, longin/out, seq, compress, histogram, waveform, sub, …

10Managed by UT-Battelle for the Department of Energy Common Fields  Design Time –NAME: Record name, unique on network! –DESC: Description –SCAN: Scan mechanism –PHAS: Scan phase –PINI: Process once on initialization? –FLNK: Forward link  Runtime –TIME: Time stamp –SEVR, STAT: Alarm Severity, Status –PACT: Process active –TPRO: Trace processing –UDF: Undefined? Never processed? –PROC: Force processing

11Managed by UT-Battelle for the Department of Energy Record Scanning  SCAN field: –When processed by other records: “Passive” (default) –Periodically: “.1 second”, “.2 second”, “.5 second”, “1 second”, “2 second”, “5 second”, “10 second” –On event: “Event” (EVNT field selects the event), “I/O Intr” (if device support allows this)  PHAS field –Adds order to records that are on the same periodic scan  First PHAS=0, then PHAS=1, …  PINI –Set to “YES” to force record once on startup. Good idea for “operator input” records that are hardly ever changed, so they have an initial value.  PROC –Writing to this field will process a record

12Managed by UT-Battelle for the Department of Energy Example “first.db” # The simplest record that 'does' something # and produces changing numbers record(calc, "$(S):random") { field(SCAN, "1 second") field(INPA, "10") field(CALC, "RNDM*A") }  Execute: softIoc –m S=$USER –d first.db  In another terminal: camonitor $USER:random  Try dbl, dbpr, dbpf

13Managed by UT-Battelle for the Department of Energy Common Input/Output Record Fields  DTYP: Device type  INP/OUT: Where to read/write  RVAL: Raw (16 bit) value  VAL: Engineering unit value Output Only:  DOL: Desired Output Link. Output records read this link to get VAL, then write to OUT…  OMSL:.. if Output Mode Select = closed_loop  IVOA: Invalid Output Action  DRVL, DRVH: Drive limits

14Managed by UT-Battelle for the Department of Energy More from “first.db” # A ramp from 0 to 'limit', were limit # can be configured via a separate record record(ao, "$(S):limit") { field(DRVH, "100") field(DOL, "10") field(PINI, "YES") } record(calc, "$(S):ramp") { field(SCAN, "1 second") field(INPA, "$(S):ramp") field(INPB, "$(S):limit") field(CALC, "A<B ? A+1 : 0") } Using ‘output’. ‘input’ would also work, since there’s no hardware to read or write, but only ‘output’ has DRVH… Reading inputs: A = my own current value B = value of..limit record Which record is scanned?

15Managed by UT-Battelle for the Department of Energy Analog Record Fields  EGU: Engineering units name  LINR: Linearization (No, Slope, breakpoint table)  EGUL, EGUF, ESLO, EOFF: Parameters for LINR  LOLO, LOW, HIGH, HIHI: Alarm Limits  LLSV, LSV, HSV, HHSV: Alarm severities

16Managed by UT-Battelle for the Department of Energy Binary Record Fields  ZNAM, ONAM: State name for “zero”, “one”  ZSV, OSV: Alarm severities

17Managed by UT-Battelle for the Department of Energy 17 Record Links  Input links may be –Constant number: “0”, “3.14”. “-1.6e-19”  Input or Output links may be –Name of other record’s field: “other”, “other.VAL”, “other.A”  If other record is in same IOC: “Database link”  If name not found: “Channel Access link” –Hardware link  Details depend on device support  DTYP field selects device support  Format examples: some_tag”, “#C1 S4”  A record’s FLNK field processes anther record after current record is ‘done’

18Managed by UT-Battelle for the Department of Energy Record (Database, Channel Access) Links  Format: “record.field {flags}” –VAL is default for field  Flags: –PP: Process a passive target record  INP, DOL: Before reading  OUT: After writing –NPP: non-process-passive (default) –MS: Maximize severity –NMS: non-MS (default) –MSS: Maximize Severity and Status –MSI:.. when severity = INVALID  Example: field(“INP”, “other_rec.VAL PP MS”)

19Managed by UT-Battelle for the Department of Energy Additional Channel Access Link Flags  CA: Force CA link, even though target in same IOC  CP: For INP link, process on received CA monitor  CPP: CP, but only if SCAN=Passive.. This won’t make any sense until we learn more about Channel Access… The IOC Application Developer’s Guide, Chapter 5 on Data Base.. Processing is worth reading.

20Managed by UT-Battelle for the Department of Energy 20 Processing chains

21Managed by UT-Battelle for the Department of Energy 21 Which record is never processed?

22Managed by UT-Battelle for the Department of Energy 22 How often is Input_1 processed?

23Managed by UT-Battelle for the Department of Energy 23 How long will this take?  PACT: Processing Active

24Managed by UT-Battelle for the Department of Energy Rate Of Change Example Calculating “Rate-of-Change” of an Input INPA fetches data that is 1 second old because it does not request processing of the AI record. INPB fetches current data because it requests the AI record to process. The subtraction of these two values reflects the ‘rate of change’ (difference/sec) of the pressure reading.

25Managed by UT-Battelle for the Department of Energy Simulation Mode When in simulation mode, the AO record does not call device support and the AI record fetches its input from the AO record.

26Managed by UT-Battelle for the Department of Energy Multiple Scan Triggers Slow Periodic Scan with Fast Change Response The AI record gets processed every 5 seconds AND whenever the AO record is changed. This provides immediate response to an operator's changes even though the normal scan rate is very slow. Changes to the power supply settings are inhibited by the BO record, which represents a Local/Remote switch.

27Managed by UT-Battelle for the Department of Energy  Typical control loop  PID Controller O(n) = K P E(n) + K I Σ i E(i) dT + K D [E(n)-E(n-1)]/dT –Error readings E(n) –Output O(n) –Proportional, Integral, Derivative Gains K x Heater Control Simulation

28Managed by UT-Battelle for the Department of Energy User Inputs to Simulation  Macros  Analog output for user input because of DRVL/DRVL record(ao, "$(user):room") { field(DESC, "Room Temperature") field(EGU, "C") field(HOPR, "40") field(LOPR, "0") field(DRVL, "0") field(DRVH, "40") field(DOL, "25") field(PINI, "YES") } record(ao, "$(user):setpoint") { field(DESC, "Temperature Setpoint") field(EGU, "C") field(HOPR, "0") field(LOPR, "100") field(DRVL, "0") field(DRVH, "100") field(PREC, "1") field(DOL, "30") field(PINI, "YES") }

29Managed by UT-Battelle for the Department of Energy Simulated Tank Temperature # supervisory: user can adjust voltage # closed_loop: PID (in separate control.db) sets voltage # When PID is INVALID, go back to 0 voltage record(ao, "$(user):heat_V") { field(DESC, "Heater Voltage") field(EGU, "V") field(DRVL,"0") field(DRVH,"110") field(DOL, "$(user):PID MS") field(OMSL,"closed_loop") field(IVOA, "Set output to IVOV") field(IVOV, "0") } # ~1100 Watt heater when run with 110V: # P = U I = U^2 / R, R~12 Ohm record(calc, "$(user):heat_Pwr") { field(DESC, "Heater Power") field(EGU, "W") field(INPA, "$(user):heat_V PP NMS") field(CALC, "A*A/12.1") } # Every second, calculate new temperature # based on current temperature, # room temperature and heater # # A - current temperature # B - room temperature # C - heater power # D - isolation factor (water room) # E - heat capacity (would really depend on water volume) # # Very roughly with # T(n+1) = T(n) + [Troom-T(n)]*Isolation_factor # + heater_pwr * heat_capacity record(calc, "$(user):tank_clc") { field(DESC,"Water Tank Simulation") field(SCAN,"1 second") field(INPA,"$(user):tank_clc.VAL") field(INPB,"$(user):room") field(INPC,"$(user):heat_Pwr PP NMS") field(INPD,"0.01") field(INPE,"0.001") field(CALC,"A+(B-A)*D+C*E") field(FLNK,"$(user):tank") }

30Managed by UT-Battelle for the Department of Energy PID (without D) by Hand # Error computation’s SCAN drives the rest record(calc, "$(user):error") { field(DESC, "Temperature Error") field(SCAN, "1 second") field(INPA, "$(user):setpoint") field(INPB, "$(user):tank MS") field(CALC, "A-B") field(PREC, "1") field(FLNK, "$(user):integral") } # Integrate error (A) but assert that # it stays within limits (C) record(calc, "$(user):integral") { field(DESC, "Integrate Error for PID") field(PREC, "3") field(INPA, "$(user):error PP MS") field(INPB, "$(user):integral") field(INPC, "20.0") field(CALC, "(B+A>C)?C:(B+A<-C)?(-C):(B+A)") field(FLNK, "$(user):PID") } # PID (PI) computation of new output # A - Kp # B - error # C - Ki # D - error integral record(calc, "$(user):PID") { field(DESC, "Water Tank PID") field(PREC, "3") field(LOPR, "0") field(HOPR, "110") field(INPA, "10.0") field(INPB, "$(user):error MS") field(INPC, "5.0") field(INPD, "$(user):integral MS") field(CALC, "A*B+C*D") }

31Managed by UT-Battelle for the Department of Energy 31 Heater Simulation

32Managed by UT-Battelle for the Department of Energy Alarms  Common fields: –SEVR: Alarm Severity  NONE, MINOR, MAJOR, INVALID –STAT: Alarm Status  UDF, READ, WRITE, CALC, HIGH, …  Binary records: –ZSV, OSV: Severity for ‘zero’ and ‘one’ state  Analog records: –LOLO, LOW, HIGH, HIHI: Thresholds –LLSV, LSV, HSV, HHSV: Associated severities –HYST: Hysteresis

33Managed by UT-Battelle for the Department of Energy Alarm Example # Raise MAJOR alarm when temperature near boiling point record(ai, "$(user):tank") { field(DESC,"Water Temparature") field(SCAN,”… field(INP, ”… field(EGU, ”C") field(HIGH,”90") field(HSV, ”MAJOR") }

34Managed by UT-Battelle for the Department of Energy Summary  Database Records configure the IOC’s data flow –Fields, links instead of custom code  There’s more –Fields MDEL/ADEL, bo.HIGH –Access security  See forhttp://aps.anl.gov/epics –IOC Application Developers’ Guide –Record Reference Manual

35Managed by UT-Battelle for the Department of Energy Things to try  Build a simple on/off fish tank controller –Simulate the heater  ‘bo’ record to turn on/off –Simulate the water temperature  ‘calc’ record(s): –Temperature rises when heater is on –Temperature drops to room temperature when heater is off –Add controller  ‘ao’ record to allow entering the desired temperature  ‘calc’ record(s) to turn heater on/off, automagically keeping water temp. close to setpoint OK to take inspiration from Heater Control Simulation example –But don’t copy a single line without understanding it –Compare behavior of the P-I controller with on/off controller