use the INSTR environment variable instead of PREFIX

This commit is contained in:
2025-04-29 15:58:32 +02:00
parent d4b111ce6d
commit d81105551d
13 changed files with 202 additions and 184 deletions

View File

@ -1,7 +1,8 @@
Counterbox Epics Module SINQDAQ Epics Module
----------------------- -----------------------
A Stream and Asyn based driver for configuring the Counterboxes at SINQ. A Stream and Asyn based driver for configuring the Data Acquisition Systems at
SINQ.
This supports the older 4 and 8 channel EL737 models and the new 10CH 2nd This supports the older 4 and 8 channel EL737 models and the new 10CH 2nd
generation systems. generation systems.
@ -15,7 +16,7 @@ Required Variables
| Environment Variable | Purpose | | Environment Variable | Purpose |
|----------------------|-----------------------------------------| |----------------------|-----------------------------------------|
| PREFIX | Prefix of all device specific PVs | | INSTR | Prefix of all device specific PVs |
| NAME | First field in all PVs after Prefix | | NAME | First field in all PVs after Prefix |
| CNTBOX\_IP | Network IP of device | | CNTBOX\_IP | Network IP of device |
| CNTBOX\_PORT | Network Port of device | | CNTBOX\_PORT | Network Port of device |
@ -23,7 +24,7 @@ Required Variables
All PVs take the form All PVs take the form
``` ```
$(PREFIX):$(NAME):* $(INSTR)$(NAME):*
``` ```
Available device startup scripts Available device startup scripts
@ -35,25 +36,25 @@ Available device startup scripts
A device can be configured using one of the startup scripts as follows A device can be configured using one of the startup scripts as follows
``` ```
epicsEnvSet("PREFIX", "SQ:INSTRUMENT") # can also be set in runScript call epicsEnvSet("INSTR", "SQ:INSTRUMENT:") # can also be set in runScript call
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestInst-DAQ1, CNTBOX_PORT=2000" runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestInst-DAQ1, CNTBOX_PORT=2000"
``` ```
## PVs of Interest ## PVs of Interest
| PV | Description | | PV | Description |
|---------------------------------------|----------------------------------------------------------------------| |-------------------------------------|----------------------------------------------------------------------|
| \$(PREFIX):\$(NAME):MsgTxt | Contains unexpected response to executed command | | \$(INSTR)\$(NAME):MsgTxt | Contains unexpected response to executed command |
| \$(PREFIX):\$(NAME):STATUS | 0: Idle, 1: Counting, 2: Low rate, 3: Paused, 4: Error | | \$(INSTR)\$(NAME):STATUS | 0: Idle, 1: Counting, 2: Low rate, 3: Paused, 4: Error |
| \$(PREFIX):\$(NAME):MONITOR-CHANNEL | Channel that PRESET-COUNT monitors (has RBV, only v2 can be changed) | | \$(INSTR)\$(NAME):MONITOR-CHANNEL | Channel that PRESET-COUNT monitors (has RBV, only v2 can be changed) |
| \$(PREFIX):\$(NAME):PRESET-COUNT | Run count until specified pv value reached | | \$(INSTR)\$(NAME):PRESET-COUNT | Run count until specified pv value reached |
| \$(PREFIX):\$(NAME):PRESET-TIME | Run count until specified pv value in seconds reached | | \$(INSTR)\$(NAME):PRESET-TIME | Run count until specified pv value in seconds reached |
| \$(PREFIX):\$(NAME):THRESHOLD | Minimum rate for counting to preceed. (has RBV) | | \$(INSTR)\$(NAME):THRESHOLD | Minimum rate for counting to preceed. (has RBV) |
| \$(PREFIX):\$(NAME):THRESHOLD-MONITOR | Channel monitored for minimum rate (has RBV) | | \$(INSTR)\$(NAME):THRESHOLD-MONITOR | Channel monitored for minimum rate (has RBV) |
| \$(PREFIX):\$(NAME):ELAPSED-TIME | Time Counterbox has been measuring for | | \$(INSTR)\$(NAME):ELAPSED-TIME | Time Counterbox has been measuring for |
| \$(PREFIX):\$(NAME):M_ | Current count on channel. (1-10 depending on box) | | \$(INSTR)\$(NAME):M_ | Current count on channel. (1-10 depending on box) |
| \$(PREFIX):\$(NAME):CHANNELS | Number of available channels (4, 8 or 10) | | \$(INSTR)\$(NAME):CHANNELS | Number of available channels (4, 8 or 10) |
## Generating Test Signals ## Generating Test Signals

View File

