Channel Access Client Coding 2006

Slides:



Advertisements
Similar presentations
Make This work with EPICS! 2006
Advertisements

1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
EPICS Base R and beyond Andrew Johnson Computer Scientist, AES Controls Group.
EPICS Channel Access Overview 2006
Channel Access Protocol Andrew Johnson Computer Scientist, AES Controls Group.
Jeffrey Hill.  LANSCE Requirements – a Review  EPICS Paradigm Shift – a Review  Status – What is Implemented  What is an Abstract Data Type?  Benefits.
PvData,pvAccess,javaIOC,pvService Status EPICS Meeting Aix-en-Provence, France Marty Kraimer, Guobao Shen, and Matej Sekoranja.
JCA 2.0 Eric. Boucher – APS EPICS Collaboration Meeting - June 18-20, 2003.
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.
Java implementation of Channel Access (CAJ) Matej Šekoranja ( presented by Rok Šabjan ) Funded by DLS (M.Heron) and DESY (M.Clausen) EPICS Meeting – SLAC,
Abeans Application Framework and Widgets Running with EPICS EPICS Workshop, Berlin, May 2002 M.Plesko on behalf of KGB Team J. Stefan Institute and Cosylab.
The Soft-IOC Based Alarm Handler – an Operations View Pam Gurd October 31, 2007.
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.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS April 2013 Control System Studio Training - Alarm System Use.
50.003: Elements of Software Construction Week 5 Basics of Threads.
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.
Channel Archiver Stats & Problems Kay Kasemir, Greg Lawson, Jeff Patton Presented by Xiaosong Geng (ORNL/SNS) March 2008.
Channel Archiver Introduction 2006
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.
Kazuro Furukawa, KEK, Jul Jacva and JCA / CAJ EPICS Workshop 2006, VECC, India 1 Java and JCA / CAJ Kenneth Evans, Jr. October 12, 2004 Part of the.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
ORNL is managed by UT-Battelle for the US Department of Energy Control System Studio: BOY Kay Kasemir ORNL/SNS A lot of material from.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Berliner Elektronenspeicherringgesellschaft für Synchrotronstrahlung mbH (BESSY) CA Proxy Gateway Status and Plans Ralph Lange, BESSY.
JavaIOC EPICS Meeting SSRF March Presented by: Marty Kraimer.
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.
‘ActiveX’ CA Server (… and Client) Oct Kay-Uwe Kasemir, LANL.
10/20/2015J-PARC1 Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS Getting Information directly from the Control.
Control System Studio (CSS) Overview Kay Kasemir, July 2009.
The CSS Scan System Kay-Uwe Kasemir SNS/ORNL Dec
1 Channel Access Concepts – EPICS Training – K.Furukawa – Mar EPICS Channel Access Concepts Kazuro Furukawa, KEK, ( ) (Bob Dalesio, LANL,
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio, CSS Overview.
General Time Update David Thompson Epics Collaboration Meeting June 14, 2006.
Introduction to the Channel Access Client Library Kenneth Evans, Jr. Kay Kasemir.
EPICS Access from Python Geoff Savage DØ Workshop Thursday June 22, 2000.
(Java) CA Client Libraries Status Matej Šekoranja
O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 1 Java Pros and Cons − Roundtable American Nuclear Society Annual Meeting June 16, 2004.
The Alternative Larry Moore. 5 Nodes and Variant Input File Sizes Hadoop Alternative.
ATF2 Mover Software 19 June 2008 Janice Nelson, Doug McCormick (SLAC) Glen White (LAL/SLAC) Justin May (no longer at SLAC)
SNS Alarm System Status Curtis Dunn Control System Suite/Eclipse Frameworks Workshop EPICS Collaboration Meeting June 12-16, 2006.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
1 Writing Channel Access Clients–EPICS Training – K.Furukawa – Mar EPICS Writing Channel Access Clients Kazuro Furukawa, KEK, ( ) (Marty.
EPICS sequencer update Greg White / William Lupton / EPICS ‘99 SLAC, May 27, 1999.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
Writing EPICS Channel Access Clients in Python Geoff Savage March 2003.
Advanced Photon Source Channel Access, CaSnooper, and CASW Kenneth Evans, Jr. Presented November 7, 2003 Argonne National Laboratory.
ROCS Web Based Reporting Tool Using SNS Relational Database By Katia Danilova, Ernest L. Williams Jr. Control Systems group, ASD, SNS.
Ralph Lange: CA Gateway Update CA Gateway Update Ralph Lange – EPICS Collaboration Meeting March SSRF.
Applications Kay Kasemir ORNL/SNS Using Information and pictures from Matthias Clausen, Jan Hatje, and Helge Rickens (DESY) October 2007.
Controls Zheqiao Geng Oct. 12, Autosave Additions/Upgrades and Experiences at SLAC Zheqiao Geng Controls Department SLAC National Accelerator Laboratory.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
EPICS and LabVIEW Tony Vento, National Instruments
Channel Archiver Overview Jan Channel Archiver Channel Access client Stores samples in disk files Design target: handle values/sec Documentation,
XAL based PV Browser Jeff Patton, Chris Fowlkes EPICS Collaboration Meeting – RDB SIG June 12, 2006.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
Channel Access Security 2006 O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 2 Channel Access Security  The IOC Application.
Berliner Elektronenspeicherringgesellschaft für Synchrotronstrahlung mbH (BESSY) CA Gateway Update Ralph Lange, BESSY Ken Evans Jr., APS Jeff Hill, LANL.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, April at SLAC Control System Studio Training - Alarm System.
Updates to CaPython/CaChannel John Hammonds Beamline Controls and Data Acquisition Group APS Engineering Support Division EPICS Collaboration Meeting INFN.
Python PVA Prototype Siniša Veseli Software Engineer AES / Software Services Group EPICS v4 Group Meeting November 19, 2013.
Monitoring Dynamic IOC Installations Using the alive Record Dohn Arms Beamline Controls & Data Acquisition Group Advanced Photon Source.
“This improved a lot since I started using Tango (three years ago) from scratch so I'm happy to see the efforts from the developers. Still there is room.
LCGAA nightlies infrastructure
SLAC USA Marty Kraimer and Matej Sekoranja
Part of the EPICS “Getting Started” Lecture Series
Writing a Channel Access Client in EPICS
Channel Access Concepts
Banafsheh Hajinasab Based on presentation by K. Strnisa, Cosylab
Channel Access Concepts
Presentation transcript:

Channel Access Client Coding 2006

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 2 Channel Access  The main CA client interface is the "C" library that comes with EPICS base  Internally uses C++, but API is pure C.  Almost all other CA client interfaces use that C library  Exception: New pure Java CAC, which for now still has some issues.  Full documentation of the C API: "EPICS R3.14 Channel Access Reference Manual", Jeff Hill, on APS EPICS web page.  See same web site for copies of previous EPICS training material that basically presents every routine in the API.  This time:  Brief makeBaseApp.pl, Matlab, Java examples.  Point to some fundamental issues.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 3 makeBaseApp.pl  Includes a template for basic CA client in C:  Start with this: makeBaseApp.pl -t caClient cacApp make  Result: bin/linux-x86/caExample bin/linux-x86/caMonitor  Then read the sources, compare with the reference manual, and edit/extend to suit your needs.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 4 makeBaseApp's caExample.c  Minimal CA client program.  Fixed timeout, waits until data arrives.  Requests everything as 'DBR_DOUBLE'.  … which results in values of C-type 'double'.  See db_access.h header file for all the DBR_… constants and the resulting C types or structures.  In addition to the basic DBR_ requests, it is possible to request packaged attributes like DBR_CTRL_ to get { value, units, limits, …} in one request.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 5 Excerpt from db_access.h /* values returned for each field type … * DBR_DOUBLE returns a double precision floating point number … * DBR_CTRL_DOUBLE returns a control double structure (dbr_ctrl_double) */ … /* structure for a control double field */ struct dbr_ctrl_double{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ dbr_short_t precision; /* number of decimal places */ dbr_short_t RISC_pad0; /* RISC alignment */ char units[MAX_UNITS_SIZE]; /* units of value */ dbr_double_t upper_disp_limit; /* upper limit of graph */ dbr_double_t lower_disp_limit; /* lower limit of graph */ dbr_double_t upper_alarm_limit; dbr_double_t upper_warning_limit; dbr_double_t lower_warning_limit; dbr_double_t lower_alarm_limit; dbr_double_t upper_ctrl_limit; /* upper control limit */ dbr_double_t lower_ctrl_limit; /* lower control limit */ dbr_double_t value; /* current value */ };

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 6 makeBaseApp's caMonitor.c  Better CA client program.  Registers callbacks to get notified when connected ot disconnected  Subscribes to value updates instead of waiting.  … but still uses the same data type (DBR_STRING) for everything.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 7 Ideal CA client?  Use callbacks for everything  no idle 'wait', no fixed time outs.  Upon connection, check the channel's native type (int, double, string, …)  to limit the type conversion burden on the IOC.  … request the matching DBR_CTRL_ once  to get the full channel detail (units, limits, …).  … and then subscribe to DBR_TIME_ to get updates of only time/status/value  so now we always stay informed, yet limit the network traffic.  Only subscribe once, not with each connection, because CA client library will automatically re-activate subscriptions!  This is what EDM, archiver, … do.  Quirk: They don't learn about online changes of channel limits, units, …. Doing that via a subscription means more network traffic, and CA doesn't send designated events for 'meta information changed'.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 8 Side Note: SNL just to get CAC help  This piece of SNL handles all the connection management and data type handling:  double value; assign value to "fred"; monitor value;  Extend into a basic 'camonitor':  evflag changed; sync value changed; ss monitor_pv { state check { when (efTestAndClear(changed)) { printf("Value is now %g\n", value); } state check } }

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 9 Quick Hacks, Scripts  In many cases, one can get by just fine by invoking the command-line 'caget' from within bash/perl/python/php.  Especially if you only need to read/write one value of a PV, not a subscription!  There are more elaborate CAC bindings available for perl/python/php  But that means you have to find, build and later maintain these!  A basic p* script is portable, but you'd have to install the CAC-for-p* binding separately for Linux, Win32, MacOS…

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 10 Perl Example use English; # Get the current value of a PV # Argumment: PV name # Result: current value sub caget($) { my ($pv) open(F, "caget -t $pv |") or die "Cannot run 'caget'\n"; $result= ; close(F); chomp($result); return $result; } # Do stuff with PVs $fred = caget("fred"); $jane = caget("jane"); $sum = $fred + $jane; printf("Sum: %g\n", $sum);

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 11 Matlab 'MCA' Extension  Same setup & maintenance issue as for p/p/p!  … but may be worth it, since Matlab adds tremendous number crunching and graphing.  Initial setup  Get MCA sources (see links on APS EPICS web)  Read the README, spend quality time with MEX.  Assume that's done by somebody else  You are in the SNS control room  'caget' from EPICS base works  Matlab works (try "matlab -nojvm -nodesktop")  Do this once: cd $EPICS_EXTENSIONS/src/mca source setup.matlab  … and from now on, Matlab should include MCA support

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 12 MCA Notes  Basically, it's a chain of  pv = mcaopen('some_pv_name');  value = mcaget(pv);  mcaput(pv, new_value);  mcaclose(pv);  Your pv is 'connected' from..open to..close  When getting more than one sample, staying connected is much more efficient than repeated calls to 'caget'.  Try 'mca ' command-line completion to get a list of all the mca… commands  Run 'help mcaopen' etc. to get help

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 13 Matlab/MCA Examples

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 14 MCA Value Subscription

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 15 Java  There is actually a JNI and a pure Java binding.  Only difference in initialization, then same API.  Usage very much like C interface, "real programming" as opposed to Matlab, but in a more forgiving Java VM.  See Docs/Java CA example.

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 16 Acknowledgements  Channel Access on every level in detail:  Jeff Hill (LANL)  makeBaseApp.pl  Ralph Lange (BESSY) and others  MCA  Andrei Terebilo (SLAC) is the original author,  Carl Lionberger maintained it for a while (then SNS)  Java CA  Eric Boucher is the original author (then APS),  Matej Sekoranja maintains it; he added the pure java version (Cosylab)