DECLARE SUB ibopstandardize () DECLARE SUB bit488v (v!) DECLARE SUB gettestparam () DECLARE SUB dlogcalc (logfile$) DECLARE SUB dlogdlvsi (logfile$, rcoil!, nturns%, nrot%, nmeas%, ni%, imag!(), simag!(), dl!(), sdl!(), tf!(), stf!()) DECLARE SUB dlogharvsi (logfile$, rcoil!, nturns%, nrot%, nmeas%, nh%, imag!, simag!, bl!(), sbl!(), th!(), sth!(), r!(), sr!()) DECLARE SUB dlognewpage (logfile$) DECLARE SUB dmeasdlav (dl!, sdl!) DECLARE SUB dmeasharav (nh%, bl!(), sbl!(), th!(), sth!(), r!(), sr!()) DECLARE SUB dpltdlvsi (logfile$, magname$, run$, ni%, imag!(), dl!(), sdl!(), tf!(), stf!()) DECLARE SUB dpltharvsi (logfile$, magname$, run$, nh%, ni%, inom!(), rvsi!(), srvsi!()) DECLARE SUB ibopmeas (imag!, simag!) DECLARE SUB fileinit (ok$) DECLARE SUB gpibinit () DECLARE SUB hp3457init () DECLARE SUB bit488i (i!) '**************************************************************************** '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' 'Prepare the screen CLS 'Initialize the GPIB CALL gpibinit 'Initialize the HP3457 CALL hp3457init 'Test the reset line 'OUT 6916, 1 'SLEEP 1 'OUT 6916, 0 'STOP 'Test the Kepco supply 'CALL bit488i(-10!) 'STOP 'Open a log file filenum% = FREEFILE OPEN "logfile.dat" FOR OUTPUT AS filenum% CLOSE filenum% logfileP$ = "logfile.dat" 'Standardize CALL ibopstandardize 'Measure the harmonics 'CALL meashar 'Plot tachometer voltage measurements 'CALL tachplotv 'Plot coil voltage measurements 'CALL coilplotv 'Message PRINT "The test is complete." END SUB gettestparam '**************************************************************************** 'This subroutine prompts the operator for the magnet name and other 'parameters of the test. ' 'Outputs put in the /testparam/ common block: ' magnameP$, name of magnet ' operatorP$, name of the operator doing the test ' teststandP$, the teststand being used ' coilP$, the ID of the measurement coil ' runP$, run number ' commentP$, comment about the test ' 'Zachary Wolf '7/8/94 '**************************************************************************** begin: 'Get the name of the magnet PRINT PRINT "What is the name of the dipole being tested?" PRINT "(8 characters or less): ["; magnameP$; "]"; INPUT magname$ magname$ = UCASE$(magname$) IF magname$ <> "" THEN magnameP$ = magname$ 'Get the operator's name(s) PRINT "Enter the operator(s) name(s): ["; operatorP$; "]"; INPUT operator$ IF operator$ <> "" THEN operatorP$ = operator$ 'Get the name of the test stand 'stand: 'PRINT "Enter which test stand is being used (Q1, Q2): ["; teststandP$; "]"; 'INPUT teststand$ 'teststand$ = UCASE$(teststand$) 'IF teststand$ <> "" THEN teststandP$ = teststand$ 'IF teststandP$ <> "Q1" AND teststandP$ <> "Q2" THEN GOTO stand 'Get the name of the measurement coil 'meascoil: 'PRINT "Enter the name of the measurement coil (QC1, or QC2): ["; coilP$; "]"; 'INPUT coil$ 'coil$ = UCASE$(coil$) 'IF coil$ <> "" THEN coilP$ = coil$ 'IF coilP$ <> "QC1" AND coilP$ <> "QC2" THEN GOTO meascoil 'Get the run number PRINT "What is the run number (1, 2, 3, ...): ["; runP$; "]"; INPUT run$ IF run$ <> "" THEN runP$ = run$ 'Get a comment PRINT "Enter any comment about the run: ["; commentP$; "]"; LINE INPUT comment$ IF comment$ <> "" THEN commentP$ = comment$ 'See if everything was entered correctly PRINT INPUT "Do you wish to make any changes to the values entered (Y or N): ", yn$ IF yn$ = "Y" OR yn$ = "y" THEN GOTO begin END SUB SUB meashar '**************************************************************************** 'This subroutine controls the integrated strength and harmonics measurements. 'Constants come from param.inc. ' 'Zachary Wolf '1/5/95 '**************************************************************************** 'Get test parameters from the operator testparam: CALL gettestparam 'Initialize the files for this run CALL fileinit(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 'Message PRINT PRINT "Beginning the magnetic field measurement cycle..." 'Simplify the notation ni% = 1 i% = 1 nh% = nhardisplayP% 'Initialize data arrays and counters ih% = 0 DIM imagvsi!(1 TO ni%) 'measured magnet current DIM simagvsi!(1 TO ni%) 'standard deviation of imag DIM dlvsi!(1 TO ni%) 'integrated dipole strength at each current DIM sdlvsi!(1 TO ni%) 'standard deviation of dl DIM tfvsi!(1 TO ni%) 'transfer function DIM stfvsi!(1 TO ni%) 'standard deviation of tf DIM bl!(1 TO nh%) 'field strength at Rcoil of the n'th harmonic DIM sbl!(1 TO nh%) 'standard deviation of Bn DIM th!(1 TO nh%) 'field angle DIM sth!(1 TO nh%) 'standard deviation of THn DIM r!(1 TO nh%) 'BLn/BL1 DIM sr!(1 TO nh%) 'standard deviation of r DIM rvsi!(1 TO nh%, 1 TO ni%) 'BLn/BL1 vs I DIM srvsi!(1 TO nh%, 1 TO ni%) 'standard deviation of BLn/BL1 vs I DIM inomhar!(1 TO ni%) 'nominal harmonics currents 'Measure the current CALL ibopmeas(imag!, simag!) 'DL 'Set the parameters for the DL measurement coilhpchanP% = coil12hpchanP% nturnscoilP% = nturnscoil12P% rcoilP! = rcoil12P! 'Measure the integrated gradient CALL dmeasdlav(dl!, sdl!) 'Compute the transfer function tf! = dl! / imag! stf! = tf! * SQR((sdl! / dl!) ^ 2 + (simag! / imag!) ^ 2) 'Save the results for summaries and plots imagvsi!(i%) = imag! simagvsi!(i%) = simag! dlvsi(i%) = dl! sdlvsi(i%) = sdl! tfvsi!(i%) = tf! stfvsi!(i%) = stf! 'HARMONICS 'Set the parameters for the harmonics measurement coilhpchanP% = coil1hpchanP% nturnscoilP% = nturnscoil1P% rcoilP! = rcoil1P! 'Measure the harmonics CALL dmeasharav(nh%, bl!(), sbl!(), th!(), sth!(), r!(), sr!()) 'Write the results to the harmonics dat file CALL dlogharvsi(hardatP$, rcoilP!, nturnscoilP%, nrotaveP%, nmeasaveP%, nh%, imag!, simag!, bl!(), sbl!(), th!(), sth!(), r!(), sr!()) 'Save the ratios for plotting ih% = ih% + 1 inomhar!(ih%) = imagtestP!(i%) FOR j% = 1 TO nh% rvsi!(j%, ih%) = r!(j%) srvsi!(j%, ih%) = sr!(j%) NEXT j% 'DL data and plot files 'Write a summary of the results to the dat file and log file CALL dlogdlvsi(dldatP$, rcoil12P!, nturnscoil12P%, nrotaveP%, nmeasaveP%, ni%, imagvsi!(), simagvsi!(), dlvsi!(), sdlvsi!(), tfvsi!(), stfvsi!()) CALL dlogdlvsi(logfileP$, rcoil12P!, nturnscoil12P%, nrotaveP%, nmeasaveP%, ni%, imagvsi!(), simagvsi!(), dlvsi!(), sdlvsi!(), tfvsi!(), stfvsi!()) 'Write the results to the plotting file CALL dpltdlvsi(dlpltP$, magnameP$, runP$, ni%, imagvsi!(), dlvsi!(), sdlvsi!(), tfvsi!(), stfvsi!()) 'Write a summary of the calculations to the dat file CALL dlognewpage(dldatP$) CALL dlogcalc(dldatP$) 'Harmonics data and plot files 'Plot the results CALL dpltharvsi(harpltP$, magnameP$, runP$, nh%, ih%, inomhar!(), rvsi!(), srvsi!()) 'Write a summary of the calculations to the dat file CALL dlognewpage(hardatP$) CALL dlogcalc(hardatP$) 'Log file 'Write a summary of the calculations to the log file CALL dlognewpage(logfileP$) CALL dlogcalc(logfileP$) END SUB