# stop the beam caput("SARCL02-MBND100:USER-DELTA-ENE-STATE", 1) # tell panel script is running caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1) caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1) # read channels dE = caget("SARCL02-MBND100:USER-DELTA-ENE") S30_GAIN = caget("S30:SET-E-GAIN-OP") S30_PHASE = caget("S30:SET-BEAM-PHASE-OP") SARCL02_P_SET = caget("SARCL02-MBND100:P-SET") SARBD01_P_SET = caget("SARBD01-MBND100:P-SET") # set new energy set-points S30_GAIN = S30_GAIN + dE SARCL02_P_SET = SARCL02_P_SET + dE SARBD01_P_SET = SARBD01_P_SET + dE caput("S30:SET-E-GAIN-OP", S30_GAIN) caput("SARCL02-MBND100:P-SET", SARCL02_P_SET) caput("SARBD01-MBND100:P-SET", SARBD01_P_SET) if S30_GAIN < 0 : # VRF needs -90 deg for decelaration S30_PHASE = S30_PHASE -180 # negative gain is not enough while S30_PHASE > 180: S30_PHASE = S30_PHASE - 360 while S30_PHASE < -180: S30_PHASE = S30_PHASE + 360 caput("S30:SET-BEAM-PHASE-OP", S30_PHASE) # adjust optics to new energy caput("S30:OPTICS-ONOFF-OP", 1) caput("SAR:OPTICS-ONOFF-OP", 1) time.sleep(10) # start the beam at 1 Hz caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 0) caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10) caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10) caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1) time.sleep(10) # beam at 10 Hz caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 6) caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 6) caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1) time.sleep(10) # optics feedback off caput("S30:OPTICS-ONOFF-OP", 0) caput("SAR:OPTICS-ONOFF-OP", 0) caput("SARCL02-MBND100:USER-DELTA-ENE-STATE", 0)