###CHECKPOINT ARGS:  -nostartlog -queue=0 - nolog-flow -nolog-blocks
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/sim/src/do_the_iss.src"
descr "do_the_iss - step-wise optimize ISS gain (in ISSmode)"
# program do_the_iss.src, created 96.01.24 Igor Zayer 
#	96.02.02  IZ	- fixed queueing to work properly
#
#	While MDI is assumed to be in ISS mode, this procedure provides the 
#	measurement both closed loop first, then open loop, turns the PAW 
#	and logs the house-keeping
#
# Calls: log_iss_par
# ------
# Variable usage:
#----------------
# !GS9: name of user logfile
#----------------

## DO CLOSED LOOP FIRST
display "  closing the loop"
writen !GS9 "  closing the loop"
tcblock mbltclsl
wait time 8  ## queueing has been turned off just prior this CF
perform log_iss_par_v03
display "  moving PAW through 1 revolution"
writen !GS9 "  moving PAW through 1 revolution"
queue on ## Queue next 4 commands.                                    ##-#
tcblock mbdpconf 44 49  17 55 17
wait time 2   ## Clocking to prevent CMS overflow
tcblock mbdpconf 44 49  53 55 17
wait time 2   ## Clocking to prevent CMS overflow
tcblock mbdpconf 44 49  89 55 17
queue off ## Synchronize w/ POCC                                      ##-#
tcblock mbdpconf 44 49 125 55 17
wait time 8
perform log_iss_par_v03

## SAME THING IN OPEN LOOP & LEAVE OPEN FOR NEXT GAIN SETTING
display "  opening the loop"
writen !GS9 "  opening the loop"
tcblock mbltopnl
perform log_iss_par_v03
display "  moving PAW through 1 revolution"
writen !GS9 "  moving PAW through 1 revolution"
queue on ## Queue next 4 commands.                                    ##-#
tcblock mbdpconf 44 49  17 55 17
wait time 2   ## Clocking to prevent CMS overflow
tcblock mbdpconf 44 49  53 55 17
wait time 2   ## Clocking to prevent CMS overflow
tcblock mbdpconf 44 49  89 55 17
queue off ## Synchronize w/ POCC                                      ##-#
tcblock mbdpconf 44 49 125 55 17
wait time 8
perform log_iss_par_v03

return
