# % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS1:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS1:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#1P") field(PREC, "2") } record(ai, "$(MOC):AXIS1:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#1F") field(PREC, "2") } record(ai, "$(MOC):AXIS1:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#1V") field(PREC, "2") } record(seq, "$(MOC):AXIS1:ReadBack") { field(LNK1, "$(MOC):AXIS1:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS1:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS1:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS1:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS1:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),1)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS1:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS1:status1") { field(INP, "$(MOC):AXIS1:READ_STAT1") } record(longin, "$(MOC):AXIS1:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),1)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS1:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS1:status2") { field(INP, "$(MOC):AXIS1:READ_STAT2") } record(longin, "$(MOC):AXIS1:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),1)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS1:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS1:status3") { field(INP, "$(MOC):AXIS1:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS2:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS2:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#2P") field(PREC, "2") } record(ai, "$(MOC):AXIS2:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#2F") field(PREC, "2") } record(ai, "$(MOC):AXIS2:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#2V") field(PREC, "2") } record(seq, "$(MOC):AXIS2:ReadBack") { field(LNK1, "$(MOC):AXIS2:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS2:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS2:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS2:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS2:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),2)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS2:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS2:status1") { field(INP, "$(MOC):AXIS2:READ_STAT1") } record(longin, "$(MOC):AXIS2:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),2)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS2:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS2:status2") { field(INP, "$(MOC):AXIS2:READ_STAT2") } record(longin, "$(MOC):AXIS2:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),2)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS2:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS2:status3") { field(INP, "$(MOC):AXIS2:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS3:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS3:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#3P") field(PREC, "2") } record(ai, "$(MOC):AXIS3:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#3F") field(PREC, "2") } record(ai, "$(MOC):AXIS3:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#3V") field(PREC, "2") } record(seq, "$(MOC):AXIS3:ReadBack") { field(LNK1, "$(MOC):AXIS3:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS3:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS3:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS3:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS3:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),3)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS3:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS3:status1") { field(INP, "$(MOC):AXIS3:READ_STAT1") } record(longin, "$(MOC):AXIS3:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),3)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS3:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS3:status2") { field(INP, "$(MOC):AXIS3:READ_STAT2") } record(longin, "$(MOC):AXIS3:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),3)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS3:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS3:status3") { field(INP, "$(MOC):AXIS3:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS4:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS4:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#4P") field(PREC, "2") } record(ai, "$(MOC):AXIS4:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#4F") field(PREC, "2") } record(ai, "$(MOC):AXIS4:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#4V") field(PREC, "2") } record(seq, "$(MOC):AXIS4:ReadBack") { field(LNK1, "$(MOC):AXIS4:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS4:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS4:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS4:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS4:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),4)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS4:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS4:status1") { field(INP, "$(MOC):AXIS4:READ_STAT1") } record(longin, "$(MOC):AXIS4:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),4)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS4:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS4:status2") { field(INP, "$(MOC):AXIS4:READ_STAT2") } record(longin, "$(MOC):AXIS4:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),4)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS4:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS4:status3") { field(INP, "$(MOC):AXIS4:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS5:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS5:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#5P") field(PREC, "2") } record(ai, "$(MOC):AXIS5:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#5F") field(PREC, "2") } record(ai, "$(MOC):AXIS5:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#5V") field(PREC, "2") } record(seq, "$(MOC):AXIS5:ReadBack") { field(LNK1, "$(MOC):AXIS5:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS5:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS5:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS5:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS5:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS5:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS5:status1") { field(INP, "$(MOC):AXIS5:READ_STAT1") } record(longin, "$(MOC):AXIS5:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS5:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS5:status2") { field(INP, "$(MOC):AXIS5:READ_STAT2") } record(longin, "$(MOC):AXIS5:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS5:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS5:status3") { field(INP, "$(MOC):AXIS5:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS6:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS6:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#6P") field(PREC, "2") } record(ai, "$(MOC):AXIS6:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#6F") field(PREC, "2") } record(ai, "$(MOC):AXIS6:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#6V") field(PREC, "2") } record(seq, "$(MOC):AXIS6:ReadBack") { field(LNK1, "$(MOC):AXIS6:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS6:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS6:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS6:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS6:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),6)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS6:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS6:status1") { field(INP, "$(MOC):AXIS6:READ_STAT1") } record(longin, "$(MOC):AXIS6:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),6)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS6:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS6:status2") { field(INP, "$(MOC):AXIS6:READ_STAT2") } record(longin, "$(MOC):AXIS6:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),6)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS6:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS6:status3") { field(INP, "$(MOC):AXIS6:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS7:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS7:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#7P") field(PREC, "2") } record(ai, "$(MOC):AXIS7:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#7F") field(PREC, "2") } record(ai, "$(MOC):AXIS7:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#7V") field(PREC, "2") } record(seq, "$(MOC):AXIS7:ReadBack") { field(LNK1, "$(MOC):AXIS7:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS7:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS7:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS7:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS7:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),7)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS7:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS7:status1") { field(INP, "$(MOC):AXIS7:READ_STAT1") } record(longin, "$(MOC):AXIS7:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),7)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS7:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS7:status2") { field(INP, "$(MOC):AXIS7:READ_STAT2") } record(longin, "$(MOC):AXIS7:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),7)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS7:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS7:status3") { field(INP, "$(MOC):AXIS7:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS8:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS8:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#8P") field(PREC, "2") } record(ai, "$(MOC):AXIS8:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#8F") field(PREC, "2") } record(ai, "$(MOC):AXIS8:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#8V") field(PREC, "2") } record(seq, "$(MOC):AXIS8:ReadBack") { field(LNK1, "$(MOC):AXIS8:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS8:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS8:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS8:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS8:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),8)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS8:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS8:status1") { field(INP, "$(MOC):AXIS8:READ_STAT1") } record(longin, "$(MOC):AXIS8:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),8)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS8:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS8:status2") { field(INP, "$(MOC):AXIS8:READ_STAT2") } record(longin, "$(MOC):AXIS8:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),8)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS8:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS8:status3") { field(INP, "$(MOC):AXIS8:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS9:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS9:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#9P") field(PREC, "2") } record(ai, "$(MOC):AXIS9:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#9F") field(PREC, "2") } record(ai, "$(MOC):AXIS9:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#9V") field(PREC, "2") } record(seq, "$(MOC):AXIS9:ReadBack") { field(LNK1, "$(MOC):AXIS9:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS9:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS9:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS9:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS9:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),9)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS9:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS9:status1") { field(INP, "$(MOC):AXIS9:READ_STAT1") } record(longin, "$(MOC):AXIS9:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),9)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS9:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS9:status2") { field(INP, "$(MOC):AXIS9:READ_STAT2") } record(longin, "$(MOC):AXIS9:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),9)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS9:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS9:status3") { field(INP, "$(MOC):AXIS9:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS10:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS10:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#10P") field(PREC, "2") } record(ai, "$(MOC):AXIS10:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#10F") field(PREC, "2") } record(ai, "$(MOC):AXIS10:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#10V") field(PREC, "2") } record(seq, "$(MOC):AXIS10:ReadBack") { field(LNK1, "$(MOC):AXIS10:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS10:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS10:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS10:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS10:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),10)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS10:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS10:status1") { field(INP, "$(MOC):AXIS10:READ_STAT1") } record(longin, "$(MOC):AXIS10:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),10)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS10:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS10:status2") { field(INP, "$(MOC):AXIS10:READ_STAT2") } record(longin, "$(MOC):AXIS10:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),10)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS10:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS10:status3") { field(INP, "$(MOC):AXIS10:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS11:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS11:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#11P") field(PREC, "2") } record(ai, "$(MOC):AXIS11:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#11F") field(PREC, "2") } record(ai, "$(MOC):AXIS11:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#11V") field(PREC, "2") } record(seq, "$(MOC):AXIS11:ReadBack") { field(LNK1, "$(MOC):AXIS11:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS11:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS11:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS11:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS11:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),11)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS11:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS11:status1") { field(INP, "$(MOC):AXIS11:READ_STAT1") } record(longin, "$(MOC):AXIS11:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),11)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS11:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS11:status2") { field(INP, "$(MOC):AXIS11:READ_STAT2") } record(longin, "$(MOC):AXIS11:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),11)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS11:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS11:status3") { field(INP, "$(MOC):AXIS11:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS12:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS12:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#12P") field(PREC, "2") } record(ai, "$(MOC):AXIS12:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#12F") field(PREC, "2") } record(ai, "$(MOC):AXIS12:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#12V") field(PREC, "2") } record(seq, "$(MOC):AXIS12:ReadBack") { field(LNK1, "$(MOC):AXIS12:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS12:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS12:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS12:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS12:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),12)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS12:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS12:status1") { field(INP, "$(MOC):AXIS12:READ_STAT1") } record(longin, "$(MOC):AXIS12:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),12)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS12:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS12:status2") { field(INP, "$(MOC):AXIS12:READ_STAT2") } record(longin, "$(MOC):AXIS12:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),12)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS12:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS12:status3") { field(INP, "$(MOC):AXIS12:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS13:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS13:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#13P") field(PREC, "2") } record(ai, "$(MOC):AXIS13:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#13F") field(PREC, "2") } record(ai, "$(MOC):AXIS13:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#13V") field(PREC, "2") } record(seq, "$(MOC):AXIS13:ReadBack") { field(LNK1, "$(MOC):AXIS13:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS13:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS13:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS13:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS13:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),13)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS13:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS13:status1") { field(INP, "$(MOC):AXIS13:READ_STAT1") } record(longin, "$(MOC):AXIS13:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),13)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS13:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS13:status2") { field(INP, "$(MOC):AXIS13:READ_STAT2") } record(longin, "$(MOC):AXIS13:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),13)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS13:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS13:status3") { field(INP, "$(MOC):AXIS13:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS14:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS14:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#14P") field(PREC, "2") } record(ai, "$(MOC):AXIS14:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#14F") field(PREC, "2") } record(ai, "$(MOC):AXIS14:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#14V") field(PREC, "2") } record(seq, "$(MOC):AXIS14:ReadBack") { field(LNK1, "$(MOC):AXIS14:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS14:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS14:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS14:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS14:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),14)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS14:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS14:status1") { field(INP, "$(MOC):AXIS14:READ_STAT1") } record(longin, "$(MOC):AXIS14:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),14)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS14:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS14:status2") { field(INP, "$(MOC):AXIS14:READ_STAT2") } record(longin, "$(MOC):AXIS14:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),14)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS14:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS14:status3") { field(INP, "$(MOC):AXIS14:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS15:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS15:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#15P") field(PREC, "2") } record(ai, "$(MOC):AXIS15:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#15F") field(PREC, "2") } record(ai, "$(MOC):AXIS15:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#15V") field(PREC, "2") } record(seq, "$(MOC):AXIS15:ReadBack") { field(LNK1, "$(MOC):AXIS15:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS15:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS15:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS15:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS15:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),15)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS15:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS15:status1") { field(INP, "$(MOC):AXIS15:READ_STAT1") } record(longin, "$(MOC):AXIS15:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),15)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS15:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS15:status2") { field(INP, "$(MOC):AXIS15:READ_STAT2") } record(longin, "$(MOC):AXIS15:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),15)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS15:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS15:status3") { field(INP, "$(MOC):AXIS15:READ_STAT3") } # % macro, PMAC, Pmac/Geobrick name # % macro, AXIS, Axis number # % macro, PORT, Asyn port record(stringout, "$(MOC):AXIS16:DESC") { field(PINI, "YES") } record(ai, "$(MOC):AXIS16:POSITION") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#16P") field(PREC, "2") } record(ai, "$(MOC):AXIS16:FOLL_ERROR") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#16F") field(PREC, "2") } record(ai, "$(MOC):AXIS16:VELOCITY") { field(DTYP, "asynFloat64") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),0)PMAC_VDF_#16V") field(PREC, "2") } record(seq, "$(MOC):AXIS16:ReadBack") { field(LNK1, "$(MOC):AXIS16:POSITION.PROC PP") field(LNK2, "$(MOC):AXIS16:FOLL_ERROR.PROC PP") field(LNK3, "$(MOC):AXIS16:VELOCITY.PROC PP") field(LNK4, "$(MOC):AXIS16:status1.PROC PP") field(DLY1, "0") field(DLY2, "0.5") field(DLY3, "0.5") field(DLY4, "0.5") field(DOL1, "1") field(DOL2, "1") field(DOL3, "1") field(DOL4, "1") } record(longin, "$(MOC):AXIS16:READ_STAT1") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),16)PMAC_C_AXIS_BITS01") field(FLNK, "$(MOC):AXIS16:status1") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS16:status1") { field(INP, "$(MOC):AXIS16:READ_STAT1") } record(longin, "$(MOC):AXIS16:READ_STAT2") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),16)PMAC_C_AXIS_BITS02") field(FLNK, "$(MOC):AXIS16:status2") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS16:status2") { field(INP, "$(MOC):AXIS16:READ_STAT2") } record(longin, "$(MOC):AXIS16:READ_STAT3") { field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),16)PMAC_C_AXIS_BITS03") field(FLNK, "$(MOC):AXIS16:status3") } #% archiver 10 Monitor record(mbbiDirect, "$(MOC):AXIS16:status3") { field(INP, "$(MOC):AXIS16:READ_STAT3") } # % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):Z_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z_OL:MOTR # This associates an edm screen with the template # % gui, M1, edm, motor.edl, motor=$(PV_NANO_STACK):Z_OL:MOTR # % gui, M1, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):Z_OL:MOTR,filename=motor.edl,box-label=$(DEV) Z open loop # This associates a BOY screen with the template # % gui, M1, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:Z_OL:MOTR,DESC=$(DEV) Z open loop, name=M1 # % gui, M1, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:Z_OL:MOTR,DESC=$(DEV) Z open loop, name=M1 # % gui, M1, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:Z_OL:MOTR,DESC=$(DEV) Z open loop, name=M1 # FIXME: this should be in pmacUtil or tpmac # % gui, M1, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:Z_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M1, status, .MOVN # % gui, M1, sevr # These define what PVs a motor detail screen should contain # % gui, M1, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M1, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M1, command, ELoss Clear, :ELOSSRC.A # % gui, M1, statusbits, Limit Violation, .LVIO, Lim # % gui, M1, statusbits, At High Limit, .HLS, High # % gui, M1, statusbits, At Low Limit, .LLS, Low # % gui, M1, demand, User High Limit, .HLM # % gui, M1, demand, User Low Limit, .LLM # % gui, M1, demand, Dial High Limit, .DHLM # % gui, M1, demand, Dial Low Limit, .DLLM # % gui, M1, demand, Motor demand, .VAL # % gui, M1, readback, Motor readback, .RBV # % gui, M1, command, Stop, .STOP # % gui, M1, command, Home Forward, .HOMF # % gui, M1, command, Home Reverse, .HOMR # % gui, M1, command, Jog Forward, .JOGF # % gui, M1, command, Jog Reverse, .JOGR # % gui, M1, command, Tweak Forward, .TWF # % gui, M1, command, Tweak Reverse, .TWR # % gui, M1, demand, Tweak Step, .TWV # % gui, M1, command, Kill, :KILL.PROC, Kill # % gui, M1, command, Sync VAL=RBV, .SYNC # % gui, M1, enum, Direction, .DIR # % gui, M1, demand, User Offset, .OFF # % gui, M1, enum, Set/Use, .SET # % gui, M1, enum, Offset, .FOFF # % gui, M1, enum, Use Encoder, .UEIP # % gui, M1, demand, Motor Step Size, .MRES # % gui, M1, readback, Steps per Rev, .SREV # % gui, M1, readback, EGUs per Rev, .UREV # % gui, M1, demand, Encoder Step Size, .ERES # % gui, M1, readback, Readback Step Size, .RRES # % gui, M1, readback, Use Encoder if Present, .UEIP # % gui, M1, demand, Max Velocity, .VMAX # % gui, M1, demand, Base Velocity, .VBAS # % gui, M1, demand, Velocity, .VELO # % gui, M1, demand, Secs to Velocity, .ACCL # % gui, M1, demand, JVEL, .JVEL # % gui, M1, demand, Jog Acceleration, .JAR # % gui, M1, demand, Backlash Distance, .BDST # % gui, M1, demand, Backlash Velocity, .BVEL # % gui, M1, demand, Backlash Secs to Vel, .BACC # % gui, M1, demand, Move Fraction, .FRAC # % gui, M1, demand, Retry Deadband, .RDBD # % gui, M1, demand, Max Retrys, .RTRY # % gui, M1, demand, PREC, .PREC # % gui, M1, demand, EGU, .EGU # % gui, M1, demand, Output Specification, .OUT # % gui, M1, readback, Readback Location, .RDBL # % gui, M1, readback, Desired Output Loc, .DOL # % gui, M1, readback, Output Mode Select, .OMSL # % gui, M1, readback, Readback Out Link, .RLNK # % gui, M1, demand, DMOV Input Link, .DINP # % gui, M1, demand, RMP Input Link, .RINP # % gui, M1, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):Z_OL:MOTR") { field(DESC,"$(DEV) Z open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),1)") field(MRES,"1") field(PREC,"0") field(EGU,"step") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):Z_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "1") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):Z_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):Z_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):Z_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):Z_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):Z_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):Z_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):Z_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):Z_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX") field(PREC,"0") field(EGU, "step") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):Z_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"0") field(EGU, "step") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):Z_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):Z_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):Z_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):Z_OL:MOTR, $(MOC):M1) alias($(PV_NANO_STACK):Z_OL:MOTR:ADDR, $(MOC):M1:ADDR) alias($(PV_NANO_STACK):Z_OL:MOTR:PORT, $(MOC):M1:PORT) alias($(PV_NANO_STACK):Z_OL:MOTR:SCALE, $(MOC):M1:SCALE) alias($(PV_NANO_STACK):Z_OL:MOTR:USER:SDIS, $(MOC):M1:USER:SDIS) alias($(PV_NANO_STACK):Z_OL:MOTR:SDIS, $(MOC):M1:SDIS) alias($(PV_NANO_STACK):Z_OL:MOTR:KILL, $(MOC):M1:KILL) alias($(PV_NANO_STACK):Z_OL:MOTR:ELOSS, $(MOC):M1:ELOSS) alias($(PV_NANO_STACK):Z_OL:MOTR:ELOSSRC, $(MOC):M1:ELOSSRC) alias($(PV_NANO_STACK):Z_OL:MOTR:MR_MOVE_WRITE, $(MOC):M1:MR_MOVE_WRITE) alias($(PV_NANO_STACK):Z_OL:MOTR:CHECK_SYNC, $(MOC):M1:CHECK_SYNC) alias($(PV_NANO_STACK):Z_OL:MOTR:FERROR, $(MOC):M1:FERROR) alias($(PV_NANO_STACK):Z_OL:MOTR:FERRORMAX, $(MOC):M1:FERRORMAX) alias($(PV_NANO_STACK):Z_OL:MOTR:FEMAXRESET, $(MOC):M1:FEMAXRESET) alias($(PV_NANO_STACK):Z_OL:MOTR:HOMEVIS, $(MOC):M1:HOMEVIS) alias($(PV_NANO_STACK):Z_OL:MOTR:HOMEVISSTR, $(MOC):M1:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):Z_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):Z_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+1`") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+1`") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),1)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):Z_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):Z_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),1)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):Z_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),1)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):Z_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),1)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):Z_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):Z_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):Z_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#1P") field(DESC, "$(DEV) Z open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):Z_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):Z_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:HMPOS") { field(DESC, "$(DEV) Z open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):Z_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):Z_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M1PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M1PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):Z_OL:MOTR:ELOSSVAR") { field(CALC, "464+1") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):Z_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+1`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+1`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS1:DESC"){ field(VAL, "M1 $(DEV) Z open loop") } #record(bo, "$(PV_NANO_STACK):Z_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 1") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):Z_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m145) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):Z_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):Z_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):Z_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):Z_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),1,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) Z open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):Z_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),1,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):Z_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):Z_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):Z_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):Z_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),1,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):Z_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Z_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):Z_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Z_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):Z_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),1,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M1:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M1.MRES CP") field(INPB, "$(MOC):M1.DIR CP") field(INPC, "$(MOC):M1:SCALE") field(OUT, "$(MOC):M1:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M1:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+1`") field(FLNK, "$(MOC):M1:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M1:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M1.OFF CP") field(OUT, "$(MOC):M1:OFF_SET PP") } record(ao, "$(MOC):M1:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+1`") field(FLNK, "$(MOC):M1:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M1:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),1)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M1:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M1:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),1)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M1:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),1)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M1:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),1)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M1:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M1:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M1:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M1:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M1:HOMING") field(CALC, "A") field(OUT, "$(MOC):M1:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M1:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M1:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#1P") field(DESC, "$(DEV) Z open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(MOC):M1:HMPOS:CALC") { field(INPA, "$(MOC):M1.MRES CP") field(INPB, "$(MOC):M1:SCALE") field(INPC, "$(MOC):M1:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M1:HMPOS PP") } record(ai, "$(MOC):M1:HMPOS") { field(DESC, "$(DEV) Z open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M1:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M1") field(OUT, "$(PV_NANO_STACK):HM:M1PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M1PV"){ } # define a kill record record(ao, "$(MOC):M1:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M1:ELOSSVAR") { field(CALC, "464+1") field(PINI, "YES") } record(ai, "$(MOC):M1:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+1`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M1:ELOSSRC") { field(OUT, "$(MOC):M1:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M1:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+1`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS1:DESC"){ field(VAL, "M1 $(DEV) Z open loop") } #record(bo, "$(MOC):M1:HOMED") { # field(DESC, "Set homed status for axis 1") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M1:HOMEDSET") #} #record(calcout, "$(MOC):M1:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M1:HOMED") # field(OUT, "@pmac.proto setIntVar(m145) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M1:DirectDemand") { field(FLNK, "$(MOC):M1:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M1:DirectCountsCalc") { field(INPA, "$(MOC):M1:DirectDemand") field(INPB, "$(MOC):M1:Mres PP") field(INPC, "$(MOC):M1:Offset PP") field(INPD, "$(MOC):M1:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M1:RawDirectDemand PP") } record(ao, "$(MOC):M1:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M1:DirectMotorSeq") field(OUT, "@asyn($(PORT),1,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) Z open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M1:DirectMotorSeq") { field(LNK1, "$(MOC):M1:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M1:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M1:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),1,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M1:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),1,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M1:MresSource") } record(scalcout, $(MOC):M1:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M1:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M1:Mres.INPA CA") field(FLNK, "$(MOC):M1:OffsetSource") } record(scalcout, "$(MOC):M1:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M1:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M1:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),1,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M1:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M1:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M1:Offset.INPA CA") } record(scalcout, $(MOC):M1:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M1:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M1:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),1,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):Z:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z:MOTR # This associates an edm screen with the template # % gui, M2, edm, motor.edl, motor=$(PV_NANO_STACK):Z:MOTR # % gui, M2, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):Z:MOTR,filename=motor.edl,box-label=$(DEV) Z closed loop # This associates a BOY screen with the template # % gui, M2, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:Z:MOTR,DESC=$(DEV) Z closed loop, name=M2 # % gui, M2, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:Z:MOTR,DESC=$(DEV) Z closed loop, name=M2 # % gui, M2, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:Z:MOTR,DESC=$(DEV) Z closed loop, name=M2 # FIXME: this should be in pmacUtil or tpmac # % gui, M2, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:Z:MOTR # This makes the component icon reflect the status and severity # % gui, M2, status, .MOVN # % gui, M2, sevr # These define what PVs a motor detail screen should contain # % gui, M2, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M2, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M2, command, ELoss Clear, :ELOSSRC.A # % gui, M2, statusbits, Limit Violation, .LVIO, Lim # % gui, M2, statusbits, At High Limit, .HLS, High # % gui, M2, statusbits, At Low Limit, .LLS, Low # % gui, M2, demand, User High Limit, .HLM # % gui, M2, demand, User Low Limit, .LLM # % gui, M2, demand, Dial High Limit, .DHLM # % gui, M2, demand, Dial Low Limit, .DLLM # % gui, M2, demand, Motor demand, .VAL # % gui, M2, readback, Motor readback, .RBV # % gui, M2, command, Stop, .STOP # % gui, M2, command, Home Forward, .HOMF # % gui, M2, command, Home Reverse, .HOMR # % gui, M2, command, Jog Forward, .JOGF # % gui, M2, command, Jog Reverse, .JOGR # % gui, M2, command, Tweak Forward, .TWF # % gui, M2, command, Tweak Reverse, .TWR # % gui, M2, demand, Tweak Step, .TWV # % gui, M2, command, Kill, :KILL.PROC, Kill # % gui, M2, command, Sync VAL=RBV, .SYNC # % gui, M2, enum, Direction, .DIR # % gui, M2, demand, User Offset, .OFF # % gui, M2, enum, Set/Use, .SET # % gui, M2, enum, Offset, .FOFF # % gui, M2, enum, Use Encoder, .UEIP # % gui, M2, demand, Motor Step Size, .MRES # % gui, M2, readback, Steps per Rev, .SREV # % gui, M2, readback, EGUs per Rev, .UREV # % gui, M2, demand, Encoder Step Size, .ERES # % gui, M2, readback, Readback Step Size, .RRES # % gui, M2, readback, Use Encoder if Present, .UEIP # % gui, M2, demand, Max Velocity, .VMAX # % gui, M2, demand, Base Velocity, .VBAS # % gui, M2, demand, Velocity, .VELO # % gui, M2, demand, Secs to Velocity, .ACCL # % gui, M2, demand, JVEL, .JVEL # % gui, M2, demand, Jog Acceleration, .JAR # % gui, M2, demand, Backlash Distance, .BDST # % gui, M2, demand, Backlash Velocity, .BVEL # % gui, M2, demand, Backlash Secs to Vel, .BACC # % gui, M2, demand, Move Fraction, .FRAC # % gui, M2, demand, Retry Deadband, .RDBD # % gui, M2, demand, Max Retrys, .RTRY # % gui, M2, demand, PREC, .PREC # % gui, M2, demand, EGU, .EGU # % gui, M2, demand, Output Specification, .OUT # % gui, M2, readback, Readback Location, .RDBL # % gui, M2, readback, Desired Output Loc, .DOL # % gui, M2, readback, Output Mode Select, .OMSL # % gui, M2, readback, Readback Out Link, .RLNK # % gui, M2, demand, DMOV Input Link, .DINP # % gui, M2, demand, RMP Input Link, .RINP # % gui, M2, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):Z:MOTR") { field(DESC,"$(DEV) Z closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),2)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mm") field(DHLM,"") field(DLLM,"") field(HLM,"0.5") field(LLM,"-0.5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):Z:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):Z:MOTR:ADDR") { field(PINI, "YES") field(VAL, "2") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):Z:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):Z:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):Z:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):Z:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):Z:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):Z:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):Z:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):Z:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):Z:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):Z:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):Z:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):Z:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):Z:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):Z:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):Z:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):Z:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):Z:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):Z:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):Z:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mm") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Z:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):Z:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):Z:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):Z:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mm") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):Z:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):Z:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):Z:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):Z:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):Z:MOTR, $(MOC):M2) alias($(PV_NANO_STACK):Z:MOTR:ADDR, $(MOC):M2:ADDR) alias($(PV_NANO_STACK):Z:MOTR:PORT, $(MOC):M2:PORT) alias($(PV_NANO_STACK):Z:MOTR:SCALE, $(MOC):M2:SCALE) alias($(PV_NANO_STACK):Z:MOTR:USER:SDIS, $(MOC):M2:USER:SDIS) alias($(PV_NANO_STACK):Z:MOTR:SDIS, $(MOC):M2:SDIS) alias($(PV_NANO_STACK):Z:MOTR:KILL, $(MOC):M2:KILL) alias($(PV_NANO_STACK):Z:MOTR:ELOSS, $(MOC):M2:ELOSS) alias($(PV_NANO_STACK):Z:MOTR:ELOSSRC, $(MOC):M2:ELOSSRC) alias($(PV_NANO_STACK):Z:MOTR:MR_MOVE_WRITE, $(MOC):M2:MR_MOVE_WRITE) alias($(PV_NANO_STACK):Z:MOTR:CHECK_SYNC, $(MOC):M2:CHECK_SYNC) alias($(PV_NANO_STACK):Z:MOTR:FERROR, $(MOC):M2:FERROR) alias($(PV_NANO_STACK):Z:MOTR:FERRORMAX, $(MOC):M2:FERRORMAX) alias($(PV_NANO_STACK):Z:MOTR:FEMAXRESET, $(MOC):M2:FEMAXRESET) alias($(PV_NANO_STACK):Z:MOTR:HOMEVIS, $(MOC):M2:HOMEVIS) alias($(PV_NANO_STACK):Z:MOTR:HOMEVISSTR, $(MOC):M2:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):Z:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):Z:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):Z:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):Z:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):Z:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):Z:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+2`") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):Z:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):Z:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):Z:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):Z:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+2`") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):Z:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),2)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):Z:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):Z:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),2)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):Z:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),2)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):Z:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),2)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):Z:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):Z:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):Z:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):Z:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):Z:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):Z:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):Z:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#2P") field(DESC, "$(DEV) Z closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(PV_NANO_STACK):Z:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):Z:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):Z:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):Z:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):Z:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):Z:MOTR:HMPOS") { field(DESC, "$(DEV) Z closed loop") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):Z:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):Z:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M2PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M2PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):Z:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):Z:MOTR:ELOSSVAR") { field(CALC, "464+2") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):Z:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+2`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):Z:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):Z:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):Z:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+2`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS2:DESC"){ field(VAL, "M2 $(DEV) Z closed loop") } #record(bo, "$(PV_NANO_STACK):Z:MOTR:HOMED") { # field(DESC, "Set homed status for axis 2") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):Z:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):Z:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):Z:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m245) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):Z:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):Z:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):Z:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):Z:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):Z:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):Z:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):Z:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):Z:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):Z:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),2,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) Z closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):Z:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):Z:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):Z:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):Z:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):Z:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),2,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):Z:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Z:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):Z:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):Z:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):Z:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Z:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):Z:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),2,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):Z:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Z:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):Z:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):Z:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Z:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):Z:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),2,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M2:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M2.MRES CP") field(INPB, "$(MOC):M2.DIR CP") field(INPC, "$(MOC):M2:SCALE") field(OUT, "$(MOC):M2:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M2:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+2`") field(FLNK, "$(MOC):M2:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M2:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M2.OFF CP") field(OUT, "$(MOC):M2:OFF_SET PP") } record(ao, "$(MOC):M2:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+2`") field(FLNK, "$(MOC):M2:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M2:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),2)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M2:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M2:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),2)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M2:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),2)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M2:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),2)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M2:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M2:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M2:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M2:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M2:HOMING") field(CALC, "A") field(OUT, "$(MOC):M2:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M2:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M2:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#2P") field(DESC, "$(DEV) Z closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(MOC):M2:HMPOS:CALC") { field(INPA, "$(MOC):M2.MRES CP") field(INPB, "$(MOC):M2:SCALE") field(INPC, "$(MOC):M2:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M2:HMPOS PP") } record(ai, "$(MOC):M2:HMPOS") { field(DESC, "$(DEV) Z closed loop") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M2:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M2") field(OUT, "$(PV_NANO_STACK):HM:M2PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M2PV"){ } # define a kill record record(ao, "$(MOC):M2:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M2:ELOSSVAR") { field(CALC, "464+2") field(PINI, "YES") } record(ai, "$(MOC):M2:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+2`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M2:ELOSSRC") { field(OUT, "$(MOC):M2:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M2:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+2`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS2:DESC"){ field(VAL, "M2 $(DEV) Z closed loop") } #record(bo, "$(MOC):M2:HOMED") { # field(DESC, "Set homed status for axis 2") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M2:HOMEDSET") #} #record(calcout, "$(MOC):M2:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M2:HOMED") # field(OUT, "@pmac.proto setIntVar(m245) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M2:DirectDemand") { field(FLNK, "$(MOC):M2:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M2:DirectCountsCalc") { field(INPA, "$(MOC):M2:DirectDemand") field(INPB, "$(MOC):M2:Mres PP") field(INPC, "$(MOC):M2:Offset PP") field(INPD, "$(MOC):M2:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M2:RawDirectDemand PP") } record(ao, "$(MOC):M2:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M2:DirectMotorSeq") field(OUT, "@asyn($(PORT),2,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) Z closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M2:DirectMotorSeq") { field(LNK1, "$(MOC):M2:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M2:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M2:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),2,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M2:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),2,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M2:MresSource") } record(scalcout, $(MOC):M2:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M2:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M2:Mres.INPA CA") field(FLNK, "$(MOC):M2:OffsetSource") } record(scalcout, "$(MOC):M2:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M2:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M2:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),2,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M2:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M2:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M2:Offset.INPA CA") } record(scalcout, $(MOC):M2:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M2:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M2:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),2,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):X_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X_OL:MOTR # This associates an edm screen with the template # % gui, M3, edm, motor.edl, motor=$(PV_NANO_STACK):X_OL:MOTR # % gui, M3, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):X_OL:MOTR,filename=motor.edl,box-label=$(DEV) X open loop # This associates a BOY screen with the template # % gui, M3, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:X_OL:MOTR,DESC=$(DEV) X open loop, name=M3 # % gui, M3, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:X_OL:MOTR,DESC=$(DEV) X open loop, name=M3 # % gui, M3, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:X_OL:MOTR,DESC=$(DEV) X open loop, name=M3 # FIXME: this should be in pmacUtil or tpmac # % gui, M3, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:X_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M3, status, .MOVN # % gui, M3, sevr # These define what PVs a motor detail screen should contain # % gui, M3, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M3, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M3, command, ELoss Clear, :ELOSSRC.A # % gui, M3, statusbits, Limit Violation, .LVIO, Lim # % gui, M3, statusbits, At High Limit, .HLS, High # % gui, M3, statusbits, At Low Limit, .LLS, Low # % gui, M3, demand, User High Limit, .HLM # % gui, M3, demand, User Low Limit, .LLM # % gui, M3, demand, Dial High Limit, .DHLM # % gui, M3, demand, Dial Low Limit, .DLLM # % gui, M3, demand, Motor demand, .VAL # % gui, M3, readback, Motor readback, .RBV # % gui, M3, command, Stop, .STOP # % gui, M3, command, Home Forward, .HOMF # % gui, M3, command, Home Reverse, .HOMR # % gui, M3, command, Jog Forward, .JOGF # % gui, M3, command, Jog Reverse, .JOGR # % gui, M3, command, Tweak Forward, .TWF # % gui, M3, command, Tweak Reverse, .TWR # % gui, M3, demand, Tweak Step, .TWV # % gui, M3, command, Kill, :KILL.PROC, Kill # % gui, M3, command, Sync VAL=RBV, .SYNC # % gui, M3, enum, Direction, .DIR # % gui, M3, demand, User Offset, .OFF # % gui, M3, enum, Set/Use, .SET # % gui, M3, enum, Offset, .FOFF # % gui, M3, enum, Use Encoder, .UEIP # % gui, M3, demand, Motor Step Size, .MRES # % gui, M3, readback, Steps per Rev, .SREV # % gui, M3, readback, EGUs per Rev, .UREV # % gui, M3, demand, Encoder Step Size, .ERES # % gui, M3, readback, Readback Step Size, .RRES # % gui, M3, readback, Use Encoder if Present, .UEIP # % gui, M3, demand, Max Velocity, .VMAX # % gui, M3, demand, Base Velocity, .VBAS # % gui, M3, demand, Velocity, .VELO # % gui, M3, demand, Secs to Velocity, .ACCL # % gui, M3, demand, JVEL, .JVEL # % gui, M3, demand, Jog Acceleration, .JAR # % gui, M3, demand, Backlash Distance, .BDST # % gui, M3, demand, Backlash Velocity, .BVEL # % gui, M3, demand, Backlash Secs to Vel, .BACC # % gui, M3, demand, Move Fraction, .FRAC # % gui, M3, demand, Retry Deadband, .RDBD # % gui, M3, demand, Max Retrys, .RTRY # % gui, M3, demand, PREC, .PREC # % gui, M3, demand, EGU, .EGU # % gui, M3, demand, Output Specification, .OUT # % gui, M3, readback, Readback Location, .RDBL # % gui, M3, readback, Desired Output Loc, .DOL # % gui, M3, readback, Output Mode Select, .OMSL # % gui, M3, readback, Readback Out Link, .RLNK # % gui, M3, demand, DMOV Input Link, .DINP # % gui, M3, demand, RMP Input Link, .RINP # % gui, M3, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):X_OL:MOTR") { field(DESC,"$(DEV) X open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),3)") field(MRES,"1") field(PREC,"0") field(EGU,"step") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):X_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):X_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "3") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):X_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):X_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):X_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):X_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):X_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):X_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):X_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):X_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):X_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):X_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):X_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):X_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):X_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):X_OL:MOTR:FERRORMAX") field(PREC,"0") field(EGU, "step") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):X_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):X_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):X_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"0") field(EGU, "step") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):X_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):X_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):X_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):X_OL:MOTR, $(MOC):M3) alias($(PV_NANO_STACK):X_OL:MOTR:ADDR, $(MOC):M3:ADDR) alias($(PV_NANO_STACK):X_OL:MOTR:PORT, $(MOC):M3:PORT) alias($(PV_NANO_STACK):X_OL:MOTR:SCALE, $(MOC):M3:SCALE) alias($(PV_NANO_STACK):X_OL:MOTR:USER:SDIS, $(MOC):M3:USER:SDIS) alias($(PV_NANO_STACK):X_OL:MOTR:SDIS, $(MOC):M3:SDIS) alias($(PV_NANO_STACK):X_OL:MOTR:KILL, $(MOC):M3:KILL) alias($(PV_NANO_STACK):X_OL:MOTR:ELOSS, $(MOC):M3:ELOSS) alias($(PV_NANO_STACK):X_OL:MOTR:ELOSSRC, $(MOC):M3:ELOSSRC) alias($(PV_NANO_STACK):X_OL:MOTR:MR_MOVE_WRITE, $(MOC):M3:MR_MOVE_WRITE) alias($(PV_NANO_STACK):X_OL:MOTR:CHECK_SYNC, $(MOC):M3:CHECK_SYNC) alias($(PV_NANO_STACK):X_OL:MOTR:FERROR, $(MOC):M3:FERROR) alias($(PV_NANO_STACK):X_OL:MOTR:FERRORMAX, $(MOC):M3:FERRORMAX) alias($(PV_NANO_STACK):X_OL:MOTR:FEMAXRESET, $(MOC):M3:FEMAXRESET) alias($(PV_NANO_STACK):X_OL:MOTR:HOMEVIS, $(MOC):M3:HOMEVIS) alias($(PV_NANO_STACK):X_OL:MOTR:HOMEVISSTR, $(MOC):M3:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):X_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):X_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):X_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):X_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+3`") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):X_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):X_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+3`") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):X_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),3)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):X_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):X_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),3)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):X_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),3)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):X_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),3)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):X_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):X_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):X_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):X_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):X_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#3P") field(DESC, "$(DEV) X open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):X_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):X_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):X_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):X_OL:MOTR:HMPOS") { field(DESC, "$(DEV) X open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):X_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):X_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M3PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M3PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):X_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):X_OL:MOTR:ELOSSVAR") { field(CALC, "464+3") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):X_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+3`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):X_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+3`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS3:DESC"){ field(VAL, "M3 $(DEV) X open loop") } #record(bo, "$(PV_NANO_STACK):X_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 3") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):X_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):X_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m345) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):X_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):X_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):X_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):X_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):X_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):X_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):X_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),3,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) X open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):X_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),3,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):X_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):X_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):X_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):X_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),3,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):X_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):X_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):X_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):X_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):X_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),3,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M3:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M3.MRES CP") field(INPB, "$(MOC):M3.DIR CP") field(INPC, "$(MOC):M3:SCALE") field(OUT, "$(MOC):M3:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M3:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+3`") field(FLNK, "$(MOC):M3:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M3:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M3.OFF CP") field(OUT, "$(MOC):M3:OFF_SET PP") } record(ao, "$(MOC):M3:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+3`") field(FLNK, "$(MOC):M3:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M3:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),3)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M3:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M3:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),3)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M3:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),3)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M3:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),3)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M3:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M3:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M3:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M3:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M3:HOMING") field(CALC, "A") field(OUT, "$(MOC):M3:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M3:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M3:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#3P") field(DESC, "$(DEV) X open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(MOC):M3:HMPOS:CALC") { field(INPA, "$(MOC):M3.MRES CP") field(INPB, "$(MOC):M3:SCALE") field(INPC, "$(MOC):M3:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M3:HMPOS PP") } record(ai, "$(MOC):M3:HMPOS") { field(DESC, "$(DEV) X open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M3:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M3") field(OUT, "$(PV_NANO_STACK):HM:M3PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M3PV"){ } # define a kill record record(ao, "$(MOC):M3:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M3:ELOSSVAR") { field(CALC, "464+3") field(PINI, "YES") } record(ai, "$(MOC):M3:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+3`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M3:ELOSSRC") { field(OUT, "$(MOC):M3:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M3:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+3`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS3:DESC"){ field(VAL, "M3 $(DEV) X open loop") } #record(bo, "$(MOC):M3:HOMED") { # field(DESC, "Set homed status for axis 3") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M3:HOMEDSET") #} #record(calcout, "$(MOC):M3:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M3:HOMED") # field(OUT, "@pmac.proto setIntVar(m345) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M3:DirectDemand") { field(FLNK, "$(MOC):M3:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M3:DirectCountsCalc") { field(INPA, "$(MOC):M3:DirectDemand") field(INPB, "$(MOC):M3:Mres PP") field(INPC, "$(MOC):M3:Offset PP") field(INPD, "$(MOC):M3:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M3:RawDirectDemand PP") } record(ao, "$(MOC):M3:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M3:DirectMotorSeq") field(OUT, "@asyn($(PORT),3,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) X open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M3:DirectMotorSeq") { field(LNK1, "$(MOC):M3:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M3:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M3:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),3,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M3:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),3,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M3:MresSource") } record(scalcout, $(MOC):M3:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M3:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M3:Mres.INPA CA") field(FLNK, "$(MOC):M3:OffsetSource") } record(scalcout, "$(MOC):M3:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M3:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M3:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),3,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M3:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M3:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M3:Offset.INPA CA") } record(scalcout, $(MOC):M3:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M3:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M3:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),3,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):X:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X:MOTR # This associates an edm screen with the template # % gui, M4, edm, motor.edl, motor=$(PV_NANO_STACK):X:MOTR # % gui, M4, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):X:MOTR,filename=motor.edl,box-label=$(DEV) X closed loop # This associates a BOY screen with the template # % gui, M4, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:X:MOTR,DESC=$(DEV) X closed loop, name=M4 # % gui, M4, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:X:MOTR,DESC=$(DEV) X closed loop, name=M4 # % gui, M4, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:X:MOTR,DESC=$(DEV) X closed loop, name=M4 # FIXME: this should be in pmacUtil or tpmac # % gui, M4, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:X:MOTR # This makes the component icon reflect the status and severity # % gui, M4, status, .MOVN # % gui, M4, sevr # These define what PVs a motor detail screen should contain # % gui, M4, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M4, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M4, command, ELoss Clear, :ELOSSRC.A # % gui, M4, statusbits, Limit Violation, .LVIO, Lim # % gui, M4, statusbits, At High Limit, .HLS, High # % gui, M4, statusbits, At Low Limit, .LLS, Low # % gui, M4, demand, User High Limit, .HLM # % gui, M4, demand, User Low Limit, .LLM # % gui, M4, demand, Dial High Limit, .DHLM # % gui, M4, demand, Dial Low Limit, .DLLM # % gui, M4, demand, Motor demand, .VAL # % gui, M4, readback, Motor readback, .RBV # % gui, M4, command, Stop, .STOP # % gui, M4, command, Home Forward, .HOMF # % gui, M4, command, Home Reverse, .HOMR # % gui, M4, command, Jog Forward, .JOGF # % gui, M4, command, Jog Reverse, .JOGR # % gui, M4, command, Tweak Forward, .TWF # % gui, M4, command, Tweak Reverse, .TWR # % gui, M4, demand, Tweak Step, .TWV # % gui, M4, command, Kill, :KILL.PROC, Kill # % gui, M4, command, Sync VAL=RBV, .SYNC # % gui, M4, enum, Direction, .DIR # % gui, M4, demand, User Offset, .OFF # % gui, M4, enum, Set/Use, .SET # % gui, M4, enum, Offset, .FOFF # % gui, M4, enum, Use Encoder, .UEIP # % gui, M4, demand, Motor Step Size, .MRES # % gui, M4, readback, Steps per Rev, .SREV # % gui, M4, readback, EGUs per Rev, .UREV # % gui, M4, demand, Encoder Step Size, .ERES # % gui, M4, readback, Readback Step Size, .RRES # % gui, M4, readback, Use Encoder if Present, .UEIP # % gui, M4, demand, Max Velocity, .VMAX # % gui, M4, demand, Base Velocity, .VBAS # % gui, M4, demand, Velocity, .VELO # % gui, M4, demand, Secs to Velocity, .ACCL # % gui, M4, demand, JVEL, .JVEL # % gui, M4, demand, Jog Acceleration, .JAR # % gui, M4, demand, Backlash Distance, .BDST # % gui, M4, demand, Backlash Velocity, .BVEL # % gui, M4, demand, Backlash Secs to Vel, .BACC # % gui, M4, demand, Move Fraction, .FRAC # % gui, M4, demand, Retry Deadband, .RDBD # % gui, M4, demand, Max Retrys, .RTRY # % gui, M4, demand, PREC, .PREC # % gui, M4, demand, EGU, .EGU # % gui, M4, demand, Output Specification, .OUT # % gui, M4, readback, Readback Location, .RDBL # % gui, M4, readback, Desired Output Loc, .DOL # % gui, M4, readback, Output Mode Select, .OMSL # % gui, M4, readback, Readback Out Link, .RLNK # % gui, M4, demand, DMOV Input Link, .DINP # % gui, M4, demand, RMP Input Link, .RINP # % gui, M4, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):X:MOTR") { field(DESC,"$(DEV) X closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),4)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mm") field(DHLM,"") field(DLLM,"") field(HLM,"0.5") field(LLM,"-0.5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):X:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):X:MOTR:ADDR") { field(PINI, "YES") field(VAL, "4") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):X:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):X:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):X:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):X:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):X:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):X:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):X:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):X:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):X:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):X:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):X:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):X:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):X:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):X:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):X:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):X:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):X:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):X:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):X:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):X:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mm") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):X:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):X:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):X:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):X:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mm") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):X:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):X:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):X:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):X:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):X:MOTR, $(MOC):M4) alias($(PV_NANO_STACK):X:MOTR:ADDR, $(MOC):M4:ADDR) alias($(PV_NANO_STACK):X:MOTR:PORT, $(MOC):M4:PORT) alias($(PV_NANO_STACK):X:MOTR:SCALE, $(MOC):M4:SCALE) alias($(PV_NANO_STACK):X:MOTR:USER:SDIS, $(MOC):M4:USER:SDIS) alias($(PV_NANO_STACK):X:MOTR:SDIS, $(MOC):M4:SDIS) alias($(PV_NANO_STACK):X:MOTR:KILL, $(MOC):M4:KILL) alias($(PV_NANO_STACK):X:MOTR:ELOSS, $(MOC):M4:ELOSS) alias($(PV_NANO_STACK):X:MOTR:ELOSSRC, $(MOC):M4:ELOSSRC) alias($(PV_NANO_STACK):X:MOTR:MR_MOVE_WRITE, $(MOC):M4:MR_MOVE_WRITE) alias($(PV_NANO_STACK):X:MOTR:CHECK_SYNC, $(MOC):M4:CHECK_SYNC) alias($(PV_NANO_STACK):X:MOTR:FERROR, $(MOC):M4:FERROR) alias($(PV_NANO_STACK):X:MOTR:FERRORMAX, $(MOC):M4:FERRORMAX) alias($(PV_NANO_STACK):X:MOTR:FEMAXRESET, $(MOC):M4:FEMAXRESET) alias($(PV_NANO_STACK):X:MOTR:HOMEVIS, $(MOC):M4:HOMEVIS) alias($(PV_NANO_STACK):X:MOTR:HOMEVISSTR, $(MOC):M4:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):X:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):X:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):X:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):X:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):X:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):X:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+4`") field(FLNK, "$(PV_NANO_STACK):X:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):X:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):X:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):X:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):X:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+4`") field(FLNK, "$(PV_NANO_STACK):X:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):X:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),4)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):X:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):X:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),4)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):X:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),4)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):X:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),4)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):X:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):X:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):X:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):X:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):X:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):X:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):X:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):X:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#4P") field(DESC, "$(DEV) X closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(PV_NANO_STACK):X:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):X:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):X:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):X:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):X:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):X:MOTR:HMPOS") { field(DESC, "$(DEV) X closed loop") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):X:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):X:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M4PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M4PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):X:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):X:MOTR:ELOSSVAR") { field(CALC, "464+4") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):X:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+4`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):X:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):X:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):X:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+4`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS4:DESC"){ field(VAL, "M4 $(DEV) X closed loop") } #record(bo, "$(PV_NANO_STACK):X:MOTR:HOMED") { # field(DESC, "Set homed status for axis 4") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):X:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):X:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):X:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m445) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):X:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):X:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):X:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):X:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):X:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):X:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):X:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):X:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):X:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):X:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),4,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) X closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):X:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):X:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):X:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):X:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):X:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),4,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):X:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):X:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):X:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):X:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):X:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):X:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):X:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):X:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),4,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):X:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):X:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):X:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):X:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):X:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):X:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),4,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M4:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M4.MRES CP") field(INPB, "$(MOC):M4.DIR CP") field(INPC, "$(MOC):M4:SCALE") field(OUT, "$(MOC):M4:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M4:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+4`") field(FLNK, "$(MOC):M4:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M4:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M4.OFF CP") field(OUT, "$(MOC):M4:OFF_SET PP") } record(ao, "$(MOC):M4:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+4`") field(FLNK, "$(MOC):M4:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M4:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),4)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M4:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M4:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),4)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M4:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),4)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M4:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),4)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M4:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M4:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M4:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M4:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M4:HOMING") field(CALC, "A") field(OUT, "$(MOC):M4:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M4:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M4:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#4P") field(DESC, "$(DEV) X closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(MOC):M4:HMPOS:CALC") { field(INPA, "$(MOC):M4.MRES CP") field(INPB, "$(MOC):M4:SCALE") field(INPC, "$(MOC):M4:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M4:HMPOS PP") } record(ai, "$(MOC):M4:HMPOS") { field(DESC, "$(DEV) X closed loop") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M4:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M4") field(OUT, "$(PV_NANO_STACK):HM:M4PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M4PV"){ } # define a kill record record(ao, "$(MOC):M4:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M4:ELOSSVAR") { field(CALC, "464+4") field(PINI, "YES") } record(ai, "$(MOC):M4:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+4`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M4:ELOSSRC") { field(OUT, "$(MOC):M4:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M4:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+4`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS4:DESC"){ field(VAL, "M4 $(DEV) X closed loop") } #record(bo, "$(MOC):M4:HOMED") { # field(DESC, "Set homed status for axis 4") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M4:HOMEDSET") #} #record(calcout, "$(MOC):M4:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M4:HOMED") # field(OUT, "@pmac.proto setIntVar(m445) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M4:DirectDemand") { field(FLNK, "$(MOC):M4:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M4:DirectCountsCalc") { field(INPA, "$(MOC):M4:DirectDemand") field(INPB, "$(MOC):M4:Mres PP") field(INPC, "$(MOC):M4:Offset PP") field(INPD, "$(MOC):M4:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M4:RawDirectDemand PP") } record(ao, "$(MOC):M4:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M4:DirectMotorSeq") field(OUT, "@asyn($(PORT),4,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) X closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M4:DirectMotorSeq") { field(LNK1, "$(MOC):M4:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M4:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M4:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),4,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M4:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),4,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M4:MresSource") } record(scalcout, $(MOC):M4:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M4:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M4:Mres.INPA CA") field(FLNK, "$(MOC):M4:OffsetSource") } record(scalcout, "$(MOC):M4:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M4:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M4:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),4,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M4:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M4:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M4:Offset.INPA CA") } record(scalcout, $(MOC):M4:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M4:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M4:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),4,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):ROLL_C_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C_OL:MOTR # This associates an edm screen with the template # % gui, M5, edm, motor.edl, motor=$(PV_NANO_STACK):ROLL_C_OL:MOTR # % gui, M5, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):ROLL_C_OL:MOTR,filename=motor.edl,box-label=$(DEV) roll open loop # This associates a BOY screen with the template # % gui, M5, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:ROLL_C_OL:MOTR,DESC=$(DEV) roll open loop, name=M5 # % gui, M5, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:ROLL_C_OL:MOTR,DESC=$(DEV) roll open loop, name=M5 # % gui, M5, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_C_OL:MOTR,DESC=$(DEV) roll open loop, name=M5 # FIXME: this should be in pmacUtil or tpmac # % gui, M5, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_C_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M5, status, .MOVN # % gui, M5, sevr # These define what PVs a motor detail screen should contain # % gui, M5, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M5, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M5, command, ELoss Clear, :ELOSSRC.A # % gui, M5, statusbits, Limit Violation, .LVIO, Lim # % gui, M5, statusbits, At High Limit, .HLS, High # % gui, M5, statusbits, At Low Limit, .LLS, Low # % gui, M5, demand, User High Limit, .HLM # % gui, M5, demand, User Low Limit, .LLM # % gui, M5, demand, Dial High Limit, .DHLM # % gui, M5, demand, Dial Low Limit, .DLLM # % gui, M5, demand, Motor demand, .VAL # % gui, M5, readback, Motor readback, .RBV # % gui, M5, command, Stop, .STOP # % gui, M5, command, Home Forward, .HOMF # % gui, M5, command, Home Reverse, .HOMR # % gui, M5, command, Jog Forward, .JOGF # % gui, M5, command, Jog Reverse, .JOGR # % gui, M5, command, Tweak Forward, .TWF # % gui, M5, command, Tweak Reverse, .TWR # % gui, M5, demand, Tweak Step, .TWV # % gui, M5, command, Kill, :KILL.PROC, Kill # % gui, M5, command, Sync VAL=RBV, .SYNC # % gui, M5, enum, Direction, .DIR # % gui, M5, demand, User Offset, .OFF # % gui, M5, enum, Set/Use, .SET # % gui, M5, enum, Offset, .FOFF # % gui, M5, enum, Use Encoder, .UEIP # % gui, M5, demand, Motor Step Size, .MRES # % gui, M5, readback, Steps per Rev, .SREV # % gui, M5, readback, EGUs per Rev, .UREV # % gui, M5, demand, Encoder Step Size, .ERES # % gui, M5, readback, Readback Step Size, .RRES # % gui, M5, readback, Use Encoder if Present, .UEIP # % gui, M5, demand, Max Velocity, .VMAX # % gui, M5, demand, Base Velocity, .VBAS # % gui, M5, demand, Velocity, .VELO # % gui, M5, demand, Secs to Velocity, .ACCL # % gui, M5, demand, JVEL, .JVEL # % gui, M5, demand, Jog Acceleration, .JAR # % gui, M5, demand, Backlash Distance, .BDST # % gui, M5, demand, Backlash Velocity, .BVEL # % gui, M5, demand, Backlash Secs to Vel, .BACC # % gui, M5, demand, Move Fraction, .FRAC # % gui, M5, demand, Retry Deadband, .RDBD # % gui, M5, demand, Max Retrys, .RTRY # % gui, M5, demand, PREC, .PREC # % gui, M5, demand, EGU, .EGU # % gui, M5, demand, Output Specification, .OUT # % gui, M5, readback, Readback Location, .RDBL # % gui, M5, readback, Desired Output Loc, .DOL # % gui, M5, readback, Output Mode Select, .OMSL # % gui, M5, readback, Readback Out Link, .RLNK # % gui, M5, demand, DMOV Input Link, .DINP # % gui, M5, demand, RMP Input Link, .RINP # % gui, M5, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):ROLL_C_OL:MOTR") { field(DESC,"$(DEV) roll open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),5)") field(MRES,"1") field(PREC,"0") field(EGU,"step") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "5") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):ROLL_C_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):ROLL_C_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):ROLL_C_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):ROLL_C_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX") field(PREC,"0") field(EGU, "step") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"0") field(EGU, "step") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):ROLL_C_OL:MOTR, $(MOC):M5) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:ADDR, $(MOC):M5:ADDR) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:PORT, $(MOC):M5:PORT) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE, $(MOC):M5:SCALE) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:USER:SDIS, $(MOC):M5:USER:SDIS) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:SDIS, $(MOC):M5:SDIS) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:KILL, $(MOC):M5:KILL) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSS, $(MOC):M5:ELOSS) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSSRC, $(MOC):M5:ELOSSRC) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:MR_MOVE_WRITE, $(MOC):M5:MR_MOVE_WRITE) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:CHECK_SYNC, $(MOC):M5:CHECK_SYNC) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:FERROR, $(MOC):M5:FERROR) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:FERRORMAX, $(MOC):M5:FERRORMAX) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:FEMAXRESET, $(MOC):M5:FEMAXRESET) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEVIS, $(MOC):M5:HOMEVIS) alias($(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEVISSTR, $(MOC):M5:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+5`") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+5`") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),5)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),5)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),5)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),5)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#5P") field(DESC, "$(DEV) roll open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HMPOS") { field(DESC, "$(DEV) roll open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):ROLL_C_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M5PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M5PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSSVAR") { field(CALC, "464+5") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+5`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+5`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS5:DESC"){ field(VAL, "M5 $(DEV) roll open loop") } #record(bo, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 5") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m545) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),5,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):ROLL_C_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):ROLL_C_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),5,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):ROLL_C_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):ROLL_C_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_C_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):ROLL_C_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),5,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M5:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M5.MRES CP") field(INPB, "$(MOC):M5.DIR CP") field(INPC, "$(MOC):M5:SCALE") field(OUT, "$(MOC):M5:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M5:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+5`") field(FLNK, "$(MOC):M5:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M5:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M5.OFF CP") field(OUT, "$(MOC):M5:OFF_SET PP") } record(ao, "$(MOC):M5:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+5`") field(FLNK, "$(MOC):M5:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M5:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),5)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M5:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M5:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),5)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M5:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),5)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M5:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),5)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M5:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M5:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M5:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M5:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M5:HOMING") field(CALC, "A") field(OUT, "$(MOC):M5:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M5:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M5:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#5P") field(DESC, "$(DEV) roll open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(MOC):M5:HMPOS:CALC") { field(INPA, "$(MOC):M5.MRES CP") field(INPB, "$(MOC):M5:SCALE") field(INPC, "$(MOC):M5:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M5:HMPOS PP") } record(ai, "$(MOC):M5:HMPOS") { field(DESC, "$(DEV) roll open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M5:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M5") field(OUT, "$(PV_NANO_STACK):HM:M5PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M5PV"){ } # define a kill record record(ao, "$(MOC):M5:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M5:ELOSSVAR") { field(CALC, "464+5") field(PINI, "YES") } record(ai, "$(MOC):M5:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+5`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M5:ELOSSRC") { field(OUT, "$(MOC):M5:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M5:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+5`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS5:DESC"){ field(VAL, "M5 $(DEV) roll open loop") } #record(bo, "$(MOC):M5:HOMED") { # field(DESC, "Set homed status for axis 5") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M5:HOMEDSET") #} #record(calcout, "$(MOC):M5:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M5:HOMED") # field(OUT, "@pmac.proto setIntVar(m545) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M5:DirectDemand") { field(FLNK, "$(MOC):M5:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M5:DirectCountsCalc") { field(INPA, "$(MOC):M5:DirectDemand") field(INPB, "$(MOC):M5:Mres PP") field(INPC, "$(MOC):M5:Offset PP") field(INPD, "$(MOC):M5:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M5:RawDirectDemand PP") } record(ao, "$(MOC):M5:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M5:DirectMotorSeq") field(OUT, "@asyn($(PORT),5,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M5:DirectMotorSeq") { field(LNK1, "$(MOC):M5:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M5:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M5:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),5,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M5:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),5,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M5:MresSource") } record(scalcout, $(MOC):M5:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M5:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M5:Mres.INPA CA") field(FLNK, "$(MOC):M5:OffsetSource") } record(scalcout, "$(MOC):M5:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M5:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M5:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),5,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M5:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M5:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M5:Offset.INPA CA") } record(scalcout, $(MOC):M5:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M5:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M5:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),5,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):ROLL_C:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C:MOTR # This associates an edm screen with the template # % gui, M6, edm, motor.edl, motor=$(PV_NANO_STACK):ROLL_C:MOTR # % gui, M6, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):ROLL_C:MOTR,filename=motor.edl,box-label=$(DEV) roll closed loop # This associates a BOY screen with the template # % gui, M6, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:ROLL_C:MOTR,DESC=$(DEV) roll closed loop, name=M6 # % gui, M6, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:ROLL_C:MOTR,DESC=$(DEV) roll closed loop, name=M6 # % gui, M6, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_C:MOTR,DESC=$(DEV) roll closed loop, name=M6 # FIXME: this should be in pmacUtil or tpmac # % gui, M6, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_C:MOTR # This makes the component icon reflect the status and severity # % gui, M6, status, .MOVN # % gui, M6, sevr # These define what PVs a motor detail screen should contain # % gui, M6, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M6, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M6, command, ELoss Clear, :ELOSSRC.A # % gui, M6, statusbits, Limit Violation, .LVIO, Lim # % gui, M6, statusbits, At High Limit, .HLS, High # % gui, M6, statusbits, At Low Limit, .LLS, Low # % gui, M6, demand, User High Limit, .HLM # % gui, M6, demand, User Low Limit, .LLM # % gui, M6, demand, Dial High Limit, .DHLM # % gui, M6, demand, Dial Low Limit, .DLLM # % gui, M6, demand, Motor demand, .VAL # % gui, M6, readback, Motor readback, .RBV # % gui, M6, command, Stop, .STOP # % gui, M6, command, Home Forward, .HOMF # % gui, M6, command, Home Reverse, .HOMR # % gui, M6, command, Jog Forward, .JOGF # % gui, M6, command, Jog Reverse, .JOGR # % gui, M6, command, Tweak Forward, .TWF # % gui, M6, command, Tweak Reverse, .TWR # % gui, M6, demand, Tweak Step, .TWV # % gui, M6, command, Kill, :KILL.PROC, Kill # % gui, M6, command, Sync VAL=RBV, .SYNC # % gui, M6, enum, Direction, .DIR # % gui, M6, demand, User Offset, .OFF # % gui, M6, enum, Set/Use, .SET # % gui, M6, enum, Offset, .FOFF # % gui, M6, enum, Use Encoder, .UEIP # % gui, M6, demand, Motor Step Size, .MRES # % gui, M6, readback, Steps per Rev, .SREV # % gui, M6, readback, EGUs per Rev, .UREV # % gui, M6, demand, Encoder Step Size, .ERES # % gui, M6, readback, Readback Step Size, .RRES # % gui, M6, readback, Use Encoder if Present, .UEIP # % gui, M6, demand, Max Velocity, .VMAX # % gui, M6, demand, Base Velocity, .VBAS # % gui, M6, demand, Velocity, .VELO # % gui, M6, demand, Secs to Velocity, .ACCL # % gui, M6, demand, JVEL, .JVEL # % gui, M6, demand, Jog Acceleration, .JAR # % gui, M6, demand, Backlash Distance, .BDST # % gui, M6, demand, Backlash Velocity, .BVEL # % gui, M6, demand, Backlash Secs to Vel, .BACC # % gui, M6, demand, Move Fraction, .FRAC # % gui, M6, demand, Retry Deadband, .RDBD # % gui, M6, demand, Max Retrys, .RTRY # % gui, M6, demand, PREC, .PREC # % gui, M6, demand, EGU, .EGU # % gui, M6, demand, Output Specification, .OUT # % gui, M6, readback, Readback Location, .RDBL # % gui, M6, readback, Desired Output Loc, .DOL # % gui, M6, readback, Output Mode Select, .OMSL # % gui, M6, readback, Readback Out Link, .RLNK # % gui, M6, demand, DMOV Input Link, .DINP # % gui, M6, demand, RMP Input Link, .RINP # % gui, M6, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):ROLL_C:MOTR") { field(DESC,"$(DEV) roll closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),6)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"13.0") field(LLM,"-13.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):ROLL_C:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:ADDR") { field(PINI, "YES") field(VAL, "6") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):ROLL_C:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):ROLL_C:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):ROLL_C:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):ROLL_C:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):ROLL_C:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):ROLL_C:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):ROLL_C:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):ROLL_C:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):ROLL_C:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):ROLL_C:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):ROLL_C:MOTR, $(MOC):M6) alias($(PV_NANO_STACK):ROLL_C:MOTR:ADDR, $(MOC):M6:ADDR) alias($(PV_NANO_STACK):ROLL_C:MOTR:PORT, $(MOC):M6:PORT) alias($(PV_NANO_STACK):ROLL_C:MOTR:SCALE, $(MOC):M6:SCALE) alias($(PV_NANO_STACK):ROLL_C:MOTR:USER:SDIS, $(MOC):M6:USER:SDIS) alias($(PV_NANO_STACK):ROLL_C:MOTR:SDIS, $(MOC):M6:SDIS) alias($(PV_NANO_STACK):ROLL_C:MOTR:KILL, $(MOC):M6:KILL) alias($(PV_NANO_STACK):ROLL_C:MOTR:ELOSS, $(MOC):M6:ELOSS) alias($(PV_NANO_STACK):ROLL_C:MOTR:ELOSSRC, $(MOC):M6:ELOSSRC) alias($(PV_NANO_STACK):ROLL_C:MOTR:MR_MOVE_WRITE, $(MOC):M6:MR_MOVE_WRITE) alias($(PV_NANO_STACK):ROLL_C:MOTR:CHECK_SYNC, $(MOC):M6:CHECK_SYNC) alias($(PV_NANO_STACK):ROLL_C:MOTR:FERROR, $(MOC):M6:FERROR) alias($(PV_NANO_STACK):ROLL_C:MOTR:FERRORMAX, $(MOC):M6:FERRORMAX) alias($(PV_NANO_STACK):ROLL_C:MOTR:FEMAXRESET, $(MOC):M6:FEMAXRESET) alias($(PV_NANO_STACK):ROLL_C:MOTR:HOMEVIS, $(MOC):M6:HOMEVIS) alias($(PV_NANO_STACK):ROLL_C:MOTR:HOMEVISSTR, $(MOC):M6:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_C:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):ROLL_C:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+6`") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+6`") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),6)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):ROLL_C:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):ROLL_C:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),6)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):ROLL_C:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),6)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):ROLL_C:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),6)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):ROLL_C:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):ROLL_C:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#6P") field(DESC, "$(DEV) roll closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_C:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):ROLL_C:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:HMPOS") { field(DESC, "$(DEV) roll closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):ROLL_C:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):ROLL_C:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M6PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M6PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):ROLL_C:MOTR:ELOSSVAR") { field(CALC, "464+6") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):ROLL_C:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+6`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+6`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS6:DESC"){ field(VAL, "M6 $(DEV) roll closed loop") } #record(bo, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMED") { # field(DESC, "Set homed status for axis 6") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m645) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):ROLL_C:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):ROLL_C:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):ROLL_C:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),6,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):ROLL_C:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),6,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):ROLL_C:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):ROLL_C:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):ROLL_C:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):ROLL_C:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),6,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):ROLL_C:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_C:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):ROLL_C:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_C:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):ROLL_C:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),6,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M6:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M6.MRES CP") field(INPB, "$(MOC):M6.DIR CP") field(INPC, "$(MOC):M6:SCALE") field(OUT, "$(MOC):M6:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M6:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+6`") field(FLNK, "$(MOC):M6:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M6:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M6.OFF CP") field(OUT, "$(MOC):M6:OFF_SET PP") } record(ao, "$(MOC):M6:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+6`") field(FLNK, "$(MOC):M6:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M6:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),6)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M6:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M6:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),6)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M6:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),6)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M6:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),6)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M6:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M6:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M6:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M6:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M6:HOMING") field(CALC, "A") field(OUT, "$(MOC):M6:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M6:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M6:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#6P") field(DESC, "$(DEV) roll closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M6:HMPOS:CALC") { field(INPA, "$(MOC):M6.MRES CP") field(INPB, "$(MOC):M6:SCALE") field(INPC, "$(MOC):M6:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M6:HMPOS PP") } record(ai, "$(MOC):M6:HMPOS") { field(DESC, "$(DEV) roll closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M6:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M6") field(OUT, "$(PV_NANO_STACK):HM:M6PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M6PV"){ } # define a kill record record(ao, "$(MOC):M6:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M6:ELOSSVAR") { field(CALC, "464+6") field(PINI, "YES") } record(ai, "$(MOC):M6:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+6`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M6:ELOSSRC") { field(OUT, "$(MOC):M6:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M6:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+6`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS6:DESC"){ field(VAL, "M6 $(DEV) roll closed loop") } #record(bo, "$(MOC):M6:HOMED") { # field(DESC, "Set homed status for axis 6") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M6:HOMEDSET") #} #record(calcout, "$(MOC):M6:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M6:HOMED") # field(OUT, "@pmac.proto setIntVar(m645) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M6:DirectDemand") { field(FLNK, "$(MOC):M6:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M6:DirectCountsCalc") { field(INPA, "$(MOC):M6:DirectDemand") field(INPB, "$(MOC):M6:Mres PP") field(INPC, "$(MOC):M6:Offset PP") field(INPD, "$(MOC):M6:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M6:RawDirectDemand PP") } record(ao, "$(MOC):M6:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M6:DirectMotorSeq") field(OUT, "@asyn($(PORT),6,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M6:DirectMotorSeq") { field(LNK1, "$(MOC):M6:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M6:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M6:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),6,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M6:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),6,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M6:MresSource") } record(scalcout, $(MOC):M6:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M6:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M6:Mres.INPA CA") field(FLNK, "$(MOC):M6:OffsetSource") } record(scalcout, "$(MOC):M6:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M6:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M6:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),6,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M6:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M6:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M6:Offset.INPA CA") } record(scalcout, $(MOC):M6:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M6:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M6:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),6,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):PITCH_C_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C_OL:MOTR # This associates an edm screen with the template # % gui, M7, edm, motor.edl, motor=$(PV_NANO_STACK):PITCH_C_OL:MOTR # % gui, M7, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):PITCH_C_OL:MOTR,filename=motor.edl,box-label=$(DEV) pitch open loop # This associates a BOY screen with the template # % gui, M7, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:PITCH_C_OL:MOTR,DESC=$(DEV) pitch open loop, name=M7 # % gui, M7, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:PITCH_C_OL:MOTR,DESC=$(DEV) pitch open loop, name=M7 # % gui, M7, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_C_OL:MOTR,DESC=$(DEV) pitch open loop, name=M7 # FIXME: this should be in pmacUtil or tpmac # % gui, M7, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_C_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M7, status, .MOVN # % gui, M7, sevr # These define what PVs a motor detail screen should contain # % gui, M7, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M7, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M7, command, ELoss Clear, :ELOSSRC.A # % gui, M7, statusbits, Limit Violation, .LVIO, Lim # % gui, M7, statusbits, At High Limit, .HLS, High # % gui, M7, statusbits, At Low Limit, .LLS, Low # % gui, M7, demand, User High Limit, .HLM # % gui, M7, demand, User Low Limit, .LLM # % gui, M7, demand, Dial High Limit, .DHLM # % gui, M7, demand, Dial Low Limit, .DLLM # % gui, M7, demand, Motor demand, .VAL # % gui, M7, readback, Motor readback, .RBV # % gui, M7, command, Stop, .STOP # % gui, M7, command, Home Forward, .HOMF # % gui, M7, command, Home Reverse, .HOMR # % gui, M7, command, Jog Forward, .JOGF # % gui, M7, command, Jog Reverse, .JOGR # % gui, M7, command, Tweak Forward, .TWF # % gui, M7, command, Tweak Reverse, .TWR # % gui, M7, demand, Tweak Step, .TWV # % gui, M7, command, Kill, :KILL.PROC, Kill # % gui, M7, command, Sync VAL=RBV, .SYNC # % gui, M7, enum, Direction, .DIR # % gui, M7, demand, User Offset, .OFF # % gui, M7, enum, Set/Use, .SET # % gui, M7, enum, Offset, .FOFF # % gui, M7, enum, Use Encoder, .UEIP # % gui, M7, demand, Motor Step Size, .MRES # % gui, M7, readback, Steps per Rev, .SREV # % gui, M7, readback, EGUs per Rev, .UREV # % gui, M7, demand, Encoder Step Size, .ERES # % gui, M7, readback, Readback Step Size, .RRES # % gui, M7, readback, Use Encoder if Present, .UEIP # % gui, M7, demand, Max Velocity, .VMAX # % gui, M7, demand, Base Velocity, .VBAS # % gui, M7, demand, Velocity, .VELO # % gui, M7, demand, Secs to Velocity, .ACCL # % gui, M7, demand, JVEL, .JVEL # % gui, M7, demand, Jog Acceleration, .JAR # % gui, M7, demand, Backlash Distance, .BDST # % gui, M7, demand, Backlash Velocity, .BVEL # % gui, M7, demand, Backlash Secs to Vel, .BACC # % gui, M7, demand, Move Fraction, .FRAC # % gui, M7, demand, Retry Deadband, .RDBD # % gui, M7, demand, Max Retrys, .RTRY # % gui, M7, demand, PREC, .PREC # % gui, M7, demand, EGU, .EGU # % gui, M7, demand, Output Specification, .OUT # % gui, M7, readback, Readback Location, .RDBL # % gui, M7, readback, Desired Output Loc, .DOL # % gui, M7, readback, Output Mode Select, .OMSL # % gui, M7, readback, Readback Out Link, .RLNK # % gui, M7, demand, DMOV Input Link, .DINP # % gui, M7, demand, RMP Input Link, .RINP # % gui, M7, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):PITCH_C_OL:MOTR") { field(DESC,"$(DEV) pitch open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),7)") field(MRES,"1") field(PREC,"0") field(EGU,"step") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "7") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):PITCH_C_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):PITCH_C_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):PITCH_C_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):PITCH_C_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX") field(PREC,"0") field(EGU, "step") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"0") field(EGU, "step") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):PITCH_C_OL:MOTR, $(MOC):M7) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:ADDR, $(MOC):M7:ADDR) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:PORT, $(MOC):M7:PORT) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE, $(MOC):M7:SCALE) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:USER:SDIS, $(MOC):M7:USER:SDIS) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:SDIS, $(MOC):M7:SDIS) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:KILL, $(MOC):M7:KILL) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSS, $(MOC):M7:ELOSS) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSSRC, $(MOC):M7:ELOSSRC) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:MR_MOVE_WRITE, $(MOC):M7:MR_MOVE_WRITE) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:CHECK_SYNC, $(MOC):M7:CHECK_SYNC) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:FERROR, $(MOC):M7:FERROR) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:FERRORMAX, $(MOC):M7:FERRORMAX) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:FEMAXRESET, $(MOC):M7:FEMAXRESET) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEVIS, $(MOC):M7:HOMEVIS) alias($(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEVISSTR, $(MOC):M7:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+7`") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+7`") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),7)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),7)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),7)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),7)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#7P") field(DESC, "$(DEV) pitch open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HMPOS") { field(DESC, "$(DEV) pitch open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):PITCH_C_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M7PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M7PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSSVAR") { field(CALC, "464+7") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+7`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+7`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS7:DESC"){ field(VAL, "M7 $(DEV) pitch open loop") } #record(bo, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 7") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m745) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),7,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),7,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):PITCH_C_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):PITCH_C_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),7,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):PITCH_C_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):PITCH_C_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_C_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):PITCH_C_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),7,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M7:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M7.MRES CP") field(INPB, "$(MOC):M7.DIR CP") field(INPC, "$(MOC):M7:SCALE") field(OUT, "$(MOC):M7:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M7:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+7`") field(FLNK, "$(MOC):M7:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M7:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M7.OFF CP") field(OUT, "$(MOC):M7:OFF_SET PP") } record(ao, "$(MOC):M7:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+7`") field(FLNK, "$(MOC):M7:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M7:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),7)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M7:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M7:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),7)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M7:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),7)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M7:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),7)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M7:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M7:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M7:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M7:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M7:HOMING") field(CALC, "A") field(OUT, "$(MOC):M7:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M7:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M7:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#7P") field(DESC, "$(DEV) pitch open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "0") field(EGU, "step") } record(calcout, "$(MOC):M7:HMPOS:CALC") { field(INPA, "$(MOC):M7.MRES CP") field(INPB, "$(MOC):M7:SCALE") field(INPC, "$(MOC):M7:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M7:HMPOS PP") } record(ai, "$(MOC):M7:HMPOS") { field(DESC, "$(DEV) pitch open loop") field(PREC, "0") field(EGU, "step") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M7:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M7") field(OUT, "$(PV_NANO_STACK):HM:M7PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M7PV"){ } # define a kill record record(ao, "$(MOC):M7:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M7:ELOSSVAR") { field(CALC, "464+7") field(PINI, "YES") } record(ai, "$(MOC):M7:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+7`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M7:ELOSSRC") { field(OUT, "$(MOC):M7:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M7:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+7`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS7:DESC"){ field(VAL, "M7 $(DEV) pitch open loop") } #record(bo, "$(MOC):M7:HOMED") { # field(DESC, "Set homed status for axis 7") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M7:HOMEDSET") #} #record(calcout, "$(MOC):M7:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M7:HOMED") # field(OUT, "@pmac.proto setIntVar(m745) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M7:DirectDemand") { field(FLNK, "$(MOC):M7:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M7:DirectCountsCalc") { field(INPA, "$(MOC):M7:DirectDemand") field(INPB, "$(MOC):M7:Mres PP") field(INPC, "$(MOC):M7:Offset PP") field(INPD, "$(MOC):M7:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M7:RawDirectDemand PP") } record(ao, "$(MOC):M7:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M7:DirectMotorSeq") field(OUT, "@asyn($(PORT),7,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M7:DirectMotorSeq") { field(LNK1, "$(MOC):M7:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M7:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M7:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),7,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M7:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),7,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M7:MresSource") } record(scalcout, $(MOC):M7:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M7:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M7:Mres.INPA CA") field(FLNK, "$(MOC):M7:OffsetSource") } record(scalcout, "$(MOC):M7:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M7:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M7:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),7,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M7:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M7:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M7:Offset.INPA CA") } record(scalcout, $(MOC):M7:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M7:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M7:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),7,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):PITCH_C:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C:MOTR # This associates an edm screen with the template # % gui, M8, edm, motor.edl, motor=$(PV_NANO_STACK):PITCH_C:MOTR # % gui, M8, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):PITCH_C:MOTR,filename=motor.edl,box-label=$(DEV) pitch closed loop # This associates a BOY screen with the template # % gui, M8, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:PITCH_C:MOTR,DESC=$(DEV) pitch closed loop, name=M8 # % gui, M8, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:PITCH_C:MOTR,DESC=$(DEV) pitch closed loop, name=M8 # % gui, M8, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_C:MOTR,DESC=$(DEV) pitch closed loop, name=M8 # FIXME: this should be in pmacUtil or tpmac # % gui, M8, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_C:MOTR # This makes the component icon reflect the status and severity # % gui, M8, status, .MOVN # % gui, M8, sevr # These define what PVs a motor detail screen should contain # % gui, M8, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M8, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M8, command, ELoss Clear, :ELOSSRC.A # % gui, M8, statusbits, Limit Violation, .LVIO, Lim # % gui, M8, statusbits, At High Limit, .HLS, High # % gui, M8, statusbits, At Low Limit, .LLS, Low # % gui, M8, demand, User High Limit, .HLM # % gui, M8, demand, User Low Limit, .LLM # % gui, M8, demand, Dial High Limit, .DHLM # % gui, M8, demand, Dial Low Limit, .DLLM # % gui, M8, demand, Motor demand, .VAL # % gui, M8, readback, Motor readback, .RBV # % gui, M8, command, Stop, .STOP # % gui, M8, command, Home Forward, .HOMF # % gui, M8, command, Home Reverse, .HOMR # % gui, M8, command, Jog Forward, .JOGF # % gui, M8, command, Jog Reverse, .JOGR # % gui, M8, command, Tweak Forward, .TWF # % gui, M8, command, Tweak Reverse, .TWR # % gui, M8, demand, Tweak Step, .TWV # % gui, M8, command, Kill, :KILL.PROC, Kill # % gui, M8, command, Sync VAL=RBV, .SYNC # % gui, M8, enum, Direction, .DIR # % gui, M8, demand, User Offset, .OFF # % gui, M8, enum, Set/Use, .SET # % gui, M8, enum, Offset, .FOFF # % gui, M8, enum, Use Encoder, .UEIP # % gui, M8, demand, Motor Step Size, .MRES # % gui, M8, readback, Steps per Rev, .SREV # % gui, M8, readback, EGUs per Rev, .UREV # % gui, M8, demand, Encoder Step Size, .ERES # % gui, M8, readback, Readback Step Size, .RRES # % gui, M8, readback, Use Encoder if Present, .UEIP # % gui, M8, demand, Max Velocity, .VMAX # % gui, M8, demand, Base Velocity, .VBAS # % gui, M8, demand, Velocity, .VELO # % gui, M8, demand, Secs to Velocity, .ACCL # % gui, M8, demand, JVEL, .JVEL # % gui, M8, demand, Jog Acceleration, .JAR # % gui, M8, demand, Backlash Distance, .BDST # % gui, M8, demand, Backlash Velocity, .BVEL # % gui, M8, demand, Backlash Secs to Vel, .BACC # % gui, M8, demand, Move Fraction, .FRAC # % gui, M8, demand, Retry Deadband, .RDBD # % gui, M8, demand, Max Retrys, .RTRY # % gui, M8, demand, PREC, .PREC # % gui, M8, demand, EGU, .EGU # % gui, M8, demand, Output Specification, .OUT # % gui, M8, readback, Readback Location, .RDBL # % gui, M8, readback, Desired Output Loc, .DOL # % gui, M8, readback, Output Mode Select, .OMSL # % gui, M8, readback, Readback Out Link, .RLNK # % gui, M8, demand, DMOV Input Link, .DINP # % gui, M8, demand, RMP Input Link, .RINP # % gui, M8, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):PITCH_C:MOTR") { field(DESC,"$(DEV) pitch closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),8)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"13.0") field(LLM,"-13.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):PITCH_C:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:ADDR") { field(PINI, "YES") field(VAL, "8") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):PITCH_C:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):PITCH_C:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):PITCH_C:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):PITCH_C:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):PITCH_C:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):PITCH_C:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):PITCH_C:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):PITCH_C:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):PITCH_C:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):PITCH_C:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):PITCH_C:MOTR, $(MOC):M8) alias($(PV_NANO_STACK):PITCH_C:MOTR:ADDR, $(MOC):M8:ADDR) alias($(PV_NANO_STACK):PITCH_C:MOTR:PORT, $(MOC):M8:PORT) alias($(PV_NANO_STACK):PITCH_C:MOTR:SCALE, $(MOC):M8:SCALE) alias($(PV_NANO_STACK):PITCH_C:MOTR:USER:SDIS, $(MOC):M8:USER:SDIS) alias($(PV_NANO_STACK):PITCH_C:MOTR:SDIS, $(MOC):M8:SDIS) alias($(PV_NANO_STACK):PITCH_C:MOTR:KILL, $(MOC):M8:KILL) alias($(PV_NANO_STACK):PITCH_C:MOTR:ELOSS, $(MOC):M8:ELOSS) alias($(PV_NANO_STACK):PITCH_C:MOTR:ELOSSRC, $(MOC):M8:ELOSSRC) alias($(PV_NANO_STACK):PITCH_C:MOTR:MR_MOVE_WRITE, $(MOC):M8:MR_MOVE_WRITE) alias($(PV_NANO_STACK):PITCH_C:MOTR:CHECK_SYNC, $(MOC):M8:CHECK_SYNC) alias($(PV_NANO_STACK):PITCH_C:MOTR:FERROR, $(MOC):M8:FERROR) alias($(PV_NANO_STACK):PITCH_C:MOTR:FERRORMAX, $(MOC):M8:FERRORMAX) alias($(PV_NANO_STACK):PITCH_C:MOTR:FEMAXRESET, $(MOC):M8:FEMAXRESET) alias($(PV_NANO_STACK):PITCH_C:MOTR:HOMEVIS, $(MOC):M8:HOMEVIS) alias($(PV_NANO_STACK):PITCH_C:MOTR:HOMEVISSTR, $(MOC):M8:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_C:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):PITCH_C:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+8`") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+8`") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),8)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):PITCH_C:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):PITCH_C:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),8)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):PITCH_C:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),8)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):PITCH_C:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),8)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):PITCH_C:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):PITCH_C:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#8P") field(DESC, "$(DEV) pitch closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_C:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):PITCH_C:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:HMPOS") { field(DESC, "$(DEV) pitch closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):PITCH_C:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):PITCH_C:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M8PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M8PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):PITCH_C:MOTR:ELOSSVAR") { field(CALC, "464+8") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):PITCH_C:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+8`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+8`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS8:DESC"){ field(VAL, "M8 $(DEV) pitch closed loop") } #record(bo, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMED") { # field(DESC, "Set homed status for axis 8") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m845) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):PITCH_C:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):PITCH_C:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):PITCH_C:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),8,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):PITCH_C:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),8,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):PITCH_C:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):PITCH_C:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):PITCH_C:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):PITCH_C:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),8,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):PITCH_C:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_C:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):PITCH_C:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_C:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):PITCH_C:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),8,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M8:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M8.MRES CP") field(INPB, "$(MOC):M8.DIR CP") field(INPC, "$(MOC):M8:SCALE") field(OUT, "$(MOC):M8:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M8:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+8`") field(FLNK, "$(MOC):M8:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M8:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M8.OFF CP") field(OUT, "$(MOC):M8:OFF_SET PP") } record(ao, "$(MOC):M8:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+8`") field(FLNK, "$(MOC):M8:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M8:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),8)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M8:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M8:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),8)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M8:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),8)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M8:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),8)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M8:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M8:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M8:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M8:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M8:HOMING") field(CALC, "A") field(OUT, "$(MOC):M8:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M8:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M8:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#8P") field(DESC, "$(DEV) pitch closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M8:HMPOS:CALC") { field(INPA, "$(MOC):M8.MRES CP") field(INPB, "$(MOC):M8:SCALE") field(INPC, "$(MOC):M8:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M8:HMPOS PP") } record(ai, "$(MOC):M8:HMPOS") { field(DESC, "$(DEV) pitch closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M8:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M8") field(OUT, "$(PV_NANO_STACK):HM:M8PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M8PV"){ } # define a kill record record(ao, "$(MOC):M8:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M8:ELOSSVAR") { field(CALC, "464+8") field(PINI, "YES") } record(ai, "$(MOC):M8:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+8`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M8:ELOSSRC") { field(OUT, "$(MOC):M8:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M8:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+8`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS8:DESC"){ field(VAL, "M8 $(DEV) pitch closed loop") } #record(bo, "$(MOC):M8:HOMED") { # field(DESC, "Set homed status for axis 8") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M8:HOMEDSET") #} #record(calcout, "$(MOC):M8:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M8:HOMED") # field(OUT, "@pmac.proto setIntVar(m845) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M8:DirectDemand") { field(FLNK, "$(MOC):M8:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M8:DirectCountsCalc") { field(INPA, "$(MOC):M8:DirectDemand") field(INPB, "$(MOC):M8:Mres PP") field(INPC, "$(MOC):M8:Offset PP") field(INPD, "$(MOC):M8:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M8:RawDirectDemand PP") } record(ao, "$(MOC):M8:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M8:DirectMotorSeq") field(OUT, "@asyn($(PORT),8,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M8:DirectMotorSeq") { field(LNK1, "$(MOC):M8:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M8:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M8:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),8,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M8:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),8,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M8:MresSource") } record(scalcout, $(MOC):M8:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M8:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M8:Mres.INPA CA") field(FLNK, "$(MOC):M8:OffsetSource") } record(scalcout, "$(MOC):M8:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M8:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M8:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),8,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M8:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M8:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M8:Offset.INPA CA") } record(scalcout, $(MOC):M8:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M8:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M8:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),8,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):ROLL_F:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F:MOTR # This associates an edm screen with the template # % gui, M9, edm, motor.edl, motor=$(PV_NANO_STACK):ROLL_F:MOTR # % gui, M9, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):ROLL_F:MOTR,filename=motor.edl,box-label=$(DEV) fine roll open loop # This associates a BOY screen with the template # % gui, M9, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:ROLL_F:MOTR,DESC=$(DEV) fine roll open loop, name=M9 # % gui, M9, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:ROLL_F:MOTR,DESC=$(DEV) fine roll open loop, name=M9 # % gui, M9, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_F:MOTR,DESC=$(DEV) fine roll open loop, name=M9 # FIXME: this should be in pmacUtil or tpmac # % gui, M9, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_F:MOTR # This makes the component icon reflect the status and severity # % gui, M9, status, .MOVN # % gui, M9, sevr # These define what PVs a motor detail screen should contain # % gui, M9, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M9, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M9, command, ELoss Clear, :ELOSSRC.A # % gui, M9, statusbits, Limit Violation, .LVIO, Lim # % gui, M9, statusbits, At High Limit, .HLS, High # % gui, M9, statusbits, At Low Limit, .LLS, Low # % gui, M9, demand, User High Limit, .HLM # % gui, M9, demand, User Low Limit, .LLM # % gui, M9, demand, Dial High Limit, .DHLM # % gui, M9, demand, Dial Low Limit, .DLLM # % gui, M9, demand, Motor demand, .VAL # % gui, M9, readback, Motor readback, .RBV # % gui, M9, command, Stop, .STOP # % gui, M9, command, Home Forward, .HOMF # % gui, M9, command, Home Reverse, .HOMR # % gui, M9, command, Jog Forward, .JOGF # % gui, M9, command, Jog Reverse, .JOGR # % gui, M9, command, Tweak Forward, .TWF # % gui, M9, command, Tweak Reverse, .TWR # % gui, M9, demand, Tweak Step, .TWV # % gui, M9, command, Kill, :KILL.PROC, Kill # % gui, M9, command, Sync VAL=RBV, .SYNC # % gui, M9, enum, Direction, .DIR # % gui, M9, demand, User Offset, .OFF # % gui, M9, enum, Set/Use, .SET # % gui, M9, enum, Offset, .FOFF # % gui, M9, enum, Use Encoder, .UEIP # % gui, M9, demand, Motor Step Size, .MRES # % gui, M9, readback, Steps per Rev, .SREV # % gui, M9, readback, EGUs per Rev, .UREV # % gui, M9, demand, Encoder Step Size, .ERES # % gui, M9, readback, Readback Step Size, .RRES # % gui, M9, readback, Use Encoder if Present, .UEIP # % gui, M9, demand, Max Velocity, .VMAX # % gui, M9, demand, Base Velocity, .VBAS # % gui, M9, demand, Velocity, .VELO # % gui, M9, demand, Secs to Velocity, .ACCL # % gui, M9, demand, JVEL, .JVEL # % gui, M9, demand, Jog Acceleration, .JAR # % gui, M9, demand, Backlash Distance, .BDST # % gui, M9, demand, Backlash Velocity, .BVEL # % gui, M9, demand, Backlash Secs to Vel, .BACC # % gui, M9, demand, Move Fraction, .FRAC # % gui, M9, demand, Retry Deadband, .RDBD # % gui, M9, demand, Max Retrys, .RTRY # % gui, M9, demand, PREC, .PREC # % gui, M9, demand, EGU, .EGU # % gui, M9, demand, Output Specification, .OUT # % gui, M9, readback, Readback Location, .RDBL # % gui, M9, readback, Desired Output Loc, .DOL # % gui, M9, readback, Output Mode Select, .OMSL # % gui, M9, readback, Readback Out Link, .RLNK # % gui, M9, demand, DMOV Input Link, .DINP # % gui, M9, demand, RMP Input Link, .RINP # % gui, M9, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):ROLL_F:MOTR") { field(DESC,"$(DEV) fine roll open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),9)") field(MRES,"0.0001") field(PREC,"2") field(EGU,"V") field(DHLM,"") field(DLLM,"") field(HLM,"10.0") field(LLM,"0.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):ROLL_F:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:ADDR") { field(PINI, "YES") field(VAL, "9") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):ROLL_F:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):ROLL_F:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):ROLL_F:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):ROLL_F:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):ROLL_F:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):ROLL_F:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):ROLL_F:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):ROLL_F:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX") field(PREC,"2") field(EGU, "V") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):ROLL_F:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"2") field(EGU, "V") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):ROLL_F:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):ROLL_F:MOTR, $(MOC):M9) alias($(PV_NANO_STACK):ROLL_F:MOTR:ADDR, $(MOC):M9:ADDR) alias($(PV_NANO_STACK):ROLL_F:MOTR:PORT, $(MOC):M9:PORT) alias($(PV_NANO_STACK):ROLL_F:MOTR:SCALE, $(MOC):M9:SCALE) alias($(PV_NANO_STACK):ROLL_F:MOTR:USER:SDIS, $(MOC):M9:USER:SDIS) alias($(PV_NANO_STACK):ROLL_F:MOTR:SDIS, $(MOC):M9:SDIS) alias($(PV_NANO_STACK):ROLL_F:MOTR:KILL, $(MOC):M9:KILL) alias($(PV_NANO_STACK):ROLL_F:MOTR:ELOSS, $(MOC):M9:ELOSS) alias($(PV_NANO_STACK):ROLL_F:MOTR:ELOSSRC, $(MOC):M9:ELOSSRC) alias($(PV_NANO_STACK):ROLL_F:MOTR:MR_MOVE_WRITE, $(MOC):M9:MR_MOVE_WRITE) alias($(PV_NANO_STACK):ROLL_F:MOTR:CHECK_SYNC, $(MOC):M9:CHECK_SYNC) alias($(PV_NANO_STACK):ROLL_F:MOTR:FERROR, $(MOC):M9:FERROR) alias($(PV_NANO_STACK):ROLL_F:MOTR:FERRORMAX, $(MOC):M9:FERRORMAX) alias($(PV_NANO_STACK):ROLL_F:MOTR:FEMAXRESET, $(MOC):M9:FEMAXRESET) alias($(PV_NANO_STACK):ROLL_F:MOTR:HOMEVIS, $(MOC):M9:HOMEVIS) alias($(PV_NANO_STACK):ROLL_F:MOTR:HOMEVISSTR, $(MOC):M9:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_F:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):ROLL_F:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+9`") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+9`") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),9)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):ROLL_F:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):ROLL_F:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),9)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):ROLL_F:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),9)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):ROLL_F:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),9)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):ROLL_F:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):ROLL_F:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#9P") field(DESC, "$(DEV) fine roll open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "2") field(EGU, "V") } record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_F:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):ROLL_F:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:HMPOS") { field(DESC, "$(DEV) fine roll open loop") field(PREC, "2") field(EGU, "V") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):ROLL_F:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):ROLL_F:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M9PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M9PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):ROLL_F:MOTR:ELOSSVAR") { field(CALC, "464+9") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):ROLL_F:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+9`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+9`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS9:DESC"){ field(VAL, "M9 $(DEV) fine roll open loop") } #record(bo, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMED") { # field(DESC, "Set homed status for axis 9") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m945) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):ROLL_F:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):ROLL_F:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):ROLL_F:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),9,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine roll open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):ROLL_F:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),9,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):ROLL_F:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):ROLL_F:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):ROLL_F:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):ROLL_F:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),9,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):ROLL_F:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_F:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):ROLL_F:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_F:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):ROLL_F:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),9,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M9:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M9.MRES CP") field(INPB, "$(MOC):M9.DIR CP") field(INPC, "$(MOC):M9:SCALE") field(OUT, "$(MOC):M9:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M9:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+9`") field(FLNK, "$(MOC):M9:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M9:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M9.OFF CP") field(OUT, "$(MOC):M9:OFF_SET PP") } record(ao, "$(MOC):M9:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+9`") field(FLNK, "$(MOC):M9:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M9:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),9)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M9:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M9:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),9)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M9:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),9)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M9:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),9)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M9:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M9:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M9:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M9:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M9:HOMING") field(CALC, "A") field(OUT, "$(MOC):M9:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M9:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M9:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#9P") field(DESC, "$(DEV) fine roll open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "2") field(EGU, "V") } record(calcout, "$(MOC):M9:HMPOS:CALC") { field(INPA, "$(MOC):M9.MRES CP") field(INPB, "$(MOC):M9:SCALE") field(INPC, "$(MOC):M9:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M9:HMPOS PP") } record(ai, "$(MOC):M9:HMPOS") { field(DESC, "$(DEV) fine roll open loop") field(PREC, "2") field(EGU, "V") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M9:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M9") field(OUT, "$(PV_NANO_STACK):HM:M9PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M9PV"){ } # define a kill record record(ao, "$(MOC):M9:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M9:ELOSSVAR") { field(CALC, "464+9") field(PINI, "YES") } record(ai, "$(MOC):M9:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+9`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M9:ELOSSRC") { field(OUT, "$(MOC):M9:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M9:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+9`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS9:DESC"){ field(VAL, "M9 $(DEV) fine roll open loop") } #record(bo, "$(MOC):M9:HOMED") { # field(DESC, "Set homed status for axis 9") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M9:HOMEDSET") #} #record(calcout, "$(MOC):M9:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M9:HOMED") # field(OUT, "@pmac.proto setIntVar(m945) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M9:DirectDemand") { field(FLNK, "$(MOC):M9:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M9:DirectCountsCalc") { field(INPA, "$(MOC):M9:DirectDemand") field(INPB, "$(MOC):M9:Mres PP") field(INPC, "$(MOC):M9:Offset PP") field(INPD, "$(MOC):M9:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M9:RawDirectDemand PP") } record(ao, "$(MOC):M9:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M9:DirectMotorSeq") field(OUT, "@asyn($(PORT),9,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine roll open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M9:DirectMotorSeq") { field(LNK1, "$(MOC):M9:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M9:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M9:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),9,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M9:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),9,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M9:MresSource") } record(scalcout, $(MOC):M9:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M9:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M9:Mres.INPA CA") field(FLNK, "$(MOC):M9:OffsetSource") } record(scalcout, "$(MOC):M9:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M9:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M9:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),9,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M9:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M9:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M9:Offset.INPA CA") } record(scalcout, $(MOC):M9:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M9:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M9:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),9,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):ROLL_F_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F_OL:MOTR # This associates an edm screen with the template # % gui, M10, edm, motor.edl, motor=$(PV_NANO_STACK):ROLL_F_OL:MOTR # % gui, M10, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):ROLL_F_OL:MOTR,filename=motor.edl,box-label=$(DEV) fine roll closed loop # This associates a BOY screen with the template # % gui, M10, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:ROLL_F_OL:MOTR,DESC=$(DEV) fine roll closed loop, name=M10 # % gui, M10, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:ROLL_F_OL:MOTR,DESC=$(DEV) fine roll closed loop, name=M10 # % gui, M10, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_F_OL:MOTR,DESC=$(DEV) fine roll closed loop, name=M10 # FIXME: this should be in pmacUtil or tpmac # % gui, M10, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_F_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M10, status, .MOVN # % gui, M10, sevr # These define what PVs a motor detail screen should contain # % gui, M10, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M10, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M10, command, ELoss Clear, :ELOSSRC.A # % gui, M10, statusbits, Limit Violation, .LVIO, Lim # % gui, M10, statusbits, At High Limit, .HLS, High # % gui, M10, statusbits, At Low Limit, .LLS, Low # % gui, M10, demand, User High Limit, .HLM # % gui, M10, demand, User Low Limit, .LLM # % gui, M10, demand, Dial High Limit, .DHLM # % gui, M10, demand, Dial Low Limit, .DLLM # % gui, M10, demand, Motor demand, .VAL # % gui, M10, readback, Motor readback, .RBV # % gui, M10, command, Stop, .STOP # % gui, M10, command, Home Forward, .HOMF # % gui, M10, command, Home Reverse, .HOMR # % gui, M10, command, Jog Forward, .JOGF # % gui, M10, command, Jog Reverse, .JOGR # % gui, M10, command, Tweak Forward, .TWF # % gui, M10, command, Tweak Reverse, .TWR # % gui, M10, demand, Tweak Step, .TWV # % gui, M10, command, Kill, :KILL.PROC, Kill # % gui, M10, command, Sync VAL=RBV, .SYNC # % gui, M10, enum, Direction, .DIR # % gui, M10, demand, User Offset, .OFF # % gui, M10, enum, Set/Use, .SET # % gui, M10, enum, Offset, .FOFF # % gui, M10, enum, Use Encoder, .UEIP # % gui, M10, demand, Motor Step Size, .MRES # % gui, M10, readback, Steps per Rev, .SREV # % gui, M10, readback, EGUs per Rev, .UREV # % gui, M10, demand, Encoder Step Size, .ERES # % gui, M10, readback, Readback Step Size, .RRES # % gui, M10, readback, Use Encoder if Present, .UEIP # % gui, M10, demand, Max Velocity, .VMAX # % gui, M10, demand, Base Velocity, .VBAS # % gui, M10, demand, Velocity, .VELO # % gui, M10, demand, Secs to Velocity, .ACCL # % gui, M10, demand, JVEL, .JVEL # % gui, M10, demand, Jog Acceleration, .JAR # % gui, M10, demand, Backlash Distance, .BDST # % gui, M10, demand, Backlash Velocity, .BVEL # % gui, M10, demand, Backlash Secs to Vel, .BACC # % gui, M10, demand, Move Fraction, .FRAC # % gui, M10, demand, Retry Deadband, .RDBD # % gui, M10, demand, Max Retrys, .RTRY # % gui, M10, demand, PREC, .PREC # % gui, M10, demand, EGU, .EGU # % gui, M10, demand, Output Specification, .OUT # % gui, M10, readback, Readback Location, .RDBL # % gui, M10, readback, Desired Output Loc, .DOL # % gui, M10, readback, Output Mode Select, .OMSL # % gui, M10, readback, Readback Out Link, .RLNK # % gui, M10, demand, DMOV Input Link, .DINP # % gui, M10, demand, RMP Input Link, .RINP # % gui, M10, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):ROLL_F_OL:MOTR") { field(DESC,"$(DEV) fine roll closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),10)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"13.0") field(LLM,"-13.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "10") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):ROLL_F_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):ROLL_F_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):ROLL_F_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):ROLL_F_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):ROLL_F_OL:MOTR, $(MOC):M10) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:ADDR, $(MOC):M10:ADDR) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:PORT, $(MOC):M10:PORT) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE, $(MOC):M10:SCALE) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:USER:SDIS, $(MOC):M10:USER:SDIS) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:SDIS, $(MOC):M10:SDIS) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:KILL, $(MOC):M10:KILL) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSS, $(MOC):M10:ELOSS) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSSRC, $(MOC):M10:ELOSSRC) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:MR_MOVE_WRITE, $(MOC):M10:MR_MOVE_WRITE) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:CHECK_SYNC, $(MOC):M10:CHECK_SYNC) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:FERROR, $(MOC):M10:FERROR) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:FERRORMAX, $(MOC):M10:FERRORMAX) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:FEMAXRESET, $(MOC):M10:FEMAXRESET) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEVIS, $(MOC):M10:HOMEVIS) alias($(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEVISSTR, $(MOC):M10:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+10`") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+10`") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),10)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),10)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),10)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),10)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#10P") field(DESC, "$(DEV) fine roll closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HMPOS") { field(DESC, "$(DEV) fine roll closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):ROLL_F_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M10PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M10PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSSVAR") { field(CALC, "464+10") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+10`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+10`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS10:DESC"){ field(VAL, "M10 $(DEV) fine roll closed loop") } #record(bo, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 10") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m1045) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),10,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine roll closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),10,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):ROLL_F_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):ROLL_F_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),10,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):ROLL_F_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):ROLL_F_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_F_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):ROLL_F_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),10,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M10:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M10.MRES CP") field(INPB, "$(MOC):M10.DIR CP") field(INPC, "$(MOC):M10:SCALE") field(OUT, "$(MOC):M10:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M10:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+10`") field(FLNK, "$(MOC):M10:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M10:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M10.OFF CP") field(OUT, "$(MOC):M10:OFF_SET PP") } record(ao, "$(MOC):M10:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+10`") field(FLNK, "$(MOC):M10:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M10:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),10)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M10:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M10:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),10)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M10:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),10)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M10:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),10)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M10:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M10:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M10:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M10:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M10:HOMING") field(CALC, "A") field(OUT, "$(MOC):M10:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M10:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M10:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#10P") field(DESC, "$(DEV) fine roll closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M10:HMPOS:CALC") { field(INPA, "$(MOC):M10.MRES CP") field(INPB, "$(MOC):M10:SCALE") field(INPC, "$(MOC):M10:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M10:HMPOS PP") } record(ai, "$(MOC):M10:HMPOS") { field(DESC, "$(DEV) fine roll closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M10:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M10") field(OUT, "$(PV_NANO_STACK):HM:M10PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M10PV"){ } # define a kill record record(ao, "$(MOC):M10:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M10:ELOSSVAR") { field(CALC, "464+10") field(PINI, "YES") } record(ai, "$(MOC):M10:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+10`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M10:ELOSSRC") { field(OUT, "$(MOC):M10:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M10:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+10`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS10:DESC"){ field(VAL, "M10 $(DEV) fine roll closed loop") } #record(bo, "$(MOC):M10:HOMED") { # field(DESC, "Set homed status for axis 10") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M10:HOMEDSET") #} #record(calcout, "$(MOC):M10:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M10:HOMED") # field(OUT, "@pmac.proto setIntVar(m1045) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M10:DirectDemand") { field(FLNK, "$(MOC):M10:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M10:DirectCountsCalc") { field(INPA, "$(MOC):M10:DirectDemand") field(INPB, "$(MOC):M10:Mres PP") field(INPC, "$(MOC):M10:Offset PP") field(INPD, "$(MOC):M10:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M10:RawDirectDemand PP") } record(ao, "$(MOC):M10:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M10:DirectMotorSeq") field(OUT, "@asyn($(PORT),10,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine roll closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M10:DirectMotorSeq") { field(LNK1, "$(MOC):M10:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M10:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M10:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),10,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M10:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),10,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M10:MresSource") } record(scalcout, $(MOC):M10:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M10:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M10:Mres.INPA CA") field(FLNK, "$(MOC):M10:OffsetSource") } record(scalcout, "$(MOC):M10:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M10:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M10:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),10,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M10:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M10:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M10:Offset.INPA CA") } record(scalcout, $(MOC):M10:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M10:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M10:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),10,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):PITCH_F:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F:MOTR # This associates an edm screen with the template # % gui, M11, edm, motor.edl, motor=$(PV_NANO_STACK):PITCH_F:MOTR # % gui, M11, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):PITCH_F:MOTR,filename=motor.edl,box-label=$(DEV) fine pitch open loop # This associates a BOY screen with the template # % gui, M11, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:PITCH_F:MOTR,DESC=$(DEV) fine pitch open loop, name=M11 # % gui, M11, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:PITCH_F:MOTR,DESC=$(DEV) fine pitch open loop, name=M11 # % gui, M11, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_F:MOTR,DESC=$(DEV) fine pitch open loop, name=M11 # FIXME: this should be in pmacUtil or tpmac # % gui, M11, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_F:MOTR # This makes the component icon reflect the status and severity # % gui, M11, status, .MOVN # % gui, M11, sevr # These define what PVs a motor detail screen should contain # % gui, M11, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M11, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M11, command, ELoss Clear, :ELOSSRC.A # % gui, M11, statusbits, Limit Violation, .LVIO, Lim # % gui, M11, statusbits, At High Limit, .HLS, High # % gui, M11, statusbits, At Low Limit, .LLS, Low # % gui, M11, demand, User High Limit, .HLM # % gui, M11, demand, User Low Limit, .LLM # % gui, M11, demand, Dial High Limit, .DHLM # % gui, M11, demand, Dial Low Limit, .DLLM # % gui, M11, demand, Motor demand, .VAL # % gui, M11, readback, Motor readback, .RBV # % gui, M11, command, Stop, .STOP # % gui, M11, command, Home Forward, .HOMF # % gui, M11, command, Home Reverse, .HOMR # % gui, M11, command, Jog Forward, .JOGF # % gui, M11, command, Jog Reverse, .JOGR # % gui, M11, command, Tweak Forward, .TWF # % gui, M11, command, Tweak Reverse, .TWR # % gui, M11, demand, Tweak Step, .TWV # % gui, M11, command, Kill, :KILL.PROC, Kill # % gui, M11, command, Sync VAL=RBV, .SYNC # % gui, M11, enum, Direction, .DIR # % gui, M11, demand, User Offset, .OFF # % gui, M11, enum, Set/Use, .SET # % gui, M11, enum, Offset, .FOFF # % gui, M11, enum, Use Encoder, .UEIP # % gui, M11, demand, Motor Step Size, .MRES # % gui, M11, readback, Steps per Rev, .SREV # % gui, M11, readback, EGUs per Rev, .UREV # % gui, M11, demand, Encoder Step Size, .ERES # % gui, M11, readback, Readback Step Size, .RRES # % gui, M11, readback, Use Encoder if Present, .UEIP # % gui, M11, demand, Max Velocity, .VMAX # % gui, M11, demand, Base Velocity, .VBAS # % gui, M11, demand, Velocity, .VELO # % gui, M11, demand, Secs to Velocity, .ACCL # % gui, M11, demand, JVEL, .JVEL # % gui, M11, demand, Jog Acceleration, .JAR # % gui, M11, demand, Backlash Distance, .BDST # % gui, M11, demand, Backlash Velocity, .BVEL # % gui, M11, demand, Backlash Secs to Vel, .BACC # % gui, M11, demand, Move Fraction, .FRAC # % gui, M11, demand, Retry Deadband, .RDBD # % gui, M11, demand, Max Retrys, .RTRY # % gui, M11, demand, PREC, .PREC # % gui, M11, demand, EGU, .EGU # % gui, M11, demand, Output Specification, .OUT # % gui, M11, readback, Readback Location, .RDBL # % gui, M11, readback, Desired Output Loc, .DOL # % gui, M11, readback, Output Mode Select, .OMSL # % gui, M11, readback, Readback Out Link, .RLNK # % gui, M11, demand, DMOV Input Link, .DINP # % gui, M11, demand, RMP Input Link, .RINP # % gui, M11, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):PITCH_F:MOTR") { field(DESC,"$(DEV) fine pitch open loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),11)") field(MRES,"0.0001") field(PREC,"2") field(EGU,"V") field(DHLM,"") field(DLLM,"") field(HLM,"10.0") field(LLM,"0.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):PITCH_F:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:ADDR") { field(PINI, "YES") field(VAL, "11") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):PITCH_F:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):PITCH_F:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):PITCH_F:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):PITCH_F:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):PITCH_F:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):PITCH_F:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):PITCH_F:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):PITCH_F:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX") field(PREC,"2") field(EGU, "V") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):PITCH_F:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"2") field(EGU, "V") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):PITCH_F:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):PITCH_F:MOTR, $(MOC):M11) alias($(PV_NANO_STACK):PITCH_F:MOTR:ADDR, $(MOC):M11:ADDR) alias($(PV_NANO_STACK):PITCH_F:MOTR:PORT, $(MOC):M11:PORT) alias($(PV_NANO_STACK):PITCH_F:MOTR:SCALE, $(MOC):M11:SCALE) alias($(PV_NANO_STACK):PITCH_F:MOTR:USER:SDIS, $(MOC):M11:USER:SDIS) alias($(PV_NANO_STACK):PITCH_F:MOTR:SDIS, $(MOC):M11:SDIS) alias($(PV_NANO_STACK):PITCH_F:MOTR:KILL, $(MOC):M11:KILL) alias($(PV_NANO_STACK):PITCH_F:MOTR:ELOSS, $(MOC):M11:ELOSS) alias($(PV_NANO_STACK):PITCH_F:MOTR:ELOSSRC, $(MOC):M11:ELOSSRC) alias($(PV_NANO_STACK):PITCH_F:MOTR:MR_MOVE_WRITE, $(MOC):M11:MR_MOVE_WRITE) alias($(PV_NANO_STACK):PITCH_F:MOTR:CHECK_SYNC, $(MOC):M11:CHECK_SYNC) alias($(PV_NANO_STACK):PITCH_F:MOTR:FERROR, $(MOC):M11:FERROR) alias($(PV_NANO_STACK):PITCH_F:MOTR:FERRORMAX, $(MOC):M11:FERRORMAX) alias($(PV_NANO_STACK):PITCH_F:MOTR:FEMAXRESET, $(MOC):M11:FEMAXRESET) alias($(PV_NANO_STACK):PITCH_F:MOTR:HOMEVIS, $(MOC):M11:HOMEVIS) alias($(PV_NANO_STACK):PITCH_F:MOTR:HOMEVISSTR, $(MOC):M11:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_F:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):PITCH_F:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+11`") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+11`") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),11)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):PITCH_F:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):PITCH_F:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),11)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):PITCH_F:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),11)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):PITCH_F:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),11)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):PITCH_F:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):PITCH_F:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#11P") field(DESC, "$(DEV) fine pitch open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "2") field(EGU, "V") } record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_F:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):PITCH_F:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:HMPOS") { field(DESC, "$(DEV) fine pitch open loop") field(PREC, "2") field(EGU, "V") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):PITCH_F:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):PITCH_F:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M11PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M11PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):PITCH_F:MOTR:ELOSSVAR") { field(CALC, "464+11") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):PITCH_F:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+11`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+11`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS11:DESC"){ field(VAL, "M11 $(DEV) fine pitch open loop") } #record(bo, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMED") { # field(DESC, "Set homed status for axis 11") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m1145) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):PITCH_F:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):PITCH_F:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):PITCH_F:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),11,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine pitch open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):PITCH_F:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),11,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):PITCH_F:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):PITCH_F:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):PITCH_F:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):PITCH_F:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),11,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):PITCH_F:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_F:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):PITCH_F:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_F:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):PITCH_F:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),11,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M11:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M11.MRES CP") field(INPB, "$(MOC):M11.DIR CP") field(INPC, "$(MOC):M11:SCALE") field(OUT, "$(MOC):M11:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M11:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+11`") field(FLNK, "$(MOC):M11:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M11:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M11.OFF CP") field(OUT, "$(MOC):M11:OFF_SET PP") } record(ao, "$(MOC):M11:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+11`") field(FLNK, "$(MOC):M11:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M11:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),11)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M11:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M11:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),11)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M11:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),11)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M11:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),11)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M11:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M11:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M11:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M11:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M11:HOMING") field(CALC, "A") field(OUT, "$(MOC):M11:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M11:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M11:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#11P") field(DESC, "$(DEV) fine pitch open loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "2") field(EGU, "V") } record(calcout, "$(MOC):M11:HMPOS:CALC") { field(INPA, "$(MOC):M11.MRES CP") field(INPB, "$(MOC):M11:SCALE") field(INPC, "$(MOC):M11:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M11:HMPOS PP") } record(ai, "$(MOC):M11:HMPOS") { field(DESC, "$(DEV) fine pitch open loop") field(PREC, "2") field(EGU, "V") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M11:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M11") field(OUT, "$(PV_NANO_STACK):HM:M11PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M11PV"){ } # define a kill record record(ao, "$(MOC):M11:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M11:ELOSSVAR") { field(CALC, "464+11") field(PINI, "YES") } record(ai, "$(MOC):M11:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+11`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M11:ELOSSRC") { field(OUT, "$(MOC):M11:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M11:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+11`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS11:DESC"){ field(VAL, "M11 $(DEV) fine pitch open loop") } #record(bo, "$(MOC):M11:HOMED") { # field(DESC, "Set homed status for axis 11") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M11:HOMEDSET") #} #record(calcout, "$(MOC):M11:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M11:HOMED") # field(OUT, "@pmac.proto setIntVar(m1145) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M11:DirectDemand") { field(FLNK, "$(MOC):M11:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M11:DirectCountsCalc") { field(INPA, "$(MOC):M11:DirectDemand") field(INPB, "$(MOC):M11:Mres PP") field(INPC, "$(MOC):M11:Offset PP") field(INPD, "$(MOC):M11:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M11:RawDirectDemand PP") } record(ao, "$(MOC):M11:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M11:DirectMotorSeq") field(OUT, "@asyn($(PORT),11,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine pitch open loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M11:DirectMotorSeq") { field(LNK1, "$(MOC):M11:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M11:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M11:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),11,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M11:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),11,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M11:MresSource") } record(scalcout, $(MOC):M11:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M11:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M11:Mres.INPA CA") field(FLNK, "$(MOC):M11:OffsetSource") } record(scalcout, "$(MOC):M11:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M11:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M11:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),11,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M11:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M11:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M11:Offset.INPA CA") } record(scalcout, $(MOC):M11:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M11:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M11:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),11,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):PITCH_F_OL:MOTR, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F_OL:MOTR # This associates an edm screen with the template # % gui, M12, edm, motor.edl, motor=$(PV_NANO_STACK):PITCH_F_OL:MOTR # % gui, M12, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):PITCH_F_OL:MOTR,filename=motor.edl,box-label=$(DEV) fine pitch closed loop # This associates a BOY screen with the template # % gui, M12, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:PITCH_F_OL:MOTR,DESC=$(DEV) fine pitch closed loop, name=M12 # % gui, M12, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:PITCH_F_OL:MOTR,DESC=$(DEV) fine pitch closed loop, name=M12 # % gui, M12, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_F_OL:MOTR,DESC=$(DEV) fine pitch closed loop, name=M12 # FIXME: this should be in pmacUtil or tpmac # % gui, M12, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_F_OL:MOTR # This makes the component icon reflect the status and severity # % gui, M12, status, .MOVN # % gui, M12, sevr # These define what PVs a motor detail screen should contain # % gui, M12, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M12, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M12, command, ELoss Clear, :ELOSSRC.A # % gui, M12, statusbits, Limit Violation, .LVIO, Lim # % gui, M12, statusbits, At High Limit, .HLS, High # % gui, M12, statusbits, At Low Limit, .LLS, Low # % gui, M12, demand, User High Limit, .HLM # % gui, M12, demand, User Low Limit, .LLM # % gui, M12, demand, Dial High Limit, .DHLM # % gui, M12, demand, Dial Low Limit, .DLLM # % gui, M12, demand, Motor demand, .VAL # % gui, M12, readback, Motor readback, .RBV # % gui, M12, command, Stop, .STOP # % gui, M12, command, Home Forward, .HOMF # % gui, M12, command, Home Reverse, .HOMR # % gui, M12, command, Jog Forward, .JOGF # % gui, M12, command, Jog Reverse, .JOGR # % gui, M12, command, Tweak Forward, .TWF # % gui, M12, command, Tweak Reverse, .TWR # % gui, M12, demand, Tweak Step, .TWV # % gui, M12, command, Kill, :KILL.PROC, Kill # % gui, M12, command, Sync VAL=RBV, .SYNC # % gui, M12, enum, Direction, .DIR # % gui, M12, demand, User Offset, .OFF # % gui, M12, enum, Set/Use, .SET # % gui, M12, enum, Offset, .FOFF # % gui, M12, enum, Use Encoder, .UEIP # % gui, M12, demand, Motor Step Size, .MRES # % gui, M12, readback, Steps per Rev, .SREV # % gui, M12, readback, EGUs per Rev, .UREV # % gui, M12, demand, Encoder Step Size, .ERES # % gui, M12, readback, Readback Step Size, .RRES # % gui, M12, readback, Use Encoder if Present, .UEIP # % gui, M12, demand, Max Velocity, .VMAX # % gui, M12, demand, Base Velocity, .VBAS # % gui, M12, demand, Velocity, .VELO # % gui, M12, demand, Secs to Velocity, .ACCL # % gui, M12, demand, JVEL, .JVEL # % gui, M12, demand, Jog Acceleration, .JAR # % gui, M12, demand, Backlash Distance, .BDST # % gui, M12, demand, Backlash Velocity, .BVEL # % gui, M12, demand, Backlash Secs to Vel, .BACC # % gui, M12, demand, Move Fraction, .FRAC # % gui, M12, demand, Retry Deadband, .RDBD # % gui, M12, demand, Max Retrys, .RTRY # % gui, M12, demand, PREC, .PREC # % gui, M12, demand, EGU, .EGU # % gui, M12, demand, Output Specification, .OUT # % gui, M12, readback, Readback Location, .RDBL # % gui, M12, readback, Desired Output Loc, .DOL # % gui, M12, readback, Output Mode Select, .OMSL # % gui, M12, readback, Readback Out Link, .RLNK # % gui, M12, demand, DMOV Input Link, .DINP # % gui, M12, demand, RMP Input Link, .RINP # % gui, M12, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):PITCH_F_OL:MOTR") { field(DESC,"$(DEV) fine pitch closed loop") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),12)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"13.0") field(LLM,"-13.0") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ADDR") { field(PINI, "YES") field(VAL, "12") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSS record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):PITCH_F_OL:MOTR.RMP CP") field(INPB,"$(PV_NANO_STACK):PITCH_F_OL:MOTR.REP NPP") field(INPC,"$(PV_NANO_STACK):PITCH_F_OL:MOTR.MRES NPP") field(INPD,"$(PV_NANO_STACK):PITCH_F_OL:MOTR.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX record(calc, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):PITCH_F_OL:MOTR, $(MOC):M12) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:ADDR, $(MOC):M12:ADDR) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:PORT, $(MOC):M12:PORT) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE, $(MOC):M12:SCALE) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:USER:SDIS, $(MOC):M12:USER:SDIS) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:SDIS, $(MOC):M12:SDIS) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:KILL, $(MOC):M12:KILL) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSS, $(MOC):M12:ELOSS) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSSRC, $(MOC):M12:ELOSSRC) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:MR_MOVE_WRITE, $(MOC):M12:MR_MOVE_WRITE) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:CHECK_SYNC, $(MOC):M12:CHECK_SYNC) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:FERROR, $(MOC):M12:FERROR) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:FERRORMAX, $(MOC):M12:FERRORMAX) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:FEMAXRESET, $(MOC):M12:FEMAXRESET) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEVIS, $(MOC):M12:HOMEVIS) alias($(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEVISSTR, $(MOC):M12:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.DIR CP") field(INPC, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+12`") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.OFF CP") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+12`") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),12)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),12)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),12)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),12)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#12P") field(DESC, "$(DEV) fine pitch closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE") field(INPC, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HMPOS PP") } record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HMPOS") { field(DESC, "$(DEV) fine pitch closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):PITCH_F_OL:MOTR") field(OUT, "$(PV_NANO_STACK):HM:M12PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M12PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSSVAR") { field(CALC, "464+12") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+12`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+12`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS12:DESC"){ field(VAL, "M12 $(DEV) fine pitch closed loop") } #record(bo, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMED") { # field(DESC, "Set homed status for axis 12") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:HOMED") # field(OUT, "@pmac.proto setIntVar(m1245) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectDemand") field(INPB, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:Mres PP") field(INPC, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:Offset PP") field(INPD, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorSeq") field(OUT, "@asyn($(PORT),12,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine pitch closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),12,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MresSource") } record(scalcout, $(PV_NANO_STACK):PITCH_F_OL:MOTR:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):PITCH_F_OL:MOTR:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),12,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):PITCH_F_OL:MOTR:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):PITCH_F_OL:MOTR:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_F_OL:MOTR:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):PITCH_F_OL:MOTR:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),12,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M12:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M12.MRES CP") field(INPB, "$(MOC):M12.DIR CP") field(INPC, "$(MOC):M12:SCALE") field(OUT, "$(MOC):M12:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M12:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+12`") field(FLNK, "$(MOC):M12:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M12:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M12.OFF CP") field(OUT, "$(MOC):M12:OFF_SET PP") } record(ao, "$(MOC):M12:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+12`") field(FLNK, "$(MOC):M12:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M12:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),12)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M12:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M12:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),12)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M12:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),12)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M12:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),12)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M12:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M12:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M12:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M12:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M12:HOMING") field(CALC, "A") field(OUT, "$(MOC):M12:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M12:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M12:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#12P") field(DESC, "$(DEV) fine pitch closed loop") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M12:HMPOS:CALC") { field(INPA, "$(MOC):M12.MRES CP") field(INPB, "$(MOC):M12:SCALE") field(INPC, "$(MOC):M12:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M12:HMPOS PP") } record(ai, "$(MOC):M12:HMPOS") { field(DESC, "$(DEV) fine pitch closed loop") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M12:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M12") field(OUT, "$(PV_NANO_STACK):HM:M12PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M12PV"){ } # define a kill record record(ao, "$(MOC):M12:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M12:ELOSSVAR") { field(CALC, "464+12") field(PINI, "YES") } record(ai, "$(MOC):M12:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+12`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M12:ELOSSRC") { field(OUT, "$(MOC):M12:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M12:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+12`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS12:DESC"){ field(VAL, "M12 $(DEV) fine pitch closed loop") } #record(bo, "$(MOC):M12:HOMED") { # field(DESC, "Set homed status for axis 12") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M12:HOMEDSET") #} #record(calcout, "$(MOC):M12:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M12:HOMED") # field(OUT, "@pmac.proto setIntVar(m1245) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M12:DirectDemand") { field(FLNK, "$(MOC):M12:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M12:DirectCountsCalc") { field(INPA, "$(MOC):M12:DirectDemand") field(INPB, "$(MOC):M12:Mres PP") field(INPC, "$(MOC):M12:Offset PP") field(INPD, "$(MOC):M12:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M12:RawDirectDemand PP") } record(ao, "$(MOC):M12:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M12:DirectMotorSeq") field(OUT, "@asyn($(PORT),12,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) fine pitch closed loop") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M12:DirectMotorSeq") { field(LNK1, "$(MOC):M12:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M12:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M12:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),12,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M12:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),12,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M12:MresSource") } record(scalcout, $(MOC):M12:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M12:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M12:Mres.INPA CA") field(FLNK, "$(MOC):M12:OffsetSource") } record(scalcout, "$(MOC):M12:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M12:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M12:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),12,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M12:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M12:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M12:Offset.INPA CA") } record(scalcout, $(MOC):M12:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M12:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M12:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),12,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):ROLL_CAP:RBK, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_CAP:RBK # This associates an edm screen with the template # % gui, M13, edm, motor.edl, motor=$(PV_NANO_STACK):ROLL_CAP:RBK # % gui, M13, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):ROLL_CAP:RBK,filename=motor.edl,box-label=$(DEV) roll cap. sensor # This associates a BOY screen with the template # % gui, M13, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:ROLL_CAP:RBK,DESC=$(DEV) roll cap. sensor, name=M13 # % gui, M13, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:ROLL_CAP:RBK,DESC=$(DEV) roll cap. sensor, name=M13 # % gui, M13, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_CAP:RBK,DESC=$(DEV) roll cap. sensor, name=M13 # FIXME: this should be in pmacUtil or tpmac # % gui, M13, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:ROLL_CAP:RBK # This makes the component icon reflect the status and severity # % gui, M13, status, .MOVN # % gui, M13, sevr # These define what PVs a motor detail screen should contain # % gui, M13, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M13, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M13, command, ELoss Clear, :ELOSSRC.A # % gui, M13, statusbits, Limit Violation, .LVIO, Lim # % gui, M13, statusbits, At High Limit, .HLS, High # % gui, M13, statusbits, At Low Limit, .LLS, Low # % gui, M13, demand, User High Limit, .HLM # % gui, M13, demand, User Low Limit, .LLM # % gui, M13, demand, Dial High Limit, .DHLM # % gui, M13, demand, Dial Low Limit, .DLLM # % gui, M13, demand, Motor demand, .VAL # % gui, M13, readback, Motor readback, .RBV # % gui, M13, command, Stop, .STOP # % gui, M13, command, Home Forward, .HOMF # % gui, M13, command, Home Reverse, .HOMR # % gui, M13, command, Jog Forward, .JOGF # % gui, M13, command, Jog Reverse, .JOGR # % gui, M13, command, Tweak Forward, .TWF # % gui, M13, command, Tweak Reverse, .TWR # % gui, M13, demand, Tweak Step, .TWV # % gui, M13, command, Kill, :KILL.PROC, Kill # % gui, M13, command, Sync VAL=RBV, .SYNC # % gui, M13, enum, Direction, .DIR # % gui, M13, demand, User Offset, .OFF # % gui, M13, enum, Set/Use, .SET # % gui, M13, enum, Offset, .FOFF # % gui, M13, enum, Use Encoder, .UEIP # % gui, M13, demand, Motor Step Size, .MRES # % gui, M13, readback, Steps per Rev, .SREV # % gui, M13, readback, EGUs per Rev, .UREV # % gui, M13, demand, Encoder Step Size, .ERES # % gui, M13, readback, Readback Step Size, .RRES # % gui, M13, readback, Use Encoder if Present, .UEIP # % gui, M13, demand, Max Velocity, .VMAX # % gui, M13, demand, Base Velocity, .VBAS # % gui, M13, demand, Velocity, .VELO # % gui, M13, demand, Secs to Velocity, .ACCL # % gui, M13, demand, JVEL, .JVEL # % gui, M13, demand, Jog Acceleration, .JAR # % gui, M13, demand, Backlash Distance, .BDST # % gui, M13, demand, Backlash Velocity, .BVEL # % gui, M13, demand, Backlash Secs to Vel, .BACC # % gui, M13, demand, Move Fraction, .FRAC # % gui, M13, demand, Retry Deadband, .RDBD # % gui, M13, demand, Max Retrys, .RTRY # % gui, M13, demand, PREC, .PREC # % gui, M13, demand, EGU, .EGU # % gui, M13, demand, Output Specification, .OUT # % gui, M13, readback, Readback Location, .RDBL # % gui, M13, readback, Desired Output Loc, .DOL # % gui, M13, readback, Output Mode Select, .OMSL # % gui, M13, readback, Readback Out Link, .RLNK # % gui, M13, demand, DMOV Input Link, .DINP # % gui, M13, demand, RMP Input Link, .RINP # % gui, M13, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):ROLL_CAP:RBK") { field(DESC,"$(DEV) roll cap. sensor") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),13)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):ROLL_CAP:RBK:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:ADDR") { field(PINI, "YES") field(VAL, "13") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):ROLL_CAP:RBK:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):ROLL_CAP:RBK:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_CAP:RBK:ELOSS record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):ROLL_CAP:RBK:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):ROLL_CAP:RBK:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):ROLL_CAP:RBK.RMP CP") field(INPB,"$(PV_NANO_STACK):ROLL_CAP:RBK.REP NPP") field(INPC,"$(PV_NANO_STACK):ROLL_CAP:RBK.MRES NPP") field(INPD,"$(PV_NANO_STACK):ROLL_CAP:RBK.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX record(calc, "$(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):ROLL_CAP:RBK:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):ROLL_CAP:RBK:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):ROLL_CAP:RBK, $(MOC):M13) alias($(PV_NANO_STACK):ROLL_CAP:RBK:ADDR, $(MOC):M13:ADDR) alias($(PV_NANO_STACK):ROLL_CAP:RBK:PORT, $(MOC):M13:PORT) alias($(PV_NANO_STACK):ROLL_CAP:RBK:SCALE, $(MOC):M13:SCALE) alias($(PV_NANO_STACK):ROLL_CAP:RBK:USER:SDIS, $(MOC):M13:USER:SDIS) alias($(PV_NANO_STACK):ROLL_CAP:RBK:SDIS, $(MOC):M13:SDIS) alias($(PV_NANO_STACK):ROLL_CAP:RBK:KILL, $(MOC):M13:KILL) alias($(PV_NANO_STACK):ROLL_CAP:RBK:ELOSS, $(MOC):M13:ELOSS) alias($(PV_NANO_STACK):ROLL_CAP:RBK:ELOSSRC, $(MOC):M13:ELOSSRC) alias($(PV_NANO_STACK):ROLL_CAP:RBK:MR_MOVE_WRITE, $(MOC):M13:MR_MOVE_WRITE) alias($(PV_NANO_STACK):ROLL_CAP:RBK:CHECK_SYNC, $(MOC):M13:CHECK_SYNC) alias($(PV_NANO_STACK):ROLL_CAP:RBK:FERROR, $(MOC):M13:FERROR) alias($(PV_NANO_STACK):ROLL_CAP:RBK:FERRORMAX, $(MOC):M13:FERRORMAX) alias($(PV_NANO_STACK):ROLL_CAP:RBK:FEMAXRESET, $(MOC):M13:FEMAXRESET) alias($(PV_NANO_STACK):ROLL_CAP:RBK:HOMEVIS, $(MOC):M13:HOMEVIS) alias($(PV_NANO_STACK):ROLL_CAP:RBK:HOMEVISSTR, $(MOC):M13:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_CAP:RBK.DIR CP") field(INPC, "$(PV_NANO_STACK):ROLL_CAP:RBK:SCALE") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+13`") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK.OFF CP") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+13`") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),13)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):ROLL_CAP:RBK:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):ROLL_CAP:RBK:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),13)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):ROLL_CAP:RBK:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),13)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):ROLL_CAP:RBK:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),13)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):ROLL_CAP:RBK:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):ROLL_CAP:RBK:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#13P") field(DESC, "$(DEV) roll cap. sensor") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):ROLL_CAP:RBK:SCALE") field(INPC, "$(PV_NANO_STACK):ROLL_CAP:RBK:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:HMPOS PP") } record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:HMPOS") { field(DESC, "$(DEV) roll cap. sensor") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):ROLL_CAP:RBK:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):ROLL_CAP:RBK") field(OUT, "$(PV_NANO_STACK):HM:M13PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M13PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):ROLL_CAP:RBK:ELOSSVAR") { field(CALC, "464+13") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):ROLL_CAP:RBK:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+13`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+13`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS13:DESC"){ field(VAL, "M13 $(DEV) roll cap. sensor") } #record(bo, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMED") { # field(DESC, "Set homed status for axis 13") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK:HOMED") # field(OUT, "@pmac.proto setIntVar(m1345) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectDemand") field(INPB, "$(PV_NANO_STACK):ROLL_CAP:RBK:Mres PP") field(INPC, "$(PV_NANO_STACK):ROLL_CAP:RBK:Offset PP") field(INPD, "$(PV_NANO_STACK):ROLL_CAP:RBK:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorSeq") field(OUT, "@asyn($(PORT),13,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll cap. sensor") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):ROLL_CAP:RBK:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),13,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:MresSource") } record(scalcout, $(PV_NANO_STACK):ROLL_CAP:RBK:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):ROLL_CAP:RBK:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):ROLL_CAP:RBK:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):ROLL_CAP:RBK:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),13,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):ROLL_CAP:RBK:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):ROLL_CAP:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):ROLL_CAP:RBK:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):ROLL_CAP:RBK:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):ROLL_CAP:RBK:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),13,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M13:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M13.MRES CP") field(INPB, "$(MOC):M13.DIR CP") field(INPC, "$(MOC):M13:SCALE") field(OUT, "$(MOC):M13:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M13:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+13`") field(FLNK, "$(MOC):M13:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M13:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M13.OFF CP") field(OUT, "$(MOC):M13:OFF_SET PP") } record(ao, "$(MOC):M13:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+13`") field(FLNK, "$(MOC):M13:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M13:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),13)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M13:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M13:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),13)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M13:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),13)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M13:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),13)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M13:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M13:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M13:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M13:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M13:HOMING") field(CALC, "A") field(OUT, "$(MOC):M13:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M13:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M13:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#13P") field(DESC, "$(DEV) roll cap. sensor") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M13:HMPOS:CALC") { field(INPA, "$(MOC):M13.MRES CP") field(INPB, "$(MOC):M13:SCALE") field(INPC, "$(MOC):M13:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M13:HMPOS PP") } record(ai, "$(MOC):M13:HMPOS") { field(DESC, "$(DEV) roll cap. sensor") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M13:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M13") field(OUT, "$(PV_NANO_STACK):HM:M13PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M13PV"){ } # define a kill record record(ao, "$(MOC):M13:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M13:ELOSSVAR") { field(CALC, "464+13") field(PINI, "YES") } record(ai, "$(MOC):M13:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+13`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M13:ELOSSRC") { field(OUT, "$(MOC):M13:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M13:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+13`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS13:DESC"){ field(VAL, "M13 $(DEV) roll cap. sensor") } #record(bo, "$(MOC):M13:HOMED") { # field(DESC, "Set homed status for axis 13") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M13:HOMEDSET") #} #record(calcout, "$(MOC):M13:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M13:HOMED") # field(OUT, "@pmac.proto setIntVar(m1345) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M13:DirectDemand") { field(FLNK, "$(MOC):M13:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M13:DirectCountsCalc") { field(INPA, "$(MOC):M13:DirectDemand") field(INPB, "$(MOC):M13:Mres PP") field(INPC, "$(MOC):M13:Offset PP") field(INPD, "$(MOC):M13:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M13:RawDirectDemand PP") } record(ao, "$(MOC):M13:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M13:DirectMotorSeq") field(OUT, "@asyn($(PORT),13,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) roll cap. sensor") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M13:DirectMotorSeq") { field(LNK1, "$(MOC):M13:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M13:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M13:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),13,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M13:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),13,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M13:MresSource") } record(scalcout, $(MOC):M13:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M13:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M13:Mres.INPA CA") field(FLNK, "$(MOC):M13:OffsetSource") } record(scalcout, "$(MOC):M13:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M13:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M13:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),13,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M13:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M13:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M13:Offset.INPA CA") } record(scalcout, $(MOC):M13:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M13:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M13:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),13,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):PITCH_CAP:RBK, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_CAP:RBK # This associates an edm screen with the template # % gui, M14, edm, motor.edl, motor=$(PV_NANO_STACK):PITCH_CAP:RBK # % gui, M14, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):PITCH_CAP:RBK,filename=motor.edl,box-label=$(DEV) pitch cap. sensor # This associates a BOY screen with the template # % gui, M14, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:PITCH_CAP:RBK,DESC=$(DEV) pitch cap. sensor, name=M14 # % gui, M14, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:PITCH_CAP:RBK,DESC=$(DEV) pitch cap. sensor, name=M14 # % gui, M14, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_CAP:RBK,DESC=$(DEV) pitch cap. sensor, name=M14 # FIXME: this should be in pmacUtil or tpmac # % gui, M14, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:PITCH_CAP:RBK # This makes the component icon reflect the status and severity # % gui, M14, status, .MOVN # % gui, M14, sevr # These define what PVs a motor detail screen should contain # % gui, M14, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M14, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M14, command, ELoss Clear, :ELOSSRC.A # % gui, M14, statusbits, Limit Violation, .LVIO, Lim # % gui, M14, statusbits, At High Limit, .HLS, High # % gui, M14, statusbits, At Low Limit, .LLS, Low # % gui, M14, demand, User High Limit, .HLM # % gui, M14, demand, User Low Limit, .LLM # % gui, M14, demand, Dial High Limit, .DHLM # % gui, M14, demand, Dial Low Limit, .DLLM # % gui, M14, demand, Motor demand, .VAL # % gui, M14, readback, Motor readback, .RBV # % gui, M14, command, Stop, .STOP # % gui, M14, command, Home Forward, .HOMF # % gui, M14, command, Home Reverse, .HOMR # % gui, M14, command, Jog Forward, .JOGF # % gui, M14, command, Jog Reverse, .JOGR # % gui, M14, command, Tweak Forward, .TWF # % gui, M14, command, Tweak Reverse, .TWR # % gui, M14, demand, Tweak Step, .TWV # % gui, M14, command, Kill, :KILL.PROC, Kill # % gui, M14, command, Sync VAL=RBV, .SYNC # % gui, M14, enum, Direction, .DIR # % gui, M14, demand, User Offset, .OFF # % gui, M14, enum, Set/Use, .SET # % gui, M14, enum, Offset, .FOFF # % gui, M14, enum, Use Encoder, .UEIP # % gui, M14, demand, Motor Step Size, .MRES # % gui, M14, readback, Steps per Rev, .SREV # % gui, M14, readback, EGUs per Rev, .UREV # % gui, M14, demand, Encoder Step Size, .ERES # % gui, M14, readback, Readback Step Size, .RRES # % gui, M14, readback, Use Encoder if Present, .UEIP # % gui, M14, demand, Max Velocity, .VMAX # % gui, M14, demand, Base Velocity, .VBAS # % gui, M14, demand, Velocity, .VELO # % gui, M14, demand, Secs to Velocity, .ACCL # % gui, M14, demand, JVEL, .JVEL # % gui, M14, demand, Jog Acceleration, .JAR # % gui, M14, demand, Backlash Distance, .BDST # % gui, M14, demand, Backlash Velocity, .BVEL # % gui, M14, demand, Backlash Secs to Vel, .BACC # % gui, M14, demand, Move Fraction, .FRAC # % gui, M14, demand, Retry Deadband, .RDBD # % gui, M14, demand, Max Retrys, .RTRY # % gui, M14, demand, PREC, .PREC # % gui, M14, demand, EGU, .EGU # % gui, M14, demand, Output Specification, .OUT # % gui, M14, readback, Readback Location, .RDBL # % gui, M14, readback, Desired Output Loc, .DOL # % gui, M14, readback, Output Mode Select, .OMSL # % gui, M14, readback, Readback Out Link, .RLNK # % gui, M14, demand, DMOV Input Link, .DINP # % gui, M14, demand, RMP Input Link, .RINP # % gui, M14, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):PITCH_CAP:RBK") { field(DESC,"$(DEV) pitch cap. sensor") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),14)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):PITCH_CAP:RBK:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:ADDR") { field(PINI, "YES") field(VAL, "14") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):PITCH_CAP:RBK:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):PITCH_CAP:RBK:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_CAP:RBK:ELOSS record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):PITCH_CAP:RBK:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):PITCH_CAP:RBK:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):PITCH_CAP:RBK.RMP CP") field(INPB,"$(PV_NANO_STACK):PITCH_CAP:RBK.REP NPP") field(INPC,"$(PV_NANO_STACK):PITCH_CAP:RBK.MRES NPP") field(INPD,"$(PV_NANO_STACK):PITCH_CAP:RBK.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX record(calc, "$(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):PITCH_CAP:RBK:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):PITCH_CAP:RBK:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):PITCH_CAP:RBK, $(MOC):M14) alias($(PV_NANO_STACK):PITCH_CAP:RBK:ADDR, $(MOC):M14:ADDR) alias($(PV_NANO_STACK):PITCH_CAP:RBK:PORT, $(MOC):M14:PORT) alias($(PV_NANO_STACK):PITCH_CAP:RBK:SCALE, $(MOC):M14:SCALE) alias($(PV_NANO_STACK):PITCH_CAP:RBK:USER:SDIS, $(MOC):M14:USER:SDIS) alias($(PV_NANO_STACK):PITCH_CAP:RBK:SDIS, $(MOC):M14:SDIS) alias($(PV_NANO_STACK):PITCH_CAP:RBK:KILL, $(MOC):M14:KILL) alias($(PV_NANO_STACK):PITCH_CAP:RBK:ELOSS, $(MOC):M14:ELOSS) alias($(PV_NANO_STACK):PITCH_CAP:RBK:ELOSSRC, $(MOC):M14:ELOSSRC) alias($(PV_NANO_STACK):PITCH_CAP:RBK:MR_MOVE_WRITE, $(MOC):M14:MR_MOVE_WRITE) alias($(PV_NANO_STACK):PITCH_CAP:RBK:CHECK_SYNC, $(MOC):M14:CHECK_SYNC) alias($(PV_NANO_STACK):PITCH_CAP:RBK:FERROR, $(MOC):M14:FERROR) alias($(PV_NANO_STACK):PITCH_CAP:RBK:FERRORMAX, $(MOC):M14:FERRORMAX) alias($(PV_NANO_STACK):PITCH_CAP:RBK:FEMAXRESET, $(MOC):M14:FEMAXRESET) alias($(PV_NANO_STACK):PITCH_CAP:RBK:HOMEVIS, $(MOC):M14:HOMEVIS) alias($(PV_NANO_STACK):PITCH_CAP:RBK:HOMEVISSTR, $(MOC):M14:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_CAP:RBK.DIR CP") field(INPC, "$(PV_NANO_STACK):PITCH_CAP:RBK:SCALE") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+14`") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK.OFF CP") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+14`") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),14)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):PITCH_CAP:RBK:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):PITCH_CAP:RBK:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),14)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):PITCH_CAP:RBK:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),14)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):PITCH_CAP:RBK:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),14)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):PITCH_CAP:RBK:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):PITCH_CAP:RBK:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#14P") field(DESC, "$(DEV) pitch cap. sensor") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):PITCH_CAP:RBK:SCALE") field(INPC, "$(PV_NANO_STACK):PITCH_CAP:RBK:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:HMPOS PP") } record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:HMPOS") { field(DESC, "$(DEV) pitch cap. sensor") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):PITCH_CAP:RBK:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):PITCH_CAP:RBK") field(OUT, "$(PV_NANO_STACK):HM:M14PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M14PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):PITCH_CAP:RBK:ELOSSVAR") { field(CALC, "464+14") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):PITCH_CAP:RBK:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+14`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+14`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS14:DESC"){ field(VAL, "M14 $(DEV) pitch cap. sensor") } #record(bo, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMED") { # field(DESC, "Set homed status for axis 14") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK:HOMED") # field(OUT, "@pmac.proto setIntVar(m1445) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectDemand") field(INPB, "$(PV_NANO_STACK):PITCH_CAP:RBK:Mres PP") field(INPC, "$(PV_NANO_STACK):PITCH_CAP:RBK:Offset PP") field(INPD, "$(PV_NANO_STACK):PITCH_CAP:RBK:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorSeq") field(OUT, "@asyn($(PORT),14,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch cap. sensor") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):PITCH_CAP:RBK:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),14,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:MresSource") } record(scalcout, $(PV_NANO_STACK):PITCH_CAP:RBK:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):PITCH_CAP:RBK:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):PITCH_CAP:RBK:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):PITCH_CAP:RBK:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),14,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):PITCH_CAP:RBK:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):PITCH_CAP:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):PITCH_CAP:RBK:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):PITCH_CAP:RBK:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):PITCH_CAP:RBK:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),14,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M14:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M14.MRES CP") field(INPB, "$(MOC):M14.DIR CP") field(INPC, "$(MOC):M14:SCALE") field(OUT, "$(MOC):M14:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M14:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+14`") field(FLNK, "$(MOC):M14:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M14:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M14.OFF CP") field(OUT, "$(MOC):M14:OFF_SET PP") } record(ao, "$(MOC):M14:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+14`") field(FLNK, "$(MOC):M14:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M14:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),14)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M14:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M14:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),14)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M14:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),14)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M14:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),14)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M14:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M14:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M14:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M14:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M14:HOMING") field(CALC, "A") field(OUT, "$(MOC):M14:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M14:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M14:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#14P") field(DESC, "$(DEV) pitch cap. sensor") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M14:HMPOS:CALC") { field(INPA, "$(MOC):M14.MRES CP") field(INPB, "$(MOC):M14:SCALE") field(INPC, "$(MOC):M14:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M14:HMPOS PP") } record(ai, "$(MOC):M14:HMPOS") { field(DESC, "$(DEV) pitch cap. sensor") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M14:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M14") field(OUT, "$(PV_NANO_STACK):HM:M14PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M14PV"){ } # define a kill record record(ao, "$(MOC):M14:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M14:ELOSSVAR") { field(CALC, "464+14") field(PINI, "YES") } record(ai, "$(MOC):M14:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+14`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M14:ELOSSRC") { field(OUT, "$(MOC):M14:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M14:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+14`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS14:DESC"){ field(VAL, "M14 $(DEV) pitch cap. sensor") } #record(bo, "$(MOC):M14:HOMED") { # field(DESC, "Set homed status for axis 14") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M14:HOMEDSET") #} #record(calcout, "$(MOC):M14:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M14:HOMED") # field(OUT, "@pmac.proto setIntVar(m1445) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M14:DirectDemand") { field(FLNK, "$(MOC):M14:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M14:DirectCountsCalc") { field(INPA, "$(MOC):M14:DirectDemand") field(INPB, "$(MOC):M14:Mres PP") field(INPC, "$(MOC):M14:Offset PP") field(INPD, "$(MOC):M14:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M14:RawDirectDemand PP") } record(ao, "$(MOC):M14:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M14:DirectMotorSeq") field(OUT, "@asyn($(PORT),14,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) pitch cap. sensor") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M14:DirectMotorSeq") { field(LNK1, "$(MOC):M14:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M14:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M14:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),14,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M14:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),14,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M14:MresSource") } record(scalcout, $(MOC):M14:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M14:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M14:Mres.INPA CA") field(FLNK, "$(MOC):M14:OffsetSource") } record(scalcout, "$(MOC):M14:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M14:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M14:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),14,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M14:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M14:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M14:Offset.INPA CA") } record(scalcout, $(MOC):M14:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M14:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M14:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),14,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):Y:RBK, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Y:RBK # This associates an edm screen with the template # % gui, M15, edm, motor.edl, motor=$(PV_NANO_STACK):Y:RBK # % gui, M15, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):Y:RBK,filename=motor.edl,box-label=$(DEV) quDIS Y # This associates a BOY screen with the template # % gui, M15, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:Y:RBK,DESC=$(DEV) quDIS Y, name=M15 # % gui, M15, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:Y:RBK,DESC=$(DEV) quDIS Y, name=M15 # % gui, M15, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:Y:RBK,DESC=$(DEV) quDIS Y, name=M15 # FIXME: this should be in pmacUtil or tpmac # % gui, M15, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:Y:RBK # This makes the component icon reflect the status and severity # % gui, M15, status, .MOVN # % gui, M15, sevr # These define what PVs a motor detail screen should contain # % gui, M15, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M15, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M15, command, ELoss Clear, :ELOSSRC.A # % gui, M15, statusbits, Limit Violation, .LVIO, Lim # % gui, M15, statusbits, At High Limit, .HLS, High # % gui, M15, statusbits, At Low Limit, .LLS, Low # % gui, M15, demand, User High Limit, .HLM # % gui, M15, demand, User Low Limit, .LLM # % gui, M15, demand, Dial High Limit, .DHLM # % gui, M15, demand, Dial Low Limit, .DLLM # % gui, M15, demand, Motor demand, .VAL # % gui, M15, readback, Motor readback, .RBV # % gui, M15, command, Stop, .STOP # % gui, M15, command, Home Forward, .HOMF # % gui, M15, command, Home Reverse, .HOMR # % gui, M15, command, Jog Forward, .JOGF # % gui, M15, command, Jog Reverse, .JOGR # % gui, M15, command, Tweak Forward, .TWF # % gui, M15, command, Tweak Reverse, .TWR # % gui, M15, demand, Tweak Step, .TWV # % gui, M15, command, Kill, :KILL.PROC, Kill # % gui, M15, command, Sync VAL=RBV, .SYNC # % gui, M15, enum, Direction, .DIR # % gui, M15, demand, User Offset, .OFF # % gui, M15, enum, Set/Use, .SET # % gui, M15, enum, Offset, .FOFF # % gui, M15, enum, Use Encoder, .UEIP # % gui, M15, demand, Motor Step Size, .MRES # % gui, M15, readback, Steps per Rev, .SREV # % gui, M15, readback, EGUs per Rev, .UREV # % gui, M15, demand, Encoder Step Size, .ERES # % gui, M15, readback, Readback Step Size, .RRES # % gui, M15, readback, Use Encoder if Present, .UEIP # % gui, M15, demand, Max Velocity, .VMAX # % gui, M15, demand, Base Velocity, .VBAS # % gui, M15, demand, Velocity, .VELO # % gui, M15, demand, Secs to Velocity, .ACCL # % gui, M15, demand, JVEL, .JVEL # % gui, M15, demand, Jog Acceleration, .JAR # % gui, M15, demand, Backlash Distance, .BDST # % gui, M15, demand, Backlash Velocity, .BVEL # % gui, M15, demand, Backlash Secs to Vel, .BACC # % gui, M15, demand, Move Fraction, .FRAC # % gui, M15, demand, Retry Deadband, .RDBD # % gui, M15, demand, Max Retrys, .RTRY # % gui, M15, demand, PREC, .PREC # % gui, M15, demand, EGU, .EGU # % gui, M15, demand, Output Specification, .OUT # % gui, M15, readback, Readback Location, .RDBL # % gui, M15, readback, Desired Output Loc, .DOL # % gui, M15, readback, Output Mode Select, .OMSL # % gui, M15, readback, Readback Out Link, .RLNK # % gui, M15, demand, DMOV Input Link, .DINP # % gui, M15, demand, RMP Input Link, .RINP # % gui, M15, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):Y:RBK") { field(DESC,"$(DEV) quDIS Y") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),15)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mm") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):Y:RBK:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):Y:RBK:ADDR") { field(PINI, "YES") field(VAL, "15") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):Y:RBK:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):Y:RBK:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):Y:RBK:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):Y:RBK:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):Y:RBK:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):Y:RBK:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):Y:RBK.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):Y:RBK:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Y:RBK:ELOSS record(ai, "$(PV_NANO_STACK):Y:RBK:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):Y:RBK:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):Y:RBK:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):Y:RBK.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):Y:RBK:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):Y:RBK:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):Y:RBK:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):Y:RBK.RMP CP") field(INPB,"$(PV_NANO_STACK):Y:RBK.REP NPP") field(INPC,"$(PV_NANO_STACK):Y:RBK.MRES NPP") field(INPD,"$(PV_NANO_STACK):Y:RBK.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):Y:RBK:FERRORMAX") field(PREC,"4") field(EGU, "mm") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):Y:RBK:FERRORMAX record(calc, "$(PV_NANO_STACK):Y:RBK:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):Y:RBK:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):Y:RBK:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mm") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):Y:RBK:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):Y:RBK:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):Y:RBK:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):Y:RBK:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):Y:RBK, $(MOC):M15) alias($(PV_NANO_STACK):Y:RBK:ADDR, $(MOC):M15:ADDR) alias($(PV_NANO_STACK):Y:RBK:PORT, $(MOC):M15:PORT) alias($(PV_NANO_STACK):Y:RBK:SCALE, $(MOC):M15:SCALE) alias($(PV_NANO_STACK):Y:RBK:USER:SDIS, $(MOC):M15:USER:SDIS) alias($(PV_NANO_STACK):Y:RBK:SDIS, $(MOC):M15:SDIS) alias($(PV_NANO_STACK):Y:RBK:KILL, $(MOC):M15:KILL) alias($(PV_NANO_STACK):Y:RBK:ELOSS, $(MOC):M15:ELOSS) alias($(PV_NANO_STACK):Y:RBK:ELOSSRC, $(MOC):M15:ELOSSRC) alias($(PV_NANO_STACK):Y:RBK:MR_MOVE_WRITE, $(MOC):M15:MR_MOVE_WRITE) alias($(PV_NANO_STACK):Y:RBK:CHECK_SYNC, $(MOC):M15:CHECK_SYNC) alias($(PV_NANO_STACK):Y:RBK:FERROR, $(MOC):M15:FERROR) alias($(PV_NANO_STACK):Y:RBK:FERRORMAX, $(MOC):M15:FERRORMAX) alias($(PV_NANO_STACK):Y:RBK:FEMAXRESET, $(MOC):M15:FEMAXRESET) alias($(PV_NANO_STACK):Y:RBK:HOMEVIS, $(MOC):M15:HOMEVIS) alias($(PV_NANO_STACK):Y:RBK:HOMEVISSTR, $(MOC):M15:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):Y:RBK:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):Y:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):Y:RBK.DIR CP") field(INPC, "$(PV_NANO_STACK):Y:RBK:SCALE") field(OUT, "$(PV_NANO_STACK):Y:RBK:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):Y:RBK:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+15`") field(FLNK, "$(PV_NANO_STACK):Y:RBK:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):Y:RBK:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):Y:RBK.OFF CP") field(OUT, "$(PV_NANO_STACK):Y:RBK:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):Y:RBK:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+15`") field(FLNK, "$(PV_NANO_STACK):Y:RBK:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):Y:RBK:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),15)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):Y:RBK:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):Y:RBK:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),15)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):Y:RBK:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),15)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):Y:RBK:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),15)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):Y:RBK:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):Y:RBK:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):Y:RBK:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):Y:RBK:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):Y:RBK:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):Y:RBK:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):Y:RBK:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):Y:RBK:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#15P") field(DESC, "$(DEV) quDIS Y") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(PV_NANO_STACK):Y:RBK:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):Y:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):Y:RBK:SCALE") field(INPC, "$(PV_NANO_STACK):Y:RBK:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):Y:RBK:HMPOS PP") } record(ai, "$(PV_NANO_STACK):Y:RBK:HMPOS") { field(DESC, "$(DEV) quDIS Y") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):Y:RBK:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):Y:RBK") field(OUT, "$(PV_NANO_STACK):HM:M15PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M15PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):Y:RBK:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):Y:RBK:ELOSSVAR") { field(CALC, "464+15") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):Y:RBK:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+15`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):Y:RBK:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):Y:RBK:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):Y:RBK:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+15`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS15:DESC"){ field(VAL, "M15 $(DEV) quDIS Y") } #record(bo, "$(PV_NANO_STACK):Y:RBK:HOMED") { # field(DESC, "Set homed status for axis 15") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):Y:RBK:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):Y:RBK:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):Y:RBK:HOMED") # field(OUT, "@pmac.proto setIntVar(m1545) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):Y:RBK:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):Y:RBK:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):Y:RBK:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):Y:RBK:DirectDemand") field(INPB, "$(PV_NANO_STACK):Y:RBK:Mres PP") field(INPC, "$(PV_NANO_STACK):Y:RBK:Offset PP") field(INPD, "$(PV_NANO_STACK):Y:RBK:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):Y:RBK:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):Y:RBK:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):Y:RBK:DirectMotorSeq") field(OUT, "@asyn($(PORT),15,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) quDIS Y") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):Y:RBK:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):Y:RBK:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):Y:RBK:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):Y:RBK:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):Y:RBK:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),15,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):Y:RBK:MresSource") } record(scalcout, $(PV_NANO_STACK):Y:RBK:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Y:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):Y:RBK:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):Y:RBK:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):Y:RBK:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Y:RBK:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):Y:RBK:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),15,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):Y:RBK:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):Y:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):Y:RBK:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):Y:RBK:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):Y:RBK:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):Y:RBK:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),15,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M15:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M15.MRES CP") field(INPB, "$(MOC):M15.DIR CP") field(INPC, "$(MOC):M15:SCALE") field(OUT, "$(MOC):M15:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M15:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+15`") field(FLNK, "$(MOC):M15:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M15:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M15.OFF CP") field(OUT, "$(MOC):M15:OFF_SET PP") } record(ao, "$(MOC):M15:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+15`") field(FLNK, "$(MOC):M15:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M15:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),15)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M15:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M15:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),15)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M15:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),15)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M15:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),15)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M15:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M15:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M15:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M15:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M15:HOMING") field(CALC, "A") field(OUT, "$(MOC):M15:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M15:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M15:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#15P") field(DESC, "$(DEV) quDIS Y") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mm") } record(calcout, "$(MOC):M15:HMPOS:CALC") { field(INPA, "$(MOC):M15.MRES CP") field(INPB, "$(MOC):M15:SCALE") field(INPC, "$(MOC):M15:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M15:HMPOS PP") } record(ai, "$(MOC):M15:HMPOS") { field(DESC, "$(DEV) quDIS Y") field(PREC, "4") field(EGU, "mm") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M15:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M15") field(OUT, "$(PV_NANO_STACK):HM:M15PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M15PV"){ } # define a kill record record(ao, "$(MOC):M15:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M15:ELOSSVAR") { field(CALC, "464+15") field(PINI, "YES") } record(ai, "$(MOC):M15:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+15`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M15:ELOSSRC") { field(OUT, "$(MOC):M15:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M15:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+15`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS15:DESC"){ field(VAL, "M15 $(DEV) quDIS Y") } #record(bo, "$(MOC):M15:HOMED") { # field(DESC, "Set homed status for axis 15") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M15:HOMEDSET") #} #record(calcout, "$(MOC):M15:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M15:HOMED") # field(OUT, "@pmac.proto setIntVar(m1545) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M15:DirectDemand") { field(FLNK, "$(MOC):M15:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M15:DirectCountsCalc") { field(INPA, "$(MOC):M15:DirectDemand") field(INPB, "$(MOC):M15:Mres PP") field(INPC, "$(MOC):M15:Offset PP") field(INPD, "$(MOC):M15:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M15:RawDirectDemand PP") } record(ao, "$(MOC):M15:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M15:DirectMotorSeq") field(OUT, "@asyn($(PORT),15,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) quDIS Y") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M15:DirectMotorSeq") { field(LNK1, "$(MOC):M15:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M15:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M15:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),15,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M15:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),15,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M15:MresSource") } record(scalcout, $(MOC):M15:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M15:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M15:Mres.INPA CA") field(FLNK, "$(MOC):M15:OffsetSource") } record(scalcout, "$(MOC):M15:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M15:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M15:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),15,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M15:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M15:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M15:Offset.INPA CA") } record(scalcout, $(MOC):M15:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M15:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M15:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),15,4)PMAC_OFFSET") }# % macro, PMAC, The P prefix for the motor controller (must match P in pmacController.template) # this template defines a motor with two names:- # (1) root is $(PV_NANO_STACK):U:RBK, the macros fully define the name of the motor # (2) 'numbered' names of the form $(MOC):Mx where x is the motor number # names are both assigned to the same PV via aliases in the case basic_asyn_motor # or simply duplicated for all other included templates, this approach works because # the PVs all point to the same ASYN parameters and improves maintainability of this # file # include motor record from the motor module #% macro, __doc__, Basic template, including motor record and associated tags #% macro, P , Device Prefix #% macro, M , Device Suffix #% macro, PORT , Asyn port for motor record #% macro, ADDR , Address on controller #% macro, DESC , Description, displayed on EDM screen #% macro, MRES , Motor Step Size (EGU) #% macro, DTYP , DTYP of record #% macro, DIR , User Direction #% macro, VBAS , Base Velocity (EGU/s) #% macro, VELO , Velocity (EGU/s) #% macro, VMAX , Max Velocity (EGU/s), defaults to VELO #% macro, ACCL , Seconds to Velocity #% macro, BDST , BL Distance (EGU) #% macro, BVEL , BL Velocity (EGU/s) #% macro, BACC , BL Seconds to Veloc. #% macro, PREC , Display Precision #% macro, EGU , Engineering Units #% macro, DHLM , Dial High Limit #% macro, DLLM , Dial Low Limit #% macro, HLM , User High Limit #% macro, LLM , User Low Limit #% macro, HLSV , HW Lim. Violation Svr #% macro, INIT , Startup commands #% macro, SREV , Steps per Revolution #% macro, RRES , Readback Step Size (EGU) #% macro, TWV , Tweak Step Size (EGU) #% macro, ERES , Encoder Step Size (EGU) #% macro, JAR , Jog Acceleration (EGU/s^2) #% macro, UEIP , Use Encoder If Present #% macro, URIP , Use RDBL If Present #% macro, RDBL , Readback Location, set URIP = 1 if you specify this #% macro, RLNK , Readback output link #% macro, RTRY , Max retry count #% macro, DLY , Readback settle time (s) #% macro, OFF , User Offset (EGU) #% macro, RDBD , Retry Deadband (EGU) #% macro, FOFF , Freeze Offset, 0=variable, 1=frozen #% macro, ADEL , Alarm monitor deadband (EGU) #% macro, NTM , New Target Monitor, only set to 0 for soft motors #% macro, FEHIGH , HIGH limit for following error #% macro, FEHIHI , HIHI limit for following error #% macro, FEHHSV , HIHI alarm severity for following error #% macro, FEHSV , HIGH alarm severity for following error #% macro, SCALE , Scale factor, if pmacSetAxisScale is used this should be set #% macro, HOMEVIS, If 1 then home is visible on the gui #% macro, HOMEVISSTR, If HOMEVIS=0, then display this text on the gui instead #% macro, name , Object name and gui association name #% macro, alh , Set this to alh to add the motor to the alarm handler and send emails, # set to '#' to comment out alh lines #% macro, gda_name, Name to export this as to GDA #% macro, gda_desc, Description to export this as to GDA # AUTOSAVE: level 0 = before record init, level 1 = before AND after record init #% autosave 0 DVAL OFF #% autosave 1 DIR DHLM DLLM TWV VBAS VELO ACCL BDST BVEL BACC RDBD EGU RTRY UEIP URIP DLY PREC DISA DISP FOFF OFF FRAC OMSL JVEL JAR ADEL MDEL #% archiver 0.5 Monitor #% archiver 0.5 Monitor RBV #% archiver 10 Monitor OFF #% archiver 10 Monitor MRES #% gdatag,template,simpleMotor,, #% gdatag,motor,rw,,RECORD,Motor #% alh #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):U:RBK # This associates an edm screen with the template # % gui, M16, edm, motor.edl, motor=$(PV_NANO_STACK):U:RBK # % gui, M16, edmembed, motor-embed-small.edl, motor=$(PV_NANO_STACK):U:RBK,filename=motor.edl,box-label=$(DEV) quDIS U # This associates a BOY screen with the template # % gui, M16, boydetail, motorApp_opi/motor_detail.opi, P=$(PV_NANO_STACK),M=:U:RBK,DESC=$(DEV) quDIS U, name=M16 # % gui, M16, boyembed, motorApp_opi/motor_embed_box.opi, P=$(PV_NANO_STACK),M=:U:RBK,DESC=$(DEV) quDIS U, name=M16 # % gui, M16, boyembed, motorApp_opi/motor_embed.opi, P=$(PV_NANO_STACK),M=:U:RBK,DESC=$(DEV) quDIS U, name=M16 # FIXME: this should be in pmacUtil or tpmac # % gui, M16, boyembed, motorApp_opi/motor_homed_embed.opi, P=$(PV_NANO_STACK),M=:U:RBK # This makes the component icon reflect the status and severity # % gui, M16, status, .MOVN # % gui, M16, sevr # These define what PVs a motor detail screen should contain # % gui, M16, statusbits, Status, .MSTA, Direction Positive, Done, High Limit, Home Limit, Unused, Closed Loop, Following Error, At Home, Encoder Present, Problem, Moving, Gain Support, Comms Error, Low Limit, Homed # % gui, M16, statusbits, ELoss, :ELOSS, Encoder Loss, Amplifier Loss, Sys Fail # % gui, M16, command, ELoss Clear, :ELOSSRC.A # % gui, M16, statusbits, Limit Violation, .LVIO, Lim # % gui, M16, statusbits, At High Limit, .HLS, High # % gui, M16, statusbits, At Low Limit, .LLS, Low # % gui, M16, demand, User High Limit, .HLM # % gui, M16, demand, User Low Limit, .LLM # % gui, M16, demand, Dial High Limit, .DHLM # % gui, M16, demand, Dial Low Limit, .DLLM # % gui, M16, demand, Motor demand, .VAL # % gui, M16, readback, Motor readback, .RBV # % gui, M16, command, Stop, .STOP # % gui, M16, command, Home Forward, .HOMF # % gui, M16, command, Home Reverse, .HOMR # % gui, M16, command, Jog Forward, .JOGF # % gui, M16, command, Jog Reverse, .JOGR # % gui, M16, command, Tweak Forward, .TWF # % gui, M16, command, Tweak Reverse, .TWR # % gui, M16, demand, Tweak Step, .TWV # % gui, M16, command, Kill, :KILL.PROC, Kill # % gui, M16, command, Sync VAL=RBV, .SYNC # % gui, M16, enum, Direction, .DIR # % gui, M16, demand, User Offset, .OFF # % gui, M16, enum, Set/Use, .SET # % gui, M16, enum, Offset, .FOFF # % gui, M16, enum, Use Encoder, .UEIP # % gui, M16, demand, Motor Step Size, .MRES # % gui, M16, readback, Steps per Rev, .SREV # % gui, M16, readback, EGUs per Rev, .UREV # % gui, M16, demand, Encoder Step Size, .ERES # % gui, M16, readback, Readback Step Size, .RRES # % gui, M16, readback, Use Encoder if Present, .UEIP # % gui, M16, demand, Max Velocity, .VMAX # % gui, M16, demand, Base Velocity, .VBAS # % gui, M16, demand, Velocity, .VELO # % gui, M16, demand, Secs to Velocity, .ACCL # % gui, M16, demand, JVEL, .JVEL # % gui, M16, demand, Jog Acceleration, .JAR # % gui, M16, demand, Backlash Distance, .BDST # % gui, M16, demand, Backlash Velocity, .BVEL # % gui, M16, demand, Backlash Secs to Vel, .BACC # % gui, M16, demand, Move Fraction, .FRAC # % gui, M16, demand, Retry Deadband, .RDBD # % gui, M16, demand, Max Retrys, .RTRY # % gui, M16, demand, PREC, .PREC # % gui, M16, demand, EGU, .EGU # % gui, M16, demand, Output Specification, .OUT # % gui, M16, readback, Readback Location, .RDBL # % gui, M16, readback, Desired Output Loc, .DOL # % gui, M16, readback, Output Mode Select, .OMSL # % gui, M16, readback, Readback Out Link, .RLNK # % gui, M16, demand, DMOV Input Link, .DINP # % gui, M16, demand, RMP Input Link, .RINP # % gui, M16, demand, Stop Out Link, .STOO record(motor,"$(PV_NANO_STACK):U:RBK") { field(DESC,"$(DEV) quDIS U") field(DTYP,"asynMotor") field(DIR,"0") field(VELO,"1.0") field(VBAS,"0") field(ACCL,"0.5") field(BDST,"0") field(BVEL,"0") field(BACC,"") field(OUT,"@asyn($(PORT),16)") field(MRES,"0.0001") field(PREC,"4") field(EGU,"mrad") field(DHLM,"") field(DLLM,"") field(HLM,"1e5") field(LLM,"-1e5") field(HLSV,"NO_ALARM") field(INIT,"") field(RTRY,"0") field(DLY,"0") field(HVEL,"1.0") field(SREV, "1") field(RRES, "") field(TWV, "0.01") field(ERES, "0.0001") field(JVEL, "1.0") field(JAR, "") field(UEIP, "1") field(URIP, "0") field(RDBL, "") field(VMAX, "1.0") field(OFF, "0") field(RDBD, "") field(FOFF, "1") field(ADEL, "0") field(NTM, "1") field(SDIS, "$(PV_NANO_STACK):U:RBK:SDIS.VAL") field(RLNK, "") info(autosaveFields, "VELO ACCL LLM HLM") } # record that holds the ADDR record(ao, "$(PV_NANO_STACK):U:RBK:ADDR") { field(PINI, "YES") field(VAL, "16") } # record that holds the PORT record(stringout, "$(PV_NANO_STACK):U:RBK:PORT") { field(PINI, "YES") field(VAL, "$(PORT)") } # record that holds the SCALE record(ao, "$(PV_NANO_STACK):U:RBK:SCALE") { field(PINI, "YES") field(VAL, "20000") } # Write a 1 to this record over Channel Access to disable the motor record and prevent CA writes to any field # including the demand field. record(ai, "$(PV_NANO_STACK):U:RBK:USER:SDIS") { field(VAL, "0") field(FLNK, "$(PV_NANO_STACK):U:RBK:SDIS") } # Note: This record forms part of the interface to auto-homing, which uses the "A" field to disable the motor record # when homing. # record that will disable and re-enable record if any of its inputs are non-zero record(calcout, "$(PV_NANO_STACK):U:RBK:SDIS") { field(DESC, "Disable on non-zero input") field(INPL, "$(PV_NANO_STACK):U:RBK:USER:SDIS") field(CALC, "(A|B|C|D|E|F|G|H|I|J|K|L)>0") field(OUT, "$(PV_NANO_STACK):U:RBK.DISP PP") } # dummy record that looks like a kill command record(ao, "$(PV_NANO_STACK):U:RBK:KILL") { field(VAL, "1") } # dummy record that looks like eloss status #% archiver 10 Monitor VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):U:RBK:ELOSS record(ai, "$(PV_NANO_STACK):U:RBK:ELOSS") { field(PINI, "YES") field(HIHI, "1") field(HHSV, "MAJOR") } # dummy record that looks like an eloss reset record(calcout, "$(PV_NANO_STACK):U:RBK:ELOSSRC") { } # check if SYNC has been pressed record(calcout, "$(PV_NANO_STACK):U:RBK:CHECK_SYNC") { field(INPA, "$(PV_NANO_STACK):U:RBK.SYNC CP") field(CALC, "A>0") field(OOPT, "When Non-zero") field(OUT, "$(PV_NANO_STACK):U:RBK:MR_MOVE_WRITE.PROC PP") } # dummy record that looks like a record to notify a CS about a raw motor move record(longout, "$(PV_NANO_STACK):U:RBK:MR_MOVE_WRITE") { } #Record to calculate the following error #% archiver 1 Monitor record(calc, "$(PV_NANO_STACK):U:RBK:FERROR") { field(DESC,"Following Error") field(INPA,"$(PV_NANO_STACK):U:RBK.RMP CP") field(INPB,"$(PV_NANO_STACK):U:RBK.REP NPP") field(INPC,"$(PV_NANO_STACK):U:RBK.MRES NPP") field(INPD,"$(PV_NANO_STACK):U:RBK.ERES NPP") field(CALC,"ABS((A*C)-(B*D))") field(FLNK,"$(PV_NANO_STACK):U:RBK:FERRORMAX") field(PREC,"4") field(EGU, "mrad") } #Record to store the maximum following error #% archiver 10 Monitor VAL #% autosave 1 VAL #% None $SEVRCOMMAND UP_ANY dls-alh-handler.py $(PV_NANO_STACK):U:RBK:FERRORMAX record(calc, "$(PV_NANO_STACK):U:RBK:FERRORMAX") { field(DESC,"Following Error Max") field(INPA,"$(PV_NANO_STACK):U:RBK:FERROR.VAL") field(INPB,"$(PV_NANO_STACK):U:RBK:FERRORMAX.VAL") field(CALC,"(A>B)?A:B") field(HIGH,"0") field(HIHI,"0") field(HHSV,"NO_ALARM") field(HSV, "NO_ALARM") field(PREC,"4") field(EGU, "mrad") } #Record to reset the maximum following error record(bo, "$(PV_NANO_STACK):U:RBK:FEMAXRESET") { field(DESC,"Reset max following error") field(DTYP,"Soft Channel") field(OUT, "$(PV_NANO_STACK):U:RBK:FERRORMAX.VAL") field(VAL, "0") } #Record to determin HOME button visibility on the motor.edl screen. record(bo, "$(PV_NANO_STACK):U:RBK:HOMEVIS") { field(DESC,"Home button visibility") field(DTYP,"Soft Channel") field(VAL, "1") field(ZNAM, "Invisible") field(ONAM, "Visible") } #Record to display a message if the HOME buttons are not visible (if HOMEVIS=0). record(stringout, "$(PV_NANO_STACK):U:RBK:HOMEVISSTR") { field(DESC, "Home visibility string") field(DTYP,"Soft Channel") field(VAL, "") } #include "basic_asyn_motor.db" # numbered name aliases for all PVs in basic_asyn_motor.template alias($(PV_NANO_STACK):U:RBK, $(MOC):M16) alias($(PV_NANO_STACK):U:RBK:ADDR, $(MOC):M16:ADDR) alias($(PV_NANO_STACK):U:RBK:PORT, $(MOC):M16:PORT) alias($(PV_NANO_STACK):U:RBK:SCALE, $(MOC):M16:SCALE) alias($(PV_NANO_STACK):U:RBK:USER:SDIS, $(MOC):M16:USER:SDIS) alias($(PV_NANO_STACK):U:RBK:SDIS, $(MOC):M16:SDIS) alias($(PV_NANO_STACK):U:RBK:KILL, $(MOC):M16:KILL) alias($(PV_NANO_STACK):U:RBK:ELOSS, $(MOC):M16:ELOSS) alias($(PV_NANO_STACK):U:RBK:ELOSSRC, $(MOC):M16:ELOSSRC) alias($(PV_NANO_STACK):U:RBK:MR_MOVE_WRITE, $(MOC):M16:MR_MOVE_WRITE) alias($(PV_NANO_STACK):U:RBK:CHECK_SYNC, $(MOC):M16:CHECK_SYNC) alias($(PV_NANO_STACK):U:RBK:FERROR, $(MOC):M16:FERROR) alias($(PV_NANO_STACK):U:RBK:FERRORMAX, $(MOC):M16:FERRORMAX) alias($(PV_NANO_STACK):U:RBK:FEMAXRESET, $(MOC):M16:FEMAXRESET) alias($(PV_NANO_STACK):U:RBK:HOMEVIS, $(MOC):M16:HOMEVIS) alias($(PV_NANO_STACK):U:RBK:HOMEVISSTR, $(MOC):M16:HOMEVISSTR) ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(PV_NANO_STACK):U:RBK:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(PV_NANO_STACK):U:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):U:RBK.DIR CP") field(INPC, "$(PV_NANO_STACK):U:RBK:SCALE") field(OUT, "$(PV_NANO_STACK):U:RBK:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(PV_NANO_STACK):U:RBK:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+16`") field(FLNK, "$(PV_NANO_STACK):U:RBK:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(PV_NANO_STACK):U:RBK:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(PV_NANO_STACK):U:RBK.OFF CP") field(OUT, "$(PV_NANO_STACK):U:RBK:OFF_SET PP") } record(ao, "$(PV_NANO_STACK):U:RBK:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+16`") field(FLNK, "$(PV_NANO_STACK):U:RBK:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(PV_NANO_STACK):U:RBK:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),16)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(PV_NANO_STACK):U:RBK:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(PV_NANO_STACK):U:RBK:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),16)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(PV_NANO_STACK):U:RBK:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),16)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(PV_NANO_STACK):U:RBK:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),16)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(PV_NANO_STACK). If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(PV_NANO_STACK):U:RBK:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(PV_NANO_STACK):U:RBK:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(PV_NANO_STACK):U:RBK:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(PV_NANO_STACK):U:RBK:HOMING_CALC) { field(PINI, 1) field(INPA, "$(PV_NANO_STACK):U:RBK:HOMING") field(CALC, "A") field(OUT, "$(PV_NANO_STACK):U:RBK:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(PV_NANO_STACK):U:RBK:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(PV_NANO_STACK):U:RBK:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#16P") field(DESC, "$(DEV) quDIS U") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(PV_NANO_STACK):U:RBK:HMPOS:CALC") { field(INPA, "$(PV_NANO_STACK):U:RBK.MRES CP") field(INPB, "$(PV_NANO_STACK):U:RBK:SCALE") field(INPC, "$(PV_NANO_STACK):U:RBK:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(PV_NANO_STACK):U:RBK:HMPOS PP") } record(ai, "$(PV_NANO_STACK):U:RBK:HMPOS") { field(DESC, "$(DEV) quDIS U") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(PV_NANO_STACK):U:RBK:SETHMPV") { field(PINI, "YES") field(VAL, "$(PV_NANO_STACK):U:RBK") field(OUT, "$(PV_NANO_STACK):HM:M16PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M16PV"){ } # define a kill record record(ao, "$(PV_NANO_STACK):U:RBK:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(PV_NANO_STACK):U:RBK:ELOSSVAR") { field(CALC, "464+16") field(PINI, "YES") } record(ai, "$(PV_NANO_STACK):U:RBK:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+16`") field(SCAN, "I/O Intr") } record(calcout, "$(PV_NANO_STACK):U:RBK:ELOSSRC") { field(OUT, "$(PV_NANO_STACK):U:RBK:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(PV_NANO_STACK):U:RBK:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+16`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS16:DESC"){ field(VAL, "M16 $(DEV) quDIS U") } #record(bo, "$(PV_NANO_STACK):U:RBK:HOMED") { # field(DESC, "Set homed status for axis 16") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(PV_NANO_STACK):U:RBK:HOMEDSET") #} #record(calcout, "$(PV_NANO_STACK):U:RBK:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(PV_NANO_STACK):U:RBK:HOMED") # field(OUT, "@pmac.proto setIntVar(m1645) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(PV_NANO_STACK):U:RBK:DirectDemand") { field(FLNK, "$(PV_NANO_STACK):U:RBK:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(PV_NANO_STACK):U:RBK:DirectCountsCalc") { field(INPA, "$(PV_NANO_STACK):U:RBK:DirectDemand") field(INPB, "$(PV_NANO_STACK):U:RBK:Mres PP") field(INPC, "$(PV_NANO_STACK):U:RBK:Offset PP") field(INPD, "$(PV_NANO_STACK):U:RBK:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(PV_NANO_STACK):U:RBK:RawDirectDemand PP") } record(ao, "$(PV_NANO_STACK):U:RBK:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(PV_NANO_STACK):U:RBK:DirectMotorSeq") field(OUT, "@asyn($(PORT),16,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) quDIS U") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(PV_NANO_STACK):U:RBK:DirectMotorSeq") { field(LNK1, "$(PV_NANO_STACK):U:RBK:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(PV_NANO_STACK):U:RBK:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(PV_NANO_STACK):U:RBK:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(PV_NANO_STACK):U:RBK:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),16,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(PV_NANO_STACK):U:RBK:MresSource") } record(scalcout, $(PV_NANO_STACK):U:RBK:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):U:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(PV_NANO_STACK):U:RBK:Mres.INPA CA") field(FLNK, "$(PV_NANO_STACK):U:RBK:OffsetSource") } record(scalcout, "$(PV_NANO_STACK):U:RBK:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):U:RBK:MresDrv PP") field(PREC, 6) } record(ao,"$(PV_NANO_STACK):U:RBK:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),16,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(PV_NANO_STACK):U:RBK:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(PV_NANO_STACK):U:RBK:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(PV_NANO_STACK):U:RBK:Offset.INPA CA") } record(scalcout, $(PV_NANO_STACK):U:RBK:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(PV_NANO_STACK):U:RBK:OffsetDrv PP") field(PREC, 4) } record(ao,"$(PV_NANO_STACK):U:RBK:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),16,4)PMAC_OFFSET") } # add numbered name aliases for above 3 templates ############################################################ # # Template to allow coordinate system kinematics to know # the resolution of each real motor # # Also to allow control of CS mappings of real motors # ############################################################### ############################################################### # Mres and Offset ############################################################### #calc mres to be written record(calcout, "$(MOC):M16:MRES_CALC") { field(CALC, "B?-A*C:A*C") field(INPA, "$(MOC):M16.MRES CP") field(INPB, "$(MOC):M16.DIR CP") field(INPC, "$(MOC):M16:SCALE") field(OUT, "$(MOC):M16:MRES_SET PP") field(OOPT, "When Non-zero") } record(ao, "$(MOC):M16:MRES_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4800+16`") field(FLNK, "$(MOC):M16:MR_MOVE_WRITE") } #calc offset to be written record(calcout, "$(MOC):M16:OFF_SET_CALC") { field(CALC, "A") field(INPA, "$(MOC):M16.OFF CP") field(OUT, "$(MOC):M16:OFF_SET PP") } record(ao, "$(MOC):M16:OFF_SET") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),0)PMAC_WD_P`4900+16`") field(FLNK, "$(MOC):M16:MR_MOVE_WRITE") } ############################################################### # Coordinate System mapping control ############################################################### # Read back which CS number the axis is in record(ai, "$(MOC):M16:CsRaw_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),16)PMAC_C_AXIS_CS") field(PINI, "NO") field(SCAN, "I/O Intr") } # Set which CS the axis is in via CSController Port Name record(mbbo, "$(MOC):M16:CsPort") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)PMAC_C_GROUP_CS_PORT") } record(mbbi, "$(MOC):M16:CsPort_RBV") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),16)PMAC_C_GROUP_CS_PORT_RBV") field(SCAN, "I/O Intr") } # set the axis' CS assignment (one of A B C U V W X Y Z I) record(stringout, "$(MOC):M16:CsAxis") { field(DTYP, "asynOctetWrite") field(OUT, "@asyn($(PORT),16)PMAC_C_GROUP_ASSIGN") } record(stringin, "$(MOC):M16:CsAxis_RBV") { field(DTYP, "asynOctetRead") field(INP, "@asyn($(PORT),16)PMAC_C_GROUP_ASSIGN_RBV") field(SCAN, "I/O Intr") }# These are the supporting records for doing kill, eloss, and adding autohome # support to a motor record #% macro, SPORT, Asyn port for eloss commands # usually PMAC_S for pmacs, the name of the pmacAsynIpPort for bricks #% macro, HOME, Prefix for autohome instance. Defaults to $(MOC):. If unspecified, # the template contains enough records to keep the motor record happy #% macro, PMAC, Prefix for pmacStatus instance. Needed to get axis descriptions # onto pmacStatusAxis screen #% macro, ALLOW_HOMED_SET, Set to a blank to allow this axis to have its homed # status manually. This is set to a comment character by default. # disable motor when homing record(calcout, "$(MOC):M16:SDIS") { # field(INPA, "$(PV_NANO_STACK):HM:HOMING CP") } # dummy record in case we aren't homing record(busy, "$(PV_NANO_STACK):HM:HOMING") { } # Monitor homing status record(bi, "$(MOC):M16:HOMING") { field(DESC, "Monitor homing status of autohome") field(INP, "$(PV_NANO_STACK):HM:HOMING CP") field(FLNK, "$(MOC):M16:HOMING_CALC") field(ZNAM, "Done") field(ONAM, "Busy") } # report to the driver if this motor is being autohomed record(calcout, $(MOC):M16:HOMING_CALC) { field(PINI, 1) field(INPA, "$(MOC):M16:HOMING") field(CALC, "A") field(OUT, "$(MOC):M16:HOMING_STATUS PP") } # report to the driver if this motor is being autohomed record(ao, $(MOC):M16:HOMING_STATUS) { field(DESC, "driver update on autohome") field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)HOMING_STATUS") } # reports position of motor without offset record(ai, "$(MOC):M16:HMPOS_RBV") { field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),0)PMAC_VDF_#16P") field(DESC, "$(DEV) quDIS U") field(SCAN, "I/O Intr") field(PINI, "YES") field(PREC, "4") field(EGU, "mrad") } record(calcout, "$(MOC):M16:HMPOS:CALC") { field(INPA, "$(MOC):M16.MRES CP") field(INPB, "$(MOC):M16:SCALE") field(INPC, "$(MOC):M16:HMPOS_RBV CP") field(CALC, "A*B*C") field(OUT, "$(MOC):M16:HMPOS PP") } record(ai, "$(MOC):M16:HMPOS") { field(DESC, "$(DEV) quDIS U") field(PREC, "4") field(EGU, "mrad") } # at startup, tell autohome template about this motor record(stringout, "$(MOC):M16:SETHMPV") { field(PINI, "YES") field(VAL, "$(MOC):M16") field(OUT, "$(PV_NANO_STACK):HM:M16PV PP") } record(stringout, "$(PV_NANO_STACK):HM:M16PV"){ } # define a kill record record(ao, "$(MOC):M16:KILL") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16)PMAC_C_KILL_AXIS") field(VAL, "0") } record(calc, "$(MOC):M16:ELOSSVAR") { field(CALC, "464+16") field(PINI, "YES") } record(ai, "$(MOC):M16:ELOSS") { field(DTYP, "asynInt32") field(INP, "@asyn($(PORT),0)PMAC_VIS_P`464+16`") field(SCAN, "I/O Intr") } record(calcout, "$(MOC):M16:ELOSSRC") { field(OUT, "$(MOC):M16:SEND_ELOSSRC PP") field(DESC, "Write 0 to A to reset Eloss") field(CALC, "A") field(A, "0") } record(ao, "$(MOC):M16:SEND_ELOSSRC") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),0)PMAC_VIS_P`464+16`") } # Overwrite the description of pmacStatus record(stringout, "$(MOC):AXIS16:DESC"){ field(VAL, "M16 $(DEV) quDIS U") } #record(bo, "$(MOC):M16:HOMED") { # field(DESC, "Set homed status for axis 16") # field(ZNAM, "NOT HOMED") # field(ONAM, "HOMED") # field(FLNK, "$(MOC):M16:HOMEDSET") #} #record(calcout, "$(MOC):M16:HOMEDSET") { # field(DESC, "Homed status") # field(DTYP, "stream") # field(CALC, "A") # field(INPA, "$(MOC):M16:HOMED") # field(OUT, "@pmac.proto setIntVar(m1645) ") #} ############################################################## # # A record to sit along side each motor record and give direct # access to the driver without any motor record logic # may be used with virtual and real motors # # This template requires that all real motors mentioned have # a real underlying motor record (to determine MRES) this is # not required for virtual motors # # This currently only supports demand but could be extended # to totally replace motor record (perhaps) # ############################################################## # % macro, PORT, The asyn port (motor controller or CS controller) # % macro, ADDR, The asyn address (real or CS axis number) # % macro, DESC, Description # % macro, PMAC, PV Prefix for the motor controller # % macro, P, PV Prefix for direct motors # % macro, M, Motor PV suffix ('Mx' for real and 'CSx:My' for CS axes) ############################################################## # Set immediate demand for this motor ############################################################## #% archiver 0.5 Monitor record(ao, "$(MOC):M16:DirectDemand") { field(FLNK, "$(MOC):M16:DirectCountsCalc.PROC") field(PREC, 4) } record(scalcout, "$(MOC):M16:DirectCountsCalc") { field(INPA, "$(MOC):M16:DirectDemand") field(INPB, "$(MOC):M16:Mres PP") field(INPC, "$(MOC):M16:Offset PP") field(INPD, "$(MOC):M16:SCALE") field(CALC, "(A-C)/B*D") field(OUT, "$(MOC):M16:RawDirectDemand PP") } record(ao, "$(MOC):M16:RawDirectDemand") { field(DTYP, "asynFloat64") field(FLNK, "$(MOC):M16:DirectMotorSeq") field(OUT, "@asyn($(PORT),16,4)MOTOR_MOVE_ABS") field(DESC, "$(DEV) quDIS U") } # busy record to make ca_put_callback return only once the motor is done moving record(seq, "$(MOC):M16:DirectMotorSeq") { field(LNK1, "$(MOC):M16:DirectMotorBusy PP") field(DO1, "1") } record(busy, "$(MOC):M16:DirectMotorBusy") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16,4)MOTOR_STATUS_MOVING") field(ZNAM, "Idle") field(ONAM, "Moving") field(PINI, "1") field(VAL, "0") } # record that holds the SCALE # this overrides the definition in basic_asyn_motor.template and connects it to the # asyn parameter that tracks the scale factor in the driver. This is set by calling # pmacSetAxisScale (for CS axes this function is exposed to startup via # pmacSetCoordStepsPerUnit) record(ao, "$(MOC):M16:SCALE") { field(DTYP, "asynInt32") field(OUT, "@asyn($(PORT),16,4)PMAC_MOTOR_SCALE") } ############################################################## # Database logic to set the correct ASLO and OFF on # DirectDemand so that it can be commanded in EGUs # # The Mres and Offset are copied into ALSO and OFF from # the appropriate real motor determined by DirectMotorNumber. # # For CS motors DirectMotorNumber is set by the driver when it # maps a CS motor directly to a real motor. # # If as CS motor is not directly mapped then it wants an # mres of 1 but the scaling means this usually translates # to 0.0001. # # For real motors DirectMotorNumber is always reported as the # motor's own number # # The calculation in MresSource handles linking in the # correct real_motor mres or the value 1 for kinematic CS axes # ############################################################## record(longin, "$(MOC):M16:DirectMotorNumber") { field(PINI, 1) field(VAL, 0) field(DTYP, "asynInt32") field(SCAN, "I/O Intr") field(INP, "@asyn($(PORT),16,4)PMAC_REAL_MOTOR_NUMBER") field(FLNK, "$(MOC):M16:MresSource") } record(scalcout, $(MOC):M16:MresSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M16:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.MRES CPP',A)):1") field(OUT, "$(MOC):M16:Mres.INPA CA") field(FLNK, "$(MOC):M16:OffsetSource") } record(scalcout, "$(MOC):M16:Mres") { field(INPA, "1") # to be overwritten by MresSource field(CALC, "A") field(VAL, 1) field(PINI, "YES") field(OUT, "$(MOC):M16:MresDrv PP") field(PREC, 6) } record(ao,"$(MOC):M16:MresDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),16,4)PMAC_MRES") } # todo non zero offset in CS kinematic axes no supported record(scalcout, $(MOC):M16:OffsetSource) { field(DTYP, "Soft Channel") field(INPA, "$(MOC):M16:DirectMotorNumber") field(CALC, "A?(PRINTF('$(MOC):M%d.OFF CPP',A)):0") field(OUT, "$(MOC):M16:Offset.INPA CA") } record(scalcout, $(MOC):M16:Offset) { field(INPA, "0") # to be overwritten by OffsetSource field(CALC, "A") field(PINI, "YES") field(OUT, "$(MOC):M16:OffsetDrv PP") field(PREC, 4) } record(ao,"$(MOC):M16:OffsetDrv") { field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),16,4)PMAC_OFFSET") }