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)
Ejemplo n.º 2
0
def test_pini_always_on():
    """Test that PINI is always on for in records regardless of initial_value"""
    bi = builder.boolIn("AAA")
    assert bi.PINI.Value() == "YES"

    mbbi = builder.mbbIn("BBB", initial_value=5)
    assert mbbi.PINI.Value() == "YES"
Ejemplo n.º 3
0
 def __init__(self, machine, name):
     builder.SetDeviceName(name)
     self.com = ModbusClient(host=machine, port=4000, auto_open=True)  #4000
     self.com.mode(constants.MODBUS_RTU)
     stat = self.com.open()
     self.pv_stat = builder.aIn("stat")
     self.pv_stat.PREC = 1
     self.pv_stat.LOPR = 0
     self.pv_stat.HOPR = 100
     self.pv_temp = builder.aIn("temp")
     self.pv_temp.PREC = 1
     self.pv_temp.LOPR = 0
     self.pv_temp.HOPR = 100
     self.pv_humi = builder.aIn("humidity")
     self.pv_humi.PREC = 1
     self.pv_humi.LOPR = 0
     self.pv_humi.HOPR = 100
     self.pv_humi.HSV = "MINOR"
     self.pv_humi.HHSV = "MAJOR"
     self.pv_humi.HIGH = 45
     self.pv_humi.HIHI = 50
     self.pv_flow = builder.aIn("flow")
     self.pv_flow.PREC = 0
     self.pv_flow.LOPR = 0
     self.pv_flow.HOPR = 600
     self.pv_flow.LOLO = 250
     self.pv_flow.LOW = 300
     self.pv_flow.HIGH = 480
     self.pv_flow.HIHI = 520
     self.pv_flow.LSV = "MINOR"
     self.pv_flow.LLSV = "MAJOR"
     self.pv_flow.HSV = "MINOR"
     self.pv_flow.HHSV = "MAJOR"
     self.stat_pv = builder.boolIn("status",
                                   ZNAM="off",
                                   ONAM="on",
                                   DESC=name)
     self.stat_pv.ZSV = "MAJOR"
     self.pv_on = builder.boolOut("on",
                                  ZNAM="0",
                                  ONAM="1",
                                  HIGH=0.1,
                                  on_update=self.turnOn)
     self.pv_off = builder.boolOut("off",
                                   ZNAM="0",
                                   ONAM="1",
                                   HIGH=0.1,
                                   on_update=self.turnOff)
     self.busy = False
     self.pv_act = builder.boolOut("activity", ZNAM="0", ONAM="1", HIGH=1)
     self.pv_was_on = builder.boolOut("was_on",
                                      ZNAM="0",
                                      ONAM="1",
                                      HIGH=1.5)
     self.pv_was_off = builder.boolOut("was_off",
                                       ZNAM="0",
                                       ONAM="1",
                                       HIGH=1.5)
     self.id_temp = 0
     self.id_stat = 1
Ejemplo n.º 4
0
 def __init__(self, boardList):
     self.boardList = boardList
     self.placevalues = builder.boolOut("PPHVplacevalues",
                                        ZNAM=0,
                                        ONAM=1,
                                        HIGH=0.1,
                                        on_update=self.place_voltages)
     self.turnvoltageoff = builder.boolOut("turnoffPPHV",
                                           ZNAM=0,
                                           ONAM=1,
                                           HIGH=0.1,
                                           on_update=self.turnoff_PPHV)
     self.indicator = builder.boolIn("indicator", ZNAM=0, ONAM=1)
Ejemplo n.º 5
0
 def __init__(self, port):
   #telnet communication to lecroy
   self.com = lecroy_com(port)
   #number of boards and channels per board
   self.nbd = 1
   self.nchan = 8
   #offset in board numbering
   self.bdofs = 12
   #list of board objects
   self.bdlist = []
   for ibd in range(self.nbd):
     self.bdlist.append(board(ibd, self.nchan, self.bdofs, self.com))
   #configuration file
   self.confnam = "config.csv"
   self.cframe = pandas.read_csv(self.confnam)
   #watchdog timer with 10 sec timeout
   self.wdt = watchdog(10, self.bdlist)
   self.wdt.start()
   #mainframe PVs
   self.hvstat_pv = builder.boolIn("hvstat", ZNAM="OFF", ONAM="ON")
   self.hvon_pv = builder.boolOut("hvon", ZNAM=0, ONAM=1, HIGH=0.1, initial_value=0, on_update=self.do_on)
   self.hvoff_pv = builder.boolOut("hvoff", ZNAM=0, ONAM=1, HIGH=0.1, initial_value=0, on_update=self.do_off)
   self.link_pv = builder.boolOut("link", ZNAM=0, ONAM=1, HIGH=0.7, initial_value=0)
Ejemplo n.º 6
0
import time
import threading

import epics
from softioc import builder
from webmon import run_webmon

#local PVs
builder.SetDeviceName("tpc_caen_monit")
#trip indicator
trip_pv = builder.boolIn("is_trip", ZNAM=0, ONAM=1)
#anode sum current, inner and outer
sum_curr_in_pv = builder.aIn("sum_curr_in")
sum_curr_out_pv = builder.aIn("sum_curr_out")

#status of tripped channel
tripstat = 512

#voltage and current values, status value
npv=192
valV = [0. for i in range(npv)]
valI = [0. for i in range(npv)]
valS = [0 for i in range(npv)]

#sector and channel numbers
numSec = [None]*npv
numCh = [None]*npv
#dictionary from PV board and chan to array index
pdict = {}
#inner/outer channels, 0 = inner, 1 = outer