150 likes | 292 Vues
Online model in Python. David Kelliher ASTeC /STFC/RAL 3 rd December 2009. Contents. Installation of EPICS and setting up a minimal server for EMMA Python Channel Access client Operation Interface and Virtual Accelerator. Machida 18/06/09. EPICS IOCs. Minimal EPICS server for EMMA.
E N D
Online model in Python David Kelliher ASTeC/STFC/RAL 3rd December 2009
Contents • Installation of EPICS and setting up a minimal server for EMMA • Python Channel Access client • Operation Interface and Virtual Accelerator
Minimal EPICS server for EMMA • Includes quadrupole position and power supply current, and BPM readouts. • Sufficient information to do tune measurements, horizontal orbit distortion and correction. + Kinetic energy, injection x,x’, number of turns
Operational Interface • Communicates with the EPICS IOC using Channel Access (CA) Client (ca.Get, ca.Put, ca.monitor etc). • Can run in VA or RA mode. It should also be possible to run the online model directly. • Interface being written in Python using Tkinter. • Python CA Clients already exist.
Python channel access • A number of implementations can be found online include caPython, epicsPV, EpicsCA and PythonCA. • Using PythonCAdeveloped by Noburu Yamamoto at KEK. • Python/C API used as wrapper. Compatible with latest stable release EPICS-3.14.10. • Download PythonCa-1.20.2 tarball from www-acc.kek.jp.
Testing PythonCA • Set EPICS_CA_ADDR_LIST to IP of computer on which EPICS server is running. • Run caRepeater in background • In test directory, after editing the channel names, can now try python testPython.py
Python connection to EMMA EPICS server #!usr/bin/env/python #import PythonCA channel access module import ca #send a magnet position to server ca.Put(“emmaserverHost:E01-MAGN-POSN-01”, 0.03) #get BPM1 reading from cell 22 ca.Get(“emmaserverHost:E22-DIA-EBPM-01”)
Virtual Accelerator • Tracking code that simulates the real machine • Zgoubi with python interface (PyZgoubi) implemented. • Beacon switch in the EPICs server could be switched on by Operation Interface. Alerted by ca.Monitor(), VA reads data it needs from server and sends results back (BPM data etc). Operation interface gets results from server and performs analysis.
Conclusions • EPICS server with minimal records to simulate EMMA has been set up. • PythonCA client installed and tested • Operation Interface can now communicate with EPICS server • Virtual Accelerator set up using PyZgoubi, controlled by EPICS server