#--- Device info ------------------------
record(stringout, "RADM:SYS0:$(U):LOCATION") {
    field(DESC, "Device location")
    field(VAL,  "Tunnel")
    field(PINI, "1")
    info(autosaveFields, "VAL")
}

record(mbbo, "RADM:SYS0:$(U):TYPE") {
    field(DESC, "Device type")
    field(ZRVL, "0")
    field(ZRST, "Thermo FHT")
    field(ONVL, "1")
    field(ONST, "RadFET")
    field(TWVL, "2")
    field(TWST, "Air Mon Sys")
    field(THVL, "3")
    field(THST, "Periphal Mon Sys")
    field(FRVL, "4")
    field(FRST, "714 Gamma Detector")
    field(VAL,  "4")
    field(PINI, "1")
    info(autosaveFields, "VAL")
}

#
# Janice Nelson 22 Sep 2021
#
# Decarad database for signals from central chassis & per system
#
# ask jlab how quickly update and let that inform your archiver settings

record(ai, "RADM:SYS0:$(U):POSN") {
    field(DESC,"Numeric value of rack position")
    field(PREC,"0")
    field(HOPR,"40")
    field(LOPR,"0")
    field(HIGH, "40")
    field(HIHI, "41")
    field(LOW, "0")
    field(LOLO, "-1")
    field(EGU, "CM#")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST VAL")
}

record(ai,"RADM:SYS0:$(U):DEV_FW") {
    field(DESC,"Firmware number")
    field(DTYP,"stream")
    field(INP,"@decarad.proto de_in1 $(PORT)")
}

record(longin,"RADM:SYS0:$(U):HEARTBEAT") {
    field(DESC,"Heartbeat")
    field(DTYP,"stream")
    field(INP,"@decarad.proto de_in2 $(PORT)")
}

#Janice look this up
record(bi,"RADM:SYS0:$(U):HVSTATUS") {
    field(DTYP,"stream")
    field(INP,"@decarad.proto de_in3 $(PORT)")
    field(ZNAM,"ON")
    field(ONAM,"OFF")
}

#Janice double check eguf egul aoff eslo etc
record(ai,"RADM:SYS0:$(U):CHAS_TEMP") {
    field(DTYP,"stream")
    field(DESC,"Temperature of decarad")
    field(INP,"@decarad.proto de_in4 $(PORT)")
    field(PREC,"2")
    field(LINR,"LINEAR")
#    field(EGUF,"500")
#    field(EGUL,"0")
    field(AOFF,"0")
    field(ASLO,"0.1221")
    field(EGU,"degC")
}

record(ai,"RADM:SYS0:$(U):HVMON") {
    field(DTYP,"stream")
    field(DESC,"Readback of HV")
    field(INP,"@decarad.proto de_in5 $(PORT)")
    field(PREC,"2")
    field(LINR,"LINEAR")
    field(EGUF,"5000")
    field(EGUL,"0")
    field(AOFF,"0")
    field(ESLO,"1.221")
    field(HIGH,"650")
    field(HIHI,"651")
    field(LOW,"380")
    field(LOLO,"379")
    field(EGU,"V")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST")
}

record(bo,"RADM:SYS0:$(U):HVCTRL") {
    field(DTYP,"stream")
    field(DESC,"0 on 1 off")
    field(OUT,"@decarad.proto de_out3 $(PORT)")
    field(ZNAM, "On")
    field(ONAM, "Off")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}

