INDI ALH Driver Testing

While testing, we initially created a simple INDI driver to allow testing of the web status server that didn't require EPICS, etc.

This driver was built in the same place as the EPICS driver, but had one integer property that was get and set-able.

/home/ksummers/instruments/INDI/LBTI_IND/src/alhdriver/noEPICS is the directory. The driver name in the bin directory is indiALH

The bad part about lots of properties, is that all have to be set at the same time with the setINDI command.

 > /web/modules/INDI/bin/getINDI ALH.*.*
ALH.Version.Driver=0.1
ALH.Version.Properties=0.1
ALH.Version.Uptime=81294.583
ALH.ECS.airCompStatus=
ALH.ECS.dampersStatus=
ALH.ECS.domeCoolingStatus=
ALH.ECS.exFansStatus=
ALH.ECS.hbsStatus=
ALH.ECS.iasStatus=
ALH.ECS.icsStatus=
ALH.ECS.lightsStatus=
ALH.ECS.mvStatus=
ALH.ECS.shutterStatus=
ALH.ECS.snowMeltStatus=
ALH.ECS.stealthFanStatus=
ALH.ECS.summerChillerStatus=
ALH.ECS.ventDoorStatus=
ALH.ECS.winterChillerStatus= 

So, to set any of these values, you have to do something like:

 >  /web/modules/INDI/bin/setINDI 'ALH.ECS.airCompStatus=1;summerChillerStatus=5;dampersStatus=;domeCoolingStatus=;exFansStatus=;hbsStatus=;iasStatus=;icsStatus=;lightsStatus=;mvStatus=;shutterStatus=0;snowMeltStatus=2;stealthFanStatus=0;ventDoorStatus=1;winterChillerStatus=0'
You can leave the value blank, if you want - that is legitimate.

To build this executable, type make -f Makefile-nonEPICS

EPICS Interface

For testing, created a /web/modules/epics area to build channel access.
Had to install a few things to make it build (like xsubpp and podchecker). Grabbed pyepics

http://cars9.uchicago.edu/software/python/pyepics3/pyepics.pdf - good pyepics documents
http://cars9.uchicago.edu/software/python/pyepics3/overview.html

 yum install perl-ExtUtils-ParseXS
 yum install perl-Pod-Checker
 /lbt/lbto_runtime/anaconda2/bin/conda install -c https://conda.anaconda.org/newville pyepics

Took just a few channels from our tcs.db and ran a simple testioc:
export EPICS_HOME="/web/modules/epics"
export EPICS_BASE="${EPICS_HOME}/base-3.14.12.4"
export EPICS_HOST_ARCH=`${EPICS_BASE}/startup/EpicsHostArch`
export PATH="${PATH}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}:${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EPICS_BASE}/lib/${EPICS_HOST_ARCH}:${EPICS_HOME}/lib/${EPICS_HOST_ARCH}"

cd $EPICS_HOME/iocBoot/testioc/
./st.cmd &
 
Then, the python can get/set. This program has a callback and sets up an EPICS monitor. It uses the pyindi.py class to call setINDI on a property with the value from the EPICS channel.
#!/lbt/lbto_runtime/anaconda2/bin/python

''' LBC channel test python EPICS/INDI app.

    monitors an LBC EPICS channel (lbc:side0:dewarPres) and 
    writes the value to the INDI property Maths.x.value.
'''
import sys
import time
import os
import pyindi
from math import exp

from epics import Device, caget, caput, PV
from pyindi import PyINDI

def valueChangeCB(pvname=None, value=None, char_value=None, **kw):
    print 'callback for ', pvname, char_value
    pi.setINDI ("Maths.x.value", char_value, timeout=1)

def main(argv):
    global pi
    pi = PyINDI(host='web')

    bDewarPresPV = PV('lbc:side0:dewarPres')
    bDewarPresPV.add_callback(valueChangeCB)
    print bDewarPresPV.get()   ## equiv to caget
    ## the following prints something like: 
    ##    <PV 'lbc:side0:dewarPres.VAL', count=1, type=time_double, access=read/write>
    print bDewarPresPV
 
    print "Waiting for change to lbc:side0:dewarPres..."
    t0 = time.time()
    while time.time() - t0 < 60.0:
       time.sleep(1.e-3)
    print 'Done.'
    
if __name__ == '__main__':
    main(sys.argv[1:])
Topic revision: r1 - 25 Apr 2017, KelleeSummers
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback