diff --git a/db/daq_2nd_gen.db b/db/daq_2nd_gen.db index ff03e73..1cc206d 100644 --- a/db/daq_2nd_gen.db +++ b/db/daq_2nd_gen.db @@ -12,7 +12,7 @@ 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(DRVH, "$(CHANNELS)") # Largest Monitor Channel field(DTYP, "stream") @@ -22,7 +22,7 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL") 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(INP, "@$(PROTO) readPresetMonitor($(INSTR)$(NAME):) $(ASYN_PORT)") field(SCAN, ".5 second") diff --git a/db/daq_4ch.db b/db/daq_4ch.db index 3fd4367..9a0ce9d 100644 --- a/db/daq_4ch.db +++ b/db/daq_4ch.db @@ -11,7 +11,7 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL") { - field(DESC, "PRESET-COUNT Monitors this channel") + field(DESC, "PRESET_COUNT Monitors this channel") field(VAL, 1) field(DRVL, 0) # Smallest Monitor Channel (should really be 1) field(DRVH, 1) # Largest Monitor Channel @@ -20,7 +20,7 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL") 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(DISP, 1) } diff --git a/db/daq_8ch.db b/db/daq_8ch.db index 27b628a..bdb001a 100644 --- a/db/daq_8ch.db +++ b/db/daq_8ch.db @@ -11,7 +11,7 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL") { - field(DESC, "PRESET-COUNT Monitors this channel") + field(DESC, "PRESET_COUNT Monitors this channel") field(VAL, 1) field(DRVL, 0) # Smallest Monitor Channel (should really be 1) field(DRVH, 1) # Largest Monitor Channel @@ -20,7 +20,7 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL") 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(DISP, 1) } diff --git a/db/daq_common.db b/db/daq_common.db index 2e9ff53..4823f71 100644 --- a/db/daq_common.db +++ b/db/daq_common.db @@ -7,6 +7,9 @@ # ASYN_PORT - Low level Asyn IP Port to EL737 # POLL_FREQ - Scan string defining main status-loop polling frequency (default .5 second) +################################################################################ +# Hardware Initialisation + # Send initial initialisation commands record(bo, "$(INSTR)$(NAME):INIT-CONF") { @@ -30,7 +33,7 @@ record(dfanout, "$(INSTR)$(NAME):RESET") field(OMSL, "closed_loop") field(DOL, "0") # Internal Count Timer - field(OUTA, "$(INSTR)$(NAME):COUNT_STARTED PP") + field(OUTA, "$(INSTR)$(NAME):WAIT_HW PP") # Time Preset # field(OUTB, "$(INSTR)$(NAME):T_PRESET PP") # field(OUTC, "$(INSTR)$(NAME):T_CLEARED PP") @@ -41,16 +44,6 @@ record(dfanout, "$(INSTR)$(NAME):RESET") # field(OUTF, "$(INSTR)$(NAME):PRESET_TYPE PP") } -################################################################################ -# Status Variables - -record(stringin, "$(INSTR)$(NAME):MsgTxt") -{ - field(DESC, "Unexpected received response") - field(DTYP, "devDAQStringError") - field(FLNK, "$(INSTR)$(NAME):INVALID-CONFIG") -} - # 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 DAQ off and # on again or running a full reset @@ -70,37 +63,52 @@ record(seq, "$(INSTR)$(NAME):REINIT-CONF") field(SELL, "$(INSTR)$(NAME):INVALID-CONFIG.VAL") } -# Important! The "$(INSTR)$(NAME):READALL" isn't configure with a SCAN. Instead, -# 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 -# counting to idle, without having updated the time and count values. -# -# 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") +################################################################################ +# Hardware Box Specific + +record(longin, "$(INSTR)$(NAME):CHANNELS") { - field(DESC, "Raw returned status value") - field(DTYP, "stream") - field(SCAN, "$(POLL_FREQ=.5 second)") - field(INP, "@$(PROTO) readStatus($(INSTR)$(NAME):) $(ASYN_PORT)") - field(FLNK, "$(INSTR)$(NAME):READALL") + field(DESC, "Total Supported Channels") + field(VAL, $(CHANNELS)) + field(DISP, 1) } +record(mbbi, "$(INSTR)$(NAME):PRESET_TYPE") +{ + field(DESC, "Type of Hardware Preset") + field(ZRVL, "0") + field(ZRST, "Unset") + field(ONVL, "1") + field(ONST, "Time") + field(TWVL, "2") + field(TWST, "Monitor") +} + +record(longin, "$(INSTR)$(NAME):WAIT_HW") +{ + field(DESC, "Internal Sent Start Count") +} + +record(stringin, "$(INSTR)$(NAME):MsgTxt") +{ + field(DESC, "Unexpected received response") + field(DTYP, "devDAQStringError") + field(FLNK, "$(INSTR)$(NAME):INVALID-CONFIG") +} + +################################################################################ +# System Status + record(bi, "$(INSTR)$(NAME):COUNTING_TIME") { - field(INP, "$(INSTR)$(NAME):RAW-STATUS.B0 NPP MS") + field(INP, "$(INSTR)$(NAME):RAW_STATUS.B0 NPP MS") field(ZNAM, "DISABLED") field(ONAM, "COUNTING") } record(bi, "$(INSTR)$(NAME):COUNTING_PRESET") { - field(INP, "$(INSTR)$(NAME):RAW-STATUS.B1 NPP MS") + field(INP, "$(INSTR)$(NAME):RAW_STATUS.B1 NPP MS") field(ZNAM, "DISABLED") field(ONAM, "COUNTING") } @@ -108,7 +116,7 @@ record(bi, "$(INSTR)$(NAME):COUNTING_PRESET") 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(INPA, "$(INSTR)$(NAME):RAW_STATUS.B2 NPP MS") field(CALC, "(A=$(RATE_OKAY_BIT))?0:1") } @@ -121,36 +129,15 @@ record(bi, "$(INSTR)$(NAME):IS_LOWRATE") record(bi, "$(INSTR)$(NAME):IS_PAUSED") { - field(INP, "$(INSTR)$(NAME):RAW-STATUS.B3 NPP MS") + field(INP, "$(INSTR)$(NAME):RAW_STATUS.B3 NPP MS") field(ZNAM, "RUNNING") field(ONAM, "PAUSED") } -record(longin, "$(INSTR)$(NAME):COUNT_STARTED") -{ - field(DESC, "Internal Sent Start Count") - field(VAL, 0) - field(PINI, "YES") -} - -record(calc, "$(INSTR)$(NAME):MAP-STATUS") -{ - field(DESC, "Maps Raw Status to State") - field(INPA, "$(INSTR)$(NAME):INVALID-CONFIG NPP MS") - field(INPB, "$(INSTR)$(NAME):RAW-STATUS.UDF NPP MS") # should also be invalid if can't read the status - field(INPC, "$(INSTR)$(NAME):COUNTING_TIME PP MS") - field(INPD, "$(INSTR)$(NAME):COUNTING_PRESET PP MS") - field(INPE, "$(INSTR)$(NAME):IS_LOWRATE PP MS") - field(INPF, "$(INSTR)$(NAME):IS_PAUSED PP MS") - field(INPG, "$(INSTR)$(NAME):COUNT_STARTED NPP MS") - field(CALC, "(A=1||B=1)?4:(F=1)?3:(C=0&&D=0&&G<=0)?0:(E=1)?2:1") - field(FLNK, "$(INSTR)$(NAME):STATUS") -} - record(mbbi, "$(INSTR)$(NAME):STATUS") { field(DESC, "DAQ Status") - field(INP, "$(INSTR)$(NAME):MAP-STATUS NPP MS") + field(INP, "$(INSTR)$(NAME):MAP_STATUS NPP MS") field(ZRVL, "0") field(ZRST, "Idle") field(ONVL, "1") @@ -162,7 +149,103 @@ record(mbbi, "$(INSTR)$(NAME):STATUS") # 4 should never happen, if it does it means the DAQ reports undocumented statusbits field(FRVL, "4") field(FRST, "INVALID") - field(FLNK, "$(INSTR)$(NAME):PRESET_TYPE_CLEAR") +} + +################################################################################ +# HW Commands + +record(dfanout,"$(INSTR)$(NAME):START") +{ + field(DESC, "clear, then trigger count") + field(SELM, "All") + field(OMSL, "closed_loop") + field(DOL, 1) + field(OUTA, "$(INSTR)$(NAME):T_HWC.PROC PP") + field(OUTB, "$(INSTR)$(NAME):CH_CLEAR.PROC PP") + field(FLNK, "$(INSTR)$(NAME):TRIGGER") +} + +record(bo,"$(INSTR)$(NAME):PAUSE") +{ + field(DESC, "Pause the current count") + field(DTYP, "stream") + field(OUT, "@$(PROTO) pauseCount($(INSTR)$(NAME):) $(ASYN_PORT)") + field(VAL, "0") + field(FLNK, "$(INSTR)$(NAME):HW_POLL_SEQ") +} + +record(bo,"$(INSTR)$(NAME):CONTINUE") +{ + field(DESC, "Continue with a count that was paused") + field(DTYP, "stream") + field(OUT, "@$(PROTO) continueCount($(INSTR)$(NAME):) $(ASYN_PORT)") + field(VAL, "0") + field(FLNK, "$(INSTR)$(NAME):HW_POLL_SEQ") +} + +record(longout, "$(INSTR)$(NAME):STOP") +{ + field(DESC, "Stop the current counting operation") + field(DTYP, "stream") + field(OUT, "@$(PROTO) stopCount($(INSTR)$(NAME):) $(ASYN_PORT)") + field(FLNK, "$(INSTR)$(NAME):HW_POLL_SEQ") +} + +################################################################################ +# Poll Loop + +record(bo, "$(INSTR)$(NAME):HW_POLL") +{ + field(OMSL, "closed_loop") + field(DOL, 1) + field(SCAN, "$(POLL_FREQ=.5 second)") + field(OUT, "$(INSTR)$(NAME):HW_POLL_SEQ.PROC") +} + +record(dfanout, "$(INSTR)$(NAME):HW_POLL_SEQ") +{ + field(DESC, "Time channel poll sequence") + field(SELM, "All") + field(OMSL, "closed_loop") + field(DOL, 1) + # This order is important, to ensure that the status + # can't change whichout having first updated the time + # and count records to their final values + field(OUTA, "$(INSTR)$(NAME):RAW_STATUS.PROC") + field(OUTB, "$(INSTR)$(NAME):READALL.PROC") + field(OUTC, "$(INSTR)$(NAME):MAP_STATUS.PROC") + field(OUTD, "$(INSTR)$(NAME):STATUS.PROC") + field(OUTE, "$(INSTR)$(NAME):PRESET_TYPE_CLEAR.PROC") + field(OUTF, "$(INSTR)$(NAME):T_PRESET_CLEAR.PROC") + field(OUTG, "$(INSTR)$(NAME):PRESET_CLEAR.PROC") + field(OUTH, "$(INSTR)$(NAME):CLEAR_WAIT_HW.PROC") +} + +# 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(DTYP, "stream") + field(INP, "@$(PROTO) readStatus($(INSTR)$(NAME):) $(ASYN_PORT)") +} + +record(calc, "$(INSTR)$(NAME):MAP_STATUS") +{ + field(DESC, "Maps Raw Status to State") + field(INPA, "$(INSTR)$(NAME):INVALID-CONFIG NPP MS") + field(INPB, "$(INSTR)$(NAME):RAW_STATUS.UDF NPP MS") # should also be invalid if can't read the status + field(INPC, "$(INSTR)$(NAME):COUNTING_TIME PP MS") + field(INPD, "$(INSTR)$(NAME):COUNTING_PRESET PP MS") + field(INPE, "$(INSTR)$(NAME):IS_LOWRATE PP MS") + field(INPF, "$(INSTR)$(NAME):IS_PAUSED PP MS") + field(INPG, "$(INSTR)$(NAME):WAIT_HW NPP MS") + field(CALC, "(A=1||B=1)?4:(F=1)?3:(C=0&&D=0&&G<=0)?0:(E=1)?2:1") } record(calcout, "$(INSTR)$(NAME):PRESET_TYPE_CLEAR") @@ -173,7 +256,6 @@ record(calcout, "$(INSTR)$(NAME):PRESET_TYPE_CLEAR") field(DOPT, "Use OCAL") field(OCAL, "0") field(OUT, "$(INSTR)$(NAME):PRESET_TYPE PP") - field(FLNK, "$(INSTR)$(NAME):T_PRESET_CLEAR") } record(calcout, "$(INSTR)$(NAME):T_PRESET_CLEAR") @@ -184,7 +266,6 @@ record(calcout, "$(INSTR)$(NAME):T_PRESET_CLEAR") field(DOPT, "Use OCAL") field(OCAL, "0") field(OUT, "$(INSTR)$(NAME):T_PRESET PP") - field(FLNK, "$(INSTR)$(NAME):PRESET_CLEAR") } record(calcout, "$(INSTR)$(NAME):PRESET_CLEAR") @@ -195,139 +276,78 @@ record(calcout, "$(INSTR)$(NAME):PRESET_CLEAR") field(DOPT, "Use OCAL") field(OCAL, "0") field(OUT, "$(INSTR)$(NAME):CH_PRESET_CLEAR PP") - field(FLNK, "$(INSTR)$(NAME):Z_COUNT_STARTED") } -record(calcout, "$(INSTR)$(NAME):Z_COUNT_STARTED") +record(calcout, "$(INSTR)$(NAME):CLEAR_WAIT_HW") { - field(INPA, "$(INSTR)$(NAME):COUNT_STARTED NPP") + field(INPA, "$(INSTR)$(NAME):WAIT_HW NPP") field(INPB, "$(INSTR)$(NAME):COUNTING_TIME NPP MS") field(INPC, "$(INSTR)$(NAME):COUNTING_PRESET NPP MS") field(CALC, "A") field(DOPT, "Use OCAL") field(OCAL, "(B||C)?0:A-1") field(OOPT, "When Non-zero") - field(OUT, "$(INSTR)$(NAME):COUNT_STARTED PP") -} - -record(longin, "$(INSTR)$(NAME):CHANNELS") -{ - field(DESC, "Total Supported Channels") - field(VAL, $(CHANNELS)) - field(DISP, 1) + field(OUT, "$(INSTR)$(NAME):WAIT_HW PP") } ################################################################################ -# Count Commands - -record(mbbi, "$(INSTR)$(NAME):PRESET_TYPE") -{ - field(DESC, "Type of Hardware Preset") - field(ZRVL, "0") - field(ZRST, "Unset") - field(ONVL, "1") - field(ONST, "Time") - field(TWVL, "2") - field(TWST, "Monitor") - field(VAL, 0) - field(PINI, "YES") -} - -record(bo,"$(INSTR)$(NAME):START") -{ - field(DESC, "Zero, then trigger") - field(FLNK, "$(INSTR)$(NAME):PREPARE") -} - -record(dfanout,"$(INSTR)$(NAME):PREPARE") -{ - field(DESC, "Zero channels") - field(SELM, "All") - field(OMSL, "supervisory") - # Elapsed Time - field(OUTA, "$(INSTR)$(NAME):T_HWC PP") - field(OUTB, "$(INSTR)$(NAME):CH_CLEAR PP") - field(FLNK, "$(INSTR)$(NAME):TRIGGER") -} +# Count Startup record(seq,"$(INSTR)$(NAME):TRIGGER") { - field(DESC, "Actually triggers sending start") - field(DO0, 1) - field(LNK0, "$(INSTR)$(NAME):PRESET-SOFT.PROC") - field(DO1, 1) - field(LNK1, "$(INSTR)$(NAME):PRESET-TIME.PROC") - field(DO2, 1) - field(LNK2, "$(INSTR)$(NAME):PRESET-COUNT.PROC") + field(DESC, "Start count according to PRESET_TYPE") field(SELM, "Specified") field(SELL, "$(INSTR)$(NAME):PRESET_TYPE NPP") - field(FLNK, "$(INSTR)$(NAME):O_COUNT_STARTED") + field(DO0, 1) + field(LNK0, "$(INSTR)$(NAME):PRESET_SOFT.PROC") + field(DO1, 1) + field(LNK1, "$(INSTR)$(NAME):PRESET_TIME.PROC") + field(DO2, 1) + field(LNK2, "$(INSTR)$(NAME):PRESET_COUNT.PROC") + field(FLNK, "$(INSTR)$(NAME):SET_WAIT_HW") } -record(longout, "$(INSTR)$(NAME):O_COUNT_STARTED") -{ - field(OMSL, "closed_loop") - field(DOL, 5) - field(OUT, "$(INSTR)$(NAME):COUNT_STARTED PP") -} - -record(ao, "$(INSTR)$(NAME):PRESET-SOFT") +record(ao, "$(INSTR)$(NAME):PRESET_SOFT") { field(DESC, "Count forever :)") field(OMSL, "closed_loop") field(DOL, "15768000") # Half a year :) - field(OUT, "$(INSTR)$(NAME):T_PRESET") - field(FLNK, "$(INSTR)$(NAME):PRESET-TIME") + field(OUT, "$(INSTR)$(NAME):T_PRESET") + field(FLNK, "$(INSTR)$(NAME):PRESET_TIME") } -record(ao,"$(INSTR)$(NAME):PRESET-TIME") +record(ao,"$(INSTR)$(NAME):PRESET_TIME") { field(DESC, "Count for specified time") field(DTYP, "stream") field(OMSL, "closed_loop") field(DOL, "$(INSTR)$(NAME):T_PRESET NPP") - field(OUT, "@$(PROTO) startWithTimePreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") + field(OUT, "@$(PROTO) startWithTimePreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") field(PREC, 2) - field(EGU, "seconds") - field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") + field(EGU, "seconds") + field(FLNK, "$(INSTR)$(NAME):HW_POLL_SEQ") } -record(ao,"$(INSTR)$(NAME):PRESET-COUNT") +record(ao,"$(INSTR)$(NAME):PRESET_COUNT") { field(DESC, "Count until preset reached") field(DTYP, "stream") field(OMSL, "closed_loop") field(DOL, "$(INSTR)$(NAME):CH_PRESET PP") - field(OUT, "@$(PROTO) startWithCountPreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") + field(OUT, "@$(PROTO) startWithCountPreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") field(PREC, 0) - field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") + field(FLNK, "$(INSTR)$(NAME):HW_POLL_SEQ") } -record(bo,"$(INSTR)$(NAME):PAUSE") +record(longout, "$(INSTR)$(NAME):SET_WAIT_HW") { - field(DESC, "Pause the current count") - field(DTYP, "stream") - field(OUT, "@$(PROTO) pauseCount($(INSTR)$(NAME):) $(ASYN_PORT)") - field(VAL, "0") - field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") + field(OMSL, "closed_loop") + field(DOL, 5) + field(OUT, "$(INSTR)$(NAME):WAIT_HW PP") } -record(bo,"$(INSTR)$(NAME):CONTINUE") -{ - field(DESC, "Continue with a count that was paused") - field(DTYP, "stream") - field(OUT, "@$(PROTO) continueCount($(INSTR)$(NAME):) $(ASYN_PORT)") - field(VAL, "0") - field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") -} - -record(longout, "$(INSTR)$(NAME):STOP") -{ - field(DESC, "Stop the current counting operation") - field(DTYP, "stream") - field(OUT, "@$(PROTO) stopCount($(INSTR)$(NAME):) $(ASYN_PORT)") - field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") -} +################################################################################ +# Hardware Lowrate Threshold record(ao,"$(INSTR)$(NAME):THRESHOLD") { @@ -368,14 +388,14 @@ record(longin,"$(INSTR)$(NAME):THRESHOLD-MONITOR_RBV") field(DTYP, "stream") field(SCAN, "1 second") field(EGU, "CH") - field(FLNK, "$(INSTR)$(NAME):THRESHOLD-MONITOR-FLNK") + field(FLNK, "$(INSTR)$(NAME):THR_MONITOR_PROCESS") } -record(calcout, "$(INSTR)$(NAME):THRESHOLD-MONITOR-FLNK") +record(calcout, "$(INSTR)$(NAME):THR_MONITOR_PROCESS") { field(DESC, "Only process Threshold when Non-Zero") - field(CALC, "A") field(INPA, "$(INSTR)$(NAME):THRESHOLD-MONITOR_RBV") + field(CALC, "A") field(OOPT, "When Non-zero") field(OUT, "$(INSTR)$(NAME):THRESHOLD_RBV.PROC PP") } @@ -388,5 +408,4 @@ record(ai, "$(INSTR)$(NAME):READALL") field(DESC, "Reads monitors and elapsed time") field(INP, "@$(PROTO) readAll$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") field(DTYP, "stream") - field(FLNK, "$(INSTR)$(NAME):MAP-STATUS") }