adds a POC preset based count

This commit is contained in:
2025-10-31 13:23:55 +01:00
parent b9e5f40c21
commit 1e853487aa
6 changed files with 460 additions and 62 deletions
+95 -1
View File
@@ -3,9 +3,93 @@
# Macros
# INSTR - Prefix
# NAME - the device name, e.g. EL737
# PORT - Stream Generator Port
# PORT - StreamGenerator Port
# CHANNEL - the number associated with the measurment channel
################################################################################
# Status Variables
# # Trigger a change in status as clearing
# record(bo, "$(INSTR)$(NAME):T$(CHANNEL)")
# {
# field(DESC, "Trigger Clearing Status")
# field(VAL, 1)
# field(OUT, "$(INSTR)$(NAME):S$(CHANNEL) PP")
# }
#
# # Trigger a change in status as value returned to 0
# record(seq, "$(INSTR)$(NAME):O$(CHANNEL)")
# {
# field(DESC, "Trigger Returned to 0 Status")
# field(LNK0, "$(INSTR)$(NAME):S$(CHANNEL) PP")
# field(DO0, 0)
# field(SELM, "Specified")
# field(SELL, "$(INSTR)$(NAME):M$(CHANNEL).VAL")
# }
#
# # Current Status of Channel, i.e. is it ready to count?
# record(bi, "$(INSTR)$(NAME):S$(CHANNEL)")
# {
# field(DESC, "Channel Status")
# field(VAL, 0)
# field(ZNAM, "OK")
# field(ONAM, "CLEARING")
# }
################################################################################
# Count Commands
# # Unfortunately, clearing the channels is somewhat complicated as a result of
# # the addition of more channels over time and minimal changes to the underlying interface
# #
# # Urs Greuter provided the following explanation:
# #
# # bei den Befehlen CC r und HC r ist der Parameter r als bit-Maske zu verstehen:
# #
# # Bit0: Zähler Channel 1
# # Bit2: Zähler Channel 2
# # Bit3: Zähler Channel 3
# # Bit4: Zähler Channel 4
# # Bit5: Zähler Channel Timer
# # Bit6: Zähler Channel 5
# # Bit7: Zähler Channel 6
# # Bit8: Zähler Channel 7
# # Bit9: Zähler Channel 8
# #
# # Beispiele:
# # CC 1 setzt den Zähler des Channels 1 zurück
# # CC 4 setzt den Zähler des Channels 3 zurück
# # CC 5 setzt gleichzeitig die Zähler der Channels 1 und 3 zurück
# # CC 16 ist gleichbedeutend wie CT (Timer zurücksetzen)
# # CC 511 setzt gleichzeitig die Zähler aller Kanäle (auch des Timers) zurück.
#
# record(calc, "$(INSTR)$(NAME):BM$(CHANNEL)")
# {
# field(DESC, "Bit Mask for Channel")
# field(INPA, $(CHANNEL))
# field(CALC, "A > 4 ? 2 ^ A : 2 ^ (A-1)")
# field(PINI, "YES")
# }
#
# record(longout, "$(INSTR)$(NAME):C$(CHANNEL)")
# {
# field(DESC, "Clear the current channel count")
# field(DTYP, "stream")
# field(OMSL, "closed_loop")
# field(DOL, "$(INSTR)$(NAME):BM$(CHANNEL) NPP")
# field(OUT, "@... clearChannel($(INSTR)$(NAME):) $(PORT)")
# field(FLNK, "$(INSTR)$(NAME):T$(CHANNEL)")
# }
#
# record(ao,"$(INSTR)$(NAME):THRESH$(CHANNEL)")
# {
# field(DESC, "Sets min rate for counting to proceed")
# field(OMSL, "supervisory")
# field(OROC, "0")
# field(OUT, "@... setMinRate($(INSTR)$(NAME):, $(CHANNEL)) $(PORT)")
# field(DTYP, "stream")
# }
################################################################################
# Read all monitors values
@@ -15,6 +99,16 @@ record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
field(EGU, "cts")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),0,$(TIMEOUT=1)) COUNTS$(CHANNEL)")
# This is probably too fast. We could trigger things the same as sinqDAQ to ensure the db is update in the same order
field(SCAN, "I/O Intr")
field(PINI, "YES")
}
# record(ai, "$(INSTR)$(NAME):R$(CHANNEL)")
# {
# field(DESC, "Rate of DAQ CH$(CHANNEL)")
# field(INP, "@... readRate($(INSTR)$(NAME):, $(CHANNEL)) $(PORT)")
# field(DTYP, "stream")
# field(EGU, "cts/sec")
# field(SCAN, "1 second")
# }
+212
View File
@@ -0,0 +1,212 @@
# EPICS Database for streamdevice specific to measurement channels
#
# Macros
# INSTR - Prefix
# NAME - the device name, e.g. EL737
# PORT - StreamGenerator Port
record(longout, "$(INSTR)$(NAME):FULL-RESET")
{
field(DESC, "Reset the DAQ")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),0,$(TIMEOUT=1)) RESET")
}
################################################################################
# Status Variables
# record(stringin, "$(INSTR)$(NAME):MsgTxt")
# {
# field(DESC, "Unexpected received response")
# field(DTYP, "devDAQStringError")
# field(FLNK, "$(INSTR)$(NAME):INVALID-CONFIG")
# }
record(mbbi, "$(INSTR)$(NAME):STATUS")
{
field(DESC, "DAQ Status")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),0,$(TIMEOUT=1)) 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")
# This is probably too fast. We could trigger things the same as sinqDAQ to ensure the db is update in the same order
field(SCAN, "I/O Intr")
field(PINI, "YES")
}
record(longin, "$(INSTR)$(NAME):CHANNELS")
{
field(DESC, "Total Supported Channels")
field(VAL, $(CHANNELS))
field(DISP, 1)
}
# # Trigger a change in status as clearing
# record(bo, "$(INSTR)$(NAME):ETT")
# {
# field(DESC, "Trigger Clearing Status")
# field(VAL, 1)
# field(OUT, "$(INSTR)$(NAME):ETS PP")
# }
#
# # Trigger a change in status as value returned to 0
# record(seq, "$(INSTR)$(NAME):ETO")
# {
# field(DESC, "Trigger Returned to 0 Status")
# field(LNK0, "$(INSTR)$(NAME):ETS PP")
# field(DO0, 0)
# field(SELM, "Specified")
# field(SELL, "$(INSTR)$(NAME):ELAPSED-TIME.VAL")
# }
#
# # Current Status of Channel, i.e. is it ready to count?
# record(bi, "$(INSTR)$(NAME):ETS")
# {
# field(DESC, "Channel Status")
# field(VAL, 0)
# field(ZNAM, "OK")
# field(ONAM, "CLEARING")
# }
################################################################################
# Count Commands
record(ao,"$(INSTR)$(NAME):PRESET-COUNT")
{
field(DESC, "Count until preset reached")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),0,$(TIMEOUT=1)) P_CNT")
field(VAL, 0)
field(PREC, 2)
}
# record(ao,"$(INSTR)$(NAME):PRESET-TIME")
# {
# field(DESC, "Count for specified time")
# field(DTYP, "stream")
# field(OUT, "@... startWithTimePreset$(CHANNELS)($(INSTR)$(NAME):) $(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, "@... pauseCount($(INSTR)$(NAME):) $(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, "@... continueCount($(INSTR)$(NAME):) $(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, "@... stopCount($(INSTR)$(NAME):) $(PORT)")
# field(FLNK, "$(INSTR)$(NAME):RAW-STATUS")
# }
record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
{
field(DESC, "PRESET-COUNT Monitors this channel")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),0,$(TIMEOUT=1)) MONITOR")
field(DRVL, "1") # Smallest Monitor Channel
field(DRVH, "$(CHANNELS)") # Largest Monitor Channel
}
record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
{
field(DESC, "PRESET-COUNT Monitors this channel")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),0,$(TIMEOUT=1)) MONITOR")
field(SCAN, "I/O Intr")
field(PINI, "YES")
}
# 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")
# }
#
# record(ao,"$(INSTR)$(NAME):THRESHOLD")
# {
# 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")
# field(OUT, "$(INSTR)$(NAME):THRESHOLD-F PP")
# }
#
# record(ai,"$(INSTR)$(NAME):THRESHOLD_RBV")
# {
# field(DESC, "Minimum rate for counting to proceed")
# field(INP, "@... readMinRate($(INSTR)$(NAME):) $(PORT)")
# field(DTYP, "stream")
# field(SCAN, "1 second")
# field(EGU, "cts/sec")
# }
#
# record(longout,"$(INSTR)$(NAME):THRESHOLD-MONITOR")
# {
# field(DESC, "Channel monitored for minimum rate")
# field(VAL, "1") # Monitor
# field(DRVL, "0") # Smallest Threshold Channel (0 is off)
# field(DRVH, "$(CHANNELS)") # Largest Threshold Channel
# field(OUT, "@... setRateMonitor($(INSTR)$(NAME):) $(PORT)")
# field(DTYP, "stream")
# }
#
# record(longin,"$(INSTR)$(NAME):THRESHOLD-MONITOR_RBV")
# {
# field(DESC, "Channel monitored for minimum rate")
# field(INP, "@... readRateMonitor($(INSTR)$(NAME):) $(PORT)")
# field(DTYP, "stream")
# field(SCAN, "1 second")
# field(EGU, "CH")
# }
#
# record(longout, "$(INSTR)$(NAME):CT")
# {
# field(DESC, "Clear the timer")
# field(DTYP, "stream")
# field(OUT, "@... clearTimer($(INSTR)$(NAME):) $(PORT)")
# field(FLNK, "$(INSTR)$(NAME):ETT")
# }
################################################################################
# Read all monitors values
# record(ai,"$(INSTR)$(NAME):ELAPSED-TIME")
# {
# field(DESC, "DAQ Measured Time")
# field(EGU, "sec")
# field(FLNK, "$(INSTR)$(NAME):ETO")
# }