#! Generated by VisualDCT v2.6
#! DBDSTART
#! DBD("../../dbd/pmac.dbd")
#! DBDEND


# # \file
# # This template allows setting of variables for a mirror bender with a single
# # actuator. It requiresPROG10_CS_motion.pmc and an instantiation of 
# # CS_bender.pmc with the variables shown in the image below:
# # \image html bender-help.png "Setup of aperture slits in X or Y"
# # Build instructions for an example IOC are available 
# # \ref build_instructions_bender "here", with a pmc file containing 
# # the CS definition available in iocs/bender/defs.pmc
# % macro, __doc__, Supporting template that allows setting of variables for a 
# bender CS 
# % macro, P, Pv Prefix
# % macro, COORD, Co-ordinate system number
# % macro, name, Object name and gui association name
# This associates an edm screen with the template
# % gui, $(name=), edm, bender-mirror.edl, bender=$(P)

record(calc, "$(P):SNG") {
  field(DESC, "Singularity position")
  field(INPA, "$(P):INTERCEPT:RBV")
  field(INPB, "$(P):SLOPE:RBV")
  field(CALC, "-A/B")
  field(PREC, "3")
  field(EGU, "mm")
}

substitute "VAR=&$(COORD)Q20,Q=:SLOPE,EGU=1/Km/mm,VARIABLE_PREC=6"
include "pmacVariableWrite.template"

substitute "VAR=&$(COORD)Q21,Q=:INTERCEPT,EGU=1/Km,VARIABLE_PREC=6"
include "pmacVariableWrite.template"

substitute "VAR=&$(COORD)Q22,Q=:LIMIT,EGU=Km,VARIABLE_PREC=1"
include "pmacVariableWrite.template"

record(calcout, "$(P):SLOPE:SYNC") {
  field(FLNK, "$(P):SNG")
}

record(calcout, "$(P):INTERCEPT:SYNC") {
  field(FLNK, "$(P):SNG")
}

#! Further lines contain data used by VisualDCT
#! View(1649,2032,1.0)
#! Record("$(P):SNG",2040,1820,0,0,"$(P):SNG")
#! Field("$(P):SNG.INPA",16777215,1,"$(P):SNG.INPA")
#! Field("$(P):SNG.INPB",16777215,1,"$(P):SNG.INPB")

#! Record("$(P):SLOPE:SYNC",1740,1850,0,0,"$(P):SLOPE:SYNC")
#! Field("$(P):SLOPE:SYNC.FLNK",16777215,1,"$(P):SLOPE:SYNC.FLNK")
#! Link("$(P):SLOPE:SYNC.FLNK","$(P):SNG")
#! Record("$(P):INTERCEPT:SYNC",1740,1970,0,0,"$(P):INTERCEPT:SYNC")
#! Field("$(P):INTERCEPT:SYNC.FLNK",16777215,1,"$(P):INTERCEPT:SYNC.FLNK")
#! Link("$(P):INTERCEPT:SYNC.FLNK","$(P):SNG")
