DECLARE SUB hp3457cnvtrig (c%, n%, v!()) DECLARE SUB dac488hrdo0 (d%) DECLARE SUB dac488hrdo1 (d%) DECLARE SUB initfile (ok$) DECLARE SUB fileheader (logfile$) DECLARE SUB fileihead (logfile$, iname$, n%, imag!()) DECLARE SUB filemkdir (destdir$) DECLARE SUB fileopenout (destdir$, basename$, ext$, filename$, ok$) DECLARE SUB fileplot (file$, epfile$) DECLARE SUB fileprnt (file$) DECLARE SUB fileprot (file$) DECLARE SUB imagstandardize () DECLARE SUB spolmain () DECLARE SUB imagramp (inom!) DECLARE SUB coilprintvn () DECLARE SUB coilplotf () DECLARE SUB gpibinit () DECLARE SUB hp3457init () DECLARE SUB dac488hrinit () DECLARE SUB dac488hrsetupv () DECLARE SUB k7011init () DECLARE SUB coilplotv () DECLARE SUB gettestparam () '**************************************************************************** 'Program TEST 'This program is used to make the rotating coil measurements. 'It samples the voltage from the rotating 'coil and Fourier analyzes the samples to get the strengths of 'each component of the field. ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Include the constants used in the program REM $INCLUDE: 'param.inc' 'Open the log file filenum% = FREEFILE logfileP$ = "logfile.dat" OPEN logfileP$ FOR OUTPUT AS filenum% CLOSE filenum% 'Open the raw data file filenum% = FREEFILE rawfileP$ = "rawfile.dat" OPEN rawfileP$ FOR OUTPUT AS filenum% CLOSE filenum% 'Prepare the screen CLS 'Initialize the GPIB CALL gpibinit 'Initialize the HP3457 CALL hp3457init 'Initialize the DAC CALL dac488hrinit CALL dac488hrsetupv 'Test the reset signal 'PRINT : PRINT "Set D/O High to stop triggers..." 'CALL dac488hrdo1(1) 'PRINT "Wait 5 seconds...." 'SLEEP 10 'PRINT "Set D/O Low to send triggers..." 'CALL dac488hrdo0(1) 'STOP 'Test the trigger 'PRINT : PRINT "Test the trigger..." 'DIM v!(0 TO 2000) 'CALL hp3457cnvtrig(1, 2001, v!()) 'STOP 'Initialize the multiplexer CALL k7011init 'Ramp the magnet 'CALL imagramp(100!) 'STOP 'Plot the coil voltage 'CALL coilplotv 'STOP 'Plot the coil frequency 'CALL coilplotf 'STOP 'Print the voltage harmonics 'CALL coilprintvn 'STOP 'Get test parameters from the operator testparam: CALL gettestparam 'Initialize the files for this run CALL initfile(ok$) IF ok$ <> "y" THEN PRINT PRINT "Problem initializing the data files." PRINT "Make sure you are using a new run number." GOTO testparam: END IF 'Standardize the magnet 'CALL imagstandardize 'Measure SL (the current is set in spolmain) CALL spolmain 'Ramp to 0 A CALL imagramp(0!) 'Message PRINT "The test is complete." END SUB initfile (ok$) '**************************************************************************** 'This subroutine does all the file initialization for the HER sextupole 'measurements. ' 'Output: ' ok$, ="y" if the file handling went ok, "n" otherwise ' 'Zachary Wolf '11/15/94 '**************************************************************************** 'Initialize ok$ = "n" 'Create the \magdata subdirectory to store the files subdir$ = "c:\magdata\" + LEFT$("s" + magnameP$ + "b" + barcodeP$, 8) CALL filemkdir(subdir$) 'Form the extension for all the files r% = VAL(runP$) IF r% < 10 THEN ext$ = "ru" + runP$ IF r% >= 10 THEN ext$ = "r" + runP$ 'RT 'Initialize the dat file for the rt measurements 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rtdat", ext$, rtdatP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Write headers to the dat file CALL fileheader(rtdatP$) 'Make a .bat file to write protect the data CALL fileprot(rtdatP$) 'Make a .bat file to print the dat file CALL fileprnt(rtdatP$) 'SL 'Initialize the data, and plot files for the SL vs I measurements 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "sldat", ext$, sldatP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit CALL fileopenout(subdir$, "slplt", ext$, slpltP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Write a header to the dat file CALL fileheader(sldatP$) CALL fileihead(sldatP$, "Standardization Currents (A):", nimagstandP%, imagstandP!()) CALL fileihead(sldatP$, "Test Currents (A):", nimagtestP%, imagtestP!()) 'Make a .bat file to write protect the data CALL fileprot(sldatP$) CALL fileprot(slpltP$) 'Make a .bat file to print the dat file CALL fileprnt(sldatP$) 'Make a .bat file to plot the plt file CALL fileplot(slpltP$, "epsl.dat") 'HAR 'Initialize the data, and plot files for the harmonics measurements CALL fileopenout(subdir$, "hardat", ext$, hardatP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit CALL fileopenout(subdir$, "harplt", ext$, harpltP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Write headers to the data file CALL fileheader(hardatP$) CALL fileihead(hardatP$, "Standardization Currents (A):", nimagstandP%, imagstandP!()) CALL fileihead(hardatP$, "Test Currents (A):", nimagtestP%, imagtestP!()) 'Make a .bat file to write protect the data CALL fileprot(hardatP$) CALL fileprot(harpltP$) 'Make a .bat file to print the dat file CALL fileprnt(hardatP$) 'Make a .bat file to plot the plt file CALL fileplot(harpltP$, "ephar.dat") 'LOGFILE 'Initialize the log file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "logfile", ext$, logfileP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'Write headers to the log file CALL fileheader(logfileP$) CALL fileihead(logfileP$, "Standardization Currents (A):", nimagstandP%, imagstandP!()) CALL fileihead(logfileP$, "Test Currents (A):", nimagtestP%, imagtestP!()) 'Make a .bat file to write protect the data CALL fileprot(logfileP$) 'Make a .bat file to print the log file 'CALL fileprnt(logfileP$) 'RAW DATA FILE 'Initialize the raw data file for the run 'Exit with ok$="n" if there is a problem CALL fileopenout(subdir$, "rawfile", ext$, rawfileP$, okopen$) IF okopen$ <> "y" THEN GOTO pblmexit 'If we made it this far, things are ok ok$ = "y" pblmexit: END SUB