rename from counterbox to daq
This commit is contained in:
28
Makefile
28
Makefile
@ -1,7 +1,7 @@
|
|||||||
# This build the sinq extensions for the PSI EPICS setup
|
# This build the sinq extensions for the PSI EPICS setup
|
||||||
include /ioc/tools/driver.makefile
|
include /ioc/tools/driver.makefile
|
||||||
|
|
||||||
MODULE=counterbox
|
MODULE=sinqDAQ
|
||||||
BUILDCLASSES=Linux
|
BUILDCLASSES=Linux
|
||||||
EPICS_VERSIONS=7.0.7
|
EPICS_VERSIONS=7.0.7
|
||||||
ARCH_FILTER=RHEL%
|
ARCH_FILTER=RHEL%
|
||||||
@ -13,26 +13,26 @@ REQUIRED+=stream
|
|||||||
|
|
||||||
# DB files to include in the release
|
# DB files to include in the release
|
||||||
TEMPLATES += db/channels.db
|
TEMPLATES += db/channels.db
|
||||||
TEMPLATES += db/counterbox_4ch.db
|
TEMPLATES += db/daq_4ch.db
|
||||||
TEMPLATES += db/counterbox_8ch.db
|
TEMPLATES += db/daq_8ch.db
|
||||||
TEMPLATES += db/counterbox_common.db
|
TEMPLATES += db/daq_common.db
|
||||||
TEMPLATES += db/counterbox_v2.db
|
TEMPLATES += db/daq_2nd_gen.db
|
||||||
TEMPLATES += db/counterbox_v2_test.db
|
TEMPLATES += db/daq_2nd_gen_test.db
|
||||||
TEMPLATES += db/counterbox.proto
|
TEMPLATES += db/daq.proto
|
||||||
|
|
||||||
# Just for simulation
|
# Just for simulation
|
||||||
TEMPLATES += db/counterbox_simcontrol.db
|
TEMPLATES += db/daq_simcontrol.db
|
||||||
|
|
||||||
# DBD files to include in the release
|
# DBD files to include in the release
|
||||||
DBDS += src/counterbox.dbd
|
DBDS += src/daq.dbd
|
||||||
|
|
||||||
# Source files to build
|
# Source files to build
|
||||||
SOURCES += src/counterbox.cpp
|
SOURCES += src/daq.cpp
|
||||||
|
|
||||||
SCRIPTS += scripts/counterbox_4ch.cmd
|
SCRIPTS += scripts/daq_4ch.cmd
|
||||||
SCRIPTS += scripts/counterbox_8ch.cmd
|
SCRIPTS += scripts/daq_8ch.cmd
|
||||||
SCRIPTS += scripts/counterbox_v2.cmd
|
SCRIPTS += scripts/daq_2nd_gen.cmd
|
||||||
SCRIPTS += sim/counterbox_sim.py
|
SCRIPTS += sim/daq_sim.py
|
||||||
|
|
||||||
CXXFLAGS += -std=c++17
|
CXXFLAGS += -std=c++17
|
||||||
USR_CFLAGS += -Wall -Wextra #-Werror
|
USR_CFLAGS += -Wall -Wextra #-Werror
|
||||||
|
37
README.md
37
README.md
@ -10,7 +10,8 @@ generation systems.
|
|||||||
## How to Use
|
## How to Use
|
||||||
|
|
||||||
Unless a custom database is needed, a device can be configure simply by setting
|
Unless a custom database is needed, a device can be configure simply by setting
|
||||||
the required environment variables when calling the correct counterbox script.
|
the required environment variables when calling the correct DAQ interface
|
||||||
|
script.
|
||||||
|
|
||||||
Required Variables
|
Required Variables
|
||||||
|
|
||||||
@ -18,8 +19,8 @@ Required Variables
|
|||||||
|----------------------|-----------------------------------------|
|
|----------------------|-----------------------------------------|
|
||||||
| INSTR | 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 |
|
| DAQ\_IP | Network IP of device |
|
||||||
| CNTBOX\_PORT | Network Port of device |
|
| DAQ\_PORT | Network Port of device |
|
||||||
|
|
||||||
All PVs take the form
|
All PVs take the form
|
||||||
|
|
||||||
@ -29,16 +30,16 @@ $(INSTR)$(NAME):*
|
|||||||
|
|
||||||
Available device startup scripts
|
Available device startup scripts
|
||||||
|
|
||||||
* scripts/counterbox\_4ch.cmd
|
* scripts/daq\_4ch.cmd
|
||||||
* scripts/counterbox\_8ch.cmd
|
* scripts/daq\_8ch.cmd
|
||||||
* scripts/counterbox\_v2.cmd
|
* scripts/daq\_2nd\_gen.cmd
|
||||||
|
|
||||||
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("INSTR", "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 "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "NAME=DAQ, DAQ_IP=TestInst-DAQ1, DAQ_PORT=2000"
|
||||||
```
|
```
|
||||||
|
|
||||||
## PVs of Interest
|
## PVs of Interest
|
||||||
@ -52,8 +53,8 @@ runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestI
|
|||||||
| \$(INSTR)\$(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 |
|
||||||
| \$(INSTR)\$(NAME):THRESHOLD | Minimum rate for counting to preceed. (has RBV) |
|
| \$(INSTR)\$(NAME):THRESHOLD | Minimum rate for counting to preceed. (has RBV) |
|
||||||
| \$(INSTR)\$(NAME):THRESHOLD-MONITOR | Channel monitored for minimum rate (has RBV) |
|
| \$(INSTR)\$(NAME):THRESHOLD-MONITOR | Channel monitored for minimum rate (has RBV) |
|
||||||
| \$(INSTR)\$(NAME):ELAPSED-TIME | Time Counterbox has been measuring for |
|
| \$(INSTR)\$(NAME):ELAPSED-TIME | Time DAQ has been measuring for |
|
||||||
| \$(INSTR)\$(NAME):M_ | Current count on channel. (1-10 depending on box) |
|
| \$(INSTR)\$(NAME):M_ | Current count on channel. (1-10 depending on DAQ system) |
|
||||||
| \$(INSTR)\$(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
|
||||||
@ -65,34 +66,34 @@ runtime via the following
|
|||||||
|
|
||||||
```
|
```
|
||||||
epicsEnvSet("LOAD_TEST_PVS","")
|
epicsEnvSet("LOAD_TEST_PVS","")
|
||||||
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestInst-DAQ1, CNTBOX_PORT=2000"
|
runScript "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "NAME=DAQ, DAQ_IP=TestInst-DAQ1, DAQ_PORT=2000"
|
||||||
```
|
```
|
||||||
|
|
||||||
See the file [counterbox\_v2\_test.db](./db/counterbox_v2_test.db)
|
See the file [daq\_2nd\_gen\_test.db](./db/daq_2nd_gen_test.db)
|
||||||
|
|
||||||
## Simulation
|
## Simulation
|
||||||
|
|
||||||
Simulation of the Hardware can be toggled on as follows:
|
Simulation of the Hardware can be toggled on as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
epicsEnvSet("SET_SIM_MODE","") # run counterbox simulation instead of connecting to actual box
|
epicsEnvSet("SET_SIM_MODE","") # run DAQ simulation instead of connecting to actual system
|
||||||
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=CB_TEST, CNTBOX_IP=localhost, CNTBOX_PORT=2000"
|
runScript "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "NAME=CB_TEST, DAQ_IP=localhost, DAQ_PORT=2000"
|
||||||
```
|
```
|
||||||
|
|
||||||
In such a case, the provided `CNTBOX_IP` is ignored, and a python program
|
In such a case, the provided `DAQ_IP` is ignored, and a python program
|
||||||
simulating the hardware is started in the background, listening at the
|
simulating the hardware is started in the background, listening at the
|
||||||
specified `CNTBOX_PORT`. So, if you have multiple devices listening on the same
|
specified `DAQ_PORT`. So, if you have multiple devices listening on the same
|
||||||
port, you might have to change this port value of one of the devices when
|
port, you might have to change this port value of one of the devices when
|
||||||
simulating hardware. You can then interact with the PVs as with the normal
|
simulating hardware. You can then interact with the PVs as with the normal
|
||||||
hardware. Keep in mind, however, that not all functionality has been
|
hardware. Keep in mind, however, that not all functionality has been
|
||||||
implemented.
|
implemented.
|
||||||
|
|
||||||
See [sim/counterbox\_sim.py](sim/counterbox_sim.py).
|
See [sim/daq\_sim.py](sim/daq_sim.py).
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
An IOC with the counterbox\_v2 started in simulation mode can be started via
|
An IOC with the 2nd generation DAQ started in simulation mode can be started
|
||||||
the [test/ioc.sh](test/ioc.sh) script.
|
via the [test/ioc.sh](test/ioc.sh) script.
|
||||||
|
|
||||||
There is also a simple automated test that can be run for a simple check of
|
There is also a simple automated test that can be run for a simple check of
|
||||||
functionality and that the PVs load [test/test.py](test/test.py).
|
functionality and that the PVs load [test/test.py](test/test.py).
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
||||||
# NAME - the device 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 Counterbox
|
# ASYN_PORT - Low level Asyn IP Port to DAQ
|
||||||
# CHANNEL - the number associated with the measurment channel
|
# CHANNEL - the number associated with the measurment channel
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -25,12 +25,12 @@ record(bo, "$(INSTR)$(NAME):C$(CHANNEL)")
|
|||||||
|
|
||||||
record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
|
record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
|
||||||
{
|
{
|
||||||
field(DESC, "Counterbox CH$(CHANNEL)")
|
field(DESC, "DAQ CH$(CHANNEL)")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(ai, "$(INSTR)$(NAME):R$(CHANNEL)")
|
record(ai, "$(INSTR)$(NAME):R$(CHANNEL)")
|
||||||
{
|
{
|
||||||
field(DESC, "Counterbox Rate CH$(CHANNEL)")
|
field(DESC, "Rate of DAQ CH$(CHANNEL)")
|
||||||
field(INP, "@$(PROTO) readRate($(INSTR)$(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")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Counterbox Protocol File
|
# SinqDAQ Protocol File
|
||||||
#
|
#
|
||||||
OutTerminator = CR;
|
OutTerminator = CR;
|
||||||
InTerminator = CR;
|
InTerminator = CR;
|
||||||
@ -14,7 +14,7 @@ initialise {
|
|||||||
out "ECHO 2"; # Ask for reponses
|
out "ECHO 2"; # Ask for reponses
|
||||||
in "%(\$1MsgTxt)s"; # Clear MsgTxt on Init
|
in "%(\$1MsgTxt)s"; # Clear MsgTxt on Init
|
||||||
@mismatch{
|
@mismatch{
|
||||||
exec 'echo "Failed to configure counterbox" && exit(1)';
|
exec 'echo "Failed to configure DAQ" && exit(1)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +65,8 @@ stopCount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearTimer{
|
clearTimer{
|
||||||
# We first stop the count, as otherwise on the newest counterboxes
|
# We first stop the count, as otherwise the 2nd Gen Data Acquisition starts
|
||||||
# it starts counting again if a time preset was set.
|
# counting again if a time preset was set. Not a problem with the older boxes
|
||||||
# Not a problem with the older boxes
|
|
||||||
stopCount;
|
stopCount;
|
||||||
out "CT";
|
out "CT";
|
||||||
in;
|
in;
|
@ -5,7 +5,7 @@
|
|||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
||||||
# NAME - the device 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 DAQ
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Status Variables
|
# Status Variables
|
@ -5,7 +5,7 @@
|
|||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
||||||
# NAME - the device 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 DAQ
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Testing Commands
|
# Testing Commands
|
@ -4,7 +4,7 @@
|
|||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
||||||
# NAME - the device 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 Counterbox
|
# ASYN_PORT - Low level Asyn IP Port to DAQ
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Status Variables
|
# Status Variables
|
@ -4,7 +4,7 @@
|
|||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
||||||
# NAME - the device 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 Counterbox
|
# ASYN_PORT - Low level Asyn IP Port to DAQ
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Status Variables
|
# Status Variables
|
@ -9,7 +9,7 @@
|
|||||||
# Send initial initialisation commands
|
# Send initial initialisation commands
|
||||||
record(bo, "$(INSTR)$(NAME):INIT-CONF")
|
record(bo, "$(INSTR)$(NAME):INIT-CONF")
|
||||||
{
|
{
|
||||||
field(DESC, "Initialises the Counterbox")
|
field(DESC, "Initialises the DAQ")
|
||||||
field(OUT, "@$(PROTO) initialise($(INSTR)$(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")
|
||||||
@ -17,7 +17,7 @@ record(bo, "$(INSTR)$(NAME):INIT-CONF")
|
|||||||
|
|
||||||
record(longout, "$(INSTR)$(NAME):FULL-RESET")
|
record(longout, "$(INSTR)$(NAME):FULL-RESET")
|
||||||
{
|
{
|
||||||
field(DESC, "Reset the Counterbox")
|
field(DESC, "Reset the DAQ")
|
||||||
field(OUT, "@$(PROTO) fullReset($(INSTR)$(NAME):) $(ASYN_PORT)")
|
field(OUT, "@$(PROTO) fullReset($(INSTR)$(NAME):) $(ASYN_PORT)")
|
||||||
field(DTYP, "stream")
|
field(DTYP, "stream")
|
||||||
}
|
}
|
||||||
@ -28,16 +28,16 @@ record(longout, "$(INSTR)$(NAME):FULL-RESET")
|
|||||||
record(stringin, "$(INSTR)$(NAME):MsgTxt")
|
record(stringin, "$(INSTR)$(NAME):MsgTxt")
|
||||||
{
|
{
|
||||||
field(DESC, "Unexpected received response")
|
field(DESC, "Unexpected received response")
|
||||||
field(DTYP, "devCounterBoxStringError")
|
field(DTYP, "devDAQStringError")
|
||||||
field(FLNK, "$(INSTR)$(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 DAQ off and
|
||||||
# on again or running a full reset
|
# on again or running a full reset
|
||||||
record(scalcout, "$(INSTR)$(NAME):INVALID-CONFIG")
|
record(scalcout, "$(INSTR)$(NAME):INVALID-CONFIG")
|
||||||
{
|
{
|
||||||
field(DESC, "Has the counterbox been configured?")
|
field(DESC, "Has the DAQ been configured?")
|
||||||
field(CALC, "AA[0,2] == '?OF'")
|
field(CALC, "AA[0,2] == '?OF'")
|
||||||
field(INAA, "$(INSTR)$(NAME):MsgTxt")
|
field(INAA, "$(INSTR)$(NAME):MsgTxt")
|
||||||
field(FLNK, "$(INSTR)$(NAME):REINIT-CONF")
|
field(FLNK, "$(INSTR)$(NAME):REINIT-CONF")
|
||||||
@ -76,7 +76,7 @@ record(calc, "$(INSTR)$(NAME):MAP-STATUS")
|
|||||||
|
|
||||||
record(mbbi, "$(INSTR)$(NAME):STATUS")
|
record(mbbi, "$(INSTR)$(NAME):STATUS")
|
||||||
{
|
{
|
||||||
field(DESC, "Counterbox Status")
|
field(DESC, "DAQ Status")
|
||||||
field(INP, "$(INSTR)$(NAME):MAP-STATUS NPP")
|
field(INP, "$(INSTR)$(NAME):MAP-STATUS NPP")
|
||||||
field(ZRVL, "0")
|
field(ZRVL, "0")
|
||||||
field(ZRST, "Idle")
|
field(ZRST, "Idle")
|
||||||
@ -86,7 +86,7 @@ record(mbbi, "$(INSTR)$(NAME):STATUS")
|
|||||||
field(TWST, "Low rate")
|
field(TWST, "Low rate")
|
||||||
field(THVL, "3")
|
field(THVL, "3")
|
||||||
field(THST, "Paused")
|
field(THST, "Paused")
|
||||||
# 4 should never happen, if it does it means the counter box reports undocumented statusbits
|
# 4 should never happen, if it does it means the DAQ reports undocumented statusbits
|
||||||
field(FRVL, "4")
|
field(FRVL, "4")
|
||||||
field(FRST, "INVALID")
|
field(FRST, "INVALID")
|
||||||
}
|
}
|
||||||
@ -207,6 +207,6 @@ record(ai, "$(INSTR)$(NAME):READALL")
|
|||||||
|
|
||||||
record(ai,"$(INSTR)$(NAME):ELAPSED-TIME")
|
record(ai,"$(INSTR)$(NAME):ELAPSED-TIME")
|
||||||
{
|
{
|
||||||
field(DESC, "Counterbox Measured Time")
|
field(DESC, "DAQ Measured Time")
|
||||||
field(EGU, "seconds")
|
field(EGU, "seconds")
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
# Sinq Counterbox EPICS Database for StreamDevice Communication with Simulation
|
# Sinq DAQ EPICS Database for StreamDevice Communication with Simulation
|
||||||
# Macros
|
# Macros
|
||||||
#
|
#
|
||||||
# INSTR - Prefix
|
# INSTR - Prefix
|
@ -1,22 +0,0 @@
|
|||||||
require asyn
|
|
||||||
require stream
|
|
||||||
|
|
||||||
epicsEnvSet("$(NAME)_CNTBOX_HOST", "$(CNTBOX_IP):$(CNTBOX_PORT)")
|
|
||||||
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_CNTBOX_HOST", "127.0.0.1:$(CNTBOX_PORT)")
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(counterbox_DIR)counterbox_sim.py $(CNTBOX_PORT) 4 &"
|
|
||||||
# starting the python socket seems to take a while
|
|
||||||
# and need misc to use built in sleep command
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
|
||||||
|
|
||||||
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
|
|
||||||
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
|
|
||||||
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=4")
|
|
||||||
dbLoadRecords("$(counterbox_DB)counterbox_4ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
|
||||||
|
|
||||||
# Could also use substitions instead.
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=2")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=4")
|
|
@ -1,26 +0,0 @@
|
|||||||
require asyn
|
|
||||||
require stream
|
|
||||||
|
|
||||||
epicsEnvSet("$(NAME)_CNTBOX_HOST", "$(CNTBOX_IP):$(CNTBOX_PORT)")
|
|
||||||
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_CNTBOX_HOST", "127.0.0.1:$(CNTBOX_PORT)")
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(counterbox_DIR)counterbox_sim.py $(CNTBOX_PORT) 8 &"
|
|
||||||
# starting the python socket seems to take a while
|
|
||||||
# and need misc to use built in sleep command
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
|
||||||
|
|
||||||
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
|
|
||||||
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
|
|
||||||
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=8")
|
|
||||||
dbLoadRecords("$(counterbox_DB)counterbox_8ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
|
||||||
|
|
||||||
# Could also use substitions instead.
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=2")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=4")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=6")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=8")
|
|
@ -1,32 +0,0 @@
|
|||||||
require asyn
|
|
||||||
require stream
|
|
||||||
|
|
||||||
epicsEnvSet("$(NAME)_CNTBOX_HOST", "$(CNTBOX_IP):$(CNTBOX_PORT=2000)")
|
|
||||||
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_CNTBOX_HOST", "127.0.0.1:$(CNTBOX_PORT=2000)")
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(counterbox_DIR)counterbox_sim.py $(CNTBOX_PORT=2000) 10 &"
|
|
||||||
# starting the python socket seems to take a while
|
|
||||||
# and need misc to use built in sleep command
|
|
||||||
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
|
||||||
|
|
||||||
epicsEnvSet("PROTO", "$(counterbox_DB)counterbox.proto")
|
|
||||||
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_CNTBOX_HOST)", 0, 0, 0)
|
|
||||||
dbLoadRecords("$(counterbox_DB)counterbox_common.db", "INSTR=$(INSTR), 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.
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=2")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=4")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=6")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=8")
|
|
||||||
dbLoadRecords("$(counterbox_DB)channels.db", "INSTR=$(INSTR), 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=10")
|
|
||||||
|
|
||||||
$(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", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
|
32
scripts/daq_2nd_gen.cmd
Normal file
32
scripts/daq_2nd_gen.cmd
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
require asyn
|
||||||
|
require stream
|
||||||
|
|
||||||
|
epicsEnvSet("$(NAME)_DAQ_HOST", "$(DAQ_IP):$(DAQ_PORT=2000)")
|
||||||
|
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_DAQ_HOST", "127.0.0.1:$(DAQ_PORT=2000)")
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(sinqDAQ_DIR)daq_sim.py $(DAQ_PORT=2000) 10 &"
|
||||||
|
# starting the python socket seems to take a while
|
||||||
|
# and need misc to use built in sleep command
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
||||||
|
|
||||||
|
epicsEnvSet("PROTO", "$(sinqDAQ_DB)daq.proto")
|
||||||
|
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_DAQ_HOST)", 0, 0, 0)
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_2nd_gen.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10")
|
||||||
|
|
||||||
|
# Could also use substitions instead.
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=9")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=10")
|
||||||
|
|
||||||
|
$(LOAD_TEST_PVS=#) $(LOAD_TEST_PVS) dbLoadRecords("$(sinqDAQ_DB)daq_2nd_gen_test.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
||||||
|
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) dbLoadRecords("$(sinqDAQ_DB)daq_simcontrol.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
22
scripts/daq_4ch.cmd
Normal file
22
scripts/daq_4ch.cmd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
require asyn
|
||||||
|
require stream
|
||||||
|
|
||||||
|
epicsEnvSet("$(NAME)_DAQ_HOST", "$(DAQ_IP):$(DAQ_PORT)")
|
||||||
|
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_DAQ_HOST", "127.0.0.1:$(DAQ_PORT)")
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(sinqDAQ_DIR)daq_sim.py $(DAQ_PORT) 4 &"
|
||||||
|
# starting the python socket seems to take a while
|
||||||
|
# and need misc to use built in sleep command
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
||||||
|
|
||||||
|
epicsEnvSet("PROTO", "$(sinqDAQ_DB)daq.proto")
|
||||||
|
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_DAQ_HOST)", 0, 0, 0)
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=4")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_4ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
||||||
|
|
||||||
|
# Could also use substitions instead.
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")
|
26
scripts/daq_8ch.cmd
Normal file
26
scripts/daq_8ch.cmd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require asyn
|
||||||
|
require stream
|
||||||
|
|
||||||
|
epicsEnvSet("$(NAME)_DAQ_HOST", "$(DAQ_IP):$(DAQ_PORT)")
|
||||||
|
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) require misc
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) epicsEnvSet("$(NAME)_DAQ_HOST", "127.0.0.1:$(DAQ_PORT)")
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) system "$(sinqDAQ_DIR)daq_sim.py $(DAQ_PORT) 8 &"
|
||||||
|
# starting the python socket seems to take a while
|
||||||
|
# and need misc to use built in sleep command
|
||||||
|
$(SET_SIM_MODE=#) $(SET_SIM_MODE) sleep 3
|
||||||
|
|
||||||
|
epicsEnvSet("PROTO", "$(sinqDAQ_DB)daq.proto")
|
||||||
|
drvAsynIPPortConfigure("ASYN_$(NAME)", "$($(NAME)_DAQ_HOST)", 0, 0, 0)
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=8")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)daq_8ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")
|
||||||
|
|
||||||
|
# Could also use substitions instead.
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=1")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=2")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=3")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=4")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=5")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=6")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=7")
|
||||||
|
dbLoadRecords("$(sinqDAQ_DB)channels.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNEL=8")
|
@ -14,13 +14,13 @@ TOTAL_CH = int(sys.argv[2]) # Number of Channels
|
|||||||
LOG2FILE = False if len(sys.argv) < 4 else bool(int(sys.argv[3]))
|
LOG2FILE = False if len(sys.argv) < 4 else bool(int(sys.argv[3]))
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger('counterbox')
|
logger = logging.getLogger('daq')
|
||||||
|
|
||||||
if LOG2FILE:
|
if LOG2FILE:
|
||||||
logging.basicConfig(filename=os.path.join(os.getcwd(), 'counterbox_sim.log'), level=logging.INFO)
|
logging.basicConfig(filename=os.path.join(os.getcwd(), 'daq_sim.log'), level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
class CounterBox:
|
class DAQ:
|
||||||
def __init__(self, total_channels):
|
def __init__(self, total_channels):
|
||||||
self.total_channels = total_channels
|
self.total_channels = total_channels
|
||||||
self.counts = [0] * self.total_channels
|
self.counts = [0] * self.total_channels
|
||||||
@ -66,7 +66,7 @@ class CounterBox:
|
|||||||
return self.counts[channel - 1]
|
return self.counts[channel - 1]
|
||||||
|
|
||||||
def getCounts(self):
|
def getCounts(self):
|
||||||
# The sinqtest box returns a maximum of 8
|
# The sinqtest daq returns a maximum of 8
|
||||||
return self.counts[0:min(len(self.counts), 8)]
|
return self.counts[0:min(len(self.counts), 8)]
|
||||||
|
|
||||||
def getMonitorCount(self):
|
def getMonitorCount(self):
|
||||||
@ -217,7 +217,7 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|||||||
logger.info(f'RECEIVED: "{received}"')
|
logger.info(f'RECEIVED: "{received}"')
|
||||||
return received
|
return received
|
||||||
|
|
||||||
counterbox = CounterBox(TOTAL_CH)
|
daq = DAQ(TOTAL_CH)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
@ -232,85 +232,85 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif data == 'ECHO 2':
|
elif data == 'ECHO 2':
|
||||||
send('Counterbox') # Sends some sort of info command
|
send('DAQ System Version Simulation') # Sends some sort of info command
|
||||||
|
|
||||||
elif data == 'RA':
|
elif data == 'RA':
|
||||||
send(
|
send(
|
||||||
' '.join(map(str,
|
' '.join(map(str,
|
||||||
[counterbox.getRunTime()] + \
|
[daq.getRunTime()] + \
|
||||||
counterbox.getCounts()
|
daq.getCounts()
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
|
|
||||||
elif re.fullmatch(r'RC (\d+)', data):
|
elif re.fullmatch(r'RC (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'RC (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'RC (\d+)', data).group(1))
|
||||||
count = counterbox.getCount(channel)
|
count = daq.getCount(channel)
|
||||||
send(f'{count}')
|
send(f'{count}')
|
||||||
|
|
||||||
elif data == 'RS':
|
elif data == 'RS':
|
||||||
send(str(counterbox.getStatus()))
|
send(str(daq.getStatus()))
|
||||||
|
|
||||||
elif data == 'S':
|
elif data == 'S':
|
||||||
counterbox.stop()
|
daq.stop()
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif data == 'CT':
|
elif data == 'CT':
|
||||||
counterbox.clearTime()
|
daq.clearTime()
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'CC (\d+)', data):
|
elif re.fullmatch(r'CC (\d+)', data):
|
||||||
counter = int(re.fullmatch(r'CC (\d+)', data).group(1))
|
counter = int(re.fullmatch(r'CC (\d+)', data).group(1))
|
||||||
counterbox.clearCount(counter)
|
daq.clearCount(counter)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
||||||
presettime = float(re.fullmatch(r'TP (\d+(\.\d+)?)', data).group(1))
|
presettime = float(re.fullmatch(r'TP (\d+(\.\d+)?)', data).group(1))
|
||||||
counterbox.startTimePreset(presettime)
|
daq.startTimePreset(presettime)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'MP (\d+)', data):
|
elif re.fullmatch(r'MP (\d+)', data):
|
||||||
counts = int(re.fullmatch(r'MP (\d+)', data).group(1))
|
counts = int(re.fullmatch(r'MP (\d+)', data).group(1))
|
||||||
counterbox.startCountPreset(counts)
|
daq.startCountPreset(counts)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif data == 'PC':
|
elif data == 'PC':
|
||||||
send(str(counterbox.getMonitorChannel()))
|
send(str(daq.getMonitorChannel()))
|
||||||
|
|
||||||
elif re.fullmatch(r'PC (\d+)', data):
|
elif re.fullmatch(r'PC (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'PC (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'PC (\d+)', data).group(1))
|
||||||
counterbox.setMonitorChannel(channel)
|
daq.setMonitorChannel(channel)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif data == 'DR':
|
elif data == 'DR':
|
||||||
send(str(counterbox.getMinRateChannel()))
|
send(str(daq.getMinRateChannel()))
|
||||||
|
|
||||||
elif re.fullmatch(r'DR (\d+)', data):
|
elif re.fullmatch(r'DR (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'DR (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'DR (\d+)', data).group(1))
|
||||||
counterbox.setMinRateChannel(channel)
|
daq.setMinRateChannel(channel)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'DL (\d+)', data):
|
elif re.fullmatch(r'DL (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'DL (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'DL (\d+)', data).group(1))
|
||||||
send('{:.3f}'.format(counterbox.getMinRate(channel)))
|
send('{:.3f}'.format(daq.getMinRate(channel)))
|
||||||
|
|
||||||
elif re.fullmatch(r'DL (\d+) (\d+(?:.\d+)?)', data):
|
elif re.fullmatch(r'DL (\d+) (\d+(?:.\d+)?)', data):
|
||||||
channel, rate = re.fullmatch(r'DL (\d+) (\d+(?:.\d+)?)', data).groups()
|
channel, rate = re.fullmatch(r'DL (\d+) (\d+(?:.\d+)?)', data).groups()
|
||||||
counterbox.setMinRate(int(channel), float(rate))
|
daq.setMinRate(int(channel), float(rate))
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'RR (\d+)', data):
|
elif re.fullmatch(r'RR (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'RR (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'RR (\d+)', data).group(1))
|
||||||
send(counterbox.getRate(channel))
|
send(daq.getRate(channel))
|
||||||
|
|
||||||
elif re.fullmatch(r'GT (\d+)', data):
|
elif re.fullmatch(r'GT (\d+)', data):
|
||||||
channel = int(re.fullmatch(r'GT (\d+)', data).group(1))
|
channel = int(re.fullmatch(r'GT (\d+)', data).group(1))
|
||||||
enabled, highlow = counterbox.getGateStatus(channel)
|
enabled, highlow = daq.getGateStatus(channel)
|
||||||
send(f'{int(enabled)} {int(highlow)}')
|
send(f'{int(enabled)} {int(highlow)}')
|
||||||
|
|
||||||
elif re.fullmatch(r'GT (\d+) (\d+) (\d+)', data):
|
elif re.fullmatch(r'GT (\d+) (\d+) (\d+)', data):
|
||||||
channel, enable, highlow = re.fullmatch(r'GT (\d+) (\d+) (\d+)', data).groups()
|
channel, enable, highlow = re.fullmatch(r'GT (\d+) (\d+) (\d+)', data).groups()
|
||||||
channel, enable, highlow = int(channel), bool(int(enable)), bool(int(highlow))
|
channel, enable, highlow = int(channel), bool(int(enable)), bool(int(highlow))
|
||||||
counterbox.setGateStatus(channel, enable, highlow)
|
daq.setGateStatus(channel, enable, highlow)
|
||||||
if enable:
|
if enable:
|
||||||
send(f'Gate {channel} enabled, counting when input = {"high" if highlow else "low"}')
|
send(f'Gate {channel} enabled, counting when input = {"high" if highlow else "low"}')
|
||||||
else:
|
else:
|
||||||
@ -320,7 +320,7 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|||||||
elif re.fullmatch(r'GATE (\d+) (\d+)', data):
|
elif re.fullmatch(r'GATE (\d+) (\d+)', data):
|
||||||
channel, highlow = re.fullmatch(r'GATE (\d+) (\d+)', data).groups()
|
channel, highlow = re.fullmatch(r'GATE (\d+) (\d+)', data).groups()
|
||||||
channel, highlow = int(channel), bool(int(highlow))
|
channel, highlow = int(channel), bool(int(highlow))
|
||||||
counterbox.setGate(channel, highlow)
|
daq.setGate(channel, highlow)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
else:
|
else:
|
@ -1,5 +0,0 @@
|
|||||||
#---------------------------------------------
|
|
||||||
# Counterbox specific DB definitions
|
|
||||||
#---------------------------------------------
|
|
||||||
|
|
||||||
device(stringin,INST_IO,devCounterBoxStringError,"devCounterBoxStringError")
|
|
@ -54,7 +54,7 @@ struct {
|
|||||||
DEVSUPFUN get_ioint_info;
|
DEVSUPFUN get_ioint_info;
|
||||||
DEVSUPFUN read_ai;
|
DEVSUPFUN read_ai;
|
||||||
DEVSUPFUN special_linconv;
|
DEVSUPFUN special_linconv;
|
||||||
} devCounterBoxStringError = {
|
} devDAQStringError = {
|
||||||
6, NULL, NULL, NULL, NULL, (DEVSUPFUN)map_raw_failure_message, NULL};
|
6, NULL, NULL, NULL, NULL, (DEVSUPFUN)map_raw_failure_message, NULL};
|
||||||
|
|
||||||
epicsExportAddress(dset, devCounterBoxStringError);
|
epicsExportAddress(dset, devDAQStringError);
|
5
src/daq.dbd
Normal file
5
src/daq.dbd
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#---------------------------------------------
|
||||||
|
# DAQ specific DB definitions
|
||||||
|
#---------------------------------------------
|
||||||
|
|
||||||
|
device(stringin, INST_IO, devDAQStringError, "devDAQStringError")
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
on error break
|
on error break
|
||||||
|
|
||||||
require counterbox
|
require sinqDAQ
|
||||||
|
|
||||||
epicsEnvSet("STREAM_PROTOCOL_PATH","./db")
|
epicsEnvSet("STREAM_PROTOCOL_PATH","./db")
|
||||||
epicsEnvSet("INSTR","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 Simulation Instead of Actual Interface
|
||||||
runScript "$(counterbox_DIR)counterbox_v2.cmd" "CNTBOX_IP=127.0.0.1, CNTBOX_PORT=2000"
|
runScript "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "DAQ_IP=127.0.0.1, DAQ_PORT=2000"
|
||||||
|
|
||||||
iocInit()
|
iocInit()
|
||||||
|
Reference in New Issue
Block a user