Integrated Low/High Voltage system application for Hall-D Detectors

From GlueXWiki
Jump to: navigation, search

Requirements

EPICS base must be installed and EPICS environment variables must be defined. Look at Installing_EPCIS_base.

Downloading the software

svn co https://halldsvn.jlab.org/repos/trunk/controls/epics

Setting up the environment

If you sourced environment of EPICS base, then you'll need to do something like this:

# A script to change the EPICS build area location to a local for a user directory
# This is needed if a user not hdsys wants to have his own development area and not 
# to interfere with the official Hall D EPICS build.

# Define the root directory where the drivers and applications will be build 
#       setenv EPICS_BUILD ~/epics/R3-14-12-3
        setenv EPICS_BUILD ~/controls/epics

# Set CA server port to be different from standart 5064. The CA client port will not change 
# because of this command 
#       setenv EPICS_CAS_SERVER_PORT 6064

# Set where the drivers and applications are checked-out and build using EPICS_BUILD variable
# this is important for someone compiling drivers and compiling and running applications
        setenv APP      ${EPICS_BUILD}/app 
        setenv DRIVERS  ${EPICS_BUILD}/drivers 

# Set the default SNMP MIB-file directory and the MIB-file list 
        setenv MIBDIRS "${DRIVERS}/mibs:/usr/share/snmp/mibs/"
        setenv MIBS    "ALL"

# Put the bin directories into the PATH and lib directories into the LD_LIBRARY_PATH variables
        setenv PATH "${APP}/bin/${EPICS_HOST_ARCH}:${PATH}:${DRIVERS}/bin/${EPICS_HOST_ARCH}:${PATH}:"
        setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${APP}/lib/${EPICS_HOST_ARCH}:${DRIVERS}/lib/${EPICS_HOST_ARCH}:"

You will need to redefine EPICS_BUILD to the directory where You had checked out.


I have the following EPICS related environment variables setup up. If something goes wrong You may want to compare what I have.

APP=/home/nerses/controls/epics/app
CLASSPATH=/halldfs1/gluex/controls/epics/R3-14-12-3/extensions/javalib
CSS=/gluex/controls/css
CSS_VERSION=3.1.4
DRIVERS=/home/nerses/controls/epics/drivers

EPICS_AR_PORT=7002
EPICS_BASE=/halldfs1/gluex/controls/epics/R3-14-12-3/base
EPICS_BUILD=/home/nerses/controls/epics
EPICS_CA_ADDR_LIST= 
EPICS_CA_MAX_ARRAY_BYTES=100000
EPICS_DISPLAY_PATH=/halldfs1/gluex/controls/epics/R3-14-12-3/app/medm
EPICS_EXTENSIONS=/halldfs1/gluex/controls/epics/R3-14-12-3/extensions
EPICS_GATEWAY_HOME=/halldfs1/gluex/controls/epics/R3-14-12-3/../gateway
EPICS=/halldfs1/gluex/controls/epics/R3-14-12-3
EPICS_HOST_ARCH=linux-x86_64
EPICS_SUPPORT=/halldfs1/gluex/controls/epics/R3-14-12-3/support
EPICS_VERSION=3-14-12-3
MIBDIRS=/home/nerses/controls/epics/drivers/mibs:/usr/share/snmp/mibs/
MIBS=ALL
MYSQINC=/usr/include/mysql
MYSQLIB=/usr/lib64/mysql
MYSQL_INCLUDE_PATH=/usr/include/mysql
MYSQL_LIB_PATH=/usr/lib64/mysql
ORBITSCREENHOME=/halldfs1/gluex/controls/epics/R3-14-12-3/extensions/src/orbitscreen
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib

Compiling the Drivers

cd $DRIVERS/configure     ; make
cd $DRIVERS/HVCAENx527App ; make
cd $DRIVERS/snmpApp       ; make
cd $DRIVERS/LVMPODApp     ; make

The 1st entry will make link to REALEASE_2_INCLUDE file. It will be required to do once. The other 3 will be needed to work with CAEN SY1527 and WIENER MPOD types of mainframes. If You'll try to make in the $DRIVERS then, most likely You will fail due to some other drivers requiring other architectures for example.

Compiling the application

cd $APP/configure ; make
cd $APP/hvCaenApp ; make

The 1st entry will make link to REALEASE_2_INCLUDE file. It will be required to do once. The other will compile the application and will install the DB files. Note: The Qt libraries will be needed in order to work with Relational DBes.

Configuring and running

cd $APP/iocBoot/iochvCaen
nano st.cmd

The st.cmd file should be configured according Your needs. Below is example content of the st.cmd file with my additional comments in between.

#!../../bin/linux-x86/hvCaen

The above line calls executable to interpret commands in this file.

Nothing needed to be configured in the following section.

## You may have to change hvCaen to something else
## everywhere it appears in this file

