From 577d4dca88a53a6671098c205ef4f9c74f0e3ed5 Mon Sep 17 00:00:00 2001 From: Edward Wall Date: Mon, 20 Apr 2026 14:45:59 +0200 Subject: [PATCH] makes the low_rate bit polarity configurable --- README.md | 15 +++++++++++++++ db/daq_2nd_gen.db | 7 ------- db/daq_4ch.db | 7 ------- db/daq_8ch.db | 7 ------- db/daq_common.db | 7 +++++++ scripts/daq_2nd_gen.cmd | 2 +- scripts/daq_4ch.cmd | 2 +- scripts/daq_8ch.cmd | 2 +- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index eb3f219..5f1d091 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ older EL737 Counterboxes. Specifically, Furthermore, the 2nd Generation DAQ's have 10 input channels, in place of the 8 or 4 channels on the older EL737 Counterboxes. +## Breaking Changes + +* From version `0.5.0`, all device startup scripts assume that a low rate is + communicated by bit 2 of the status being set to 1. Beforehand, when using + daq\_2nd\_gen.cmd, the default was 0. So if you are using this script, you + might need to now additionally set the variable **RATE_OKAY_BIT** to 1, to + correct for this change, if you see a low rate warning in Nicos, when the + rate is above the configured threshold. + ## How to Use Unless a custom database is needed, a device can be configure simply by setting @@ -40,6 +49,12 @@ Required Variables | DAQ\_IP | Network IP of device | | DAQ\_PORT | Network Port of device | +Optional Variables + +| Environment Variable | Purpose | +|----------------------|-----------------------------------------------------------------------------| +| RATE\_OKAY\_BIT | Some DAQs invert the rate bit. Set to 1 to correct inversion, default is 0. | + All PVs take the form ``` diff --git a/db/daq_2nd_gen.db b/db/daq_2nd_gen.db index 2a82306..f5f2af9 100644 --- a/db/daq_2nd_gen.db +++ b/db/daq_2nd_gen.db @@ -38,13 +38,6 @@ record(seq, "$(INSTR)$(NAME):CORRECT-MONITOR-CHANNEL") field(SCAN, ".5 second") } -record(calc, "$(INSTR)$(NAME):RATE_MAP") -{ - field(DESC, "Want a consistent lowrate pv") - field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP MS") - field(CALC, "(A=1)?0:1") -} - ################################################################################ # Count Commands diff --git a/db/daq_4ch.db b/db/daq_4ch.db index 1373c53..ca34dd5 100644 --- a/db/daq_4ch.db +++ b/db/daq_4ch.db @@ -25,13 +25,6 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV") field(DISP, 1) } -record(calc, "$(INSTR)$(NAME):RATE_MAP") -{ - field(DESC, "Want a consistent lowrate pv") - field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP MS") - field(CALC, "(A=0)?0:1") -} - ################################################################################ # Count Commands diff --git a/db/daq_8ch.db b/db/daq_8ch.db index 3e10646..fa49da6 100644 --- a/db/daq_8ch.db +++ b/db/daq_8ch.db @@ -25,13 +25,6 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV") field(DISP, 1) } -record(calc, "$(INSTR)$(NAME):RATE_MAP") -{ - field(DESC, "Want a consistent lowrate pv") - field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP MS") - field(CALC, "(A=0)?0:1") -} - ################################################################################ # Count Commands diff --git a/db/daq_common.db b/db/daq_common.db index 60b0f8d..433e5f6 100644 --- a/db/daq_common.db +++ b/db/daq_common.db @@ -86,6 +86,13 @@ record(bi, "$(INSTR)$(NAME):COUNTING_PRESET") field(ONAM, "COUNTING") } +record(calc, "$(INSTR)$(NAME):RATE_MAP") +{ + field(DESC, "This bit is not consistent across DAQs") + field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP MS") + field(CALC, "(A=$(RATE_OKAY_BIT))?0:1") +} + record(bi, "$(INSTR)$(NAME):IS_LOWRATE") { field(INP, "$(INSTR)$(NAME):RATE_MAP PP MS") diff --git a/scripts/daq_2nd_gen.cmd b/scripts/daq_2nd_gen.cmd index 25f576b..f9879cf 100644 --- a/scripts/daq_2nd_gen.cmd +++ b/scripts/daq_2nd_gen.cmd @@ -12,7 +12,7 @@ $(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_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10, RATE_OKAY_BIT=$(RATE_OKAY_BIT=0)") dbLoadRecords("$(sinqDAQ_DB)daq_2nd_gen.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=10") # Could also use substitions instead. diff --git a/scripts/daq_4ch.cmd b/scripts/daq_4ch.cmd index 6c43c94..208dfc1 100644 --- a/scripts/daq_4ch.cmd +++ b/scripts/daq_4ch.cmd @@ -12,7 +12,7 @@ $(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_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=4, RATE_OKAY_BIT=$(RATE_OKAY_BIT=0)") dbLoadRecords("$(sinqDAQ_DB)daq_4ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") # Could also use substitions instead. diff --git a/scripts/daq_8ch.cmd b/scripts/daq_8ch.cmd index 1ac5187..af2f1be 100644 --- a/scripts/daq_8ch.cmd +++ b/scripts/daq_8ch.cmd @@ -12,7 +12,7 @@ $(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_common.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME), CHANNELS=8, RATE_OKAY_BIT=$(RATE_OKAY_BIT=0)") dbLoadRecords("$(sinqDAQ_DB)daq_8ch.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)") # Could also use substitions instead.