1 / 10

Enhancing EPICS Control with PythonCA and PyDM Integration

Join the collaboration meeting at PSI with Xiaoqiang Wang from Paul Scherrer Institut on January 1, 2020, showcasing the motivation behind the creation of caPython/CaChannel interface by Geoff Savage in 1999. Learn about the evolution from SWIG 1.1 to EPICS 3.13 and the challenges faced in building on new systems like SWIG 1.3. Explore the enhanced features of the new CaChannel interface based on PythonCA, actively maintained by Noboru Yamamoto for improved compatibility and thread safety. Discover high-level interfaces, PyQt4 integration, and portable access server. Get hands-on examples on integrating PV control and display, and using SWIG wrapper for channel access server. Dive into Python scripting for EPICS control, with demonstrations and discussions on real-time applications.

clindsey
Download Presentation

Enhancing EPICS Control with PythonCA and PyDM Integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PSI, Xiaoqiang Wang Paul Scherrer Institut Python Channel Access Client/Server Extension EPICS Spring Collaboration Meeting, ITER 1. Januar 2020

  2. Motivation Geoff Savage created caPython/CaChannel interface in 1999. SWIG 1.1 based EPICS 3.13 Stable sine 2000, problematic to build on new system (SWIG 1.3) Many scripts are using the CaChannel interface Noboru Yamamoto has PythonCA Python/C API EPICS 3.14 Actively maintained “New” CaChannel interface based on PythonCA Full docstring test 99% compatible Preemptive callback enabled Transparent thread safety

  3. CaChannel Interface Connection search search_and_connect clear_channel searchw Synchronization pend_io pend_event poll flush_io Write array_put array_put_callback putw Read array_get array_get_callback getw • Monitors • add_masked_array_event • clear_event Group operation • sg_create • sg_delete • sg_get • sg_put • sg_reset • sg_block • sg_test Higher Level Interfaces • ca_util • epicsPV, epicsMotor, epicsScan

  4. PyQt4 integration - classes

  5. PyQt4 integration - designer python PyDM.py motors.ui

  6. PyQt4 integration - example Integrated PV control/display Macro based automation

  7. Portable Channel Access Server SWIG wrapper of channel access server library No significant C++ code written 4 classes wrapped: caServe, casPV,casChannel, gdd Main problem is dealing with gdd object 1 new class PV to dispatch read request using gddAppFuncTable 8 typemap definition to convert data in/out pythonic get/put methods

  8. PSI, A minimal example - source 1 import cas 2 3 classmyPV(cas.casPV): 4 def__init__(self, name): 5 cas.casPV.__init__(self) 6 self.name = name 7 self.value = 3 8 9 defwrite(self, context, value): 10 self.value= value.get() 11 return cas.S_casApp_success 12 13 defgetValue(self, value): 14 value.put(self.value) 15 value.setTimeStamp() 16 return cas.S_casApp_success 17 18 def getPrecision(self, value): 19 value.put(3) 20 return cas.S_casApp_success 21 22 defbestExternalType(self): 23 return cas.aitEnumFloat64 24 25 defgetName(self): 26 return self.name 27 • 28 classmyServer(cas.caServer): • 29 def__init__(self): • 30 cas.caServer.__init__(self) • 31 self.pv = myPV(‘jimi’) • 32 • 33 defpvExistTest(self,context,addr,name): • 34 if name == ‘jimi’: • 35 return cas.pverExistsHere • 36 else: • 37 return cas.pverDoesNotExistHere • 38 • 39 defpvAttach(self, context, name): • 40 if name == ‘jimi’: • 41 return self.pv • 42 else: • 43 return cas.S_casApp_pvNotFound • 44 • 45 • 46 if __name__ == ‘__main__’: • 47 s = myServer() • 48 s.setDebugLevel(3) • 49 while True: • 50 cas.process(0.01) PSI, 1. Januar 2020

  9. A minimal example - output [bash SLSBASE=/work]$ caput jimi 1.6 Old : jimi 0 New : jimi 1.6 [bash SLSBASE=/work]$ cainfo jimi jimi: NAME jimi VAL 1.6 EGU {} SIZE 1 SEVR NO_ALARM STAT NO_ALARM TIME {05/26/10 13:00:43.351047609} TYPE DBF_DOUBLE HOPR 0 LOPR 0 DRVH 0 DRVL 0 HIHI 0 HIGH 0 LOLO 0 LOW 0 PREC 3 ACCESS RW IOC gfalc05.psi.ch

  10. References PythonCA: http://controls.web.psi.ch/cgi-bin/twiki/view/Main/NewPythonEpicsInterface PyCAS: http://controls.web.psi.ch/cgi-bin/twiki/view/Main/PythonChannelAccessServer CAS: http://www.aps.anl.gov/epics/extensions/cas/index.php

More Related