Files
pyDevSup/documentation/gettingstarted.rst
Michael Davidsaver f66a457504 more doc
2014-06-16 18:25:18 -04:00

2.0 KiB

Getting Started

Counter

Consider a simple EPICS database with one record. Call it cntrec.db <../testApp/cntrec.db>

../testApp/cntrec.db

This is creating a single record which will use the "Python Device" support code (aka this package). It will attempt to scan (call the process method) one a second. The INP field is parsed and the first work identifies the Python module which will provide the logic behind this record (everything after the first word is passed to the module build function.

Now create cntmod.py <../testApp/cntmod.py> with the following.

../testApp/cntmod.py

This module is expected to provide a special callable build. We also provide a constructor and method detach <DeviceSupport.detach> which don't do anything. The process <DeviceSupport.process> method increments the VAL field of the attached Record <devsup.db.Record>.

Start this IOC with. :

$ ./bin/linux-x86_64/softIocPy2.7 -d cntrec.db
Starting iocInit
...
iocRun: All initialization complete
epics>dbl
test:count
epics>

Now in another terminal run.:

$ camonitor test:count
...
test:count                     2014-06-16 16:48:22.891825 9  
test:count                     2014-06-16 16:48:23.891967 10  
test:count                     2014-06-16 16:48:24.892137 11  
test:count                     2014-06-16 16:48:25.892286 12

It may be necessary to run export EPICS_CA_ADDR_LIST=localhost first.

Additional examples and applications

This module comes with several examples in testApp as well as three complete applications.

logApp

Observes a line based text file as new lines are appended. Writes each line to a charactor array PV. Special handling of caPutLog files.

pidMonApp

Monitors the PID file created by a UNIX daemon.

weatherApp

Retreives weather reports via the pymetar module.