Files
camini/db/sumIO.db
2025-11-04 13:55:29 +01:00

121 lines
3.4 KiB
Plaintext

# sumIO.db, SW impl. of protoncurrent averaging and interface with camini and NICOS
#
# The following PVs is indirectly required by camini, they have to first be
# mapped to EpicsReadable devices.
# $(P)THRES
# $(P)BEAMCOPY
# These could be renamed if corresponding NICOS setup files are adapted.
#
# The following PVs are expected to exists by the BeamOracle device in NICOS.
# This device only take $(P) as input, so the name-suffix has to be exact unless
# the BeamOracle device is modified/updated.
# $(P)SWITCH
# $(P)ACCINT
# $(P)ACCTIME
# $(P)BEAMAVG
#
# This DB also provides a macro $(AI) that used to forward the beam valid signal.
# For camini this is used to forward the value to the $(P)CAMINI:AUX PV.
#
#################################
# Comments from original author:
# This code integrates the beam intensity signal during the
# time where the integration is activated (SWITCH = 1)
# and the camera is acquiring (SHUTTER = 0). It also counts
# the time during which the integration occured to compute
# the average intensity. This average intensity is compared
# to a threshold to indicate the camera whether the exposure
# is sufficient.
##################################
# this is a switch which can be set to activate/deactivate the counting
record(bi, "$(P)SWITCH") {
field(DTYP,"Soft Channel")
field(ZNAM,"Low")
field(ONAM,"High")
# Enable by default, until we have something to interface with
field(VAL, 0)
}
# This is an accumulator for the beam intensity integral
record(ai, "$(P)ACCINT") {
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
# This is an accumulator for the exposure time
record(ai, "$(P)ACCTIME"){
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
# This is the threshold for acceptable intensity
record(ai, "$(P)THRES") {
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
# This record keeps the last average value
record(ai, "$(P)LASTAVG") {
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
# This is a record to hold a copy of the HIPA proton beam intensity
record(ai, "$(P)BEAMCOPY") {
field(SCAN, "1 second")
field(DTYP, "Soft Channel")
field(INP, "$(AI)")
}
# This record computes the total exposure time
# (gated by the SWITCH and SHUTTER signals)
record(calcout, "$(P)EXPTIME") {
field(SCAN,".1 second")
field(INPA,"$(AI)")
field(INPB,"$(P)SWITCH")
field(INPC,"$(CAM)SHUTTER")
field(INPD,"$(P)ACCTIME")
field(CALC,"(B >= 1) AND (C = 0)? D + 0.1 : D")
field(OUT,"$(P)ACCTIME PP")
field(OOPT,"On Change")
field(DOPT,"Use CALC")
}
# This record computes the integral of the beam intensity
# (gated by the SWITCH and SHUTTER signals)
record(calcout, "$(P)BEAMINT") {
field(SCAN,".1 second")
field(INPA,"$(AI)")
field(INPB,"$(P)SWITCH")
field(INPC,"$(CAM)SHUTTER")
field(INPD,"$(P)ACCINT")
field(CALC,"(B >= 1) AND (C = 0)? D + 0.1*A : D")
field(OUT,"$(P)ACCINT PP")
field(OOPT,"On Change")
field(DOPT,"Use CALC")
field(FLNK, "$(P)BEAMAVG")
}
# This record computes the average beam intensity
record(calcout, "$(P)BEAMAVG") {
field(INPA,"$(P)EXPTIME")
field(INPB,"$(P)BEAMINT")
field(INPC,"$(P)LASTAVG")
field(CALC,"A > 0 ? B/A : C")
field(OUT,"$(P)LASTAVG PP")
field(OOPT,"On Change")
field(DOPT,"Use CALC")
field(FLNK, "$(P)AUX")
}
# This record compares the average intensity to the threshold
record(calcout, "$(P)AUX") {
field(INPA,"$(P)BEAMAVG")
field(INPB,"$(P)THRES")
field(CALC,"A >= B ? 1 : 0")
field(OUT,"$(CAM)AUX PP")
field(DOPT,"Use CALC")
}