# Wire Scanner Database Entries for $(U)
#
#
# Start or Stop Scanning $(U)
#
record(bo, "$(U):STARTSCAN") {
  field(DESC, "Start Wire Scan with $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "Scanning")
  field(ZNAM, "Scan Stopped")
}

#
# Normally scanning moves from inner position to outer
# position, against the force of the vacuum.  If this
# PV is set to true, then $(U)
# will scan from the outer to inner position, moving
# with the force of the vacuum.  The scanner is expected
# to provide best results when moving against the force
# of the vacuum.
#
record(bo, "$(U):SCANTOCENTER") {
  field(DESC, "$(mad) will scan inwards")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "Scan to Center")
  field(ZNAM, "Scan from Center")
  info(autosaveFields, "VAL")
}

#
# Angle of $(U) from beam's point of view
#
record(ao, "$(U):INSTALLANGLE") {
  field(DESC, "Orientation of $(mad)")
  field(ASG, "WIREADMIN")
  field(EGU, "degrees")
  field(VAL, "$(orient)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# Repeatability of $(U) when doing a wire scan.
# If the motion returns to the original LVDT-measured position, within
# POSNTHRESH $(units), the scan is considered successful.  If not, then
# RETRIES number of scans (in total) will be attempted.
#
record(ao, "$(U):POSNTHRESH") {
  field(DESC, "$(mad) Position Deadband")
  field(ASG, "WIREUSER")
  field(EGU, "$(units)")
  field(VAL, "$(thresh)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# Calculated time for wire scan; actual time that wire is spent moving.
#
record(ao, "$(U):SCANTIME") {
  field(DESC, "$(mad) Calc. Scan Time")
  field(ASG, "WIREUSER")
  field(EGU, "seconds")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
}

#
# The most recent scan $(U)
# was considered to have successfully moved.
#
record(mbbo, "$(U):HADSUCCESS") {
  field(DESC, "$(mad) Scan Successful")
  field(ASG, "$WIREUSER")
  field(OMSL, "supervisory")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(DTYP, "Raw Soft Channel")
  field(NOBT, "32")
  field(ZRST, "No Scan Attempt")
  field(ZRVL, "0")
  field(ONST, "Scan Successful")
  field(ONVL, "1")
  field(TWST, "Scan Failed")
  field(TWVL, "2")
  field(PINI, "YES")
}

#
# The total number of scans to be done by $(U)
# for a given scan request; if the scanner motion does not return
# to POSNTHRESH $(units) of where it started, then a retry is made.
#
record(ao, "$(U):RETRIES") {
  field(DESC, "$(mad) Retries to Do")
  field(ASG, "WIREUSER")
  field(VAL, "$(retries)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The current retry attempt of $(U) to
# perform a scan.  Up to RETRIES attempts will be made, and this
# value indicates which attempt is currently underway.
#
record(ao, "$(U):CURRENTRETRY") {
  field(DESC, "$(mad) Current Retry Count")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
}

#
# Does $(U) Have a Working X Wire?
#
record(bo, "$(U):HASXWIRE") {
  field(DESC, "Is X Wire Avail. on $(mad)")
  field(ASG, "WIREADMIN")
  field(VAL, "$(hasx)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "X Wire is Usable")
  field(ZNAM, "X Wire NOT Usable")
  info(autosaveFields, "VAL")
}

#
# Will the X Wire from $(U) be Used?
#
record(bo, "$(U):USEXWIRE") {
  field(DESC, "Is X Wire Used on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(hasx)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "X Wire Selected")
  field(ZNAM, "X Wire NOT Selected")
  info(autosaveFields, "VAL")
}

#
# Distance of $(U) X Wire from beam centerline,
# when motor is at the 0 position.  The U Wire intersecting with the
# beam centerline is defined as 0.
#
record(ao, "$(U):XWIREOFFSET") {
  field(DESC, "Offset of $(mad) X Wire")
  field(ASG, "WIREADMIN")
  field(EGU, "$(units)")
  field(VAL, "$(xoffs)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The location at which the X Wire can be positioned to
# start a scan in pull-through-beam mode on $(U)
#
record(longout, "$(U):XWIREOUTER") {
  field(DESC, "Outer X on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(xout)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

#
# The location at which the X Wire can be positioned to
# start a scan in push-through-beam mode on $(U)
#
record(longout, "$(U):XWIREINNER") {
  field(DESC, "Inner X on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(xin)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

#
# Does $(U) Have a Working Y Wire?
#
record(bo, "$(U):HASYWIRE") {
  field(DESC, "Is Y Wire Avail. on $(mad)")
  field(ASG, "WIREADMIN")
  field(VAL, "$(hasy)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "Y Wire is Usable")
  field(ZNAM, "Y Wire NOT Usable")
  info(autosaveFields, "VAL")
}

#
# Will the Y Wire from $(U) be Used?
#
record(bo, "$(U):USEYWIRE") {
  field(DESC, "Is Y Wire Used on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "Y Wire Selected")
  field(ZNAM, "Y Wire NOT Selected")
  info(autosaveFields, "VAL")
}

#
# Distance of $(U) Y Wire from beam centerline,
# when motor is at the 0 position.  The U Wire intersecting with the
# beam centerline is defined as 0.
#
record(ao, "$(U):YWIREOFFSET") {
  field(DESC, "Offset of $(mad) Y Wire")
  field(ASG, "WIREADMIN")
  field(EGU, "$(units)")
  field(VAL, "$(yoffs)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The location at which the Y Wire can be positioned to
# start a scan in pull-through-beam mode on $(U)
#
record(longout, "$(U):YWIREOUTER") {
  field(DESC, "Outer Y on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(yout)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

#
# The location at which the Y Wire can be positioned to
# start a scan in push-through-beam mode on $(U)
#
record(longout, "$(U):YWIREINNER") {
  field(DESC, "Inner Y on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(yin)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

# Does $(U) Have a Working U (diagonal) Wire?
#
record(bo, "$(U):HASUWIRE") {
  field(DESC, "Is U Wire Avail. on $(mad)")
  field(ASG, "WIREADMIN")
  field(VAL, "$(hasu)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "U Wire is Usable")
  field(ZNAM, "U Wire NOT Usable")
  info(autosaveFields, "VAL")
}

#
# Will the U Wire from $(U) be Used?
#
record(bo, "$(U):USEUWIRE") {
  field(DESC, "Is U Wire Used on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(ONAM, "U Wire Selected")
  field(ZNAM, "U Wire NOT Selected")
  info(autosaveFields, "VAL")
}

#
# Distance of $(U) U Wire from beam centerline,
# when motor is at the 0 position.  The U Wire intersecting with the
# beam centerline is defined as 0.
#
record(ao, "$(U):UWIREOFFSET") {
  field(DESC, "Offset of $(mad) U Wire")
  field(ASG, "WIREADMIN")
  field(EGU, "$(units)")
  field(VAL, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The location at which the U Wire can be positioned to
# start a scan in pull-through-beam mode on $(U)
#
record(longout, "$(U):UWIREOUTER") {
  field(DESC, "Outer U on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(uout)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

#
# The location at which the U Wire can be positioned to
# start a scan in push-through-beam mode on $(U)
#
record(longout, "$(U):UWIREINNER") {
  field(DESC, "Inner U on $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(uin)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  field(DRVH, "$(hilim)")
  field(DRVL, "$(lolim)")
  field(HOPR, "$(hilim)")
  field(LOPR, "$(lolim)")
  info(autosaveFields, "VAL")
}

#
# The position at which the current scan will start, set to
# the value of :XWIREOUTER, :YWIREOUTER or UWIREOUTER if in
# pull-through-beam mode, or set to :XWIREINNER, :YWIREINNER
# or UWIREINNER if in push-through-beam mode, for $(U)
#
record(ao, "$(U):SCANPOSSTART") {
  field(DESC, "$(mad) Wire Start Pos")
  field(ASG, "WIREUSER")
  field(VAL, "$(xin)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The position at which the current scan will stop, set to
# the value of :XWIREOUTER, :YWIREOUTER or UWIREOUTER if in
# push-through-beam mode, or set to :XWIREINNER, :YWIREINNER
# or UWIREINNER if in pull-through-beam mode, for $(U)
#
record(ao, "$(U):SCANPOSSTOP") {
  field(DESC, "$(mad) Stop Position")
  field(ASG, "WIREUSER")
  field(VAL, "$(xout)")
  field(EGU, "$(units)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The number of beam pulses which $(U)
# will intercept as it moves across the total range of travel.
# This is typically selected by the user.
#
record(ao, "$(U):SCANPULSES") {
  field(DESC, "Pulses needed by $(mad)")
  field(ASG, "WIREUSER")
  field(VAL, "$(pulses)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# The time to delay between motion stop and position readout
#
record(ao, "$(U):SCANDELAY") {
  field(DESC, "$(mad) Position Delay Time")
  field(ASG, "WIREUSER")
  field(VAL, "$(delay)")
  field(EGU, "seconds")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

#
# An indication of progress in terms of percent
# completion of $(U)
#
record(ao, "$(U):SCANPROGRESS") {
  field(DESC, "Progress $(mad) WireScan")
  field(ASG, "WIREUSER")
  field(VAL, "0")
  field(EGU, "percent")
  field(HOPR, "100")
  field(LOPR, "0")
  field(PREC, "0")
  field(SCAN, "Passive")
  field(PINI, "YES")
}

#
# A textual indication of the status of $(U)
#
record(stringout, "$(U):SCANTEXT") {
  field(DESC, "$(mad) Wire Scan Status")
  field(ASG, "WIREUSER")
  field(VAL, "READY to START Wire Scan")
  field(SCAN, "Passive")
  field(PINI, "YES")
}

#
# Angle of $(U) from beam's point of view
#
record(ao, "$(U):XWIRESIZE") {
  field(DESC, "Diam. of $(mad) x wire")
  field(ASG, "WIREADMIN")
  field(EGU, "microns")
  field(VAL, "$(xdiameter)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

record(ao, "$(U):YWIRESIZE") {
  field(DESC, "Diam. of $(mad) y wire")
  field(ASG, "WIREADMIN")
  field(EGU, "microns")
  field(VAL, "$(ydiameter)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}

record(ao, "$(U):UWIRESIZE") {
  field(DESC, "Diam. of $(mad) u wire")
  field(ASG, "WIREADMIN")
  field(EGU, "microns")
  field(VAL, "$(udiameter)")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL")
}


