This repository has been archived on 2025-11-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SinqProtonCurrent/db/protoncurrent.db

123 lines
3.2 KiB
Plaintext

# A collection of records which can be used to integrate the proton
# signal coming from HIPA. Please see ../README.md for examples on how to use
# them.
# The individual records are described below.
#
# Macros
# P - Prefix
# AI - HIPA Beam Current PV
# GATE - (optional) second gating PV
# Switch to activate / deactivate the following records:
# - $(P)BEAMINT: Used to integrate the proton count over time
# - $(P)COUNTTIME: Used to compute the count time.
# Setting this record to 1 starts integration of the proton signal, setting it
# to zero stops it.
record(bi, "$(P)SWITCH")
{
field(DESC, "Gates signal intensity measurement")
field(DTYP, "Soft Channel")
field(ZNAM, "Low")
field(ONAM, "High")
}
record(bi, "$(P)SHUTTER")
{
field(DESC, "Optional extra gate for e.g. Camera")
field(DTYP, "Soft Channel")
field(ZNAM, "High")
field(ONAM, "Low")
field(INP, "$(GATE=0) CP")
field(SCAN, "Passive")
}
record(ai, "$(P)BEAMCPY")
{
field(DESC, "Copy of $(AI)")
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
field(INP, "$(AI) CP")
field(SCAN, "Passive")
}
# This record reports the time since the start of the proton count integration.
# This record is populated from $(P)COUNTTIME and only meant to be read.
record(ai, "$(P)ACCTIME")
{
field(DESC, "Beam time accumulator")
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
record(calcout, "$(P)COUNTTIME")
{
field(DESC, "Computes Exposure Time")
field(SCAN, ".1 second")
field(INPA, "$(AI)")
field(INPB, "$(P)SWITCH")
field(INPC, "$(P)SHUTTER")
field(INPD, "$(P)ACCTIME")
field(CALC, "(B >= 1 && C == 0) ? D + 0.1 : D")
field(OUT, "$(P)ACCTIME PP")
field(OOPT, "On Change")
field(DOPT, "Use CALC")
}
# Integral proton count. This record is populated from $(P)BEAMINT and only
# meant to be read. It is reset once the preset has been reached.
record(ai, "$(P)ACCINT")
{
field(DESC, "Beam intensity accumulator")
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
}
record(calcout, "$(P)BEAMINT")
{
field(DESC, "Computes Beam Intensity")
field(SCAN, "Passive")
field(INPA, "$(AI) CP")
field(INPB, "$(P)SWITCH")
field(INPC, "$(P)SHUTTER")
field(INPD, "$(P)ACCINT")
field(CALC, "(B >= 1 && C = 0) ? D + A : D")
field(OUT, "$(P)ACCINT PP")
field(OOPT, "On Change")
field(DOPT, "Use CALC")
field(FLNK, "$(P)PRESET-COUNTER")
}
# Preset value for the proton count. When the integral proton count stored in
# $(P)ACCINT reaches this value, the integration is stopped.
record(ai, "$(P)PRESET")
{
field(DESC, "max intensity count preset")
field(DTYP, "Soft Channel")
field(LINR, "LINEAR")
field(VAL, 0)
}
record(calcout, "$(P)PRESET-COUNTER")
{
field(DESC, "auto stops measurement at preset")
field(SCAN, "Passive")
field(INPA, "$(P)BEAMINT")
field(INPB, "$(P)SWITCH")
field(INPC, "$(P)SHUTTER")
field(INPD, "$(P)PRESET")
field(CALC, "(B >= 1 && D > 0 && A >= D && C == 0) ? 0 : 1")
field(OUT, "$(P)SWITCH PP")
field(OOPT, "When Zero")
field(DOPT, "Use CALC")
}
record(calcout, "$(P)BEAMAVG")
{
field(SCAN, ".1 second")
field(INPA, "$(P)ACCTIME")
field(INPB, "$(P)ACCINT")
field(CALC, "A > 0 ? B/A : 0")
field(OOPT, "On Change")
field(DOPT, "Use CALC")
}