@ -1,9 +1,11 @@
# EL737 EPICS Database for streamdevice support # EPICS Database for streamdevice specific to measurement channels
#
# Macros # Macros
# P - Prefix # INSTR - Prefix
# NAME - just a name, e.g. EL737 # NAME - the device name, e.g. EL737
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to EL737 # ASYN_PORT - Low level Asyn IP Port to Counterbox
# CHANNEL - the number associated with the measurment channel
################################################################################ ################################################################################
# Status Variables # Status Variables
@ -11,25 +13,25 @@
################################################################################ ################################################################################
# Count Commands # Count Commands
record(bo, "$(P):$(NAME):C$(CHANNEL)") record(bo, "$(INSTR)$(NAME):C$(CHANNEL)")
{ {
field(DESC, "Clear the current channel count") field(DESC, "Clear the current channel count")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) clearChannel($(P):$(NAME):, $(CHANNEL)) $(ASYN_PORT)") field(OUT, "@$(PROTO) clearChannel($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
} }
################################################################################ ################################################################################
# Read all monitors values # Read all monitors values
record(longin, "$(P):$(NAME):M$(CHANNEL)") record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
{ {
field(DESC, "Counterbox CH$(CHANNEL)") field(DESC, "Counterbox CH$(CHANNEL)")
} }
record(ai, "$(P):$(NAME):R$(CHANNEL)") record(ai, "$(INSTR)$(NAME):R$(CHANNEL)")
{ {
field(DESC, "Counterbox Rate CH$(CHANNEL)") field(DESC, "Counterbox Rate CH$(CHANNEL)")
field(INP, "@$(PROTO) readRate($(P):$(NAME):, $(CHANNEL)) $(ASYN_PORT)") field(INP, "@$(PROTO) readRate($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
field(SCAN, "1 second") field(SCAN, "1 second")
} }

View File

@ -1,14 +1,15 @@
# Counterbox EPICS Database # EPICS Database for streamdevice support 1st gen systems with 4 channels
#
# Macros # Macros
# P - Prefix # INSTR - Prefix
# NAME - just a name, e.g. EL737 # NAME - the device name, e.g. EL737
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to EL737 # ASYN_PORT - Low level Asyn IP Port to Counterbox
################################################################################ ################################################################################
# Status Variables # Status Variables
record(longout, "$(P):$(NAME):MONITOR-CHANNEL") record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(VAL, 1) field(VAL, 1)
@ -17,7 +18,7 @@ record(longout, "$(P):$(NAME):MONITOR-CHANNEL")
field(DISP, 1) field(DISP, 1)
} }
record(longin, "$(P):$(NAME):MONITOR-CHANNEL_RBV") record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(VAL, 1) field(VAL, 1)

View File

@ -1,14 +1,15 @@
# EL737 EPICS Database for streamdevice support # EPICS Database for streamdevice support 1st gen systems with 8 channels
#
# Macros # Macros
# P - Prefix # INSTR - Prefix
# NAME - just a name, e.g. EL737 # NAME - the device name, e.g. EL737
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to EL737 # ASYN_PORT - Low level Asyn IP Port to Counterbox
################################################################################ ################################################################################
# Status Variables # Status Variables
record(longout, "$(P):$(NAME):MONITOR-CHANNEL") record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(VAL, 1) field(VAL, 1)
@ -17,7 +18,7 @@ record(longout, "$(P):$(NAME):MONITOR-CHANNEL")
field(DISP, 1) field(DISP, 1)
} }
record(longin, "$(P):$(NAME):MONITOR-CHANNEL_RBV") record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(VAL, 1) field(VAL, 1)

View File

