adds a similar retry mechanism as was implemented with the shutter

This commit is contained in:
2026-04-09 16:08:14 +02:00
parent 28cd0879be
commit 0d20534dcf
5 changed files with 121 additions and 13 deletions
+1
View File
@@ -5,4 +5,5 @@ record(longin, "$(INSTR)$(SPS_REGISTER_NAME):$(UINT_NAME)")
field(INP, "@$(SPS_REGISTER_NAME)/$(OFFSET) T=BYTE")
field(PINI, "YES")
field(SCAN, "I/O Intr")
field(FLNK, "$(FLNK=)")
}
+111 -3
View File
@@ -1,8 +1,8 @@
record(longout, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP-INIT")
{
field(DESC, "Initialises BEAMSTOP PV")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP NPP")
field(DOL, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP_RBV NPP")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP NPP")
field(OMSL, "closed_loop")
field(PINI, "YES")
}
@@ -22,12 +22,42 @@ record(seq, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER-DELAY")
{
field(DESC, "Delays Internal Trigger as SPS too slow")
field(DOL0, 1)
field(LNK0, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER PP")
field(LNK0, "$(INSTR)$(SPS_REGISTER_NAME):SET-BUSY.PROC PP")
field(DLY0, 0.5)
field(SELM, "All")
field(PINI, "NO")
}
record(longout, "$(INSTR)$(SPS_REGISTER_NAME):SET-BUSY")
{
field(DESC, "Trigger Internal Busy Status")
# This determines the number of max retry ticks
field(VAL, 5)
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BUSY PP")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER")
}
# Reset status
record(seq, "$(INSTR)$(SPS_REGISTER_NAME):RESET")
{
field(DESC, "Try to reset status")
# Set the beamstop setpoint to same as readback
# in case they are out of sync, i.e. retry error.
field(DOL0, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP_RBV NPP")
field(LNK0, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP NPP")
field(DOL1, 0)
field(LNK1, "$(INSTR)$(SPS_REGISTER_NAME):STATUS PP")
field(SELM, "All")
}
record(bi, "$(INSTR)$(SPS_REGISTER_NAME):BUSY")
{
field(DESC, "Internal Busy State")
field(VAL, 0)
field(ZNAM, "Ready")
field(ONAM, "Busy")
}
record(longout, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER")
{
field(DESC, "Internal Trigger")
@@ -38,6 +68,57 @@ record(longout, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):MAP-STATUS PP")
}
# This is a hack, the SPS sometimes doesn't registers the beamstop
# execute command.
#
record(calcout, "$(INSTR)$(SPS_REGISTER_NAME):RETRY")
{
field(INPA, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP")
field(INPB, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP_RBV")
field(INPC, "$(INSTR)$(SPS_REGISTER_NAME):BUSY")
field(INPD, "$(INSTR)$(SPS_REGISTER_NAME):MOVES")
field(INPE, "$(INSTR)$(SPS_REGISTER_NAME):STATUS")
field(CALC, "A#B&&C#0&&D=0&&E=0?1:0")
field(DOPT, "Use CALC")
field(OOPT, "When Non-zero")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):TRIGGER.PROC PP")
field(SCAN, "1 second")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):DECREASE-BUSY-TICK")
}
record(calcout, "$(INSTR)$(SPS_REGISTER_NAME):DECREASE-BUSY-TICK")
{
field(INPA, "$(INSTR)$(SPS_REGISTER_NAME):BUSY")
field(CALC, "A")
field(OOPT, "When Non-zero")
field(DOPT, "Use OCAL")
field(OCAL, "A-1")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BUSY PP")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):DELAY-RETRY-ERROR")
}
# Delay check for retry error, not this happens after each retry.
# But we gate the retry error wih checking if busy is 0
record(seq, "$(INSTR)$(SPS_REGISTER_NAME):DELAY-RETRY-ERROR")
{
field(DESC, "Delays checking if retry error occurred")
field(DOL0, 1)
field(LNK0, "$(INSTR)$(SPS_REGISTER_NAME):RETRY-ERROR.PROC PP")
field(DLY0, 0.5)
field(SELM, "All")
}
record(calcout, "$(INSTR)$(SPS_REGISTER_NAME):RETRY-ERROR")
{
field(INPA, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP")
field(INPB, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP_RBV")
field(INPC, "$(INSTR)$(SPS_REGISTER_NAME):BUSY")
field(INPD, "$(INSTR)$(SPS_REGISTER_NAME):MOVES")
field(CALC, "A#B&&C=0&&D=0?1:0")
field(OOPT, "When Non-zero")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):MAP-STATUS PP")
}
record(calc, "$(INSTR)$(SPS_REGISTER_NAME):MAP-STATUS")
{
field(DESC, "Maps Status Variables to singular status")
@@ -51,7 +132,6 @@ record(calc, "$(INSTR)$(SPS_REGISTER_NAME):MAP-STATUS")
field(INPH, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP NPP")
field(INPI, "$(INSTR)$(SPS_REGISTER_NAME):BEAMSTOP_RBV NPP")
field(CALC, "(F=0||G=0||D=1)?3:(A=1)?2:(C=1||H#I)?1:(B=0)?3:0")
field(SCAN, ".1 second")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):STATUS PP")
}
@@ -69,4 +149,32 @@ record(mbbi, "$(INSTR)$(SPS_REGISTER_NAME):STATUS")
field(THST, "Error")
field(FRST, "4")
field(FRST, "Unknown")
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):STATUS-Msg")
}
record(stringout, "$(INSTR)$(SPS_REGISTER_NAME):Retry-Error-Msg")
{
field(DESC, "Beamstop max retries failed message")
field(VAL, "Failed trying to change beamstop")
}
record(scalcout, "$(INSTR)$(SPS_REGISTER_NAME):STATUS-Msg")
{
field(DESC, "Status Message")
field(INPA, "$(INSTR)$(SPS_REGISTER_NAME):RETRY-ERROR NPP")
field(INAA, "$(INSTR)$(SPS_REGISTER_NAME):Retry-Error-Msg NPP")
field(INBB, "$(INSTR)$(SPS_REGISTER_NAME):BLOCKED-REASON-Msg NPP")
field(CALC, 'A=1?AA:BB')
field(FLNK, "$(INSTR)$(SPS_REGISTER_NAME):SET-READY")
}
record(calcout, "$(INSTR)$(SPS_REGISTER_NAME):SET-READY")
{
field(INPA, "$(INSTR)$(SPS_REGISTER_NAME):MOVES")
field(CALC, "A")
field(OOPT, "Transition To Zero")
field(DOPT, "Use OCAL")
field(OCAL, "0")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BUSY PP")
}
-1
View File
@@ -203,4 +203,3 @@ record(calcout, "$(INSTR)$(SPS_REGISTER_NAME):SET-READY")
field(OCAL, "0")
field(OUT, "$(INSTR)$(SPS_REGISTER_NAME):BUSY PP")
}
+1 -1
View File
@@ -19,7 +19,7 @@ s7plcFWConfigure("$(SPS_REGISTER_NAME)", "$(SPS_IP)", "$(FETCH_PORT=2000),1,$(FE
dbLoadRecords("$(sinqSPS_DB)/sps_status.db", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME)")
# Shutter PVs
dbLoadTemplate("$(sinqSPS_DB)/sans_llb_beamstop.substitutions", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME)")
dbLoadTemplate("$(sinqSPS_DB)/sans_llb_beamstop.substitutions", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME), STATUS_FLNK=$(INSTR)$(SPS_REGISTER_NAME):MAP-STATUS")
# Additional Mapping PVs
dbLoadRecords("$(sinqSPS_DB)/sans_llb_beamstop.db", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME)")
+8 -8
View File
@@ -23,17 +23,17 @@ file "$(sinqSPS_DB)/readusint.db"
file "$(sinqSPS_DB)/readbit.db"
{
pattern
{OFFSET, BIT, BIT_NAME , ZNAM , ONAM , DESC}
{6 , 0 , "SERVICE-MODE" , "disabled", "enabled", "" }
{6 , 1 , "IN-POSITION" , "no" , "yes" , "" }
{6 , 2 , "MOVES" , "no" , "yes" , "" }
{6 , 3 , "ERROR" , "no" , "yes" , "" }
{6 , 4 , "EXECUTE-POSSIBLE" , "no" , "yes" , "" }
{OFFSET, BIT, BIT_NAME , ZNAM , ONAM , DESC, FLNK }
{6 , 0 , "SERVICE-MODE" , "disabled", "enabled", "" , "" }
{6 , 1 , "IN-POSITION" , "no" , "yes" , "" , "" }
{6 , 2 , "MOVES" , "no" , "yes" , "" , "" }
{6 , 3 , "ERROR" , "no" , "yes" , "" , "" }
{6 , 4 , "EXECUTE-POSSIBLE" , "no" , "yes" , "" , "$(STATUS_FLNK)"}
}
file "$(sinqSPS_DB)/readstring.db"
{
pattern
{OFFSET, LENGTH, STRING_NAME }
{8 , 30 , "BLOCKED-REASON" }
{OFFSET, LENGTH, STRING_NAME , FLNK }
{8 , 30 , "BLOCKED-REASON", "$(STATUS_FLNK)"}
}