# scanOnce requests are placed in a ring buffer.
# This command can be used to set the size for the ring buffer.
# The default is 1000. It should rarely be necessary to override this default.
# Normally the ring buffer overflow messages appear when the scanOnce task fails.
scanOnceSetQueueSize 2000

Set up the PREFIX of EPICS PVes, so it would not mess up with other IOCes. Most likely the production version of IOC will have empty PREFIX. For detector test setups use something like "cdc_test" for CDC detector.

< envPaths
#epicsEnvSet("PREFIX","")
epicsEnvSet("PREFIX","mytest")
epicsEnvSet("MIB","WIENER-CRATE-MIB::")
epicsEnvSet("WO", "WIENER-CRATE-MIB::output")

Nothing needed to be configured in the following section.

# Error Log To Console 0 or 1
eltc 1

cd ${TOP}

## Register all support components
dbLoadDatabase "dbd/hvCaen.dbd"
hvCaen_registerRecordDeviceDriver pdbbase

# detUsePrefix "prefix"
detUsePrefix ${PREFIX}

The following section is temporarly fix for snmp driver. On the 2nd and 3rd lines put the hostname of the MPOD crates. Make these 2 lines for every MPOD You're going to use.

devSnmpSetParam(DebugLevel, 0)
devSnmpSetMaxOidsPerReq("halldmpod4", 1)
devSnmpSetSnmpVersion("halldmpod4","SNMP_VERSION_2c")
devSnmpSetParam(ReadStarvationMSec, 60000)
devSnmpSetParam(PassivePollMSec, 1500)
devSnmpSetParam(SetSkipReadbackMSec, 50000000)

Comment out the detectors those are not needed.

#CAENx527ConfigureCreate "hv0", "halldcaenhv1"
#detConfigureCrate "Detector", "URI"
detConfigureCrate "BCAL","sqlite:///home/nerses/t1/controls/epics/app/hvCaenApp/src/tt.db"
detConfigureCrate "CDC", "sqlite:///home/nerses/t1/controls/epics/app/hvCaenApp/src/tt.db"
detConfigureCrate "FDC", "sqlite:///home/nerses/t1/controls/epics/app/hvCaenApp/src/tt.db"
detConfigureCrate "PS",  "sqlite:///home/nerses/t1/controls/epics/app/hvCaenApp/src/tt.db"

detDbLoadRecords is required, don't touch it.

## Load record instances
#dbLoadRecords("db/xxx.db","user=hovanesHost")

# Automatically generate EPICS DB for CAEN HV Chassis
#CAENx527DbLoadRecords
detDbLoadRecords

Setup similarly other histograms if needed or comment out if not needed. Be careful, wrong NELM, DET or SUFFIX most likely will result in crash of IOC.

dbLoadRecords "db/DetWF.db" "DET=CDC:lv,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=20"
dbLoadRecords "db/DetWF.db" "DET=CDC:lv,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=20"
dbLoadRecords "db/DetWF.db" "DET=CDC:hv,PREFIX=${PREFIX},SUFFIX=imon,NELM=149"
dbLoadRecords "db/DetWF.db" "DET=CDC:hv,PREFIX=${PREFIX},SUFFIX=vmon,NELM=149"

dbLoadRecords "db/DetWF.db" "DET=FDC:lv,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=74"
dbLoadRecords "db/DetWF.db" "DET=FDC:lv,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=74"
dbLoadRecords "db/DetWF.db" "DET=FDC:hv,PREFIX=${PREFIX},SUFFIX=imon,NELM=192"
dbLoadRecords "db/DetWF.db" "DET=FDC:hv,PREFIX=${PREFIX},SUFFIX=vmon,NELM=192"
dbLoadRecords "db/DetWF.db" "DET=FDC:hv,PREFIX=${PREFIX},SUFFIX=v0set:fbk,NELM=192"

dbLoadRecords "db/DetWF.db" "DET=PS:lv,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=8"
dbLoadRecords "db/DetWF.db" "DET=PS:lv,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=8"
dbLoadRecords "db/DetWF.db" "DET=PS:bias,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=58"
dbLoadRecords "db/DetWF.db" "DET=PS:bias,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=58"

dbLoadRecords "db/DetWF.db" "DET=BCAL:bias,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=384"
dbLoadRecords "db/DetWF.db" "DET=BCAL:bias,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=384"
dbLoadRecords "db/DetWF.db" "DET=BCAL:lv,PREFIX=${PREFIX},SUFFIX=i_rd,NELM=48"
dbLoadRecords "db/DetWF.db" "DET=BCAL:lv,PREFIX=${PREFIX},SUFFIX=v_sens,NELM=48"

Mandatory IOC init call.

cd ${TOP}/iocBoot/${IOC}
iocInit

To run:

./st.cmd

Or if You need extra messages to be displayed:

./st.cmd -D 1

The number 1 could be up to 10 with increasing verbosity.