示例#1
0
 def __init__(self, boardList):
     self.boardList = boardList
     #pv created to place VPD demand voltages
     self.placevalues = builder.boolOut("VPDplacevalues",
                                        ZNAM=0,
                                        ONAM=1,
                                        HIGH=0.1,
                                        on_update=self.place_voltages)
     #pv created to turn VPD voltages to 0
     self.turnvoltageoff = builder.boolOut("turnoffVPD",
                                           ZNAM=0,
                                           ONAM=1,
                                           HIGH=0.1,
                                           on_update=self.turnoff_VPD)
     self.activefile = 1
     self.dictionary = {}
     self.chooseFile = builder.longOut("VPD_setting",
                                       initial_value=self.activefile,
                                       on_update=self.request_change)
     self.reload = builder.boolOut("reload_VPD",
                                   ZNAM=0,
                                   ONAM=1,
                                   HIGH=0.1,
                                   on_update=self.reload_dictionary)
     self.fileInUse = builder.stringIn("VPDfilestatus")
     self.listofstringIns = []
     self.maximum = 10
     for i in range(self.maximum):
         self.listofstringIns.append(
             builder.stringIn("VPDfile" + str(i + 1)))
示例#2
0
 def __init__(self, boardList):
     self.boardList = boardList
     #create pv to place BBC voltages
     self.placevalues = builder.boolOut("BBCplacevalues",
                                        ZNAM=0,
                                        ONAM=1,
                                        HIGH=0.1,
                                        on_update=self.place_voltages)
     self.diction_ary = {}
     self.activefile = 1
     self.chooseFile = builder.longOut("BBC_setting",
                                       initial_value=self.activefile,
                                       on_update=self.request_change)
     #create pv to reload dictionary if changes were made according to the files where demand voltages
     #are retrieved from
     self.reload = builder.boolOut("reload_BBC",
                                   ZNAM=0,
                                   ONAM=1,
                                   HIGH=0.1,
                                   on_update=self.reload_dictionary)
     #create pv to retrieve file status of BBC
     self.fileInUse = builder.stringIn("BBCfilestatus")
     #create pv to set BBC voltages to zero
     self.turnoffBBC = builder.boolOut("BBCturnoff",
                                       ZNAM=0,
                                       ONAM=1,
                                       HIGH=0.1,
                                       on_update=self.turnoff_BBC)
     self.listofstringIns = []
     self.maximum = 10
     for i in range(self.maximum):
         self.listofstringIns.append(
             builder.stringIn("BBCfile" + str(i + 1)))
def build_typed_pvs():
    """Build generic PVs"""
    dynamic_pvs = {}

    builder.aOut('AO:STATIC', **ANALOGUE_VALUES)
    builder.aIn('AI:STATIC', **ANALOGUE_VALUES)
    dynamic_pvs.update({
        builder.aOut('AO:DYNAMIC', **ANALOGUE_VALUES):
        lambda pv: increment(pv, 10)})

    builder.longOut('LONGO:STATIC',**LONG_VALUES)
    builder.longIn('LONGI:STATIC',**LONG_VALUES)
    dynamic_pvs.update({
        builder.aOut('LONGO:DYNAMIC', **LONG_VALUES):
        lambda pv: increment(pv, 10)})

    builder.boolOut('BOOLO:STATIC', **BOOLEAN_VALUES)
    builder.boolIn('BOOLI:STATIC', **BOOLEAN_VALUES)
    dynamic_pvs.update({
        builder.boolOut('BOOLO:DYNAMIC', **BOOLEAN_VALUES):
        lambda pv: increment(pv, 1)})

    builder.stringOut('STRINGO:STATIC', initial_value=STRINGS[0])
    builder.stringIn('STRINGI:STATIC', initial_value=STRINGS[0])
    dynamic_pvs.update({
        builder.stringOut('STRINGO:DYNAMIC', initial_value=STRINGS[0]):
        update_string})

    enum_pv = builder.mbbOut('MBBO:STATIC', *STRINGS, initial_value=0)
    enum_pv = builder.mbbIn('MBBI:STATIC', *STRINGS, initial_value=0)
    dynamic_pvs.update({
        builder.mbbOut('MBBO:DYNAMIC', *STRINGS, initial_value=0):
        lambda pv: increment(pv, len(STRINGS) - 1)})
    return lambda: update_pvs(dynamic_pvs)
    def test_string_rejects_overlong_strings(self):
        """Test that stringIn & stringOut records reject strings >=39 chars"""

        OVERLONG_STR = MAX_LEN_STR + "A"

        with pytest.raises(ValueError):
            builder.stringIn("STRIN1", initial_value=OVERLONG_STR)

        with pytest.raises(ValueError):
            builder.stringOut("STROUT1", initial_value=OVERLONG_STR)

        with pytest.raises(ValueError):
            si = builder.stringIn("STRIN2")
            si.set(OVERLONG_STR)

        with pytest.raises(ValueError):
            so = builder.stringOut("STROUT2", initial_value=OVERLONG_STR)
            so.set(OVERLONG_STR)
