# Init sequence record. Initialized by pressing :MOTR_INIT button. # The init_seq, # a) turns off and then turns on the motor within 0.5s # c) pushes 0 to home_check disable field and then homes the motor after 0.5s record(bo, "$(P)MOTR_INIT") { field(DESC, "Init or Re Init") field(ZNAM, "Standby") field(ONAM, "Initialize ") } record(bo, "$(P)MOTR_INIT_DBG") { field(DTYP, "Raw Soft Channel") field(DESC, "Init debug flag") field(VAL, "0") field(ZNAM, "Debug Off") field(ONAM, "Debug On") } # Error acknowledge command initiates acknowledge sequence # For linmot, disbale and then enable the motor to clear the error. record(bo, "$(P)MOTR_ERR_ACK_CMD") { field(DESC, "Error Ack CMD") field(FLNK, "$(FLNK)") field(ZNAM, "NO ACK") field(ONAM, "ACK") } record(seq, "$(P)ACK_ERR_SEQ") { field(DESC, "Acknowledge error") field(DLY1, "2") field(DOL1, "0") field(LNK1, "$(P)$(M).CNEN") field(DOL2, "1") field(LNK2, "$(P)$(M).CNEN") field(ASG, "Internal") } # Motor switch on command # Motor can be turned on by # a) MOTR.CNEN and MOTR_SWITCH_ON_CMD # To ensure that both the commands work and not counter one another, calc records used # and both the PV`s should be updated if one does. record(bo, "$(P)MOTR_SWITCH_ON_CMD") { field(DESC, "Motor switch on CMD") field(ZNAM, "OFF") field(ONAM, "ON") } record(calcout, "$(P)CALC_ENABLE") { field(DESC, "Check ON cmd is pressed") field(CALC, "(A#B)?1:0") field(INPA, "$(P)MOTR_SWITCH_ON_CMD CP") field(INPB, "$(P)$(M).CNEN") field(OUT, "$(P)ENABLE_BO.PROC") field(OOPT, "When Non-zero") field(ASG, "Internal") } record(bo, "$(P)ENABLE_BO") { field(DESC, "copies switch on to cnen") field(DOL, "$(P)MOTR_SWITCH_ON_CMD") field(OUT, "$(P)$(M).CNEN PP") field(OMSL, "closed_loop") field(ASG, "Internal") } record(calcout, "$(P)CALC_CNEN") { field(DESC, "Check CNEN is pressed") field(CALC, "(A#B)?1:0") field(INPA, "$(P)$(M).CNEN CP") field(INPB, "$(P)MOTR_SWITCH_ON_CMD") field(OUT, "$(P)CNEN_BO.PROC") field(OOPT, "When Non-zero") field(ASG, "Internal") } record(bo, "$(P)CNEN_BO") { field(DESC, "copies switch on to bo") field(DOL, "$(P)$(M).CNEN") field(OUT, "$(P)MOTR_SWITCH_ON_CMD PP") field(OMSL, "closed_loop") field(ASG, "Internal") } # Motor home command # Motor can be homed by # a) MOTR.HOMR , HOML and MOTR_HOME_CMD # To ensure that both the commands work and not counter one another, calc records used # and both the PV`s should be updated if one does. record(bo, "$(P)MOTR_HOME_CMD") { field(DESC, "MOtor Home CMD") field(ZNAM, "OFF") field(ONAM, "HOME") } record(calcout, "$(P)CALC_HCMD") { field(DESC, "Check HOME cmd is pressed") field(CALC, "(A#B)?1:0") field(INPA, "$(P)MOTR_HOME_CMD CP") field(INPB, "$(P)$(M).HOMR") field(OUT, "$(P)HCMD_BO.PROC") field(OOPT, "When Non-zero") field(ASG, "Internal") } record(bo, "$(P)HCMD_BO") { field(DESC, "copies home cmd to homr_bo") field(DOL, "$(P)MOTR_HOME_CMD") field(OUT, "$(P)$(M).HOMR PP") field(OMSL, "closed_loop") field(ASG, "Internal") } record(calcout, "$(P)CALC_HOMR") { field(DESC, "Check HOMR is pressed") field(CALC, "(A#B)?1:0") field(INPA, "$(P)$(M).HOMR CP") field(INPB, "$(P)MOTR_HOME_CMD") field(OUT, "$(P)HOMR_BO.PROC") field(OOPT, "When Non-zero") field(ASG, "Internal") } record(bo, "$(P)HOMR_BO") { field(DESC, "copies HOMR to HCMD_bo") field(DOL, "$(P)$(M).HOMR") field(OUT, "$(P)MOTR_HOME_CMD PP") field(OMSL, "closed_loop") field(ASG, "Internal") } # Retract pv inititates the retract sequence # Retract equence homes and disables the motor record(bo, "$(P)MOTR_RETRACT") { field(DESC, "Motor Home and Disable") field(ZNAM, "Standby") field(ONAM, "Retract") } # As counter is incremental, reset counter sequence is used. # This sequence check`s if motor is homed and then resets the counter value. # To check if motor is homed, motion active status should transition to zero. # If motor record readback and external encoder readback are different # Initiates a sequence which updates teh motor readback to match encoder # Also make sure the retract position is higher than lower limit # Ensure the links are passive process. # No need for passive process for POSN. It updates as I/O interrupt record(bo, "$(P)CORRECT"){ field(DESC, "Update POSN value into MOTR value") field(FLNK, "$(P)CORRECT_SEQ") field(ZNAM, "No Update") field(ONAM, "Updating") } record(calcout, "$(P)CORRECT_CALC") { field(DESC, "Diff btw POSN and MOTR.VAL") field(CALC, "A-B+C") field(INPA, "$(P)POSN") field(INPB, "$(P)MOTR.RBV PP") field(INPC, "$(P)MOTR.OFF PP") field(ASG, "Internal") } record(seq, "$(P)CORRECT_SEQ") { field(DESC, "Update POSN value into MOTR value") field(DOL1, "1") field(LNK1, "$(P)MOTR.SET PP") field(DOL2, "$(P)CORRECT_CALC.VAL PP") field(LNK2, "$(P)MOTR.OFF") field(DLY2, "1") field(DOL3, "0") field(LNK3, "$(P)MOTR.SET PP") field(DLY3, "1") field(DLY4, "1") field(DOL4, "$(P)MOTR_RETRACT_POS_CALC PP") field(LNK4, "$(P)MOTR_RETRACT_POS.VAL PP") field(DLY5, "1") field(DOL5, "1") field(LNK5, "$(P)CORRECT_STS PP") field(ASG, "Internal") } record(calcout, "$(P)MOTR_RETRACT_POS_CALC") { field(DESC, "Diff btw lower limit and retract pos") field(CALC, "A+100") field(INPA, "$(P)MOTR.LLM PP") field(ASG, "Internal") } record(bi, "$(P)CORRECT_STS") { field(DESC, "readback correct status") field(ZNAM, "No Update") field(ONAM, "Readback corrected") } # Store control architecture record(bo, "$(P)ARCHITECTURE") { field(DESC, "set control architecture") field(SCAN, "Passive") field(ZNAM, "ATCA") field(ONAM, "APCI") field(VAL, "1") info(autosaveFields, "VAL") }