@ -1,82 +1,83 @@
# EL737 EPICS Database for streamdevice support # EPICS Database for streamdevice support with SinqDAQ Systems
#
# Macros # Macros
# P - Prefix # INSTR - Prefix
# NAME - just a name, e.g. EL737 # NAME - the device name, e.g. EL737
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to EL737 # ASYN_PORT - Low level Asyn IP Port to EL737
# Send initial initialisation commands # Send initial initialisation commands
record(bo, "$(P):$(NAME):INIT-CONF") record(bo, "$(INSTR)$(NAME):INIT-CONF")
{ {
field(DESC, "Initialises the Counterbox") field(DESC, "Initialises the Counterbox")
field(OUT, "@$(PROTO) initialise($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) initialise($(INSTR)$(NAME):) $(ASYN_PORT)")
field(PINI, "YES") # Run at init field(PINI, "YES") # Run at init
field(DTYP, "stream") field(DTYP, "stream")
} }
record(longout, "$(P):$(NAME):FULL-RESET") record(longout, "$(INSTR)$(NAME):FULL-RESET")
{ {
field(DESC, "Reset the Counterbox") field(DESC, "Reset the Counterbox")
field(OUT, "@$(PROTO) fullReset($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) fullReset($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
} }
################################################################################ ################################################################################
# Status Variables # Status Variables
record(stringin, "$(P):$(NAME):MsgTxt") record(stringin, "$(INSTR)$(NAME):MsgTxt")
{ {
field(DESC, "Unexpected received response") field(DESC, "Unexpected received response")
field(DTYP, "devCounterBoxStringError") field(DTYP, "devCounterBoxStringError")
field(FLNK, "$(P):$(NAME):INVALID-CONFIG") field(FLNK, "$(INSTR)$(NAME):INVALID-CONFIG")
} }
# We want to recognise the invalid config error message, so that we can rerun # We want to recognise the invalid config error message, so that we can rerun
# the init if it occurs. This should only happen after turning the box off and # the init if it occurs. This should only happen after turning the box off and
# on again or running a full reset # on again or running a full reset
record(scalcout, "$(P):$(NAME):INVALID-CONFIG") record(scalcout, "$(INSTR)$(NAME):INVALID-CONFIG")
{ {
field(DESC, "Has the counterbox been configured?") field(DESC, "Has the counterbox been configured?")
field(CALC, "AA[0,2] == '?OF'") field(CALC, "AA[0,2] == '?OF'")
field(INAA, "$(P):$(NAME):MsgTxt") field(INAA, "$(INSTR)$(NAME):MsgTxt")
field(FLNK, "$(P):$(NAME):REINIT-CONF") field(FLNK, "$(INSTR)$(NAME):REINIT-CONF")
} }
record(seq, "$(P):$(NAME):REINIT-CONF") record(seq, "$(INSTR)$(NAME):REINIT-CONF")
{ {
field(LNK1, "$(P):$(NAME):INIT-CONF PP") field(LNK1, "$(INSTR)$(NAME):INIT-CONF PP")
field(DO1, 1) field(DO1, 1)
field(SELM, "Specified") field(SELM, "Specified")
field(SELL, "$(P):$(NAME):INVALID-CONFIG.VAL") field(SELL, "$(INSTR)$(NAME):INVALID-CONFIG.VAL")
} }
# Important! The "$(P):$(NAME):READALL" isn't configure with a SCAN. Instead, # Important! The "$(INSTR)$(NAME):READALL" isn't configure with a SCAN. Instead,
# it must always be triggered after the value of $(P):$(NAME):RAW-STATUS is # it must always be triggered after the value of $(INSTR)$(NAME):RAW-STATUS is
# updated, so that it can't be the case that the status changes back from # updated, so that it can't be the case that the status changes back from
# counting to idle, without having updated the time and count values. # counting to idle, without having updated the time and count values.
record(longin, "$(P):$(NAME):RAW-STATUS") record(longin, "$(INSTR)$(NAME):RAW-STATUS")
{ {
field(DESC, "Raw returned status value") field(DESC, "Raw returned status value")
field(DTYP, "stream") field(DTYP, "stream")
field(SCAN, ".5 second") field(SCAN, ".5 second")
field(INP, "@$(PROTO) readStatus($(P):$(NAME):) $(ASYN_PORT)") field(INP, "@$(PROTO) readStatus($(INSTR)$(NAME):) $(ASYN_PORT)")
field(FLNK, "$(P):$(NAME):READALL") field(FLNK, "$(INSTR)$(NAME):READALL")
} }
record(calc, "$(P):$(NAME):MAP-STATUS") record(calc, "$(INSTR)$(NAME):MAP-STATUS")
{ {
field(DESC, "Maps Raw Status to State") field(DESC, "Maps Raw Status to State")
field(INPA, "$(P):$(NAME):RAW-STATUS NPP") field(INPA, "$(INSTR)$(NAME):RAW-STATUS NPP")
field(INPB, "$(P):$(NAME):INVALID-CONFIG NPP") field(INPB, "$(INSTR)$(NAME):INVALID-CONFIG NPP")
field(INPC, "$(P):$(NAME):RAW-STATUS.UDF NPP") # should also be invalid if can't read the status field(INPC, "$(INSTR)$(NAME):RAW-STATUS.UDF NPP") # should also be invalid if can't read the status
field(CALC, "(B=1||C==1)?4:A=0?0:(A=1||A=2)?1:(A=5||A=6)?2:(A=9||A=13||A=10||A=14)?3:4") field(CALC, "(B=1||C==1)?4:A=0?0:(A=1||A=2)?1:(A=5||A=6)?2:(A=9||A=13||A=10||A=14)?3:4")
field(FLNK, "$(P):$(NAME):STATUS") field(FLNK, "$(INSTR)$(NAME):STATUS")
} }
record(mbbi, "$(P):$(NAME):STATUS") record(mbbi, "$(INSTR)$(NAME):STATUS")
{ {
field(DESC, "Counterbox Status") field(DESC, "Counterbox Status")
field(INP, "$(P):$(NAME):MAP-STATUS NPP") field(INP, "$(INSTR)$(NAME):MAP-STATUS NPP")
field(ZRVL, "0") field(ZRVL, "0")
field(ZRST, "Idle") field(ZRST, "Idle")
field(ONVL, "1") field(ONVL, "1")
@ -90,7 +91,7 @@ record(mbbi, "$(P):$(NAME):STATUS")
field(FRST, "INVALID") field(FRST, "INVALID")
} }
record(longin, "$(P):$(NAME):CHANNELS") record(longin, "$(INSTR)$(NAME):CHANNELS")
{ {
field(DESC, "Total Supported Channels") field(DESC, "Total Supported Channels")
field(VAL, $(CHANNELS)) field(VAL, $(CHANNELS))
@ -101,54 +102,54 @@ record(longin, "$(P):$(NAME):CHANNELS")
################################################################################ ################################################################################
# Count Commands # Count Commands
record(ao,"$(P):$(NAME):PRESET-COUNT") record(ao,"$(INSTR)$(NAME):PRESET-COUNT")
{ {
field(DESC, "Count until preset reached") field(DESC, "Count until preset reached")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) startWithCountPreset$(CHANNELS)($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) startWithCountPreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, 0) field(VAL, 0)
field(PREC, 2) field(PREC, 2)
field(FLNK, "$(P):$(NAME):RAW-STATUS") field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
} }
record(ao,"$(P):$(NAME):PRESET-TIME") record(ao,"$(INSTR)$(NAME):PRESET-TIME")
{ {
field(DESC, "Count for specified time") field(DESC, "Count for specified time")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) startWithTimePreset$(CHANNELS)($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) startWithTimePreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, 0) field(VAL, 0)
field(PREC, 2) field(PREC, 2)
field(EGU, "seconds") field(EGU, "seconds")
field(FLNK, "$(P):$(NAME):RAW-STATUS") field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
} }
record(bo,"$(P):$(NAME):PAUSE") record(bo,"$(INSTR)$(NAME):PAUSE")
{ {
field(DESC, "Pause the current count") field(DESC, "Pause the current count")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) pauseCount($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) pauseCount($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, "0") field(VAL, "0")
field(FLNK, "$(P):$(NAME):RAW-STATUS") field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
} }
record(bo,"$(P):$(NAME):CONTINUE") record(bo,"$(INSTR)$(NAME):CONTINUE")
{ {
field(DESC, "Continue with a count that was paused") field(DESC, "Continue with a count that was paused")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) continueCount($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) continueCount($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, "0") field(VAL, "0")
field(FLNK, "$(P):$(NAME):RAW-STATUS") field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
} }
record(bo, "$(P):$(NAME):STOP") record(bo, "$(INSTR)$(NAME):STOP")
{ {
field(DESC, "Stop the current counting operation") field(DESC, "Stop the current counting operation")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) stopCount($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) stopCount($(INSTR)$(NAME):) $(ASYN_PORT)")
field(FLNK, "$(P):$(NAME):RAW-STATUS") field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
} }
record(ao,"$(P):$(NAME):THRESHOLD") record(ao,"$(INSTR)$(NAME):THRESHOLD")
{ {
field(DESC, "Minimum rate for counting to proceed") field(DESC, "Minimum rate for counting to proceed")
field(VAL, "0") # Rate field(VAL, "0") # Rate
@ -156,55 +157,55 @@ record(ao,"$(P):$(NAME):THRESHOLD")
field(DRVH, "100000") # Maximum Rate field(DRVH, "100000") # Maximum Rate
field(OMSL, "supervisory") field(OMSL, "supervisory")
field(OROC, "0") field(OROC, "0")
field(OUT, "@$(PROTO) setMinRate($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) setMinRate($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
} }
record(ai,"$(P):$(NAME):THRESHOLD_RBV") record(ai,"$(INSTR)$(NAME):THRESHOLD_RBV")
{ {
field(DESC, "Minimum rate for counting to proceed") field(DESC, "Minimum rate for counting to proceed")
field(INP, "@$(PROTO) readMinRate($(P):$(NAME):) $(ASYN_PORT)") field(INP, "@$(PROTO) readMinRate($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
field(SCAN, "1 second") field(SCAN, "1 second")
} }
record(longout,"$(P):$(NAME):THRESHOLD-MONITOR") record(longout,"$(INSTR)$(NAME):THRESHOLD-MONITOR")
{ {
field(DESC, "Channel monitored for minimum rate") field(DESC, "Channel monitored for minimum rate")
field(VAL, "1") # Monitor field(VAL, "1") # Monitor
field(DRVL, "0") # Smallest Threshold Channel (0 is off) field(DRVL, "0") # Smallest Threshold Channel (0 is off)
field(DRVH, "$(CHANNELS)") # Largest Threshold Channel field(DRVH, "$(CHANNELS)") # Largest Threshold Channel
field(OUT, "@$(PROTO) setRateMonitor($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) setRateMonitor($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
} }
record(longin,"$(P):$(NAME):THRESHOLD-MONITOR_RBV") record(longin,"$(INSTR)$(NAME):THRESHOLD-MONITOR_RBV")
{ {
field(DESC, "Channel monitored for minimum rate") field(DESC, "Channel monitored for minimum rate")
field(INP, "@$(PROTO) readRateMonitor($(P):$(NAME):) $(ASYN_PORT)") field(INP, "@$(PROTO) readRateMonitor($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
field(SCAN, "1 second") field(SCAN, "1 second")
} }
record(bo, "$(P):$(NAME):CT") record(bo, "$(INSTR)$(NAME):CT")
{ {
field(DESC, "Clear the timer") field(DESC, "Clear the timer")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) clearTimer($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) clearTimer($(INSTR)$(NAME):) $(ASYN_PORT)")
} }
################################################################################ ################################################################################
# Read all monitors values # Read all monitors values
record(ai, "$(P):$(NAME):READALL") record(ai, "$(INSTR)$(NAME):READALL")
{ {
field(DESC, "Reads monitors and elapsed time") field(DESC, "Reads monitors and elapsed time")
field(INP, "@$(PROTO) readAll$(CHANNELS)($(P):$(NAME):) $(ASYN_PORT)") field(INP, "@$(PROTO) readAll$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)")
field(DTYP, "stream") field(DTYP, "stream")
field(FLNK, "$(P):$(NAME):MAP-STATUS") field(FLNK, "$(INSTR)$(NAME):MAP-STATUS")
} }
record(ai,"$(P):$(NAME):ELAPSED-TIME") record(ai,"$(INSTR)$(NAME):ELAPSED-TIME")
{ {
field(DESC, "Counterbox Measured Time") field(DESC, "Counterbox Measured Time")
field(EGU, "seconds") field(EGU, "seconds")

View File

@ -1,26 +1,27 @@
# Sinq Counterbox EPICS Database for StreamDevice Communication with Simulation # Sinq Counterbox EPICS Database for StreamDevice Communication with Simulation
# Macros # Macros
# P - Prefix #
# INSTR - Prefix
# NAME - just a name, e.g. EL737 # NAME - just a name, e.g. EL737
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to EL737 # ASYN_PORT - Low level Asyn IP Port to EL737
################################################################################ ################################################################################
record(bo, "$(P):$(NAME):G1") record(bo, "$(INSTR)$(NAME):G1")
{ {
field(DESC, "Set Gate 1 Low/High") field(DESC, "Set Gate 1 Low/High")
field(ZNAM, "Low") field(ZNAM, "Low")
field(ONAM, "High") field(ONAM, "High")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGate($(P):$(NAME):, 1) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGate($(INSTR)$(NAME):, 1) $(ASYN_PORT)")
} }
record(bo, "$(P):$(NAME):G2") record(bo, "$(INSTR)$(NAME):G2")
{ {
field(DESC, "Set Gate 2 Low/High") field(DESC, "Set Gate 2 Low/High")
field(ZNAM, "Low") field(ZNAM, "Low")
field(ONAM, "High") field(ONAM, "High")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGate($(P):$(NAME):, 2) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGate($(INSTR)$(NAME):, 2) $(ASYN_PORT)")
} }

View File

@ -1,28 +1,30 @@
# EL737 EPICS Database for streamdevice support # EPICS Database for streamdevice support for functionality specific to the 2nd
# Generation Systems
#
# Macros # Macros
# P - Prefix # INSTR - Prefix
# NAME - just a name, e.g. DAQV2 # NAME - the device name, e.g. DAQV2
# PROTO - Stream device protocol file # PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to Counterbox # ASYN_PORT - Low level Asyn IP Port to Counterbox
################################################################################ ################################################################################
# Status Variables # Status Variables
record(longout, "$(P):$(NAME):MONITOR-CHANNEL") record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(DRVL, "1") # Smallest Monitor Channel field(DRVL, "1") # Smallest Monitor Channel
field(DRVH, "$(CHANNELS)") # Largest Monitor Channel field(DRVH, "$(CHANNELS)") # Largest Monitor Channel
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) writePresetMonitor($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) writePresetMonitor($(INSTR)$(NAME):) $(ASYN_PORT)")
field(FLNK, "$(P):$(NAME):MONITOR-CHANNEL_RBV") field(FLNK, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
} }
record(longin, "$(P):$(NAME):MONITOR-CHANNEL_RBV") record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
{ {
field(DESC, "PRESET-COUNT Monitors this channel") field(DESC, "PRESET-COUNT Monitors this channel")
field(DTYP, "stream") field(DTYP, "stream")
field(INP, "@$(PROTO) readPresetMonitor($(P):$(NAME):) $(ASYN_PORT)") field(INP, "@$(PROTO) readPresetMonitor($(INSTR)$(NAME):) $(ASYN_PORT)")
field(SCAN, "5 second") field(SCAN, "5 second")
} }
@ -35,70 +37,70 @@ record(longin, "$(P):$(NAME):MONITOR-CHANNEL_RBV")
################################################################################ ################################################################################
# Gating Settings # Gating Settings
record(bo, "$(P):$(NAME):GATE-1") record(bo, "$(INSTR)$(NAME):GATE-1")
{ {
field(DESC, "First Gating Channel") field(DESC, "First Gating Channel")
field(ZNAM, "Disabled") field(ZNAM, "Disabled")
field(ONAM, "Enabled") field(ONAM, "Enabled")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGateStatus($(P):$(NAME):, 1) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGateStatus($(INSTR)$(NAME):, 1) $(ASYN_PORT)")
} }
record(bo, "$(P):$(NAME):GATE-ON-1") record(bo, "$(INSTR)$(NAME):GATE-ON-1")
{ {
field(DESC, "Count when first Gate high/low") field(DESC, "Count when first Gate high/low")
field(ZNAM, "Low") field(ZNAM, "Low")
field(ONAM, "High") field(ONAM, "High")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGateStatus($(P):$(NAME):, 1) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGateStatus($(INSTR)$(NAME):, 1) $(ASYN_PORT)")
} }
record(bi, "$(P):$(NAME):GATE-1_RBV") record(bi, "$(INSTR)$(NAME):GATE-1_RBV")
{ {
field(DESC, "First Gating Channel") field(DESC, "First Gating Channel")
field(ZNAM, "Disabled") field(ZNAM, "Disabled")
field(ONAM, "Enabled") field(ONAM, "Enabled")
field(DTYP, "stream") field(DTYP, "stream")
field(INP, "@$(PROTO) getGateStatus($(P):$(NAME):, 1) $(ASYN_PORT)") field(INP, "@$(PROTO) getGateStatus($(INSTR)$(NAME):, 1) $(ASYN_PORT)")
field(SCAN, "2 second") field(SCAN, "2 second")
} }
record(bi, "$(P):$(NAME):GATE-ON-1_RBV") record(bi, "$(INSTR)$(NAME):GATE-ON-1_RBV")
{ {
field(DESC, "Count when first Gate high/low") field(DESC, "Count when first Gate high/low")
field(ZNAM, "Low") field(ZNAM, "Low")
field(ONAM, "High") field(ONAM, "High")
} }
record(bo, "$(P):$(NAME):GATE-2") record(bo, "$(INSTR)$(NAME):GATE-2")
{ {
field(DESC, "First Gating Channel") field(DESC, "First Gating Channel")
field(ZNAM, "Disabled") field(ZNAM, "Disabled")
field(ONAM, "Enabled") field(ONAM, "Enabled")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGateStatus($(P):$(NAME):, 2) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGateStatus($(INSTR)$(NAME):, 2) $(ASYN_PORT)")
} }
record(bo, "$(P):$(NAME):GATE-ON-2") record(bo, "$(INSTR)$(NAME):GATE-ON-2")
{ {
field(DESC, "Count when first Gate high/low") field(DESC, "Count when first Gate high/low")
field(ZNAM, "Low") field(ZNAM, "Low")
field(ONAM, "High") field(ONAM, "High")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setGateStatus($(P):$(NAME):, 2) $(ASYN_PORT)") field(OUT, "@$(PROTO) setGateStatus($(INSTR)$(NAME):, 2) $(ASYN_PORT)")
} }
record(bi, "$(P):$(NAME):GATE-2_RBV") record(bi, "$(INSTR)$(NAME):GATE-2_RBV")
{ {
field(DESC, "Second Gating Channel") field(DESC, "Second Gating Channel")
field(ZNAM, "Disabled") field(ZNAM, "Disabled")
field(ONAM, "Enabled") field(ONAM, "Enabled")
field(DTYP, "stream") field(DTYP, "stream")
field(INP, "@$(PROTO) getGateStatus($(P):$(NAME):, 2) $(ASYN_PORT)") field(INP, "@$(PROTO) getGateStatus($(INSTR)$(NAME):, 2) $(ASYN_PORT)")
field(SCAN, "2 second") field(SCAN, "2 second")
} }
record(bi, "$(P):$(NAME):GATE-ON-2_RBV") record(bi, "$(INSTR)$(NAME):GATE-ON-2_RBV")
{ {
field(DESC, "Count when second Gate high/low") field(DESC, "Count when second Gate high/low")
field(ZNAM, "Low") field(ZNAM, "Low")

View File

@ -1,31 +1,40 @@
# EPICS Database for streamdevice support for testing functionality specific to
# the 2nd Generation Systems
#
# Macros
# INSTR - Prefix
# NAME - the device name, e.g. DAQV2
# PROTO - Stream device protocol file
# ASYN_PORT - Low level Asyn IP Port to Counterbox
################################################################################ ################################################################################
# Testing Commands # Testing Commands
# These won't match the values on the machine after a full restart But I chose # These won't match the values on the machine after a full restart But I chose
# not to force their intialisation as they are only important for testing # not to force their intialisation as they are only important for testing
record(bo, "$(P):$(NAME):TESTGEN") record(bo, "$(INSTR)$(NAME):TESTGEN")
{ {
field(DESC, "Turn on/off Testgen Signal") field(DESC, "Turn on/off Testgen Signal")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) switchTestgenOnOff($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) switchTestgenOnOff($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, 0) field(VAL, 0)
field(ZNAM, "OFF") field(ZNAM, "OFF")
field(ONAM, "ON") field(ONAM, "ON")
} }
record(longout, "$(P):$(NAME):TESTGEN-LOWRATE") record(longout, "$(INSTR)$(NAME):TESTGEN-LOWRATE")
{ {
field(DESC, "Set Minimum Testgen Rate") field(DESC, "Set Minimum Testgen Rate")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) setTestSignal($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, 1000) field(VAL, 1000)
} }
record(longout, "$(P):$(NAME):TESTGEN-HIGHRATE") record(longout, "$(INSTR)$(NAME):TESTGEN-HIGHRATE")
{ {
field(DESC, "Set Maximum Testgen Rate") field(DESC, "Set Maximum Testgen Rate")
field(DTYP, "stream") field(DTYP, "stream")
field(OUT, "@$(PROTO) setTestSignal($(P):$(NAME):) $(ASYN_PORT)") field(OUT, "@$(PROTO) setTestSignal($(INSTR)$(NAME):) $(ASYN_PORT)")
field(VAL, 1000) field(VAL, 1000)
} }

View File

@ -12,11 +12,11 @@ $(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto") epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0) drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=4") dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=4")
dbLoadRecords("$(counterbox_DB)counterbox_4ch.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") dbLoadRecords("$(counterbox_DB)counterbox_4ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
# Could also use substitions instead. # Could also use substitions instead.
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")

View File

@ -12,15 +12,15 @@ $(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto") epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0) drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=8") dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=8")
dbLoadRecords("$(counterbox_DB)counterbox_8ch.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") dbLoadRecords("$(counterbox_DB)counterbox_8ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
# Could also use substitions instead. # Could also use substitions instead.
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8")

View File

@ -12,21 +12,21 @@ $(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto") epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0) drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10") dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10")
dbLoadRecords("$(counterbox_DB)counterbox_v2.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10") dbLoadRecords("$(counterbox_DB)counterbox_v2.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10")
# Could also use substitions instead. # Could also use substitions instead.
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=9") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=9")
dbLoadRecords("$(counterbox_DB)channels.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=10") dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=10")
$(LOAD_TEST_PVS=#) $(LOAD_TEST_PVS) dbLoadRecords("$(counterbox_DB)counterbox_v2_test.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") $(LOAD_TEST_PVS=#) $(LOAD_TEST_PVS) dbLoadRecords("$(counterbox_DB)counterbox_v2_test.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
$(SET_SIM_MODE=#) $(SET_SIM_MODE) dbLoadRecords("$(counterbox_DB)counterbox_simcontrol.db", "P=$(PREFIX), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") $(SET_SIM_MODE=#) $(SET_SIM_MODE) dbLoadRecords("$(counterbox_DB)counterbox_simcontrol.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")

View File

@ -5,7 +5,7 @@ on error break
require counterbox require counterbox
epicsEnvSet("STREAM_PROTOCOL_PATH","./db") epicsEnvSet("STREAM_PROTOCOL_PATH","./db")
epicsEnvSet("PREFIX","SQ:TEST") epicsEnvSet("INSTR","SQ:TEST:")
epicsEnvSet("NAME","CB_TEST") epicsEnvSet("NAME","CB_TEST")
epicsEnvSet("SET_SIM_MODE","") # Run Counterbox Simulation Instead of Actual Box epicsEnvSet("SET_SIM_MODE","") # Run Counterbox Simulation Instead of Actual Box

View File

@ -40,53 +40,53 @@ def get_piped_output(proc):
return stdqueue, errqueue return stdqueue, errqueue
def getState(prefix, name): def getState(instr, name):
result = run(['caget', f'{prefix}:{name}:STATUS'], stdout=PIPE) result = run(['caget', f'{instr}{name}:STATUS'], stdout=PIPE)
state = result.stdout.decode('ascii').rstrip().split()[1] state = result.stdout.decode('ascii').rstrip().split()[1]
print(f'Currently in state {state}') print(f'Currently in state {state}')
return state return state
def getCount(prefix, name, ch): def getCount(instr, name, ch):
result = run(['caget', f'{prefix}:{name}:M{ch}'], stdout=PIPE) result = run(['caget', f'{instr}{name}:M{ch}'], stdout=PIPE)
count = int(result.stdout.decode('ascii').rstrip().split()[1]) count = int(result.stdout.decode('ascii').rstrip().split()[1])
print(f'M{ch} == {count}') print(f'M{ch} == {count}')
return count return count
def presetTime(prefix, name, time): def presetTime(instr, name, time):
print(f'Starting count for {time} seconds') print(f'Starting count for {time} seconds')
run(['caput', f'{prefix}:{name}:PRESET-TIME', f'{time}']) run(['caput', f'{instr}{name}:PRESET-TIME', f'{time}'])
def presetCount(prefix, name, count): def presetCount(instr, name, count):
print(f'Starting count until channel 1 reaches {count}') print(f'Starting count until channel 1 reaches {count}')
run(['caput', f'{prefix}:{name}:PRESET-COUNT', f'{count}']) run(['caput', f'{instr}{name}:PRESET-COUNT', f'{count}'])
def testCanCount(prefix, name): def testCanCount(instr, name):
# Check in Idle State # Check in Idle State
assert getState(prefix, name) == 'Idle', 'Not in valid state' assert getState(instr, name) == 'Idle', 'Not in valid state'
# Start Time Based Count and Check that Status Changes # Start Time Based Count and Check that Status Changes
assert getCount(prefix, name, 1) == 0, "Erroneous nonzero starting count value" assert getCount(instr, name, 1) == 0, "Erroneous nonzero starting count value"
presetTime(prefix, name, 5) presetTime(instr, name, 5)
time.sleep(1) time.sleep(1)
assert getState(prefix, name) == 'Counting', 'Didn\'t start counting' assert getState(instr, name) == 'Counting', 'Didn\'t start counting'
time.sleep(5) time.sleep(5)
assert getState(prefix, name) == 'Idle', 'Didn\'t finish counting' assert getState(instr, name) == 'Idle', 'Didn\'t finish counting'
assert getCount(prefix, name, 1) > 0, 'No events were counted' assert getCount(instr, name, 1) > 0, 'No events were counted'
# Start Monitor Based Count and Check that Status Changes # Start Monitor Based Count and Check that Status Changes
presetAmount = 100 presetAmount = 100
presetCount(prefix, name, presetAmount) presetCount(instr, name, presetAmount)
time.sleep(1) time.sleep(1)
assert getState(prefix, name) == 'Counting', 'Didn\'t start counting' assert getState(instr, name) == 'Counting', 'Didn\'t start counting'
assert getCount(prefix, name, 1) < presetAmount assert getCount(instr, name, 1) < presetAmount
while getState(prefix, name) != 'Idle': while getState(instr, name) != 'Idle':
time.sleep(1) time.sleep(1)
assert getCount(prefix, name, 1) == presetAmount, 'Counted events not equal to preset' assert getCount(instr, name, 1) == presetAmount, 'Counted events not equal to preset'
assert getCount(prefix, name, 2) > 0 assert getCount(instr, name, 2) > 0
def test(prefix, name): def test(instr, name):
# TODO pass prefix and name to script # TODO pass instr and name to script
proc = Popen([f'{os.environ["PARENT_PATH"]}/ioc.sh'], stdout=PIPE, stderr=PIPE, shell=False) proc = Popen([f'{os.environ["PARENT_PATH"]}/ioc.sh'], stdout=PIPE, stderr=PIPE, shell=False)
try: try:
@ -104,7 +104,7 @@ def test(prefix, name):
print("IOC Initialisation Complete") print("IOC Initialisation Complete")
print("Starting Tests") print("Starting Tests")
testCanCount(prefix, name) testCanCount(instr, name)
print("Success") print("Success")
proc.kill() proc.kill()
@ -123,7 +123,7 @@ if __name__ == '__main__':
print("Starting Test") print("Starting Test")
# Test V2 # Test V2
if test('SQ:TEST', 'CB_TEST'): if test('SQ:TEST:', 'CB_TEST'):
exit(0) exit(0)
else: else:
exit(1) exit(1)