Recipe for testing the taurus epics scheme
Based on:
- https://prjemian.github.io/epicspi/
- http://cars.uchicago.edu/software/python/pyepics3/overview.html
- http://epics.nsls2.bnl.gov/debian/
- http://ics-web.sns.ornl.gov/kasemir/CSS/Training/FRIB/2%20EPICS%20Database.pdf
Based on a debian system (tested on a debian stretch):
As root:
# wget -qO - http://epics.nsls2.bnl.gov/debian/repo-key.pub | apt-key add - OK # echo 'deb http://epics.nsls2.bnl.gov/debian/ jessie/staging main contrib' >> /etc/apt/sources.list.d/epics.list # aptitude update (...) # aptitude install epics-dev The following NEW packages will be installed: epics-catools{a} epics-dev epics-msi{a} libepics3.14.12.3{a} (...) # pip install pyepics (...)
We do this as a regular user.
Create a file called testioc.db
with the following content:
record(ao,"XXX:a"){ field(DTYP,"Soft Channel") field(VAL,0) field(UDF,1) field(FLNK,"XXX:sum") } record(ao,"XXX:b"){ field(DTYP,"Soft Channel") field(VAL,0) field(UDF,1) field(FLNK,"XXX:sum") } record(calc,"XXX:sum"){ field(INPA,"XXX:a") field(INPB,"XXX:b") field(CALC,"A+B") } record(calc, "XXX:random"){ field(SCAN, "1 second") field(INPA, "XXX:a") field(CALC, "RNDM*A") }
And start this new ioc:
$ softIoc -d testioc.db Starting iocInit ############################################################################ ## EPICS R3.14.12.3-11 $Date: Mon 2012-12-17 14:11:47 -0600$ ## EPICS Base built May 11 2015 ############################################################################ iocRun: All initialization complete epics>
Running the following python script:
from epics import PV import time a = PV('XXX:a') b = PV('XXX:b') sum = PV('XXX:sum') r = PV('XXX:random') print "ctrvars=", a.get_ctrlvars() a.value = 2 b.value = 3 time.sleep(1) print "%f + %f = %f" % (a.value, b.value, sum.value) print "r:" for i in range(5): time.sleep(1) print r.value
Outputs this:
ctrvars= {'status': 0, 'lower_disp_limit': 0.0, 'upper_disp_limit': 0.0, 'severity': 0, 'upper_ctrl_limit': 0.0, 'lower_alarm_limit': nan, 'precision': 0, 'upper_alarm_limit': nan, 'lower_warning_limit': nan, 'upper_warning_limit': nan, 'units': '', 'lower_ctrl_limit': 0.0} 2.000000 + 3.000000 = 5.000000 r: 0.516304264897 1.86718547341 0.736461432822 1.36296635386 1.78036163882
With taurus 3.6.1: (with taurus>=4 remove the "//")
$ taurusform epics://XXX:random epics://XXX:a epics://XXX:b epics://XXX:sum
Shows a form showing the 4 corresponding PVs