#
# Sequence to trigger PV processing
#
record(seq,"RADM:SYS0:$(U):SEQ") {
    field(DESC,"Sequence to trigger PV processing")
    field(DLY0, "0.06")
    field(DLY1, "0.06")
    field(DLY2, "0.06")
    field(DLY3, "0.06")
    field(DLY4, "0.06")
    field(DLY5, "0.06")
    field(DLY6, "0.06")
    field(DLY7, "0.06")
    field(DLY8, "0.06")
    field(DLY9, "0.06")
    field(DLYA, "0.06")
    field(DLYB, "0.06")
    field(DLYC, "0.06")
    field(DLYD, "0.06")
    field(DLYE, "0.06")
    field(DOL0, "1")
    field(DOL1, "1")
    field(DOL2, "1")
    field(DOL3, "1")
    field(DOL4, "1")
    field(DOL5, "1")
    field(DOL6, "1")
    field(DOL7, "1")
    field(DOL8, "1")
    field(DOL9, "1")
    field(DOLA, "1")
    field(DOLB, "1")
    field(DOLC, "1")
    field(DOLD, "1")
    field(DOLE, "1")
    field(LNK0,"RADM:SYS0:$(U):01:GAMMA_DOSE_RATE.PROC")
    field(LNK1,"RADM:SYS0:$(U):02:GAMMA_DOSE_RATE.PROC")
    field(LNK2,"RADM:SYS0:$(U):03:GAMMA_DOSE_RATE.PROC")
    field(LNK3,"RADM:SYS0:$(U):04:GAMMA_DOSE_RATE.PROC")
    field(LNK4,"RADM:SYS0:$(U):05:GAMMA_DOSE_RATE.PROC")
    field(LNK5,"RADM:SYS0:$(U):06:GAMMA_DOSE_RATE.PROC")
    field(LNK6,"RADM:SYS0:$(U):07:GAMMA_DOSE_RATE.PROC")
    field(LNK7,"RADM:SYS0:$(U):08:GAMMA_DOSE_RATE.PROC")
    field(LNK8,"RADM:SYS0:$(U):09:GAMMA_DOSE_RATE.PROC")
    field(LNK9,"RADM:SYS0:$(U):10:GAMMA_DOSE_RATE.PROC")
    field(LNKA,"RADM:SYS0:$(U):DEV_FW.PROC")
    field(LNKB,"RADM:SYS0:$(U):HEARTBEAT.PROC")
    field(LNKC,"RADM:SYS0:$(U):CHAS_TEMP.PROC")
    field(LNKD,"RADM:SYS0:$(U):HVMON.PROC")
    field(LNKE,"RADM:SYS0:$(U):HVSTATUS.PROC")
    field(SCAN,"1 second")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):01:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in11 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):01:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):01:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):01:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):01:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):01:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):01:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):01:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):02:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in12 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):02:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):02:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):02:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):02:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):02:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):02:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):02:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):03:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in13 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):03:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):03:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):03:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):03:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):03:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):03:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):03:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):04:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in14 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):04:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):04:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):04:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):04:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):04:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):04:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):04:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):05:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in15 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):05:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):05:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):05:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):05:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):05:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):05:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):05:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):06:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in16 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):06:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):06:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):06:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):06:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):06:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):06:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):06:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):07:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in17 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):07:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):07:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):07:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):07:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):07:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):07:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):07:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):08:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in18 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):08:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):08:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):08:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):08:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):08:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):08:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):08:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):09:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in19 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):09:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):09:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):09:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):09:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):09:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):09:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):09:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
#
# Janice Nelson 24 Sept 2021
#
# Support for individual decarad channels
#

# readout of the rad value
record(ai,"RADM:SYS0:$(U):10:GAMMA_DOSE_RATE") {
    field(DTYP,"stream")
    field(DESC,"Dose Rate Readout")
    field(INP,"@decarad.proto de_in20 $(PORT)")
    field(EGU,"mR/hr")
    field(PREC,"1")
    field(HIGH,"50")
    field(HIHI,"300")
    field(FLNK, "RADM:SYS0:$(U):10:GAMMAHST")
    info(autosaveFields, "LOLO LOW HIGH HIHI LLSV LSV HSV HHSV HYST HOPR LOPR")
}

# record to grab the last n samples of the dose rate in a circ buffer
record(compress,"RADM:SYS0:$(U):10:GAMMAHST") {
    field(DESC, "circular buffer for gamma")
    field(INP, "RADM:SYS0:$(U):10:GAMMA_DOSE_RATE")
    field(ALG, "Circular Buffer")
    field(NSAM, "10")
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    field(FLNK, "RADM:SYS0:$(U):10:GAMMAAVE")
    info(autosaveFields, "HOPR LOPR")
}

# record to average the values in the circ buffer
record(compress, "RADM:SYS0:$(U):10:GAMMAAVE") {
    field(DESC, "ave of gamma circ buffer")
    field(INP, "RADM:SYS0:$(U):10:GAMMAHST")
    field(ALG, "N to 1 Average")
    field(NSAM, "1")
# this should equal the NSAM of the circ buffer
    field(N, "10") # this should equal the NSAM of the circ buffer
    field(HOPR, "50")
    field(LOPR, "0")
    field(EGU, "mR/hr")
    field(PREC, "1")
    info(autosaveFields, "HOPR LOPR")
}

record(stringout,"RADM:SYS0:$(U):10:POSN") {
    field(DTYP,"Soft Channel")
    field(DESC,"Position of decarad head")
    field(PINI, "YES")
    info(autosaveFields, "VAL")
}
