Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14214e6151 | |||
| b8406016d2 | |||
| b26704d061 | |||
| 5f86266fc0 |
19
db/daq.proto
19
db/daq.proto
@@ -204,52 +204,33 @@ setGate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# TODO To clean
|
|
||||||
|
|
||||||
startWithCountPreset4 {
|
startWithCountPreset4 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
readAll4;
|
readAll4;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithCountPreset8 {
|
startWithCountPreset8 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
readAll8;
|
readAll8;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithCountPreset10 {
|
startWithCountPreset10 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
clearCounter10;
|
|
||||||
readAll10;
|
readAll10;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset4 {
|
startWithTimePreset4 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
readAll4;
|
readAll4;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset8 {
|
startWithTimePreset8 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
readAll8;
|
readAll8;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset10 {
|
startWithTimePreset10 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
clearCounter10;
|
|
||||||
readAll10;
|
readAll10;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ record(seq, "$(INSTR)$(NAME):CORRECT-MONITOR-CHANNEL")
|
|||||||
field(SCAN, ".5 second")
|
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")
|
||||||
|
field(CALC, "(A=1)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
|
|||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):RATE_MAP")
|
||||||
|
{
|
||||||
|
field(DESC, "Want a consistent lowrate pv")
|
||||||
|
field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP")
|
||||||
|
field(CALC, "(A=0)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
|
|||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):RATE_MAP")
|
||||||
|
{
|
||||||
|
field(DESC, "Want a consistent lowrate pv")
|
||||||
|
field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP")
|
||||||
|
field(CALC, "(A=0)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,15 @@ record(seq, "$(INSTR)$(NAME):REINIT-CONF")
|
|||||||
# it must always be triggered after the value of $(INSTR)$(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, "$(INSTR)$(NAME):RAW-STATUS")
|
#
|
||||||
|
# The status can be interpreted as follows
|
||||||
|
#
|
||||||
|
# Bit 0: NC_STAT_P_TIME_C
|
||||||
|
# Bit 1: NC_STAT_P_COUNT_C
|
||||||
|
# Bit 2: NC_STAT_RATE_OK_C It appears this should be ignored unless counting
|
||||||
|
# Bit 3: NC_STAT_PAUSE_C
|
||||||
|
#
|
||||||
|
record(mbbiDirect, "$(INSTR)$(NAME):RAW-STATUS")
|
||||||
{
|
{
|
||||||
field(DESC, "Raw returned status value")
|
field(DESC, "Raw returned status value")
|
||||||
field(DTYP, "stream")
|
field(DTYP, "stream")
|
||||||
@@ -64,13 +72,44 @@ record(longin, "$(INSTR)$(NAME):RAW-STATUS")
|
|||||||
field(FLNK, "$(INSTR)$(NAME):READALL")
|
field(FLNK, "$(INSTR)$(NAME):READALL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):COUNTING_TIME")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B0")
|
||||||
|
field(ZNAM, "DISABLED")
|
||||||
|
field(ONAM, "COUNTING")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):COUNTING_PRESET")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B1")
|
||||||
|
field(ZNAM, "DISABLED")
|
||||||
|
field(ONAM, "COUNTING")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):IS_LOWRATE")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RATE_MAP PP")
|
||||||
|
field(ZNAM, "LOW RATE")
|
||||||
|
field(ONAM, "GOOD RATE")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):IS_PAUSED")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B3")
|
||||||
|
field(ZNAM, "RUNNING")
|
||||||
|
field(ONAM, "PAUSED")
|
||||||
|
}
|
||||||
|
|
||||||
record(calc, "$(INSTR)$(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, "$(INSTR)$(NAME):RAW-STATUS NPP")
|
field(INPA, "$(INSTR)$(NAME):INVALID-CONFIG NPP")
|
||||||
field(INPB, "$(INSTR)$(NAME):INVALID-CONFIG NPP")
|
field(INPB, "$(INSTR)$(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(INPC, "$(INSTR)$(NAME):COUNTING_TIME PP")
|
||||||
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(INPD, "$(INSTR)$(NAME):COUNTING_PRESET PP")
|
||||||
|
field(INPE, "$(INSTR)$(NAME):IS_LOWRATE PP")
|
||||||
|
field(INPF, "$(INSTR)$(NAME):IS_PAUSED PP")
|
||||||
|
field(CALC, "(A=1||B=1)?4:(F=1)?3:(C=0&&D=0)?0:(E=0)?2:1")
|
||||||
field(FLNK, "$(INSTR)$(NAME):STATUS")
|
field(FLNK, "$(INSTR)$(NAME):STATUS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class DAQ:
|
|||||||
]
|
]
|
||||||
|
|
||||||
def clearCount(self, counter):
|
def clearCount(self, counter):
|
||||||
self.counts[counter-1] = 0
|
self.counts[counter] = 0
|
||||||
|
|
||||||
def clearCounts(self):
|
def clearCounts(self):
|
||||||
self.counts = [0] * self.total_channels
|
self.counts = [0] * self.total_channels
|
||||||
@@ -260,7 +260,11 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|||||||
|
|
||||||
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))
|
||||||
daq.clearCount(counter)
|
num_bits = daq.total_channels
|
||||||
|
bits = [(counter >> bit) & 1 for bit in range(num_bits - 1, -1, -1)]
|
||||||
|
for ch, bit in enumerate(bits):
|
||||||
|
if bit:
|
||||||
|
daq.clearCount(ch)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
||||||
|
|||||||
Reference in New Issue
Block a user