DECLARE SUB measure () DECLARE SUB standardize () DECLARE SUB gettestparam () DECLARE SUB logbl (logfile$, m%, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB logplot (logfile$, magname$, run$, m%, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) DECLARE SUB bl1pt (m%, imag!, vt!, svt!, vtxc!, svtxc!, r!, sr!, bl!, sbl!, tf!, stf!) DECLARE SUB imagramp (rr!, ifin!) DECLARE SUB fileheaderii (logfile$, mn$, op$, ts$, dv$, rn$, cm$, n1%, i1!(), n2%, i2!()) DECLARE SUB fileinitldp (magname$, run$, test$, logfile$, datfile$, pltfile$, ok$) DECLARE SUB gpibinit () DECLARE SUB dac488hrinit () DECLARE SUB dac488hrsetupv () DECLARE SUB hp3457init () '**************************************************************************** 'Program HERDBL 'This program is used to measure the integrated field strength of the 'B-Factory HER dipoles. It samples the voltage from the rotating coil. 'It then numerically integrates the coil voltage as a function of time 'over a half period. This gives the change of flux in the coil as it is 'flipped. The integrated dipole field strength is then determined. ' 'Zachary Wolf '4/11/94 '**************************************************************************** 'Include the constants used in the program REM $INCLUDE: 'param.inc' 'Prepare the screen CLS 'Initialize the GPIB CALL gpibinit 'Initialize the DAC CALL dac488hrinit CALL dac488hrsetupv 'Initialize the HP3457 CALL hp3457init 'Print a message about the program PRINT PRINT "Program HERDBL" PRINT "This program measures the integrated field strengths of all three" PRINT "B-Factory HER dipoles on the test stands as a function of current." PRINT "Make sure all coils are centered in the magnets." PRINT 'Get test parameters from the operator testparam: CALL gettestparam 'Initialize the log, data, and plot files CALL fileinitldp(magname1P$, runP$, "bl", logfile1P$, datfile1P$, pltfile1P$, ok1$) CALL fileinitldp(magname2P$, runP$, "bl", logfile2P$, datfile2P$, pltfile2P$, ok2$) IF ok1$ <> "y" OR ok2$ <> "y" THEN PRINT PRINT "Problem initializing the data files." PRINT "Make sure you are using a new run number." GOTO testparam: END IF 'Write headers to the log and data files CALL fileheaderii(logfile1P$, magname1P$, operatorP$, "D1", "Coil 1", runP$, commentP$, imagnstandP%, imagstandP!(), imagntestP%, imagtestP!()) CALL fileheaderii(datfile1P$, magname1P$, operatorP$, "D1", "Coil 1", runP$, commentP$, imagnstandP%, imagstandP!(), imagntestP%, imagtestP!()) CALL fileheaderii(logfile2P$, magname2P$, operatorP$, "D2", "Coil 2", runP$, commentP$, imagnstandP%, imagstandP!(), imagntestP%, imagtestP!()) CALL fileheaderii(datfile2P$, magname2P$, operatorP$, "D2", "Coil 2", runP$, commentP$, imagnstandP%, imagstandP!(), imagntestP%, imagtestP!()) 'Standardize the magnet CALL standardize 'Do the measurements CALL measure 'Message PRINT PRINT "Ramping to 0 Amps." 'Ramp to 0 amps CALL imagramp(imagramprateP!, 0!) '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: ' magname1P$, name of magnet 1 ' magname2P$, name of magnet 2 ' operatorP$, name of the operator doing the test ' runP$, run number ' commentP$, comment about the test ' 'Zachary Wolf '4/16/94 '**************************************************************************** begin: 'Get the name of the magnet on test stand 1 PRINT "What is the name of the magnet on test stand D1?" PRINT "(8 characters or less): ["; magname1P$; "]"; INPUT magname1$ magname1$ = UCASE$(magname1$) IF magname1$ <> "" THEN magname1P$ = magname1$ 'Get the name of the magnet on test stand 2 PRINT "What is the name of the magnet on test stand D2?" PRINT "(8 characters or less): ["; magname2P$; "]"; INPUT magname2$ magname2$ = UCASE$(magname2$) IF magname2$ <> "" THEN magname2P$ = magname2$ 'Get the operator's name(s) PRINT "Enter the operator(s) name(s): ["; operatorP$; "]"; INPUT operator$ IF operator$ <> "" THEN operatorP$ = operator$ '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 measure '**************************************************************************** 'This subroutine controls the measurement of the integrated field strength 'as a function of current for the B-Factory high energy ring dipoles. 'Constants come from param.inc. ' 'Zachary Wolf '4/16/94 '**************************************************************************** 'Message PRINT PRINT "Beginning the measurement cycle..." 'Simplify the notation ni% = imagntestP% nm% = 2 'this is hardwired, assumed throughout 'Initialize data arrays DIM imag!(1 TO ni%, 0 TO nm%) 'measured magnet current DIM vt!(1 TO ni%, 0 TO nm%) 'integrated voltage DIM svt!(1 TO ni%, 0 TO nm%) 'standard deviation DIM vtxc!(1 TO ni%, 0 TO nm%) 'corrected vt, as if reference coil was used DIM svtxc!(1 TO ni%, 0 TO nm%) 'standard deviation DIM r!(1 TO ni%, 0 TO nm%) 'ratio to reference magnet DIM sr!(1 TO ni%, 0 TO nm%) 'standard deviation DIM bl!(1 TO ni%, 0 TO nm%) 'integrated field strength DIM sbl!(1 TO ni%, 0 TO nm%) 'standard deviation DIM tf!(1 TO ni%, 0 TO nm%) 'transfer function BL/I DIM stf!(1 TO ni%, 0 TO nm%) 'standard deviation 'Loop over currents FOR i% = 1 TO ni% 'Message PRINT PRINT "Ramping to "; imagtestP!(i%); " Amps." 'Ramp to the desired current CALL imagramp(imagramprateP!, imagtestP!(i%)) 'Loop over reference and magnets under test FOR m% = 0 TO nm% 'Make a measurement CALL bl1pt(m%, imag!(i%, m%), vt!(i%, m%), svt!(i%, m%), vtxc!(i%, m%), svtxc!(i%, m%), r!(i%, m%), sr!(i%, m%), bl!(i%, m%), sbl!(i%, m%), tf!(i%, m%), stf!(i%, m%)) 'End loop over magnets NEXT m% 'End loop over currents NEXT i% 'Write the results to the log file and data file 'Magnet 1 CALL logbl(logfile1P$, 1, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) CALL logbl(datfile1P$, 1, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) 'Magnet 2 CALL logbl(logfile2P$, 2, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) CALL logbl(datfile2P$, 2, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) 'Write the results to the plotting file 'Magnet 1 CALL logplot(pltfile1P$, magname1P$, runP$, 1, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) 'Magnet 2 CALL logplot(pltfile2P$, magname2P$, runP$, 2, ni%, imag!(), vt!(), svt!(), vtxc!(), svtxc!(), r!(), sr!(), bl!(), sbl!(), tf!(), stf!()) END SUB SUB standardize '**************************************************************************** 'This procedure controls the standardization of the magnet. 'Parameters come from param.inc. ' 'Zachary Wolf '4/23/94 '**************************************************************************** 'Let the operator know what is happening PRINT PRINT "Standardizing the magnet..." 'Simplify the notation ni% = imagnstandP% 'Loop over currents FOR i% = 1 TO ni% 'Message PRINT PRINT "Ramping to "; imagstandP!(i%); " Amps." 'Ramp to the desired current CALL imagramp(imagramprateP!, imagstandP!(i%)) 'End loop over currents NEXT i% END SUB