示例#5
0
    def __init__(self, ip):
        self.readData = builder.boolOut('readData',
                                        on_update=self.place_voltages,
                                        HIGH=0.1)
        self.on = builder.boolOut('on', on_update=self.turnOn, HIGH=0.1)
        self.off = builder.boolOut('off', on_update=self.turnOff, HIGH=0.1)
        self.avrgVolt = builder.aIn('avrgVolt')
        self.avrgTemp = builder.longIn('avrgTemp')
        self.avrgVoltInner = builder.aIn('avrgVoltInner')
        self.avrgVoltOuter = builder.aIn('avrgVoltOuter')
        self.marker = builder.longIn('marker')
        self.setVoltInner_pv = builder.aOut("setVoltInner",
                                            on_update=self.setVoltInner)
        self.setVoltOuter_pv = builder.aOut("setVoltOuter",
                                            on_update=self.setVoltOuter)
        self.write_voltages_pv = builder.boolOut("write_voltages",
                                                 on_update=self.write_voltages,
                                                 HIGH=0.1)
        self.datacsv = "data.csv"
        self.reset = builder.boolOut("reset", on_update=self.Reset, HIGH=0.1)
        self.adj_current_pv = builder.boolOut("adj_current",
                                              on_update=self.adj_current,
                                              HIGH=0.1)
        self.adj_msg = "Last done: "
        self.adj_stat_pv = builder.stringIn("adj_stat",
                                            initial_value=self.adj_msg +
                                            "none")

        self.chlist = []
        self.wboard, self.wch = 0, 0
        self.ip = ip
        self.dictWiener, self.dictTPC = {}, {}

        #snmp 5.8 for user defined precision in current readings, compiled according to
        # http://file.wiener-d.com/software/net-snmp/net-snmp-CompileForExtendedPrecision-2015-03-06.txt
        self.snmpwalk = "/usr/local/Net-SNMP_5-8/code/apps/snmpwalk"
        self.snmpset = "/usr/local/Net-SNMP_5-8/code/apps/snmpset -v 2c -c seCrET " + self.ip + " WIENER-CRATE-MIB::"

        file = open("file.txt", "w")
        file.write(
            "TPC sector \t TPC channel \t WIENER board \t WIENER channel \n")
        for self.i in xrange(1, 25):  # sector
            for self.j in xrange(2):  # channel
                a = '{0} \t\t {1} \t\t {2} \t\t {3} \n'.format(
                    self.i, self.j, self.wboard, self.wch)
                file.write(a)
                self.chlist.append(
                    Channel(self.i, self.j, self.wboard, self.wch,
                            self.snmpset))
                self.dictWiener[(self.wboard, self.wch)] = self.chlist[-1]
                self.dictTPC[(self.i, self.j)] = self.chlist[-1]
                self.wch += 1
                if (self.wch > 15):
                    self.wboard += 1
                    self.wch = 0
        file.close()
        print "Before start, you have to Load Voltage from file through Load Voltage button "
示例#6
0
 def __init__(self):
     print "Initializing the current calibration"
     self.caen_imon_val = []
     self.caen_imadj_val = []
     for ibd in xrange(0, 16, 2):
         for ich in xrange(24):
             pvnam = "SY4527:{0:02d}:{1:03d}:".format(ibd, ich)
             self.caen_imon_val.append(pvnam + "IMon.VAL")
             self.caen_imadj_val.append(pvnam + "ImAdj.VAL")
     self.run_calib_pv = boolOut("run_calib",
                                 on_update=self.run_calib,
                                 HIGH=0.1)
     self.msg = "Last done: "
     self.calib_stat_pv = stringIn("calib_stat",
                                   initial_value=self.msg + "none")
示例#7
0
    def __init__(self, config):

        #name for the pvs
        host = config["host"].strip()
        ioc = config["ioc"].strip()
        pvnam = host + ":" + ioc

        #status pv
        self.pv_stat = builder.mbbIn(pvnam + ":status", ("OK", 0),
                                     ("NOT_RUNNING", 1),
                                     ("MULTIPLE_INSTANCES", 2),
                                     ("DISCONNECTED", 3), ("UNDEFINED", 4))

        #description pv
        desc = config["description"].strip(" \"'")
        self.pv_desc = builder.stringIn(pvnam + ":description",
                                        initial_value=desc)
rc4 = records.calc('FDBK4:AUTOCALC', CALC=A)

##############################################

builder.SetDeviceName('SR-DI-DCCT-01')

x1SRcurr = builder.aOut('SIGNAL', initial_value=10)

##############################################

builder.SetDeviceName('FE04I-PS-SHTR-02')

x1FEss = builder.mbbOut('STA', initial_value=1)  # front end shutter status

##############################################

builder.SetDeviceName('BL04I-PS-SHTR-01')

x1BLss = builder.mbbOut('STA', initial_value=1)

# Create the identity PVs

builder.stringIn('WHOAMI', VAL='XBPM feedback controller')
builder.stringIn('HOSTNAME', VAL=os.uname()[1])

builder.LoadDatabase()
softioc.iocInit()

softioc.interactive_ioc(globals())
sys.exit()
示例#9
0
import logging

from pkg_resources import require
require('cothread==2.13')
require('epicsdbbuilder==1.0')
require("numpy")

from softioc import softioc, builder

import PIController
import PIStepScan

if __name__ == '__main__':
    # Prepare params for IOC
    builder.SetDeviceName("BL13J-MO-PI-01:SCAN")
    builder.stringIn('WHOAMI', VAL='PI scan controller')
    builder.stringIn('HOSTNAME', VAL=os.uname()[1])

    logging.basicConfig(level=logging.DEBUG)

    # Connect to PI controller
    # Terminal server
    # pi_controller = PIController("172.23.82.5", 4011)
    # Ethernet
    #pi_controller = PIController.PIController("172.23.82.249", 50000, debug=False)
    pi_controller = PIController.PIController("Fake address 01", 50000,
                                              debug=True)

    # Step scan logic and records
    pi_step_scan = PIStepScan.PIStepScan(pi_controller)
    # Create our records