Slides - Agenda INFN

Updates to CaPython/CaChannel
John Hammonds
Beamline Controls and Data Acquisition Group
APS Engineering Support Division
EPICS Collaboration Meeting
INFN Legnaro, Italy
Oct 15-17, 2008
Introduction
 Looking for a scripting language for use on the beamlines at APS.
 Many of the beamline scientists are not comfortable with Java due to the
jump to object-oriented programming.
 CaChannel/CaPython written by Geoff Savage at Fermilab.
– CaPython is a Python wrapper around channel access C libraries.
– Some use at APS already.
 Latest version was written using SWIG 1.1, Python 2.2 and channel
access 3.12.
 Could not get this to compile on standard APS machines with SWIG 1.3,
Python 2.4 and channel access 3.14.
2
SWIG
 Simplified Wrapper and Interface Generator (SWIG) – Presents the allure
of providing your header files and automatically wrapping your code.
Unfortunately, Channel Access is more than just simple C code (pointers,
callbacks, multi-platform support).
 Since Geoff did the initial version, SWIG has moved from version 1.1 to
1.3, which changed many of the things used in the interface file.
 Compile problems were mostly due to changes in this library.
 After installing SWIG 1.1, I was able to compile Geoff’s ca_wrap.c but
was not able to use SWIG to regenerate it. This meant updates would
not be possible.
 Have now modified the SWIG interface files so that compiling with SWIG
1.3 is possible. This now opens up future developments like adding 3.14
functions.
3
Current Status
 Have been able to compile and do basic testing on Solaris-sparc, Linux
and Solaris-x86 using Python 2.4.
 I was able to write a script for testing that monitored a channel and
changed the contents of a 20,000 element array based on that value.
 We are trying to work towards a standard set of Python tools (wxPython,
numpy, matplotlib, …) for use on the beamlines.
 Moving to Python 2.5.
4
Performance
CaPython Performance
From catime
Mbps
C
Connect test
19.4
Float Test
put
4.1
get
29.5
wait
0.7
Double
put
16.4
get
32
wait
0.6
String
put
16.4
get
29.6
wait
0.7
Int
put
15.1
get
30.8
wait
0.7
2.0 GHz Pentium 4 Processor
catime jph:userCalc1 10000
My CaPython
Geoff's CaPython
3.9
2.5
2.6
5.8
0.6
3.2
5.5
0.6
8.8
5.7
0.7
8.8
5.6
0.7
10.2
6.4
0.7
9
5.3
0.5
8.4
5.6
0.7
5
Extensions/Uses
 ca_util – Tim Mooney – thin layer above CaChannel to provide one line
caget, caput, camonitor, …
 epicsPV – Mark Rivers - Interface to EPICS channel access,
enhancements to CaChannel. Used to build MCA display. Not used
much now.
 Sector 11 – Brian Toby – Various programs for alignment of beamline
components, automation of scans.
 Sector 33 & 34 – Pete Jemian – Populate round-robin database (see
RRDTools) to produce web plots of EPICS data.
6
RRDTools (Round-Robin Database)
7
More Round-Robin Database
8
Goals
 Fold this work back in as a real update to CaChannel/CaPython.
Coordinate with Geoff.
 Add in 3.14 support including multithreading.
 Create a standard way of doing things at APS.
 Create a standard set of widgets to simplify connection to channels.
 Applications – Our group will be comparing possibilities in Python and
Java.
9
Demo
10
Acknowledgments
 Geoff Savage (FNAL) - for producing the original version of
CaPython/CaChannel.
 U.S. Department of Energy – work is supported by the Office of Science,
Office of Basic Energy Sciences, under Contract No. DE-AC0206CH11357.
11