diff --git a/db/daq_soft_proton.db b/db/daq_soft_proton.db new file mode 100644 index 0000000..cc3a52c --- /dev/null +++ b/db/daq_soft_proton.db @@ -0,0 +1,186 @@ +# EPICS database for counterbox-like interface using proton current, +# as retrieved via network from HIPA. +# +# This is created to be able reuse the SinqDAQ interface +# in Nicos, to avoid having more code to maintain there. + +record(mbbi, "$(INSTR)$(NAME):STATUS") +{ + field(DESC, "DAQ Status") + field(ZRVL, "0") + field(ZRST, "Idle") + field(ONVL, "1") + field(ONST, "Counting") + field(TWVL, "2") + field(TWST, "Low rate") + field(THVL, "3") + field(THST, "Paused") + # 4 should never happen, if it does it means the DAQ reports undocumented statusbits + field(FRVL, "4") + field(FRST, "INVALID") +} + +record(longin, "$(INSTR)$(NAME):CHANNELS") +{ + field(DESC, "Total Supported Channels") + field(VAL, $(CHANNELS=1)) + field(DISP, 1) +} + +record(longout, "$(INSTR)$(NAME):FULL-RESET") +{ + field(DESC, "Reset the DAQ") + field(OUT, "@$(PROTO) fullReset($(INSTR)$(NAME):) $(ASYN_PORT)") + field(DTYP, "stream") +} + +record(stringin, "$(INSTR)$(NAME):MsgTxt") +{ + field(DESC, "Miscellanous messages") +} +################################################################################ +# Count Commands + +record(ao,"$(INSTR)$(NAME):PRESET-COUNT") +{ + field(DESC, "Count until preset reached") + field(DTYP, "stream") + field(OUT, "@$(PROTO) startWithCountPreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") + field(VAL, 0) + field(PREC, 2) + field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") +} + +record(ao,"$(INSTR)$(NAME):PRESET-TIME") +{ + field(DESC, "Count for specified time") + field(DTYP, "stream") + field(OUT, "@$(PROTO) startWithTimePreset$(CHANNELS)($(INSTR)$(NAME):) $(ASYN_PORT)") + field(VAL, 0) + field(PREC, 2) + field(EGU, "seconds") + field(FLNK, "$(INSTR)$(NAME):RAW-STATUS") +} + +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):RAW-STATUS") +} + +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") +} + +record(longout,"$(INSTR)$(NAME):THRESHOLD-MONITOR") +{ + # Alias to RBV to be compatible with higher level interface + alias("$(INSTR)$(NAME):THRESHOLD-MONITOR_RBV") + field(DESC, "Channel monitored for minimum rate") + field(VAL, "1") # Monitor + field(DRVL, "0") # Smallest Threshold Channel (0 is off) + field(DRVH, "$(CHANNELS=1)") # Largest Threshold Channel + field(DTYP, "stream") +} + +record(ao,"$(INSTR)$(NAME):THRESHOLD") +{ + # Alias to RBV to be compatible with higher level interface + alias("$(INSTR)$(NAME):THRESHOLD_RBV") + field(DESC, "Minimum rate for counting to proceed") + field(VAL, "1") # Default Rate + # Could perhaps still be improved. + # It seems to only accept whole counts? + field(DRVL, "1") # Minimum Rate + field(DRVH, "100000") # Maximum Rate + field(OMSL, "supervisory") + field(OROC, "0") +} + +record(ai,"$(INSTR)$(NAME):ELAPSED-TIME") +{ + field(DESC, "DAQ Measured Time") + field(EGU, "sec") + field(FLNK, "$(INSTR)$(NAME):ETO") +} + +# Subroutine record which emulates the counterbox functionality +record(sub, "$(INSTR)$(NAME):EMULATION") +{ + field(SCAN, "0.1 seconds" + field(INAM, "InitEmulatedCounter") + field(SNAM, "ProcessEmulatedCounter" + field(INPA, "$(INSTR)$(NAME):STATUS") + field(INPB, "$(INSTR)$(NAME):M$(CHANNEL=0)") + field(INPC, "$(INSTR)$(NAME):ELAPSED-TIME") + field(INPD, "$(INSTR)$(NAME):R$(CHANNEL=0) PP") + field(INPE, "$(INSTR)$(NAME):PRESET-COUNT") + field(INPF, "$(INSTR)$(NAME):PRESET-TIME") + field(INPG, "$(INSTR)$(NAME):PAUSE") + field(INPH, "$(INSTR)$(NAME):CONTINUE") + field(INPI, "$(INSTR)$(NAME):STOP") + + field(OUTA, "$(INSTR)$(NAME):STATUS PP") + field(OUTB, "$(INSTR)$(NAME):M$(CHANNEL=0) PP") + field(OUTC, "$(INSTR)$(NAME):ELAPSED-TIME PP") +} + +####################### +# Channel interface +####################### +record(int64in, "$(INSTR)$(NAME):M$(CHANNEL=0)") +{ + field(DESC, "DAQ CH$(CHANNEL=0)") + field(EGU, "cts") +} + +record(calc, "$(INSTR)$(NAME):R$(CHANNEL=0)") +{ + field(DESC, "Rate of DAQ CH$(CHANNEL=0)") + field(INPA, "$(REMOTE_RATE_PV) CA" + field(INPB, "$(SHUTTER1_PV=0)") + field(INPC, "$(SHUTTER1_CLOSED_VAL=1)" + field(INPD, "$(SHUTTER2_PV=0)") + field(INPE, "$(SHUTTER2_CLOSED_VAL=1)") + # If either shutter is closed we have no rate + field(CALC, "B != C && D != E ? A : 0") + field(EGU, "cts/sec") +} + +# Clear channel, has to be calcout due to client +# writing 1 to it. +record(calcout, "$(INSTR)$(NAME):C$(CHANNEL=0)") +{ + field(DESC, "Clear the current channel count") + field(OOPT, "Every Time") + field(DOPT, "Use OCAL") + field(OCAL, "0") + field(OUT, "$(INSTR)$(NAME):M$(CHANNEL=0) PP" +} + +# Current Status of Channel, i.e. is it ready to count? +# This is probbably only need to satify the interface. +record(bi, "$(INSTR)$(NAME):S$(CHANNEL=0)") +{ + field(DESC, "Channel Status") + field(VAL, 0) + field(ZNAM, "OK") + field(ONAM, "CLEARING") +} +