+ All Categories
Home > Documents > Paul Scherrer Institut

Paul Scherrer Institut

Date post: 08-Jan-2016
Category:
Upload: keola
View: 43 times
Download: 0 times
Share this document with a friend
Description:
Xiaoqiang Wang. Paul Scherrer Institut. Python Channel Access Client/Server Extension. EPICS Spring Collaboration Meeting, ITER. 6. Oktober 2014. Motivation. Geoff Savage created caPython/CaChannel interface in 1999. SWIG 1.1 based EPICS 3.13 - PowerPoint PPT Presentation

of 10

Click here to load reader

Transcript
  • MotivationGeoff Savage created caPython/CaChannel interface in 1999.SWIG 1.1 basedEPICS 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 APIEPICS 3.14Actively maintained

    New CaChannel interface based on PythonCAFull docstring test99% compatiblePreemptive callback enabledTransparent thread safety

    PSI,

  • CaChannel InterfaceConnectionsearchsearch_and_connectclear_channelsearchw

    Synchronizationpend_iopend_eventpollflush_io

    Writearray_putarray_put_callbackputw

    Readarray_getarray_get_callbackgetwMonitorsadd_masked_array_eventclear_event

    Group operationsg_createsg_deletesg_getsg_putsg_resetsg_blocksg_test

    Higher Level Interfaces ca_util epicsPV, epicsMotor, epicsScan

    PSI,

  • PyQt4 integration - classes

    PSI,

  • PyQt4 integration - designerpython PyDM.py motors.ui

    PSI,

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

    PSI,

  • Portable Channel Access ServerSWIG wrapper of channel access server libraryNo significant C++ code written4 classes wrapped: caServe, casPV, casChannel, gddMain problem is dealing with gdd object1 new class PV to dispatch read request using gddAppFuncTable8 typemap definition to convert data in/outpythonic get/put methods

    PSI,

  • *PSI,A minimal example - source*PSI,Seite * 1 import cas 2 3 class myPV(cas.casPV): 4 def __init__(self, name): 5 cas.casPV.__init__(self) 6 self.name = name 7 self.value = 3 8 9 def write(self, context, value): 10 self.value= value.get() 11 return cas.S_casApp_success 12 13 def getValue(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 2122 def bestExternalType(self): 23 return cas.aitEnumFloat64 24 25 def getName(self): 26 return self.name 27 28 class myServer(cas.caServer): 29 def __init__(self): 30 cas.caServer.__init__(self) 31 self.pv = myPV(jimi)3233 def pvExistTest(self,context,addr,name): 34 if name == jimi: 35 return cas.pverExistsHere36 else: 37 return cas.pverDoesNotExistHere3839 def pvAttach(self, context, name): 40 if name == jimi: 41 return self.pv42 else: 43 return cas.S_casApp_pvNotFound444546 if __name__ == __main__: 47 s = myServer() 48 s.setDebugLevel(3) 49 while True: 50 cas.process(0.01)

    PSI,

  • A minimal example - output[bash SLSBASE=/work]$ caput jimi 1.6Old : jimi 0New : jimi 1.6[bash SLSBASE=/work]$ cainfo jimijimi:NAME jimiVAL 1.6EGU {}SIZE 1SEVR NO_ALARMSTAT NO_ALARMTIME {05/26/10 13:00:43.351047609}TYPE DBF_DOUBLEHOPR 0LOPR 0DRVH 0DRVL 0HIHI 0HIGH 0LOLO 0LOW 0PREC 3ACCESS RWIOC gfalc05.psi.ch

    PSI,

  • ReferencesPythonCA: http://controls.web.psi.ch/cgi-bin/twiki/view/Main/NewPythonEpicsInterfacePyCAS: http://controls.web.psi.ch/cgi-bin/twiki/view/Main/PythonChannelAccessServerCAS: http://www.aps.anl.gov/epics/extensions/cas/index.php

    PSI,

    Python aware widgetUI designerMEDM like loader


Recommended